Repository navigation
feat(@arkenv/nextjs): remove ArkEnvScript; document Next + Docker (#1911) - #1930
Conversation
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 detectedLatest commit: 2dd5baf The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
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]>
There was a problem hiding this comment.
ℹ️ 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 forArkEnvScript/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 ofA2 + 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.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
@arkenv/agent-plugin
arkenv
@arkenv/build
@arkenv/bun-plugin
@arkenv/core
@arkenv/fumadocs-ui
@arkenv/nextjs
@arkenv/nuxt
@arkenv/rsbuild-plugin
@arkenv/standard
@arkenv/tanstack-addon
@arkenv/vite-plugin
commit: |
There was a problem hiding this comment.
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.tsxdeleted, exports dropped fromindex.ts/react-server.ts, jiti./scriptaliases removed, major changeset added. - Codegen reverted to plain inlining —
config/generate.tsnow emitsKEY: process.env.KEY;arkenv-internal.tsdrops theglobalEnvoverride; tests assert generated output no longer contains__arkenv_env__. - A3 docs story — new
apps/www/content/docs/guides/nextjs-docker.mdx, guides index/meta.jsonentries, a Next-steps card, amigrating-to-v1section, and aCONTEXT.mdbullet. - 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 withdocker 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.tsxis gone,reactis no longer imported anywhere in@arkenv/nextjs; itspeerDependencies/@types/reactdevDependency could be dropped.src/package.test.ts:6currently pinspeerDependencies.react, so that test would need updating — fine to defer, but worth a follow-up.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
ℹ️ 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: collapsedgenerateRuntimeEnvLinesto a singlereturn allKeys.map(...).join("\n"), wrapped the longNEXT_PUBLIC_VALassertion innew-features.test.tsx, and realigned thedocs/adr/README.mdcluster table. Verified against HEAD: no semantic change, and the generated line is stillKEY: 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.
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]>
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Docker guide fixed for standalone output —
next.config.tsnow setsoutput: "standalone", and the runtime stage copies.next/staticpluspublic/into the image. - Build-time validation satisfied — the build stage takes a placeholder
ARG DATABASE_URLsowithArkEnvvalidation passes duringnext build, with an info Callout documentingwithArkEnv(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.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Fixes #1911.
Decision
B — remove
ArkEnvScript/globalThis.__arkenv_env__(S-tier: A2 + B4 + C1), with A3 docs shipping:migrating-to-v1note namingnext-runtime-envso Docker users are not strandedHat write-up:
docs/design/arkenvscript-nextjs-runtime-public-env.md.Code
script.tsx; drop exports fromindex/react-serverKEY: process.env.KEYonly (no global peek)__arkenv_env__@arkenv/nextjsReview follow-ups
output: \"standalone\", copypublic/,DATABASE_URLbuild placeholder forwithArkEnv, drop empty runtimeENVLocal verification
@arkenv/nextjsVitest: 7 files / 48 tests passed. MDXlint clean on new/updated guides.