Skip to content

feat(@arkenv/nextjs): remove ArkEnvScript; document Next + Docker (#1911) - #1930

Merged
yamcodes merged 5 commits into
v1from
cursor/hat-arkenvscript-1911-a958
Sep 21, 2026
Merged

yamcodes merged 5 commits into
v1from
cursor/hat-arkenvscript-1911-a958

Conversation

@yamcodes

@yamcodes yamcodes commented Sep 21, 2026 •

Copy link
Copy Markdown
Owner

Fixes #1911.

Decision

B — remove ArkEnvScript / globalThis.__arkenv_env__ (S-tier: A2 + B4 + C1), with A3 docs shipping:

  • Dedicated Next.js and Docker guide (bake-time public env, server-pass-props, ecosystem pointer)
  • migrating-to-v1 note naming next-runtime-env so Docker users are not stranded
  • ADR 0034

Hat write-up: docs/design/arkenvscript-nextjs-runtime-public-env.md.

Code

  • Delete script.tsx; drop exports from index / react-server
  • Codegen emits KEY: process.env.KEY only (no global peek)
  • Runtime merge no longer reads __arkenv_env__
  • Tests + major changeset for @arkenv/nextjs

Review follow-ups

  • Docker guide: output: \"standalone\", copy public/, DATABASE_URL build placeholder for withArkEnv, drop empty runtime ENV
  • Design-note status was already locked to ADR 0034 / S stack (reply only)

Local verification

@arkenv/nextjs Vitest: 7 files / 48 tests passed. MDXlint clean on new/updated guides.

Open in Web Open in Cursor 

Living design note scoring keep-vs-remove with layered options,
ecosystem research, and an S-tier lean toward hard removal at RC.

Co-authored-by: Yam Borodetsky <[email protected]>
@changeset-bot

changeset-bot Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2dd5baf

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@arkenv/nextjs Major

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

@github-actions github-actions Bot added the docs Adds or changes documentation, or acts as documentation in and of itself label Sep 21, 2026
autofix-ci Bot and others added 2 commits September 21, 2026 09:09
Drop the undocumented runtime public-env global and align codegen with
Next build-time NEXT_PUBLIC_* inlining. Add the Docker guide, v1 migrate
note naming next-runtime-env, and ADR 0034.

Fixes #1911

Co-authored-by: Yam Borodetsky <[email protected]>
@github-actions github-actions Bot added www Improvements or additions to arkenv.js.org tests This issue or PR is about adding, removing or changing tests @arkenv/nextjs Issues or Pull Requests involving the Next.js integration for ArkEnv labels Sep 21, 2026
@cursor cursor Bot changed the title docs: hat evaluation for ArkEnvScript keep-or-remove (#1911) feat(@arkenv/nextjs): remove ArkEnvScript; document Next + Docker (#1911) Sep 21, 2026

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — one minor suggestion inline.

Reviewed changes

  • New design note docs/design/arkenvscript-nextjs-runtime-public-env.md — a layered (A/B/C) keep-or-remove evaluation for ArkEnvScript / globalThis.__arkenv_env__ in @arkenv/nextjs, with eight metrics, a per-layer hat, an S/A/B/C/D/E tier list, four use cases, and an S lean of A2 + B4 + C1.

The note's load-bearing claims check out against the repo: ArkEnvScript exists in packages/nextjs/src/script.tsx and is exported from index.ts / react-server.ts; the codegen global read is at packages/nextjs/src/config/generate.ts:9; frameworks/index.mdx still prints "Requires rebuild for NEXT_PUBLIC_*"; ADR 0028 and docs/CONTEXT.md say what the note cites; and the #1906 / #1911 / comment links all resolve. No behavioral surface is touched.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@pkg-pr-new

pkg-pr-new Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@arkenv/agent-plugin

npm i https://pkg.pr.new/@arkenv/agent-plugin@1930

arkenv

npm i https://pkg.pr.new/arkenv@1930

@arkenv/build

npm i https://pkg.pr.new/@arkenv/build@1930

@arkenv/bun-plugin

npm i https://pkg.pr.new/@arkenv/bun-plugin@1930

@arkenv/core

npm i https://pkg.pr.new/@arkenv/core@1930

@arkenv/fumadocs-ui

npm i https://pkg.pr.new/@arkenv/fumadocs-ui@1930

@arkenv/nextjs

npm i https://pkg.pr.new/@arkenv/nextjs@1930

@arkenv/nuxt

npm i https://pkg.pr.new/@arkenv/nuxt@1930

@arkenv/rsbuild-plugin

npm i https://pkg.pr.new/@arkenv/rsbuild-plugin@1930

@arkenv/standard

npm i https://pkg.pr.new/@arkenv/standard@1930

@arkenv/tanstack-addon

npm i https://pkg.pr.new/@arkenv/tanstack-addon@1930

@arkenv/vite-plugin

npm i https://pkg.pr.new/@arkenv/vite-plugin@1930

commit: 2dd5baf

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

The new Docker guide's Dockerfile won't run as written: it never enables output: "standalone", and its build step can't satisfy ArkEnv's build-time validation. Both are anchored inline.

Reviewed changes

  • Remove ArkEnvScript / __arkenv_env__ from @arkenv/nextjs — script.tsx deleted, exports dropped from index.ts / react-server.ts, jiti ./script aliases removed, major changeset added.
  • Codegen reverted to plain inlining — config/generate.ts now emits KEY: process.env.KEY; arkenv-internal.ts drops the globalEnv override; tests assert generated output no longer contains __arkenv_env__.
  • A3 docs story — new apps/www/content/docs/guides/nextjs-docker.mdx, guides index/meta.json entries, a Next-steps card, a migrating-to-v1 section, and a CONTEXT.md bullet.
  • ADR 0034 (docs/adr/0034-no-nextjs-runtime-env-global.md) plus the ADR README cluster row, and the design note updated to "accepted / shipped" (resolves the prior review's status-line note).

The code side looks correct and the removal is clean — no dangling ./script export map entries, and new-features.test.tsx still exercises vi / afterEach / arkenv after the deleted blocks. The .not.toContain("__arkenv_env__") assertions in both test files are good regression guards.

ℹ️ Nitpicks

  • ENV DATABASE_URL= in the Dockerfile sets an empty default in the runtime image. It's redundant with docker run -e DATABASE_URL=… and converts a missing secret into an empty-string URL error rather than a missing-key one — probably just drop it.
  • Now that script.tsx is gone, react is no longer imported anywhere in @arkenv/nextjs; its peerDependencies / @types/react devDependency could be dropped. src/package.test.ts:6 currently pins peerDependencies.react, so that test would need updating — fine to defer, but worth a follow-up.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ Delta since the last review is formatting-only. The two [!IMPORTANT] findings from that review are still open and are not restated here.

Reviewed changes

  • [autofix.ci] apply automated fixes (ee7f18e4) — biome-only reformat of three files: collapsed generateRuntimeEnvLines to a single return allKeys.map(...).join("\n"), wrapped the long NEXT_PUBLIC_VAL assertion in new-features.test.tsx, and realigned the docs/adr/README.md cluster table. Verified against HEAD: no semantic change, and the generated line is still KEY: process.env.KEY.

The two inline findings from the previous review on apps/www/content/docs/guides/nextjs-docker.mdx (missing output: "standalone"; the build step cannot satisfy withArkEnv validation for the required DATABASE_URL) still apply to this head.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Address review: enable output standalone, copy public/, pass a
DATABASE_URL build placeholder for withArkEnv, drop empty runtime ENV.

Co-authored-by: Yam Borodetsky <[email protected]>

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

  • Docker guide fixed for standalone output — next.config.ts now sets output: "standalone", and the runtime stage copies .next/static plus public/ into the image.
  • Build-time validation satisfied — the build stage takes a placeholder ARG DATABASE_URL so withArkEnv validation passes during next build, with an info Callout documenting withArkEnv(nextConfig, { validate: false }) as the alternative and where missing-key checks move to.

Both prior [!IMPORTANT] findings are addressed; validate is a real option (packages/nextjs/src/config/types.ts:82) and arkenv check is a real CLI command.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@yamcodes
yamcodes merged commit 46e140f into v1 Sep 21, 2026
19 checks passed
@yamcodes
yamcodes deleted the cursor/hat-arkenvscript-1911-a958 branch September 21, 2026 10:24
@arkenv-bot arkenv-bot Bot mentioned this pull request Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

@arkenv/nextjs Issues or Pull Requests involving the Next.js integration for ArkEnv docs Adds or changes documentation, or acts as documentation in and of itself tests This issue or PR is about adding, removing or changing tests www Improvements or additions to arkenv.js.org

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove ArkEnvScript / __arkenv_env__; document Next + Docker

2 participants