pxnpm 6.0.10 → 6.0.11
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/pxnpm.cjs +2 -25
- package/package.json +1 -1
package/bin/pxnpm.cjs
CHANGED
|
@@ -29,32 +29,9 @@ try {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
try {
|
|
32
|
-
|
|
33
|
-
const path = require('path');
|
|
34
|
-
const dotenv = require('../dist/node_modules/dotenv');
|
|
35
|
-
const minimist = require('../dist/node_modules/minimist');
|
|
36
|
-
// 解析命令行参数
|
|
37
|
-
const args = minimist(process.argv.slice(2));
|
|
38
|
-
const envMode = args['env-mode'] || 'development'; // 默认为 development
|
|
39
|
-
|
|
40
|
-
// 定义文件加载顺序
|
|
41
|
-
const envFiles = [
|
|
42
|
-
'.env',
|
|
43
|
-
'.env.local',
|
|
44
|
-
`.env.${envMode}`,
|
|
45
|
-
`.env.${envMode}.local`
|
|
46
|
-
];
|
|
47
|
-
|
|
48
|
-
// 加载 .env 文件,并保证后加载的覆盖前面的
|
|
49
|
-
envFiles.forEach(file => {
|
|
50
|
-
const envPath = path.resolve(process.cwd(), file);
|
|
51
|
-
if (fs.existsSync(envPath)) {
|
|
52
|
-
// console.log(`加载环境文件: ${envPath}`);
|
|
53
|
-
dotenv.config({ path: envPath, override: true }); // 加载并覆盖 process.env
|
|
54
|
-
}
|
|
55
|
-
});
|
|
32
|
+
process.env.WORKSPACE_PWD = process.cwd()
|
|
56
33
|
} catch {
|
|
57
|
-
// We don't have/need to care about
|
|
34
|
+
// We don't have/need to care about WORKSPACE_PWD failed
|
|
58
35
|
}
|
|
59
36
|
|
|
60
37
|
global['pxnpm__startedAt'] = Date.now()
|