@willbooster/wb 13.21.1 → 13.21.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/dotenv.js CHANGED
@@ -34,7 +34,11 @@ export function runDotenvCommand(args) {
34
34
  }
35
35
 
36
36
  function readAndApplyEnvironmentVariables(cwd) {
37
- const envVars = readEnvFile(path.join(cwd, '.env'));
37
+ const parsed = {
38
+ ...readEnvFile(path.join(cwd, '.env')),
39
+ ...(process.env.WB_ENV ? readEnvFile(path.join(cwd, `.env.${process.env.WB_ENV}`)) : {}),
40
+ };
41
+ const envVars = expand({ parsed, processEnv: {} }).parsed ?? parsed;
38
42
  for (const [key, value] of Object.entries(envVars)) {
39
43
  if (!(key in process.env)) {
40
44
  process.env[key] = value;
@@ -43,8 +47,7 @@ function readAndApplyEnvironmentVariables(cwd) {
43
47
  }
44
48
 
45
49
  function readEnvFile(filePath) {
46
- const parsed = config({ path: path.resolve(filePath), processEnv: {}, quiet: true }).parsed ?? {};
47
- return expand({ parsed, processEnv: {} }).parsed ?? parsed;
50
+ return config({ path: path.resolve(filePath), processEnv: {}, quiet: true }).parsed ?? {};
48
51
  }
49
52
 
50
53
  function removeNpmAndYarnEnvironmentVariables(envVars) {