Skip to content

Commit e740d18

Browse files
committed
move the merging to extractProjectEnvVars
1 parent 9ff653c commit e740d18

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/cloudflare/src/cli/build/utils/extract-project-env-vars.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ function readEnvFiles(fileNames: string[], { monorepoRoot, appPath }: BuildOptio
1111
path.join(appPath, fileName),
1212
])
1313
.filter((filePath) => fs.existsSync(filePath) && fs.statSync(filePath).isFile())
14-
.map((filePath) => parse(fs.readFileSync(filePath).toString()))
15-
.reduce<Record<string, string>>((acc, overrides) => ({ ...acc, ...overrides }), {});
14+
.map((filePath) => parse(fs.readFileSync(filePath).toString()));
1615
}
1716

1817
/**
@@ -30,5 +29,7 @@ function readEnvFiles(fileNames: string[], { monorepoRoot, appPath }: BuildOptio
3029
* the env files at the root of the monorepo.
3130
*/
3231
export function extractProjectEnvVars(mode: string, options: BuildOptions) {
33-
return readEnvFiles([".env", `.env.${mode}`, ".env.local", `.env.${mode}.local`], options);
32+
const envVars = readEnvFiles([".env", `.env.${mode}`, ".env.local", `.env.${mode}.local`], options);
33+
34+
return envVars.reduce<Record<string, string>>((acc, overrides) => ({ ...acc, ...overrides }), {});
3435
}

0 commit comments

Comments
 (0)