@infly/libs 2.5.0 → 2.7.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/README.md +502 -469
- 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 +34 -44
- 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/compose-release.js +7 -9
- package/build/docker/deployment/health-check.sh +5 -1
- package/build/docker/deployment/promote-image.sh +75 -5
- package/build/docker/deployment/release.sh +5 -1
- package/build/docker/docker-build-push.js +23 -23
- package/build/docker/project-install.js +42 -35
- package/build/docker/release-docker.js +7 -25
- package/build/docker/release-mode.js +7 -25
- package/build/docker/release-paths.js +30 -0
- package/build/docker/release-validation.js +248 -0
- package/build/docker/source-snapshot.js +2 -1
- package/build/docker/target-image.js +227 -0
- package/build/docker/target-release.js +540 -860
- 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/jenkins/README.md +94 -0
- package/jenkins/src/com/infly/jenkins/BuildProvenance.groovy +16 -0
- package/jenkins/src/com/infly/jenkins/PipelineJson.groovy +28 -0
- package/jenkins/src/com/infly/jenkins/ReleaseNotification.groovy +86 -0
- package/jenkins/vars/inflyNotify.groovy +83 -0
- package/package.json +4 -1
- 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 +813 -828
- package/script/git-automation/submodule-utils.js +16 -16
- package/workspace/config.js +144 -144
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const { logTerminal } = require("../../cli/terminal-style");
|
|
1
2
|
const fs = require("fs");
|
|
2
3
|
const path = require("path");
|
|
3
4
|
const { execSync } = require("child_process");
|
|
@@ -12,9 +13,9 @@ const { autoCloneProject, gitBranch, baseGitUrl } = projectConfig || {};
|
|
|
12
13
|
function cloneRepository(url, branch, targetDir) {
|
|
13
14
|
try {
|
|
14
15
|
execSync(`git clone -b ${branch} ${url} ${targetDir}`);
|
|
15
|
-
|
|
16
|
+
logTerminal("success", `项目克隆成功: ${path.basename(targetDir)}`);
|
|
16
17
|
} catch (err) {
|
|
17
|
-
|
|
18
|
+
logTerminal("error", `项目克隆失败: ${url} ${err.message}`);
|
|
18
19
|
}
|
|
19
20
|
}
|
|
20
21
|
|
|
@@ -47,17 +48,17 @@ function batchCloneProject(projects = config.workspaces || [], autoClone = autoC
|
|
|
47
48
|
|
|
48
49
|
if (autoClone) {
|
|
49
50
|
if (!Array.isArray(projects) || projects.length === 0) {
|
|
50
|
-
|
|
51
|
+
logTerminal("warning", "没有可克隆的项目或配置错误。");
|
|
51
52
|
process.exit(1);
|
|
52
53
|
}
|
|
53
|
-
|
|
54
|
+
logTerminal("info", `项目克隆开始 =======>`);
|
|
54
55
|
projects.forEach((repo = "") => {
|
|
55
56
|
const [targetFileDir = "", projectName = ""] = repo.split("/");
|
|
56
57
|
const repoUrl = baseGitUrl + projectName + ".git";
|
|
57
58
|
const targetDir = path.resolve(projectRoot, repo);
|
|
58
59
|
cloneRepository(repoUrl, gitBranch, targetDir);
|
|
59
60
|
});
|
|
60
|
-
|
|
61
|
+
logTerminal("info", `项目克隆完成 =======>`);
|
|
61
62
|
process.exit(0);
|
|
62
63
|
}
|
|
63
64
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
const { execSync } = require("node:child_process");
|
|
2
|
+
const { logTerminal } = require("../../cli/terminal-style");
|
|
2
3
|
|
|
3
4
|
function configureMergeDriver() {
|
|
4
5
|
try {
|
|
5
6
|
const current = execSync("git config --global merge.ours.driver").toString().trim();
|
|
6
7
|
if (current) {
|
|
7
|
-
|
|
8
|
+
logTerminal("success", " merge.ours.driver 已配置:", current);
|
|
8
9
|
return true;
|
|
9
10
|
}
|
|
10
11
|
} catch (_) {
|
|
@@ -13,7 +14,7 @@ function configureMergeDriver() {
|
|
|
13
14
|
|
|
14
15
|
try {
|
|
15
16
|
execSync("git config --global merge.ours.driver true");
|
|
16
|
-
|
|
17
|
+
logTerminal("success", " merge.ours.driver 配置成功");
|
|
17
18
|
return true;
|
|
18
19
|
} catch (error) {
|
|
19
20
|
console.error(" × merge.ours.driver 配置失败:", error.message);
|
|
@@ -23,7 +24,6 @@ function configureMergeDriver() {
|
|
|
23
24
|
|
|
24
25
|
function configureGitAliases() {
|
|
25
26
|
// 预留:后续可在此配置 git alias
|
|
26
|
-
console.log(" -> git aliases 配置完成");
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
module.exports = { configureGitAliases, configureMergeDriver };
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
const { logTerminal } = require("../../cli/terminal-style");
|
|
1
2
|
const { execSync } = require("child_process");
|
|
2
3
|
|
|
3
4
|
function submoduleInit() {
|
|
4
5
|
try {
|
|
5
6
|
execSync("git submodule update --init --recursive", { stdio: "inherit" });
|
|
6
|
-
|
|
7
|
+
logTerminal("success", "Git子模块初始化完成");
|
|
7
8
|
} catch (error) {
|
|
8
|
-
|
|
9
|
+
logTerminal("error", "Git命令执行失败:", error.message);
|
|
9
10
|
process.exit(1);
|
|
10
11
|
}
|
|
11
12
|
}
|
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
const fs = require("fs");
|
|
2
|
-
const path = require("path");
|
|
3
|
-
const { execFileSync } = require("child_process");
|
|
4
|
-
|
|
5
|
-
function gitOutput(args, cwd = process.cwd()) {
|
|
6
|
-
return execFileSync("git", args, {
|
|
7
|
-
cwd,
|
|
8
|
-
encoding: "utf8",
|
|
9
|
-
shell: process.platform === "win32"
|
|
10
|
-
}).trim();
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function findGitRepo(cwd) {
|
|
14
|
-
let currentDir = path.resolve(cwd || process.cwd());
|
|
15
|
-
|
|
16
|
-
while (true) {
|
|
17
|
-
const gitPath = path.join(currentDir, ".git");
|
|
18
|
-
|
|
19
|
-
if (fs.existsSync(gitPath)) {
|
|
20
|
-
const stat = fs.statSync(gitPath);
|
|
21
|
-
const repo = {
|
|
22
|
-
root: currentDir,
|
|
23
|
-
commonDir: gitPath
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
if (stat.isFile()) {
|
|
27
|
-
const content = fs.readFileSync(gitPath, "utf8");
|
|
28
|
-
const match = content.match(/gitdir:\s*(.+)/i);
|
|
29
|
-
|
|
30
|
-
if (match) {
|
|
31
|
-
repo.commonDir = path.resolve(currentDir, match[1].trim());
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return repo;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const parentDir = path.dirname(currentDir);
|
|
39
|
-
|
|
40
|
-
if (parentDir === currentDir) {
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
currentDir = parentDir;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
1
|
+
const fs = require("fs");
|
|
2
|
+
const path = require("path");
|
|
3
|
+
const { execFileSync } = require("child_process");
|
|
4
|
+
|
|
5
|
+
function gitOutput(args, cwd = process.cwd()) {
|
|
6
|
+
return execFileSync("git", args, {
|
|
7
|
+
cwd,
|
|
8
|
+
encoding: "utf8",
|
|
9
|
+
shell: process.platform === "win32"
|
|
10
|
+
}).trim();
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function findGitRepo(cwd) {
|
|
14
|
+
let currentDir = path.resolve(cwd || process.cwd());
|
|
15
|
+
|
|
16
|
+
while (true) {
|
|
17
|
+
const gitPath = path.join(currentDir, ".git");
|
|
18
|
+
|
|
19
|
+
if (fs.existsSync(gitPath)) {
|
|
20
|
+
const stat = fs.statSync(gitPath);
|
|
21
|
+
const repo = {
|
|
22
|
+
root: currentDir,
|
|
23
|
+
commonDir: gitPath
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
if (stat.isFile()) {
|
|
27
|
+
const content = fs.readFileSync(gitPath, "utf8");
|
|
28
|
+
const match = content.match(/gitdir:\s*(.+)/i);
|
|
29
|
+
|
|
30
|
+
if (match) {
|
|
31
|
+
repo.commonDir = path.resolve(currentDir, match[1].trim());
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return repo;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const parentDir = path.dirname(currentDir);
|
|
39
|
+
|
|
40
|
+
if (parentDir === currentDir) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
currentDir = parentDir;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
48
|
function getGitCommonDir(cwd) {
|
|
49
|
-
const repo = findGitRepo(cwd);
|
|
50
|
-
|
|
51
|
-
if (repo) {
|
|
52
|
-
return repo.commonDir;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
try {
|
|
56
|
-
const commonDir = gitOutput(["-C", cwd, "rev-parse", "--git-common-dir"]);
|
|
57
|
-
return path.resolve(cwd, commonDir);
|
|
58
|
-
} catch {
|
|
59
|
-
return path.resolve(cwd || process.cwd());
|
|
60
|
-
}
|
|
49
|
+
const repo = findGitRepo(cwd);
|
|
50
|
+
|
|
51
|
+
if (repo) {
|
|
52
|
+
return repo.commonDir;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
try {
|
|
56
|
+
const commonDir = gitOutput(["-C", cwd, "rev-parse", "--git-common-dir"]);
|
|
57
|
+
return path.resolve(cwd, commonDir);
|
|
58
|
+
} catch {
|
|
59
|
+
return path.resolve(cwd || process.cwd());
|
|
60
|
+
}
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
function resolveGitWorktreeRoot(cwd) {
|