Skip to content

Commit df55478

Browse files
committed
fix(cli): resolve dead loop in nextjs scaffold template and update changeset example
1 parent eb2d1dc commit df55478

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

.changeset/flat-layout-mode.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ export const env = arkenv({
1414
DATABASE_URL: "string",
1515
NEXT_PUBLIC_API_URL: "string",
1616
NODE_ENV: "'development' | 'production' | 'test' = 'development'",
17+
CUSTOM_VAR: "string",
18+
}, {
19+
exposeToClient: ["CUSTOM_VAR"]
1720
});
1821
```
1922

packages/cli/src/features/scaffold/templates/nextjs-template.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,12 @@ export function buildNextjsTemplate(
9494
const flatFields = allFields.map((field) => field.replace(/^\t\t/, "\t"));
9595

9696
const exposedKeyNames: string[] = [];
97-
if (envKeys && envKeys.length > 0) {
98-
for (const key of envKeys) {
99-
if (key === "NODE_ENV") {
100-
// NODE_ENV is implicitly shared, no need to list it in options.expose
97+
for (const field of sharedFields) {
98+
const match = field.trim().match(/^([a-zA-Z0-9_]+)\s*:/);
99+
if (match) {
100+
const key = match[1];
101+
if (key !== "NODE_ENV") {
102+
exposedKeyNames.push(key);
101103
}
102104
}
103105
}

0 commit comments

Comments
 (0)