Skip to content

Commit

Permalink
fix: make --auto-cascade-env refer to only .env if all related env va…
Browse files Browse the repository at this point in the history
…rs are empty
  • Loading branch information
exKAZUu committed Sep 26, 2023
1 parent 301444f commit 7e31482
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 2 additions & 4 deletions packages/shared-lib-node/src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,11 @@ export const yargsOptionsBuilderForEnv = {
type: 'string',
},
'cascade-node-env': {
description:
'Same with --cascade-env=<NODE_ENV>. If NODE_ENV is falsy, "development" is applied. Preferred over `auto-cascade-env`.',
description: 'Same with --cascade-env=<NODE_ENV || "development">. Preferred over `auto-cascade-env`.',
type: 'boolean',
},
'auto-cascade-env': {
description:
'Same with --cascade-env=<WB_ENV || APP_ENV || NODE_ENV>. If they are falsy, "development" is applied.',
description: 'Same with --cascade-env=<WB_ENV || APP_ENV || NODE_ENV || "">.',
type: 'boolean',
default: true,
},
Expand Down
6 changes: 5 additions & 1 deletion packages/wb/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ await yargs(hideBin(process.argv))

removeNpmAndYarnEnvironmentVariables(process.env);

if (['tc', 'typecheck'].includes(argv._[0].toString())) return;
const command = argv._[0].toString();
if (['tc', 'typecheck'].includes(command)) return;
if (command === 'test') {
process.env.WB_ENV = process.env.WB_ENV || 'test';
}
loadEnvironmentVariables(argv, project.dirPath);
})
.command(buildIfNeededCommand)
Expand Down

0 comments on commit 7e31482

Please sign in to comment.