@willbooster/wb 21.7.3 → 22.0.0
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 +6 -15
- package/dist/index.js +5 -5
- package/package.json +1 -1
package/bin/dotenv.js
CHANGED
|
@@ -69,17 +69,11 @@ function runCommandWithEnvironment(command, usage) {
|
|
|
69
69
|
|
|
70
70
|
// Mirrors src/commands/dotenv.ts (validateStandardWbEnv) for this startup fast path.
|
|
71
71
|
function validateStandardWbEnv(value, fixTarget) {
|
|
72
|
-
if (
|
|
73
|
-
!value ||
|
|
74
|
-
['development', 'test', 'staging', 'production'].includes(value) ||
|
|
75
|
-
process.env.WB_SKIP_ENV_CHECK === '1' ||
|
|
76
|
-
process.env.WB_SKIP_ENV_CHECK === 'true'
|
|
77
|
-
) {
|
|
72
|
+
if (!value || ['development', 'test', 'staging', 'production'].includes(value)) {
|
|
78
73
|
return;
|
|
79
74
|
}
|
|
80
75
|
console.error(
|
|
81
|
-
`WB_ENV must be one of development, test, staging, or production, but is "${value}".
|
|
82
|
-
`Fix ${fixTarget}, or set WB_SKIP_ENV_CHECK=1 to skip this check.`
|
|
76
|
+
`WB_ENV must be one of development, test, staging, or production, but is "${value}". Fix ${fixTarget}.`
|
|
83
77
|
);
|
|
84
78
|
process.exit(1);
|
|
85
79
|
}
|
|
@@ -129,9 +123,8 @@ function readAndApplyEnvironmentVariables(cwd) {
|
|
|
129
123
|
process.env[key] = value;
|
|
130
124
|
}
|
|
131
125
|
}
|
|
132
|
-
// Validate only AFTER applying the sources
|
|
133
|
-
//
|
|
134
|
-
// child will see.
|
|
126
|
+
// Validate only AFTER applying the sources: both the captured exported mode (it selected the
|
|
127
|
+
// profile) and the FINAL value the child will see.
|
|
135
128
|
validateStandardWbEnv(mode, 'the exported variable');
|
|
136
129
|
validateStandardWbEnv(process.env.WB_ENV, 'the env source or the exported variable');
|
|
137
130
|
// The selected environment is what an env source silently resolving WB_ENV to a DIFFERENT value
|
|
@@ -143,13 +136,11 @@ function readAndApplyEnvironmentVariables(cwd) {
|
|
|
143
136
|
if (
|
|
144
137
|
process.env.WB_ENV &&
|
|
145
138
|
['development', 'test', 'staging', 'production'].includes(expectedCascade) &&
|
|
146
|
-
process.env.WB_ENV !== expectedCascade
|
|
147
|
-
process.env.WB_SKIP_ENV_CHECK !== '1' &&
|
|
148
|
-
process.env.WB_SKIP_ENV_CHECK !== 'true'
|
|
139
|
+
process.env.WB_ENV !== expectedCascade
|
|
149
140
|
) {
|
|
150
141
|
console.error(
|
|
151
142
|
`WB_ENV resolves to "${process.env.WB_ENV}" although the "${expectedCascade}" environment was selected. ` +
|
|
152
|
-
`Fix the WB_ENV defined in the env sources
|
|
143
|
+
`Fix the WB_ENV defined in the env sources.`
|
|
153
144
|
);
|
|
154
145
|
process.exit(1);
|
|
155
146
|
}
|