Conversation
🦋 Changeset detectedLatest commit: 9c6a352 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
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 8 minutes and 33 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 ignored due to path filters (1)
📒 Files selected for processing (25)
WalkthroughRenames the project and package from ark.env to arkenv across repository metadata, documentation, examples, and code. Updates import paths and API usage from ark.env(...)/ark.env.env(...) to arkenv(...). Adjusts docs site metadata/constants and Vite plugin references. Removes old package README, adds new one, and updates manifests and scripts. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Dev as Developer App
participant ARK as arkenv (library)
participant ENV as process.env
Dev->>ARK: arkenv({ schema, defaults })
ARK->>ENV: read variables
ARK-->>Dev: validated env (typed) / error on invalid
note over ARK,Dev: API surface: direct function arkenv(...) replaces ark.env(...).
sequenceDiagram
autonumber
participant Vite as Vite Config
participant Load as loadEnv()
participant ARK as arkenv()
participant ENV as process.env
Vite->>Load: loadEnv(mode, cwd)
Load-->>Vite: raw env map
Vite->>ARK: arkenv(options, rawEnv)
ARK->>ENV: resolve/merge as needed
ARK-->>Vite: typed env for plugin/config
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 8
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (6)
apps/docs/content/docs/index.mdx (1)
33-39: Incorrect import in example snippet.
You callarkenv(...)but importarkas the default. Import the default asarkenv.-import ark, { host, port } from 'arkenv'; +import arkenv, { host, port } from 'arkenv';examples/basic/index.ts (1)
1-7: Missing import forarkenv.
arkenv({...})is used but not imported, which will fail at compile time.-import { host, port } from "arkenv"; +import arkenv, { host, port } from "arkenv"; const env = arkenv({ HOST: host.default("localhost"), PORT: port.default("3000"), NODE_ENV: "'development' | 'production' | 'test' = 'development'", });examples/with-bun/README.md (1)
83-86: Fix output value to match the earlier .env example (“new_value”).Currently the guide echoes new_value but shows my_value in the output.
- my_value + new_valueREADME.md (1)
52-66: Quickstart import/usage mismatch (arkvsarkenv)The snippet imports
arkas the default but callsarkenv(...). Align the import with the call.-import ark, { host, port } from 'arkenv'; +import arkenv, { host, port } from 'arkenv'; -const env = arkenv({ +const env = arkenv({ HOST: host, PORT: port, NODE_ENV: "'development' | 'production' | 'test'", });apps/docs/content/docs/guides/environment-configuration.mdx (1)
238-244: Fix import/initializer mismatch in feature flags exampleAlign the default import with the
arkenv(...)call.-import ark from 'arkenv'; +import arkenv from 'arkenv'; -export const env = arkenv({ +export const env = arkenv({packages/arkenv/CHANGELOG.md (1)
50-56: Fix example: default import alias should bearkenvThe code imports
arkbut callsarkenv(...). Align the alias to prevent confusion.- import ark from "arkenv"; + import arkenv, { host, port } from "arkenv"; - const env = arkenv({ + const env = arkenv({ HOST: host, PORT: port, });
🧹 Nitpick comments (23)
apps/docs/next.config.ts (1)
12-12: Make comment resilient to future base path changes.Reference the constant instead of the literal to avoid drift.
Apply:
-// Will redirect localhost:3000 to localhost:3000/arkenv +// Redirect "/" to BASE_URL (e.g., /arkenv) for local devapps/docs/components/page/logo.tsx (1)
17-17: Centralize product name to prevent future rename drift.Source the display string from a config constant so branding stays consistent.
Within this file:
+import { PRODUCT_NAME_DISPLAY } from "~/config/constants"; ... - arkenv + {PRODUCT_NAME_DISPLAY}If not present, define in apps/docs/config/constants.ts:
export const PRODUCT_NAME_DISPLAY = "arkenv";packages/arkenv/README.md (1)
1-7: Enhance package README with install/usage and migration note.Adding brief “Install”, “Quickstart”, and “Migration (ark.env → arkenv)” sections will help users landing directly on this package.
I can draft a minimal template aligned with your docs/examples if you want.
apps/docs/.env.example (1)
22-23: Confirm Sentry slugs are intended.
SENTRY_PROJECT example is “arkenv” but SENTRY_ORG example still shows “ark-env”. If the org was renamed, update the example to match; otherwise, keep as-is.If renamed, apply:
-# Example: ark-env +# Example: arkenvpackages/vite-plugin/src/index.ts (2)
7-15: Type-level cleanup (optional).
The genericexport default <T extends EnvSchema>(options: EnvSchema<T>)is a bit confusing sinceEnvSchemaalready wrapsT. Consider constrainingTto the record shape and usingEnvSchema<T>only foroptionsto improve readability.For example:
-type EnvSchema< T extends Record<string, string | undefined> = Record<string, string | undefined> > = type.validate<T>; +type EnvShape = Record<string, string | undefined>; +type EnvSchema<T extends EnvShape = EnvShape> = type.validate<T>; -export default <T extends EnvSchema>(options: EnvSchema<T>): Plugin => ({ +export default <T extends EnvShape>(options: EnvSchema<T>): Plugin => ({
15-19: Optional: run validation early in the Vite lifecycle.
If you want env validation before other plugins, addenforce: "pre"to the plugin object.export default <T extends EnvSchema>(options: EnvSchema<T>): Plugin => ({ name: "@arkenv/vite-plugin", + enforce: "pre", config(_config, { mode }) { arkenv(options, loadEnv(mode, process.cwd(), "")); }, });apps/docs/content/docs/index.mdx (1)
15-16: Verify “single dependency” claim/link.
The note links to chalk@5.4.1. If ArkEnv’s only dependency is not chalk, update the text/link to the actual dep or remove the parenthetical.apps/docs/components/page/stackblitz-demo.tsx (1)
13-15: Harden the fallback slug to ignore empty/whitespace env values.An empty NEXT_PUBLIC_STACKBLITZ_GITHUB_REPO_SLUG won’t trigger the nullish coalescing. Trim and treat empty as unset.
useEffect(() => { if (!embedRef.current) return; - sdk.embedGithubProject( - embedRef.current, - process.env.NEXT_PUBLIC_STACKBLITZ_GITHUB_REPO_SLUG ?? - "yamcodes/arkenv/tree/main/examples/basic", + const slug = + (process.env.NEXT_PUBLIC_STACKBLITZ_GITHUB_REPO_SLUG ?? "") + .trim() || "yamcodes/arkenv/tree/main/examples/basic"; + sdk.embedGithubProject( + embedRef.current, + slug, { openFile: "index.ts",examples/with-bun/README.md (2)
8-12: Hyphenate “Type-safe”.Minor style fix for consistency.
-- Typesafe environment configuration +- Type-safe environment configuration
45-51: Add missing import in the snippet for clarity.Readers may copy/paste; include the import of arkenv.
// index.ts +import arkenv from "arkenv"; const env = arkenv({ // other definitions... MY_ENV_VAR: "string" });packages/arkenv/src/env.test.ts (1)
27-35: Isolate env mutations in testsSetting
process.env.TEST_STRINGandprocess.env.WRONG_TYPEcan leak across tests. Prefervi.stubEnvwith cleanup, or snapshot/restore around each test.Example:
import { afterEach, vi } from "vitest"; afterEach(() => { vi.unstubAllEnvs(); });Or manually save/restore the specific keys.
Confirm your Vitest version supports
vi.stubEnv(Vitest ≥0.34). If not, use manual save/restore.Also applies to: 54-68
apps/docs/app/(home)/page.tsx (1)
12-15: Brand casing nit: consider “ArkEnv” in title/descriptionElsewhere the brand is “ArkEnv”. For consistency, consider:
- title: “ArkEnv: Typesafe Environment Variables”
- description: “ArkEnv is a tool…”
package.json (1)
8-12: Avoid moving README during release (use copy instead)
mv README.md packages/arkenvmutates the working tree and can leave the root README missing locally. Prefer copying.- "release": "mv README.md packages/arkenv && pnpm run build:packages && changeset publish", + "release": "cp README.md packages/arkenv/README.md && pnpm run build:packages && changeset publish",Optionally, make packages/arkenv/README.md the source of truth and remove the copy step by keeping that file in VCS.
packages/arkenv/CHANGELOG.md (1)
104-107: Fix markdownlint MD037 (no space inside emphasis)Remove the leading space inside the emphasis markers.
- ** ArkEnv now supports TypeScript inference** - check out this quick example: + **ArkEnv now supports TypeScript inference** - check out this quick example:packages/arkenv/package.json (1)
20-21: Test script coupling to root project
pnpm -w test --project arkenvassumes a workspace-level Vitest project named "arkenv". If that project name changes, tests will silently skip. Consider a localvitestconfig to make this self-contained.packages/vite-plugin/package.json (2)
31-35: Deduplicate "arkenv" keyword."arkenv" appears twice in keywords.
"keywords": [ "arktype", - "arkenv", - "arkenv", + "arkenv", "environment", "variables", "vite", "plugin" ],
41-46: Drop rimraf; use tsup --clean.Avoid an extra tool and potential missing devDependency.
"scripts": { - "build": "rimraf dist && tsup", + "build": "tsup --clean", "prepack": "pnpm run build", "typecheck": "tsc --noEmit", "clean": "rimraf dist node_modules" },If you prefer keeping rimraf, add it to devDependencies to ensure prepack works outside the workspace root.
examples/with-bun/package.json (1)
10-10: Bump arkenv to the latest version (0.1.5) in this exampleexamples/with-bun/package.json:
- "arkenv": "^0.1.3", + "arkenv": "^0.1.5",Aligns with the package’s current version and other examples.
examples/basic/package.json (1)
11-12: Align arkenv version across examples
Update arkenv from "^0.1.3" to "^0.1.4" in examples/basic and examples/with-bun to match with-vite-react-ts. Verify arkenv@0.1.4 publication before merging.examples/with-vite-react-ts/package.json (1)
12-13: Bump plugin to match monorepo version.The plugin package.json shows 0.0.3; update the example to reduce drift.
- "@arkenv/vite-plugin": "^0.0.2", + "@arkenv/vite-plugin": "^0.0.3",examples/basic/README.md (3)
9-9: Hyphenate “Type-safe”.Minor wording polish.
-- Typesafe environment configuration +- Type-safe environment configuration
77-79: Link to the docs site instead of the repo.Use the primary docs URL for a smoother path from the example.
-- [ArkEnv docs](https://github.com/yamcodes/arkenv) +- [ArkEnv docs](https://yam.codes/arkenv)
39-44: Consider showing the import in the snippet.Readers may not know how arkenv is imported (default vs named). Add one line above the call for clarity.
I can update the snippet once you confirm the intended import form (e.g., default
import arkenv from 'arkenv'vs namedimport { arkenv } from 'arkenv').
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (3)
examples/basic/package-lock.jsonis excluded by!**/package-lock.jsonexamples/with-vite-react-ts/package-lock.jsonis excluded by!**/package-lock.jsonpnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (36)
.changeset/config.json(1 hunks)CONTRIBUTING.md(3 hunks)README.md(3 hunks)THANKS.md(1 hunks)apps/docs/.env.example(2 hunks)apps/docs/README.md(1 hunks)apps/docs/app/(home)/page.tsx(1 hunks)apps/docs/app/docs/[[...slug]]/page.tsx(1 hunks)apps/docs/components/page/logo.tsx(1 hunks)apps/docs/components/page/stackblitz-demo.tsx(1 hunks)apps/docs/config/constants.ts(1 hunks)apps/docs/content/docs/README.md(1 hunks)apps/docs/content/docs/examples.mdx(2 hunks)apps/docs/content/docs/guides/environment-configuration.mdx(3 hunks)apps/docs/content/docs/index.mdx(3 hunks)apps/docs/content/docs/quickstart.mdx(4 hunks)apps/docs/next.config.ts(1 hunks)arkenv.code-workspace(1 hunks)examples/README.md(1 hunks)examples/basic/README.md(4 hunks)examples/basic/index.ts(1 hunks)examples/basic/package.json(1 hunks)examples/with-bun/README.md(4 hunks)examples/with-bun/index.ts(1 hunks)examples/with-bun/package.json(1 hunks)examples/with-vite-react-ts/package.json(1 hunks)package.json(2 hunks)packages/ark.env/README.md(0 hunks)packages/arkenv/CHANGELOG.md(2 hunks)packages/arkenv/README.md(1 hunks)packages/arkenv/package.json(3 hunks)packages/arkenv/src/env.test.ts(4 hunks)packages/vite-plugin/CHANGELOG.md(2 hunks)packages/vite-plugin/README.md(1 hunks)packages/vite-plugin/package.json(2 hunks)packages/vite-plugin/src/index.ts(2 hunks)
💤 Files with no reviewable changes (1)
- packages/ark.env/README.md
🧰 Additional context used
🧬 Code graph analysis (3)
examples/with-bun/index.ts (1)
packages/arkenv/src/env.ts (1)
env(20-42)
packages/arkenv/src/env.test.ts (1)
packages/arkenv/src/env.ts (1)
env(20-42)
examples/basic/index.ts (1)
packages/arkenv/src/env.ts (1)
env(20-42)
🪛 LanguageTool
examples/with-bun/README.md
[grammar] ~8-~8: There might be a mistake here.
Context: ...hat's inside? The example demonstrates: - Setting up environment variables with Ar...
(QB_NEW_EN)
[grammar] ~9-~9: There might be a mistake here.
Context: ...ing up environment variables with ArkEnv - Using default values - Typesafe environm...
(QB_NEW_EN)
THANKS.md
[style] ~6-~6: Consider using a more formal and expressive alternative to ‘amazing’.
Context: ...y, please check it out. Seriously, it's amazing! Thank you 🙏
(AWESOME)
apps/docs/content/docs/index.mdx
[grammar] ~20-~20: There might be a mistake here.
Context: ...n be error-prone. Common issues include: - Missing environment variables causing ru...
(QB_NEW_EN)
[grammar] ~21-~21: There might be a mistake here.
Context: ...onment variables causing runtime crashes - Type mismatches between expected and act...
(QB_NEW_EN)
[grammar] ~22-~22: There might be a mistake here.
Context: ...tches between expected and actual values - Lack of validation for critical configur...
(QB_NEW_EN)
[grammar] ~23-~23: There might be a mistake here.
Context: ...of validation for critical configuration - No autocomplete or type hints in your ID...
(QB_NEW_EN)
examples/basic/README.md
[grammar] ~8-~8: There might be a mistake here.
Context: ...hat's inside? The example demonstrates: - Setting up environment variables with Ar...
(QB_NEW_EN)
[grammar] ~9-~9: There might be a mistake here.
Context: ...ing up environment variables with ArkEnv - Using default values - Typesafe environm...
(QB_NEW_EN)
README.md
[grammar] ~49-~49: There might be a mistake here.
Context: ... ```
(QB_NEW_EN)
🪛 GitHub Actions: tests
packages/vite-plugin/src/index.ts
[error] 17-17: tsup build failed for @arkenv/vite-plugin: TypeScript error TS2304: Cannot find name 'arkenv'.
packages/arkenv/src/env.test.ts
[error] 30-30: pnpm test failed: ReferenceError: arkenv is not defined in src/env.test.ts (line 30). 4 tests failed: env > should validate string env variables; env > should throw when required env variable is missing; env > should throw when env variable has wrong type; env > should validate against a custom environment.
🪛 GitHub Check: test (macos-latest)
packages/arkenv/src/env.test.ts
[failure] 30-30: src/env.test.ts > env > should validate string env variables
ReferenceError: arkenv is not defined
❯ src/env.test.ts:30:15
[failure] 76-76: src/env.test.ts > env > should validate against a custom environment
ReferenceError: arkenv is not defined
❯ src/env.test.ts:76:27
🪛 GitHub Check: test (ubuntu-latest)
packages/arkenv/src/env.test.ts
[failure] 30-30: src/env.test.ts > env > should validate string env variables
ReferenceError: arkenv is not defined
❯ src/env.test.ts:30:15
[failure] 76-76: src/env.test.ts > env > should validate against a custom environment
ReferenceError: arkenv is not defined
❯ src/env.test.ts:76:27
🪛 markdownlint-cli2 (0.17.2)
packages/arkenv/CHANGELOG.md
106-106: Spaces inside emphasis markers
(MD037, no-space-in-emphasis)
🔇 Additional comments (28)
arkenv.code-workspace (1)
8-10: Workspace entry rename approved; no residualark.envreferences found. Checks confirmpackages/arkenvexists, the legacypackages/ark.envfolder is gone, and no stale references remain..changeset/config.json (1)
3-3: Changelog repo rename LGTM.Matches the repo move to yamcodes/arkenv.
apps/docs/config/constants.ts (1)
1-1: BASE_URL rename LGTM – no stale “/ark.env” references detected.apps/docs/app/docs/[[...slug]]/page.tsx (1)
85-85: Metadata suffix rename LGTM.Consistent with the new brand.
apps/docs/content/docs/examples.mdx (2)
4-4: Description rename LGTM.
18-24: Links updated correctly; no remainingark.envreferences found.apps/docs/content/docs/README.md (1)
1-5: LGTM — rename and links look consistent.
Branding, welcome text, and docsite URL are correctly updated to ArkEnv.apps/docs/.env.example (1)
2-7: LGTM on repo/StackBlitz examples.
Examples now point to yamcodes/arkenv and the basic example path. No issues.examples/with-bun/README.md (1)
53-59: Confirm doc link is correct post-rename.Double-check the anchor path resolves under /arkenv.
THANKS.md (1)
5-6: LGTM — branding updated consistently.apps/docs/README.md (1)
1-5: LGTM — title and links reflect ArkEnv.Optionally verify the new path is live.
CONTRIBUTING.md (3)
1-4: LGTM — CONTRIBUTING updated for ArkEnv.Clone path and directory name look correct.
58-58: Confirm license line matches the repo’s LICENSE file.If the license changed during rename, update this note accordingly.
18-20: No leftover references toark.envfound
Ran a recursive grep across the repository—no occurrences of “ark.env” remain.packages/vite-plugin/CHANGELOG.md (1)
11-16: LGTM: links and package name updated to arkenvThe repository links and package tag renames look correct and consistent.
Also applies to: 23-23, 33-33
README.md (1)
2-9: Badges/links: rename consistency looks goodTop hero link, Actions badge, bundle size, and npm badges correctly target
arkenv. No action needed.Also applies to: 6-9
examples/README.md (2)
1-11: LGTM: examples README matches new brandingTitle, descriptions, and table formatting read well and consistently use “ArkEnv”.
14-29: Nice addition: contribution guide for examplesThe structure checklist is clear and useful.
apps/docs/content/docs/guides/environment-configuration.mdx (1)
177-177: Branding text LGTMThe section title correctly reflects the rename.
apps/docs/content/docs/quickstart.mdx (3)
11-12: Install snippet LGTMPackage names reflect the new branding.
29-29: Reference update LGTMThe ArkType reference reads well post-rename.
121-122: Card copy LGTMThe description now correctly references arkenv.
package.json (2)
2-5: Monorepo rename LGTMWorkspace name and layout look consistent with the package rename.
29-31: pnpm config formatting LGTMInline arrays are fine and equivalent.
packages/arkenv/CHANGELOG.md (1)
61-62: Confirm named export exists or adjust wordingIf
envis not a named export, replace with the actual named exports (e.g.,{ host, port }) or document the recommended import forms. If it is exported, ignore.Would you like me to scan the package entry to confirm named exports and update the snippet accordingly?
packages/arkenv/package.json (3)
2-3: Package rename LGTMName and module type look correct.
8-9: Description LGTMClear and aligned with branding.
32-38: Repository metadata LGTMHomepage, repo URL, and bugs path match the new repo.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
- Renamed `ark.env` package to `arkenv` - Updated `@arkenv/vite-plugin` to use `arkenv` - Updated main export from `env` to `defineEnv` - No user code changes required
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## arkenv@0.2.0 ### Minor Changes - Rename from `ark.env` to `arkenv` _[`#102`](#102) [`dfdc17f`](dfdc17f) [@yamcodes](https://github.com/yamcodes)_ BREAKING CHANGE: Package renamed from `ark.env` to `arkenv`, main export renamed from `env` to `defineEnv`. Before: ```ts import ark, { host, port } from "ark.env"; const env = ark.env({ HOST: host, PORT: port, }); ``` After: ```ts import { defineEnv, host, port } from "arkenv"; const env = defineEnv({ HOST: host, PORT: port, }); ``` ## @arkenv/vite-plugin@0.0.4 ### Patch Changes - Use new `arkenv` package _[`#102`](#102) [`dfdc17f`](dfdc17f) [@yamcodes](https://github.com/yamcodes)_ This package has been updated to use the new `arkenv` package. No changes from your side are required. <details><summary>Updated 1 dependency</summary> <small> [`dfdc17f`](dfdc17f) </small> - `arkenv@0.2.0` </details> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Summary by CodeRabbit