@infly/libs 2.6.0 → 2.7.1
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/README.md +21 -1
- package/adapters/vue2/project-preview.js +9 -16
- package/adapters/webpack/auto-export.js +53 -52
- package/bin/cli.js +3 -2
- package/build/build-dist/index.js +52 -67
- package/build/build-utils/command.js +58 -57
- package/build/build-utils/deps.js +28 -28
- package/build/build-utils/git.js +246 -254
- package/build/build-utils/preview.js +79 -78
- package/build/build-utils/webhook.js +135 -135
- package/build/docker/deployment/health-check.sh +5 -1
- package/build/docker/deployment/release.sh +25 -2
- package/build/docker/docker-build-push.js +20 -21
- package/build/docker/release-docker.js +5 -4
- package/build/docker/release-paths.js +30 -30
- package/build/docker/release-validation.js +51 -7
- package/build/docker/target-image.js +44 -6
- package/build/docker/target-release.js +540 -527
- package/build/project-files.js +47 -47
- package/cli/progress.js +4 -11
- package/cli/terminal-style.js +40 -0
- package/core/async/concurrency.js +29 -29
- package/package.json +3 -3
- package/script/git-automation/check-packages.js +5 -12
- package/script/git-automation/git-clone.js +6 -5
- package/script/git-automation/git-configure.js +3 -3
- package/script/git-automation/git-submodule.js +3 -2
- package/script/git-automation/git-utils.js +59 -59
- package/script/git-automation/index.js +862 -828
- package/script/git-automation/submodule-utils.js +16 -16
- package/workspace/config.js +144 -144
|
@@ -1,57 +1,58 @@
|
|
|
1
|
-
const {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
...
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
...
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
1
|
+
const { logTerminal } = require("../../cli/terminal-style");
|
|
2
|
+
const { spawn } = require("child_process");
|
|
3
|
+
|
|
4
|
+
function run(command, args, options = {}) {
|
|
5
|
+
return new Promise((resolve, reject) => {
|
|
6
|
+
const useShell = options.shell !== undefined ? options.shell : process.platform === "win32";
|
|
7
|
+
// Avoid DEP0190: when shell=true, pass command+args as single string
|
|
8
|
+
const [cmd, cmdArgs] = useShell
|
|
9
|
+
? [[command, ...args].join(" "), []]
|
|
10
|
+
: [command, args];
|
|
11
|
+
const child = spawn(cmd, cmdArgs, {
|
|
12
|
+
cwd: options.cwd || process.cwd(),
|
|
13
|
+
env: {
|
|
14
|
+
...process.env,
|
|
15
|
+
...(options.env || {})
|
|
16
|
+
},
|
|
17
|
+
stdio: options.stdio || "inherit",
|
|
18
|
+
shell: useShell
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
child.on("close", (code) => {
|
|
22
|
+
if (code === 0) {
|
|
23
|
+
resolve();
|
|
24
|
+
} else {
|
|
25
|
+
reject(new Error(`${command} ${args.join(" ")} failed with exit code ${code}`));
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
child.on("error", reject);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function spawnBackground(command, args, options = {}) {
|
|
34
|
+
const useShell = options.shell !== undefined ? options.shell : process.platform === "win32";
|
|
35
|
+
const [cmd, cmdArgs] = useShell
|
|
36
|
+
? [[command, ...args].join(" "), []]
|
|
37
|
+
: [command, args];
|
|
38
|
+
const child = spawn(cmd, cmdArgs, {
|
|
39
|
+
cwd: options.cwd || process.cwd(),
|
|
40
|
+
env: {
|
|
41
|
+
...process.env,
|
|
42
|
+
...(options.env || {})
|
|
43
|
+
},
|
|
44
|
+
stdio: options.stdio || "inherit",
|
|
45
|
+
shell: useShell
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
child.on("error", (error) => {
|
|
49
|
+
logTerminal("error", error.message);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
return child;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
module.exports = {
|
|
56
|
+
run,
|
|
57
|
+
spawnBackground
|
|
58
|
+
};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
const fs = require("fs");
|
|
2
|
-
const path = require("path");
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* 从项目的 webpack/vite 等构建配置中解析对兄弟 app 的依赖。
|
|
6
|
-
*
|
|
1
|
+
const fs = require("fs");
|
|
2
|
+
const path = require("path");
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 从项目的 webpack/vite 等构建配置中解析对兄弟 app 的依赖。
|
|
6
|
+
*
|
|
7
7
|
* 规则:如果 vue.config.js / vite.config.* / next.config.* 的 alias 中存在指向 ../ 的路径,
|
|
8
|
-
* 则认为当前项目依赖该兄弟 app,构建前需要确保兄弟 app 源码是最新的。
|
|
9
|
-
*
|
|
10
|
-
* 示例(vue.config.js):
|
|
11
|
-
* alias: {
|
|
12
|
-
* "@example-admin": projectResolve("../example-admin/src")
|
|
13
|
-
* }
|
|
14
|
-
*
|
|
15
|
-
* @param {string} appDir - 当前 app 目录的绝对路径
|
|
16
|
-
* @returns {string[]} 兄弟 app 根目录(含 package.json)的绝对路径列表
|
|
17
|
-
*/
|
|
8
|
+
* 则认为当前项目依赖该兄弟 app,构建前需要确保兄弟 app 源码是最新的。
|
|
9
|
+
*
|
|
10
|
+
* 示例(vue.config.js):
|
|
11
|
+
* alias: {
|
|
12
|
+
* "@example-admin": projectResolve("../example-admin/src")
|
|
13
|
+
* }
|
|
14
|
+
*
|
|
15
|
+
* @param {string} appDir - 当前 app 目录的绝对路径
|
|
16
|
+
* @returns {string[]} 兄弟 app 根目录(含 package.json)的绝对路径列表
|
|
17
|
+
*/
|
|
18
18
|
function resolveSiblingAppDeps(appDir) {
|
|
19
19
|
const siblings = [];
|
|
20
20
|
const configFiles = [
|
|
@@ -51,13 +51,13 @@ function resolveSiblingAppDeps(appDir) {
|
|
|
51
51
|
addSibling(match[2]);
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
|
|
55
|
-
for (const configFile of configFiles) {
|
|
56
|
-
const configPath = path.join(appDir, configFile);
|
|
57
|
-
if (!fs.existsSync(configPath)) continue;
|
|
58
|
-
|
|
59
|
-
const content = fs.readFileSync(configPath, "utf8");
|
|
60
|
-
|
|
54
|
+
|
|
55
|
+
for (const configFile of configFiles) {
|
|
56
|
+
const configPath = path.join(appDir, configFile);
|
|
57
|
+
if (!fs.existsSync(configPath)) continue;
|
|
58
|
+
|
|
59
|
+
const content = fs.readFileSync(configPath, "utf8");
|
|
60
|
+
|
|
61
61
|
// 匹配 alias 中指向 ../ 兄弟目录的值,兼容以下写法:
|
|
62
62
|
// "@foo": projectResolve("../foo/src")
|
|
63
63
|
// "@foo": resolve("../foo/src")
|
|
@@ -77,8 +77,8 @@ function resolveSiblingAppDeps(appDir) {
|
|
|
77
77
|
|
|
78
78
|
[...objectAliasPatterns, ...arrayAliasPatterns].forEach((pattern) => collectMatches(content, pattern));
|
|
79
79
|
}
|
|
80
|
-
|
|
81
|
-
return siblings;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
module.exports = { resolveSiblingAppDeps };
|
|
80
|
+
|
|
81
|
+
return siblings;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
module.exports = { resolveSiblingAppDeps };
|