diff --git a/packages/shared-lib-node/src/env.ts b/packages/shared-lib-node/src/env.ts index c80649e4..8221c8bc 100644 --- a/packages/shared-lib-node/src/env.ts +++ b/packages/shared-lib-node/src/env.ts @@ -17,12 +17,12 @@ export const yargsOptionsBuilderForEnv = { }, 'cascade-env': { description: - 'Environment to load cascading .env files (e.g., `.env`, `.env.`, `.env.local` and `.env..local`). Preferred over `auto-cascade-env`', + 'Environment to load cascading .env files (e.g., `.env`, `.env.`, `.env.local` and `.env..local`). Preferred over `cascade-node-env` and `auto-cascade-env`.', type: 'string', }, 'cascade-node-env': { description: - 'Same with --cascade-env=. If NODE_ENV is falsy, "development" is applied. Preferred over `cascade-env` and `auto-cascade-env`.', + 'Same with --cascade-env=. If NODE_ENV is falsy, "development" is applied. Preferred over `auto-cascade-env`.', type: 'boolean', }, 'auto-cascade-env': { @@ -38,7 +38,13 @@ export const yargsOptionsBuilderForEnv = { * */ export function loadEnvironmentVariables(argv: Options, cwd: string): Record { let envPaths = (argv.env ?? []).map((envPath) => envPath.toString()); - const cascade = argv.cascadeNodeEnv ? process.env.NODE_ENV || 'development' : argv.cascadeEnv; + const cascade = + argv.cascadeEnv ?? + (argv.cascadeNodeEnv + ? process.env.NODE_ENV || 'development' + : argv.autoCascadeEnv + ? process.env.WB_ENV || process.env.APP_ENV || process.env.NODE_ENV || 'development' + : undefined); if (typeof cascade === 'string') { if (envPaths.length === 0) envPaths.push('.env'); envPaths = envPaths.flatMap((envPath) => diff --git a/packages/wb/src/index.ts b/packages/wb/src/index.ts index 82987a60..b4efd896 100644 --- a/packages/wb/src/index.ts +++ b/packages/wb/src/index.ts @@ -19,7 +19,6 @@ await yargs(hideBin(process.argv)) .scriptName('wb') .options(sharedOptionsBuilder) .middleware((argv) => { - console.log(argv); const workingDir = argv['working-dir']; if (workingDir) { const dirPath = path.resolve(workingDir);