Conversation
…mple to plain JavaScript.
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Rate limit exceeded@yamcodes has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 15 minutes and 43 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (1)
WalkthroughAdds a new basic JavaScript example, updates workspace entries and example metadata to remove TypeScript labeling, and introduces a Node.js playground module that defines, validates, logs, and exports environment variables using arkenv. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
with-typescript example and convert the basic exa……ple to be JavaScript-only.
…ith-bun` to `with-bun-ts` and `basic` to `with-typescript`.
…ypeScript from Vite React example title, and update file extensions.
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (4)
examples/basic-js/package.json (1)
16-18: Use a version range for Node.js engine constraint.The exact version constraint
"node": "24"is overly restrictive and may cause compatibility issues. Use a range that allows for patch and minor updates within the supported major version.Apply this diff:
"engines": { - "node": "24" + "node": ">=24 <25" },Or consider aligning with the
with-vite-reactexample which uses">=22 <26"for broader compatibility:"engines": { - "node": "24" + "node": ">=22 <26" },examples/README.md (1)
13-15: Consider clarifying the distinction betweenbasicandbasic-jsexamples.With both
basicandbasic-jsexamples now available, users might be confused about which to choose. Consider adding a brief note explaining the difference (e.g.,basicuses TypeScript whilebasic-jsdemonstrates pure JavaScript usage).Based on learnings: The
basicexample is documented as the Node.js example. Consider whether having bothbasic(TypeScript) andbasic-js(JavaScript) serves users well, or if a clearer naming convention would help (e.g.,basic-tsandbasic-js).apps/playgrounds/node/index.js (1)
7-7: Consider using the= []syntax for array defaults.Per coding guidelines, default values should use the
= valuesyntax. This can be simplified to:- ALLOWED_ORIGINS: type("string[]").default(() => []), + ALLOWED_ORIGINS: "string[] = []",This is more concise and follows the same pattern as the other defaults in the schema.
Based on coding guidelines, which specify using the
= valuesyntax for default values.examples/basic-js/README.md (1)
36-43: Consider aligning documentation example with actual implementation pattern.The documentation shows using
arkenv({...})directly with an inline schema, but the actualindex.jsimplementation usestype({...})followed byarkenv(Env, process.env). While both patterns are valid, this inconsistency might confuse users.Consider either:
- Updating the documentation to match the implementation pattern, or
- Adding a note explaining that both patterns work
This would help users better understand the relationship between the tutorial and the actual code.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (4)
examples/basic/package-lock.jsonis excluded by!**/package-lock.jsonexamples/with-vite-react-ts/package-lock.jsonis excluded by!**/package-lock.jsonexamples/with-vite-react/public/vite.svgis excluded by!**/*.svgexamples/with-vite-react/src/assets/react.svgis excluded by!**/*.svg
📒 Files selected for processing (10)
apps/playgrounds/node/index.js(1 hunks)arkenv.code-workspace(1 hunks)examples/README.md(1 hunks)examples/basic-js/.env.example(1 hunks)examples/basic-js/.gitignore(1 hunks)examples/basic-js/README.md(1 hunks)examples/basic-js/package.json(1 hunks)examples/basic-js/tsconfig.json(1 hunks)examples/with-vite-react/README.md(1 hunks)examples/with-vite-react/package.json(1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
**/*.{ts,tsx,js,jsx}: UsecreateEnv(schema)function (available as default export, typically imported asarkenv) to create validated environment objects with ArkType schema definitions
Use built-in validators (host, port, url, email) from ArkEnv when available in environment schemas instead of writing custom validators
Provide default values for optional environment variables in schemas using the= valuesyntax
Use descriptive environment variable names that indicate purpose and format in schema definitions
Files:
apps/playgrounds/node/index.js
examples/*/package.json
📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)
Examples in examples/ directory are not published, may have their own lock files, and are used as test fixtures
Files:
examples/basic-js/package.jsonexamples/with-vite-react/package.json
**/package.json
📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)
Use workspace:* protocol for workspace dependencies between packages
When referencing workspace packages, use the
workspace:*protocol in dependencies
Files:
examples/basic-js/package.jsonexamples/with-vite-react/package.json
{**/package.json,pnpm-lock.yaml,pnpm-workspace.yaml}
📄 CodeRabbit inference engine (.cursor/rules/pnpm.mdc)
{**/package.json,pnpm-lock.yaml,pnpm-workspace.yaml}: Always usepnpmfor all package management operations
Never usenpmoryarncommands
Files:
examples/basic-js/package.jsonexamples/with-vite-react/package.json
{pnpm-workspace.yaml,**/package.json}
📄 CodeRabbit inference engine (.cursor/rules/pnpm.mdc)
Certain native dependencies are configured with
onlyBuiltDependenciesin pnpm configuration: @biomejs/biome, @sentry/cli, @swc/core, @tailwindcss/oxide, @vercel/speed-insights, esbuild, sharp
Files:
examples/basic-js/package.jsonexamples/with-vite-react/package.json
🧠 Learnings (42)
📓 Common learnings
Learnt from: yamcodes
Repo: yamcodes/arkenv PR: 132
File: packages/arkenv/README.md:13-14
Timestamp: 2025-09-09T17:37:19.650Z
Learning: For yamcodes/arkenv project: Runtime support documentation should link to specific examples: Node.js (examples/basic), Bun (examples/with-bun), Vite (examples/with-vite-react-ts).
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T16:03:35.759Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `createEnv(schema)` function (available as default export, typically imported as `arkenv`) to create validated environment objects with ArkType schema definitions
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Keep environment variable schemas readable and TypeScript-like using ArkType syntax
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T16:03:35.759Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use built-in validators (host, port, url, email) from ArkEnv when available in environment schemas instead of writing custom validators
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Leverage ArkType's built-in types (e.g., `string.host`, `number.port`) where possible in environment schemas
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-24T16:04:00.957Z
Learning: Applies to **/*.{ts,tsx} : Use `ArkEnvError` for environment variable validation errors
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: ArkType validates environment variables at runtime and TypeScript types are inferred from the schema definition
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Use ArkType's `type()` function to define schemas in environment variable definitions
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/test-patterns.mdc:0-0
Timestamp: 2025-11-24T16:04:36.939Z
Learning: Achieve coverage goals: environment variable parsing and validation, type checking and error handling, default value handling, custom type validation, plugin integration with Vite, and real project build testing using examples as fixtures
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/test-patterns.mdc:0-0
Timestamp: 2025-11-24T16:04:36.939Z
Learning: Applies to packages/vite-plugin/src/**/*.test.ts : Test Vite plugin using the `with-vite-react-ts` example as a fixture and validate plugin works with real Vite projects
📚 Learning: 2025-11-24T16:04:00.957Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-24T16:04:00.957Z
Learning: Applies to **/*.{ts,tsx} : Use TypeScript 5.1+ features when appropriate
Applied to files:
examples/basic-js/tsconfig.json
📚 Learning: 2025-11-24T16:04:00.957Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-24T16:04:00.957Z
Learning: Applies to **/*.{ts,tsx} : Organize imports automatically (Biome handles this)
Applied to files:
examples/basic-js/tsconfig.json
📚 Learning: 2025-11-24T16:04:00.957Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-24T16:04:00.957Z
Learning: Applies to **/*.{ts,tsx} : Include examples in JSDoc comments when helpful for public APIs
Applied to files:
examples/basic-js/tsconfig.jsonexamples/README.md
📚 Learning: 2025-11-24T16:04:00.957Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-24T16:04:00.957Z
Learning: Applies to **/*.{ts,tsx} : Use JSDoc comments for public APIs
Applied to files:
examples/basic-js/tsconfig.json
📚 Learning: 2025-11-24T16:04:00.957Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-24T16:04:00.957Z
Learning: Applies to **/*.{ts,tsx} : Avoid explicit types when TypeScript can infer them (`noInferrableTypes` error)
Applied to files:
examples/basic-js/tsconfig.json
📚 Learning: 2025-11-24T16:04:00.957Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-24T16:04:00.957Z
Learning: Applies to **/*.{ts,tsx} : Leverage `const` type parameters for better inference in TypeScript
Applied to files:
examples/basic-js/tsconfig.json
📚 Learning: 2025-11-24T16:04:36.939Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/test-patterns.mdc:0-0
Timestamp: 2025-11-24T16:04:36.939Z
Learning: Applies to **/*.integration.test.{ts,tsx} : Use `*.integration.test.ts` suffix to distinguish integration tests from unit tests
Applied to files:
examples/basic-js/tsconfig.json
📚 Learning: 2025-11-24T16:04:00.957Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-24T16:04:00.957Z
Learning: Applies to **/*.{ts,tsx} : Use kebab-case for TypeScript filenames (e.g., `create-env.ts`)
Applied to files:
examples/basic-js/tsconfig.json
📚 Learning: 2025-11-24T16:03:35.759Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T16:03:35.759Z
Learning: Applies to **/*.integration.test.{ts,tsx} : Name integration tests with `.integration.test.ts` or `.integration.test.tsx` suffix to distinguish them from unit tests
Applied to files:
examples/basic-js/tsconfig.json
📚 Learning: 2025-11-24T16:04:00.957Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-24T16:04:00.957Z
Learning: Applies to **/*.{ts,tsx} : Avoid unnecessary template literals (`noUnusedTemplateLiteral` error)
Applied to files:
examples/basic-js/tsconfig.json
📚 Learning: 2025-11-24T16:04:00.957Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-24T16:04:00.957Z
Learning: Prefer tree-shakeable exports for better bundling
Applied to files:
examples/basic-js/tsconfig.json
📚 Learning: 2025-11-24T16:04:47.583Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:47.583Z
Learning: Applies to apps/playgrounds/bun-react/**/*.{ts,tsx,js,jsx,html,css} : Use `bun build <file.html|file.ts|file.css>` instead of `webpack` or `esbuild` for bundling
Applied to files:
examples/basic-js/tsconfig.json
📚 Learning: 2025-11-24T16:04:47.583Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:47.583Z
Learning: Applies to apps/playgrounds/bun-react/**/*.ts : Use `bun --hot` to run TypeScript entry files with hot module reloading enabled
Applied to files:
examples/basic-js/tsconfig.jsonexamples/with-vite-react/package.json
📚 Learning: 2025-11-24T16:04:58.629Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:58.629Z
Learning: Applies to apps/playgrounds/bun/**/*.{ts,tsx,js,jsx} : Bun automatically loads .env files, so don't use `dotenv` library
Applied to files:
examples/basic-js/.gitignoreexamples/basic-js/.env.example
📚 Learning: 2025-11-24T16:04:47.583Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:47.583Z
Learning: Applies to apps/playgrounds/bun-react/**/*.{ts,tsx,js,jsx} : Bun automatically loads .env files, so don't use the dotenv package
Applied to files:
examples/basic-js/.gitignoreexamples/with-vite-react/package.jsonexamples/basic-js/.env.example
📚 Learning: 2025-11-24T16:03:35.759Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T16:03:35.759Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `createEnv(schema)` function (available as default export, typically imported as `arkenv`) to create validated environment objects with ArkType schema definitions
Applied to files:
apps/playgrounds/node/index.jsexamples/basic-js/README.mdexamples/basic-js/package.jsonexamples/with-vite-react/package.jsonexamples/README.mdexamples/with-vite-react/README.md
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Keep environment variable schemas readable and TypeScript-like using ArkType syntax
Applied to files:
apps/playgrounds/node/index.jsexamples/basic-js/README.mdexamples/basic-js/package.jsonexamples/with-vite-react/package.jsonexamples/README.mdexamples/with-vite-react/README.md
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Leverage ArkType's built-in types (e.g., `string.host`, `number.port`) where possible in environment schemas
Applied to files:
apps/playgrounds/node/index.jsexamples/basic-js/README.mdexamples/basic-js/package.jsonexamples/README.mdexamples/with-vite-react/README.md
📚 Learning: 2025-11-24T16:03:35.759Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T16:03:35.759Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use built-in validators (host, port, url, email) from ArkEnv when available in environment schemas instead of writing custom validators
Applied to files:
apps/playgrounds/node/index.jsexamples/basic-js/README.md
📚 Learning: 2025-11-24T16:04:00.957Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-24T16:04:00.957Z
Learning: Applies to **/*.{ts,tsx} : Use `ArkEnvError` for environment variable validation errors
Applied to files:
apps/playgrounds/node/index.jsexamples/basic-js/README.mdexamples/basic-js/package.jsonexamples/README.mdexamples/with-vite-react/README.md
📚 Learning: 2025-11-24T16:03:35.759Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T16:03:35.759Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use descriptive environment variable names that indicate purpose and format in schema definitions
Applied to files:
apps/playgrounds/node/index.jsexamples/basic-js/README.mdexamples/basic-js/.env.example
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: ArkType validates environment variables at runtime and TypeScript types are inferred from the schema definition
Applied to files:
apps/playgrounds/node/index.jsexamples/basic-js/README.md
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Use ArkType's `type()` function to define schemas in environment variable definitions
Applied to files:
apps/playgrounds/node/index.jsexamples/basic-js/README.mdexamples/basic-js/package.json
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Convert ArkType validation errors to `ArkEnvError` for user-friendly error messages that include variable name and expected type
Applied to files:
apps/playgrounds/node/index.jsexamples/basic-js/README.md
📚 Learning: 2025-11-24T16:03:35.759Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T16:03:35.759Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Provide default values for optional environment variables in schemas using the `= value` syntax
Applied to files:
apps/playgrounds/node/index.jsexamples/basic-js/.env.example
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Leverage ArkType's type inference for TypeScript types instead of manual type definitions
Applied to files:
apps/playgrounds/node/index.jsexamples/basic-js/README.mdexamples/basic-js/package.jsonexamples/with-vite-react/README.md
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Use union types for enums in ArkType schemas (e.g., `"'dev' | 'prod'"`) instead of separate enum definitions
Applied to files:
apps/playgrounds/node/index.js
📚 Learning: 2025-11-24T16:03:35.759Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T16:03:35.759Z
Learning: Group related environment variables in logical schemas and document environment requirements in README files
Applied to files:
examples/basic-js/README.md
📚 Learning: 2025-09-09T17:37:19.650Z
Learnt from: yamcodes
Repo: yamcodes/arkenv PR: 132
File: packages/arkenv/README.md:13-14
Timestamp: 2025-09-09T17:37:19.650Z
Learning: For yamcodes/arkenv project: Runtime support documentation should link to specific examples: Node.js (examples/basic), Bun (examples/with-bun), Vite (examples/with-vite-react-ts).
Applied to files:
examples/basic-js/README.mdarkenv.code-workspaceexamples/basic-js/package.jsonexamples/with-vite-react/package.jsonexamples/README.mdexamples/with-vite-react/README.md
📚 Learning: 2025-11-24T16:04:36.939Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/test-patterns.mdc:0-0
Timestamp: 2025-11-24T16:04:36.939Z
Learning: Applies to packages/vite-plugin/src/**/*.test.ts : Test Vite plugin using the `with-vite-react-ts` example as a fixture and validate plugin works with real Vite projects
Applied to files:
arkenv.code-workspaceexamples/with-vite-react/package.jsonexamples/README.mdexamples/with-vite-react/README.md
📚 Learning: 2025-11-24T16:04:11.901Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/monorepo.mdc:0-0
Timestamp: 2025-11-24T16:04:11.901Z
Learning: packages/arkenv should not depend on other workspace packages; packages/vite-plugin depends on arkenv; apps/www may depend on workspace packages
Applied to files:
arkenv.code-workspaceexamples/basic-js/package.jsonexamples/with-vite-react/package.json
📚 Learning: 2025-11-24T16:04:36.939Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/test-patterns.mdc:0-0
Timestamp: 2025-11-24T16:04:36.939Z
Learning: Applies to packages/vite-plugin/src/**/*.test.ts : Use fixture-based testing pattern with `__fixtures__` directory for Vite plugin tests
Applied to files:
arkenv.code-workspaceexamples/with-vite-react/package.jsonexamples/with-vite-react/README.md
📚 Learning: 2025-11-24T16:04:11.901Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/monorepo.mdc:0-0
Timestamp: 2025-11-24T16:04:11.901Z
Learning: Applies to examples/*/package.json : Examples in examples/ directory are not published, may have their own lock files, and are used as test fixtures
Applied to files:
arkenv.code-workspaceexamples/basic-js/package.jsonexamples/README.mdexamples/basic-js/.env.example
📚 Learning: 2025-11-24T16:04:19.413Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:19.413Z
Learning: Applies to package.json : The project uses `pnpm10.20.0` (specified in `packageManager` field)
Applied to files:
examples/basic-js/package.json
📚 Learning: 2025-11-24T16:04:11.901Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/monorepo.mdc:0-0
Timestamp: 2025-11-24T16:04:11.901Z
Learning: Applies to packages/*/package.json : Packages in packages/ directory must be published to npm and require changesets for versioning, proper exports, and type definitions
Applied to files:
examples/basic-js/package.json
📚 Learning: 2025-11-24T16:04:11.901Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/monorepo.mdc:0-0
Timestamp: 2025-11-24T16:04:11.901Z
Learning: Applies to tooling/*/package.json : Tooling in tooling/ directory contains development and testing tools that are not published to npm and excluded from changesets
Applied to files:
examples/basic-js/package.json
📚 Learning: 2025-11-24T16:04:47.583Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:47.583Z
Learning: Applies to apps/playgrounds/bun-react/**/*.test.{ts,tsx,js,jsx} : Use `bun test` instead of `jest` or `vitest` for running tests
Applied to files:
examples/with-vite-react/package.json
📚 Learning: 2025-11-24T16:04:47.583Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:47.583Z
Learning: Applies to apps/playgrounds/bun-react/**/*.html : Use HTML imports with `Bun.serve()` and don't use Vite for frontend bundling and development
Applied to files:
examples/with-vite-react/package.jsonexamples/with-vite-react/README.md
📚 Learning: 2025-11-24T16:03:35.759Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T16:03:35.759Z
Learning: Add examples demonstrating new functionality in the `examples/` directory when adding new features or validators
Applied to files:
examples/README.md
📚 Learning: 2025-11-24T16:04:36.939Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/test-patterns.mdc:0-0
Timestamp: 2025-11-24T16:04:36.939Z
Learning: Achieve coverage goals: environment variable parsing and validation, type checking and error handling, default value handling, custom type validation, plugin integration with Vite, and real project build testing using examples as fixtures
Applied to files:
examples/README.mdexamples/with-vite-react/README.md
📚 Learning: 2025-11-24T16:04:00.957Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-24T16:04:00.957Z
Learning: Applies to **/*.{ts,tsx} : Use UPPER_SNAKE_CASE for environment variables and constants
Applied to files:
examples/basic-js/.env.example
🧬 Code graph analysis (4)
apps/playgrounds/node/index.js (3)
packages/arkenv/src/type.ts (1)
type(3-3)packages/vite-plugin/src/index.ts (1)
arkenv(50-86)packages/arkenv/src/create-env.ts (1)
createEnv(34-52)
arkenv.code-workspace (3)
examples/with-vite-react-ts/src/vite-env.d.ts (2)
ImportMetaEnv(18-18)ViteTypeOptions(8-14)examples/with-vite-react-ts/src/App.tsx (1)
App(6-34)apps/playgrounds/vite/src/App.tsx (1)
App(6-46)
examples/README.md (2)
examples/with-vite-react-ts/src/App.tsx (3)
App(6-34)count(21-21)setCount(21-21)examples/with-vite-react-ts/src/vite-env.d.ts (2)
ViteTypeOptions(8-14)ImportMetaEnv(18-18)
examples/basic-js/.env.example (4)
packages/arkenv/src/array-defaults.integration.test.ts (1)
env(14-30)packages/arkenv/src/custom-types.integration.test.ts (7)
vi(21-29)createEnv(34-37)vi(215-223)vi(129-143)env(199-205)vi(145-159)vi(161-173)packages/bun-plugin/src/index.test.ts (1)
originalEnv(4-69)examples/with-vite-react-ts/vite.config.ts (1)
env(11-20)
🪛 dotenv-linter (4.0.0)
examples/basic-js/.env.example
[warning] 3-3: [UnorderedKey] The NODE_ENV key should go before the PORT key
(UnorderedKey)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: test-e2e (a11y)
🔇 Additional comments (12)
examples/with-vite-react/package.json (1)
2-2: LGTM! Rename aligns with PR objectives.The package name change removes the TypeScript-specific suffix while the example continues to use TypeScript internally, correctly indicating that ArkEnv supports both TypeScript and JavaScript projects.
arkenv.code-workspace (2)
87-90: LGTM! New workspace folder added correctly.The workspace configuration correctly adds the new
basic-jsexample folder.
96-97: LGTM! Folder path updated consistently.The workspace configuration correctly reflects the rename from
with-vite-react-tstowith-vite-react.examples/basic-js/package.json (1)
6-8: Verify Node.js version compatibility with--env-fileflag.The scripts use Node.js's
--env-fileflag, which was introduced in Node.js 20.6.0. Ensure the engine constraint (currently set to Node 24) is compatible with this feature and that the minimum supported version is documented.The use of
--env-fileis excellent for a JavaScript example as it eliminates the need for third-party dotenv packages. However, verify that this approach is documented in the example's README so users understand the Node.js version requirement.examples/basic-js/.gitignore (1)
1-1: LGTM! Correctly excludes environment files.The
.gitignoreproperly excludes.envfiles from version control, which is essential for protecting sensitive environment variables.examples/basic-js/.env.example (1)
1-3: LGTM! Sensible default environment variables.The environment variable template provides reasonable defaults for a basic Node.js application. The static analysis warning about key ordering is pedantic and can be safely ignored—environment variable order does not affect functionality.
examples/with-vite-react/README.md (1)
1-1: LGTM! Title correctly reflects optional TypeScript usage.Removing "TypeScript" from the title aligns with the PR's goal of demonstrating that ArkEnv works with or without TypeScript, while the content still appropriately documents TypeScript integration features for those who choose to use it.
examples/README.md (2)
5-8: Excellent addition clarifying JavaScript support.This note effectively addresses the PR's objective by explicitly stating that TypeScript is not required and providing a link to the JavaScript example. This will help JavaScript-only developers quickly find relevant resources.
15-15: LGTM! Reference updated consistently.The example reference correctly updates from
with-vite-react-tstowith-vite-react.examples/basic-js/tsconfig.json (1)
1-12: Based on my verification, I've found critical issues with theexamples/basic-jsexample that go beyond the original review comment. Let me now generate the rewritten review comment:
The
examples/basic-jsexample is incomplete and contains contradictory/unnecessary files.The
basic-jsexample has multiple issues:
index.jsis empty (0 bytes): The example's entry point contains no code, making it non-functional. The README describes what to do but provides nothing to run. This should contain the same ArkEnv setup shown inexamples/basic/index.ts, adapted for JavaScript.
tsconfig.jsonis unnecessary: For a pure JavaScript example with no TypeScript files, this configuration serves no purpose. It's identical toexamples/basic/tsconfig.jsonand isn't referenced in any npm scripts or documentation.Example not listed in
examples/README.md: The main examples README mentionsbasic-jsin a NOTE section but doesn't include it in the examples table, making it discoverable only through that note.Recommended fixes:
- Populate
index.jswith the JavaScript equivalent of the code inexamples/basic/index.ts- Remove
tsconfig.jsonfromexamples/basic-js/(or document why it's present if intended for IDE support)- Add
basic-jsto the examples table inexamples/README.mdfor consistency⛔ Skipped due to learnings
Learnt from: yamcodes Repo: yamcodes/arkenv PR: 132 File: packages/arkenv/README.md:13-14 Timestamp: 2025-09-09T17:37:19.650Z Learning: For yamcodes/arkenv project: Runtime support documentation should link to specific examples: Node.js (examples/basic), Bun (examples/with-bun), Vite (examples/with-vite-react-ts).Learnt from: CR Repo: yamcodes/arkenv PR: 0 File: .cursor/rules/coding-guidelines.mdc:0-0 Timestamp: 2025-11-24T16:04:00.957Z Learning: Applies to **/*.{ts,tsx} : Include examples in JSDoc comments when helpful for public APIsLearnt from: CR Repo: yamcodes/arkenv PR: 0 File: .cursor/rules/coding-guidelines.mdc:0-0 Timestamp: 2025-11-24T16:04:00.957Z Learning: Applies to **/*.{ts,tsx} : Use TypeScript 5.1+ features when appropriateLearnt from: CR Repo: yamcodes/arkenv PR: 0 File: apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0 Timestamp: 2025-11-24T16:04:47.583Z Learning: Applies to apps/playgrounds/bun-react/**/*.ts : Use `bun --hot` to run TypeScript entry files with hot module reloading enabledLearnt from: CR Repo: yamcodes/arkenv PR: 0 File: .cursor/rules/coding-guidelines.mdc:0-0 Timestamp: 2025-11-24T16:04:00.957Z Learning: Prefer tree-shakeable exports for better bundlingLearnt from: CR Repo: yamcodes/arkenv PR: 0 File: apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0 Timestamp: 2025-11-24T16:04:47.583Z Learning: Applies to apps/playgrounds/bun-react/**/*.{ts,tsx,js,jsx,html,css} : Use `bun build <file.html|file.ts|file.css>` instead of `webpack` or `esbuild` for bundlingapps/playgrounds/node/index.js (1)
15-28: LGTM!The destructuring, logging, and export demonstrate proper ArkEnv usage in JavaScript. The implementation clearly shows how validated environment variables can be accessed and used.
examples/basic-js/README.md (1)
44-77: LGTM!The walkthrough is clear, practical, and effectively demonstrates:
- How ArkEnv validation errors appear
- How to resolve missing required variables using
.envfiles- Step-by-step commands that users can execute
- Helpful next steps with documentation links
The tutorial provides a solid learning experience for users new to ArkEnv in JavaScript contexts.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
examples/basic-js/README.md (1)
36-43: Clarify the initial schema to improve example completeness.The example shows adding
MY_ENV_VARwith a comment indicating "// other definitions..." already exist. For a "basic" example, it would be helpful to explicitly show what the initial schema contains (e.g., HOST, PORT, NODE_ENV as referenced in the.env.examplecontext), so readers understand the full environment structure before and after adding a new variable.Consider revising the code snippet to show the complete initial schema or adding a note explaining what variables are already defined:
// index.js const env = arkenv({ - // other definitions... + HOST: "string.host | string", + PORT: "number.port | string", + NODE_ENV: "'development' | 'production'", MY_ENV_VAR: "string" });Alternatively, add an explanatory sentence: "The schema already defines HOST, PORT, and NODE_ENV (shown in
.env.example). Now let's add a new required variable:"
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
examples/basic-js/README.md(1 hunks)
🧰 Additional context used
🧠 Learnings (15)
📓 Common learnings
Learnt from: yamcodes
Repo: yamcodes/arkenv PR: 132
File: packages/arkenv/README.md:13-14
Timestamp: 2025-09-09T17:37:19.650Z
Learning: For yamcodes/arkenv project: Runtime support documentation should link to specific examples: Node.js (examples/basic), Bun (examples/with-bun), Vite (examples/with-vite-react-ts).
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T16:03:35.759Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `createEnv(schema)` function (available as default export, typically imported as `arkenv`) to create validated environment objects with ArkType schema definitions
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Keep environment variable schemas readable and TypeScript-like using ArkType syntax
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/test-patterns.mdc:0-0
Timestamp: 2025-11-24T16:04:36.939Z
Learning: Achieve coverage goals: environment variable parsing and validation, type checking and error handling, default value handling, custom type validation, plugin integration with Vite, and real project build testing using examples as fixtures
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:47.583Z
Learning: Applies to apps/playgrounds/bun-react/**/*.{ts,tsx,js,jsx} : Use `bun <file>` instead of `node <file>` or `ts-node <file>` for running TypeScript and JavaScript files
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:58.629Z
Learning: Applies to apps/playgrounds/bun/**/*.{ts,js} : Use `bun <file>` instead of `node <file>` or `ts-node <file>` for running scripts
📚 Learning: 2025-09-09T17:37:19.650Z
Learnt from: yamcodes
Repo: yamcodes/arkenv PR: 132
File: packages/arkenv/README.md:13-14
Timestamp: 2025-09-09T17:37:19.650Z
Learning: For yamcodes/arkenv project: Runtime support documentation should link to specific examples: Node.js (examples/basic), Bun (examples/with-bun), Vite (examples/with-vite-react-ts).
Applied to files:
examples/basic-js/README.md
📚 Learning: 2025-11-24T16:03:35.759Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T16:03:35.759Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `createEnv(schema)` function (available as default export, typically imported as `arkenv`) to create validated environment objects with ArkType schema definitions
Applied to files:
examples/basic-js/README.md
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Keep environment variable schemas readable and TypeScript-like using ArkType syntax
Applied to files:
examples/basic-js/README.md
📚 Learning: 2025-11-24T16:03:35.759Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T16:03:35.759Z
Learning: Group related environment variables in logical schemas and document environment requirements in README files
Applied to files:
examples/basic-js/README.md
📚 Learning: 2025-11-24T16:04:00.957Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-24T16:04:00.957Z
Learning: Applies to **/*.{ts,tsx} : Use `ArkEnvError` for environment variable validation errors
Applied to files:
examples/basic-js/README.md
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Convert ArkType validation errors to `ArkEnvError` for user-friendly error messages that include variable name and expected type
Applied to files:
examples/basic-js/README.md
📚 Learning: 2025-11-24T16:03:35.759Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T16:03:35.759Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use descriptive environment variable names that indicate purpose and format in schema definitions
Applied to files:
examples/basic-js/README.md
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Use ArkType's `type()` function to define schemas in environment variable definitions
Applied to files:
examples/basic-js/README.md
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Leverage ArkType's built-in types (e.g., `string.host`, `number.port`) where possible in environment schemas
Applied to files:
examples/basic-js/README.md
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Use union types for enums in ArkType schemas (e.g., `"'dev' | 'prod'"`) instead of separate enum definitions
Applied to files:
examples/basic-js/README.md
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: ArkType validates environment variables at runtime and TypeScript types are inferred from the schema definition
Applied to files:
examples/basic-js/README.md
📚 Learning: 2025-11-24T16:04:00.957Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-24T16:04:00.957Z
Learning: Applies to **/*.{ts,tsx} : Use PascalCase for type names (e.g., `ArkEnvError`)
Applied to files:
examples/basic-js/README.md
📚 Learning: 2025-11-24T16:03:35.759Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T16:03:35.759Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use built-in validators (host, port, url, email) from ArkEnv when available in environment schemas instead of writing custom validators
Applied to files:
examples/basic-js/README.md
📚 Learning: 2025-11-24T16:04:36.939Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/test-patterns.mdc:0-0
Timestamp: 2025-11-24T16:04:36.939Z
Learning: Achieve coverage goals: environment variable parsing and validation, type checking and error handling, default value handling, custom type validation, plugin integration with Vite, and real project build testing using examples as fixtures
Applied to files:
examples/basic-js/README.md
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: test-e2e (e2e)
- GitHub Check: test-e2e (a11y)
🔇 Additional comments (2)
examples/basic-js/README.md (2)
8-11: Good integration of feedback on runtime-vs.-compile-time validation terminology.The update from "Typesafe environment configuration" to "Runtime-validated environment configuration" (line 11) accurately reflects what ArkEnv provides in a pure JavaScript context, addressing prior review feedback.
50-50: Documentation URL is valid and verified.The link at line 50 to
arkenv.js.org/docs/arkenv/how-to/load-environment-variables#using-env-filesis correct. This page exists in the documentation structure and is actively tested by the Playwright test suite. The same URL is also used consistently across other example READMEs (examples/basic/README.md,examples/with-bun/README.md) and is referenced in the site's meta configuration, confirming its validity.
Closes #456
Summary by CodeRabbit
New Features
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.