@cmflow/cli 3.2.1 → 3.4.0-alpha.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/{.prettierrc → .oxfmtrc.json} +2 -1
- package/.yarn/install-state.gz +0 -0
- package/.yarn/releases/yarn-4.18.0.cjs +1000 -0
- package/.yarnrc.yml +8 -1
- package/README.md +66 -72
- package/bin/cm-checkfeatures.ts +10 -0
- package/bin/cm-clean.ts +10 -0
- package/bin/cm-config.ts +10 -0
- package/bin/cm-deploy.ts +10 -0
- package/bin/cm-expedit.ts +19 -0
- package/bin/cm-fetch.ts +10 -0
- package/bin/cm-finish.ts +10 -0
- package/bin/cm-jira-releases.ts +10 -0
- package/bin/cm-merge.ts +10 -0
- package/bin/cm-publish.ts +10 -0
- package/bin/cm-pull.ts +8 -0
- package/bin/cm-push.ts +10 -0
- package/bin/cm-rebase.ts +10 -0
- package/bin/{cmrelease.js → cm-release.ts} +0 -0
- package/bin/cm-republish.ts +10 -0
- package/bin/cm-start.ts +10 -0
- package/bin/cm.ts +40 -0
- package/dist/bin/cm.mjs +74985 -0
- package/dist/bin/cmrelease.mjs +72397 -0
- package/dist/cli-truncate-BmHD4ngn.mjs +152 -0
- package/dist/cli-truncate-CXNquMRK.mjs +152 -0
- package/dist/cli-truncate-DbOyuy2e.mjs +2 -0
- package/dist/cli-truncate-DbOyuy2e.mjs.map +1 -0
- package/dist/common-CwPbT3So.mjs +66 -0
- package/dist/common-CwPbT3So.mjs.map +1 -0
- package/dist/docker-clean-tags-Cd-E8IqJ.mjs +2 -0
- package/dist/docker-clean-tags-Cd-E8IqJ.mjs.map +1 -0
- package/dist/docker-publish-B0E0qYYB.mjs +2 -0
- package/dist/docker-publish-B0E0qYYB.mjs.map +1 -0
- package/dist/get-config-DoOyLztI.mjs +41 -0
- package/dist/get-config-DoOyLztI.mjs.map +1 -0
- package/dist/get-east-asian-width-Tfn8qoqd.mjs +2 -0
- package/dist/get-east-asian-width-Tfn8qoqd.mjs.map +1 -0
- package/dist/get-east-asian-width-eFfEkHwo.mjs +682 -0
- package/dist/log-update-B2GqeeDd.mjs +497 -0
- package/dist/log-update-BldA9lkm.mjs +497 -0
- package/dist/log-update-By8Z-mak.mjs +6 -0
- package/dist/log-update-By8Z-mak.mjs.map +1 -0
- package/dist/rolldown-runtime-B4iAMlE-.mjs +35 -0
- package/dist/semver-D8gwMSFO.mjs +2 -0
- package/dist/semver-D8gwMSFO.mjs.map +1 -0
- package/dist/src/index.mjs +18 -0
- package/dist/src/index.mjs.map +1 -0
- package/dist/src/semantic/core/analyze-commits.mjs +2 -0
- package/dist/src/semantic/core/analyze-commits.mjs.map +1 -0
- package/dist/src/semantic/core/conditional.mjs +2 -0
- package/dist/src/semantic/core/conditional.mjs.map +1 -0
- package/dist/src/semantic/core/exit.mjs +2 -0
- package/dist/src/semantic/core/exit.mjs.map +1 -0
- package/dist/src/semantic/core/prepare/bump-version.mjs +48 -0
- package/dist/src/semantic/core/prepare/bump-version.mjs.map +1 -0
- package/dist/src/semantic/core/prepare/commit.mjs +2 -0
- package/dist/src/semantic/core/prepare/commit.mjs.map +1 -0
- package/dist/src/semantic/core/prepare/release-info.mjs +2 -0
- package/dist/src/semantic/core/prepare/release-info.mjs.map +1 -0
- package/dist/src/semantic/core/run.mjs +2 -0
- package/dist/src/semantic/core/run.mjs.map +1 -0
- package/dist/src/semantic/core/sync-repository.mjs +2 -0
- package/dist/src/semantic/core/sync-repository.mjs.map +1 -0
- package/dist/src/semantic/core/verify-conditions.mjs +2 -0
- package/dist/src/semantic/core/verify-conditions.mjs.map +1 -0
- package/dist/src/semantic/core/verify-release.mjs +2 -0
- package/dist/src/semantic/core/verify-release.mjs.map +1 -0
- package/dist/src/semantic/docker/publish.mjs +2 -0
- package/dist/src/semantic/docker/publish.mjs.map +1 -0
- package/dist/src/semantic/docker/success.mjs +2 -0
- package/dist/src/semantic/docker/success.mjs.map +1 -0
- package/dist/strip-ansi-Aeu5cmZe.mjs +174 -0
- package/dist/strip-ansi-Cl0pRo-s.mjs +2 -0
- package/dist/strip-ansi-Cl0pRo-s.mjs.map +1 -0
- package/dist/wrap-ansi-BeIjar2W.mjs +2 -0
- package/dist/wrap-ansi-CWIezXNl.mjs +330 -0
- package/dist/wrap-ansi-DsMb4WnZ.mjs +9 -0
- package/dist/wrap-ansi-DsMb4WnZ.mjs.map +1 -0
- package/dist/wrap-ansi-T0rz0Urp.mjs +330 -0
- package/mise.toml +2 -0
- package/oxlint.json +25 -0
- package/package.json +65 -62
- package/release.config.mjs +6 -6
- package/src/commands/checkfeatures.ts +39 -0
- package/src/commands/clean.ts +36 -0
- package/src/commands/config.ts +31 -0
- package/src/commands/deploy.ts +39 -0
- package/src/commands/fetch.ts +30 -0
- package/src/commands/finish.ts +50 -0
- package/src/commands/{index.js → index.ts} +3 -0
- package/src/commands/jira-releases.ts +97 -0
- package/src/commands/merge.ts +58 -0
- package/src/commands/prompts/{branches.js → branches.ts} +13 -5
- package/src/commands/pull.ts +44 -0
- package/src/commands/push.ts +48 -0
- package/src/commands/rebase.ts +56 -0
- package/src/commands/republish.ts +34 -0
- package/src/commands/start.ts +123 -0
- package/src/commands/tasks/{merge-branch.js → merge-branch.ts} +18 -3
- package/src/commands/tasks/push-branch.ts +19 -0
- package/src/commands/tasks/{rebase-all-branches.js → rebase-all-branches.ts} +10 -2
- package/src/commands/tasks/{refresh-repository.js → refresh-repository.ts} +8 -4
- package/src/commands/tasks/run-test.ts +28 -0
- package/src/commands/tasks/{update-branch.js → update-branch.ts} +15 -9
- package/src/commands/tasks/{update-dependencies.js → update-dependencies.ts} +4 -3
- package/src/common/back/directus/{directus-flow.test.js → directus-flow.test.ts} +1 -0
- package/src/common/back/directus/{directus-flow.js → directus-flow.ts} +10 -2
- package/src/common/back/http/{http-proxy.js → http-proxy.ts} +7 -1
- package/src/common/back/http/{http-request.spec.js → http-request.spec.ts} +8 -7
- package/src/common/back/http/{http-request.js → http-request.ts} +16 -19
- package/src/common/back/jira/{get-sorted-releases.js → get-sorted-releases.ts} +2 -2
- package/src/common/back/jira/interfaces/JiraIIssue.d.ts +3 -3
- package/src/common/back/jira/{jira-releases.js → jira-releases.ts} +14 -3
- package/src/common/back/jira/{jira-request.js → jira-request.ts} +9 -1
- package/src/common/back/jira/{jira-search.js → jira-search.ts} +2 -2
- package/src/common/cli/{bun.test.js → bun.test.ts} +17 -10
- package/src/common/cli/{bun.js → bun.ts} +4 -4
- package/src/common/cli/cli.ts +127 -0
- package/src/common/cli/{docker.test.js → docker.test.ts} +22 -14
- package/src/common/cli/{docker.js → docker.ts} +6 -6
- package/src/common/cli/{git.test.js → git.test.ts} +19 -11
- package/src/common/cli/{git.js → git.ts} +24 -24
- package/src/common/cli/{lerna.test.js → lerna.test.ts} +18 -11
- package/src/common/cli/{lerna.js → lerna.ts} +4 -4
- package/src/common/cli/{npm.test.js → npm.test.ts} +17 -10
- package/src/common/cli/{npm.js → npm.ts} +4 -4
- package/src/common/cli/{pnpm.test.js → pnpm.test.ts} +17 -10
- package/src/common/cli/{pnpm.js → pnpm.ts} +4 -4
- package/src/common/cli/{yarn.test.js → yarn.test.ts} +17 -12
- package/src/common/cli/{yarn.js → yarn.ts} +4 -4
- package/src/common/configure-git-workspace.ts +39 -0
- package/src/common/{get-config.js → get-config.ts} +3 -1
- package/src/common/{get-package-json.js → get-package-json.ts} +1 -0
- package/src/common/{get-package-manager.js → get-package-manager.ts} +1 -0
- package/src/common/{get-release-config.js → get-release-config.ts} +1 -0
- package/src/common/{index.js → index.ts} +1 -0
- package/src/common/{run-command.test.js → run-command.test.ts} +1 -0
- package/src/common/run-command.ts +67 -0
- package/src/common/types.ts +26 -0
- package/src/common/vendor.d.ts +4 -0
- package/src/{index.js → index.ts} +5 -1
- package/src/semantic/core/{analyze-commits.js → analyze-commits.ts} +7 -3
- package/src/semantic/core/{conditional.js → conditional.ts} +16 -9
- package/src/semantic/core/{exit.js → exit.ts} +3 -2
- package/src/semantic/core/prepare/{bump-version.js → bump-version.ts} +11 -8
- package/src/semantic/core/prepare/{commit.js → commit.ts} +3 -2
- package/src/semantic/core/prepare/release-info.ts +6 -0
- package/src/semantic/core/{run.js → run.ts} +3 -2
- package/src/semantic/core/sync-repository.ts +55 -0
- package/src/semantic/core/{verify-conditions.js → verify-conditions.ts} +4 -3
- package/src/semantic/core/{verify-release.js → verify-release.ts} +2 -1
- package/src/semantic/docker/publish.ts +6 -0
- package/src/semantic/docker/{success.js → success.ts} +2 -1
- package/src/semantic/utils/__mock__/test1/package.json +7 -1
- package/src/semantic/utils/__mock__/test1/packages/a/package.json +9 -1
- package/src/semantic/utils/__mock__/test1/packages/b/package.json +7 -1
- package/src/semantic/utils/{bump-packages-version.test.js → bump-packages-version.test.ts} +1 -0
- package/src/semantic/utils/{bump-packages-version.js → bump-packages-version.ts} +12 -11
- package/src/semantic/utils/{calculate-snapshot-version.test.js → calculate-snapshot-version.test.ts} +10 -8
- package/src/semantic/utils/calculate-snapshot-version.ts +17 -0
- package/src/semantic/utils/display-package-info.ts +12 -0
- package/src/semantic/utils/display-release-info.ts +13 -0
- package/src/semantic/utils/{docker-clean-tags.test.js → docker-clean-tags.test.ts} +1 -0
- package/src/semantic/utils/{docker-clean-tags.js → docker-clean-tags.ts} +11 -4
- package/src/semantic/utils/{docker-publish.test.js → docker-publish.test.ts} +1 -0
- package/src/semantic/utils/{docker-publish.js → docker-publish.ts} +4 -3
- package/src/semantic/utils/{log-section.js → log-section.ts} +5 -1
- package/src/semantic/utils/{transform-writer.js → transform-writer.ts} +37 -13
- package/tsconfig.build.json +29 -0
- package/tsconfig.json +8 -32
- package/tsdown.config.ts +63 -0
- package/vitest.config.mts +4 -5
- package/.prettierignore +0 -5
- package/.yarn/releases/yarn-4.7.0.cjs +0 -935
- package/bin/checkfeatures.sh +0 -5
- package/bin/cm-clean.js +0 -8
- package/bin/cm-config.js +0 -15
- package/bin/cm-deploy.js +0 -8
- package/bin/cm-fetch.js +0 -12
- package/bin/cm-finish.js +0 -14
- package/bin/cm-jira-releases.js +0 -16
- package/bin/cm-merge.js +0 -12
- package/bin/cm-publish.js +0 -15
- package/bin/cm-push.js +0 -15
- package/bin/cm-rebase.js +0 -15
- package/bin/cm-republish.js +0 -12
- package/bin/cm-start.js +0 -21
- package/bin/cm.js +0 -27
- package/bin/cmexpedit.sh +0 -9
- package/bin/cmpull.sh +0 -7
- package/eslint.config.mjs +0 -67
- package/src/commands/clean.js +0 -29
- package/src/commands/config.js +0 -23
- package/src/commands/deploy.js +0 -34
- package/src/commands/fetch.js +0 -18
- package/src/commands/finish.js +0 -43
- package/src/commands/jira-releases.js +0 -62
- package/src/commands/merge.js +0 -41
- package/src/commands/push.js +0 -23
- package/src/commands/rebase.js +0 -35
- package/src/commands/republish.js +0 -21
- package/src/commands/start.js +0 -109
- package/src/commands/tasks/push-branch.js +0 -10
- package/src/commands/tasks/run-test.js +0 -21
- package/src/common/cli/cli.js +0 -110
- package/src/common/configure-git-workspace.js +0 -26
- package/src/common/run-command.js +0 -64
- package/src/semantic/core/prepare/release-info.js +0 -5
- package/src/semantic/core/sync-repository.js +0 -52
- package/src/semantic/docker/publish.js +0 -5
- package/src/semantic/utils/calculate-snapshot-version.js +0 -15
- package/src/semantic/utils/display-package-info.js +0 -11
- package/src/semantic/utils/display-release-info.js +0 -12
- /package/src/commands/{release.js → release.ts} +0 -0
- /package/src/commands/utils/{check-install.js → check-install.ts} +0 -0
- /package/src/common/back/jira/{jira-request.spec.js → jira-request.spec.ts} +0 -0
- /package/src/common/back/jira/{jira-search.spec.js → jira-search.spec.ts} +0 -0
- /package/src/semantic/{define-config.js → define-config.ts} +0 -0
- /package/src/semantic/utils/{release-rules.js → release-rules.ts} +0 -0
- /package/src/workflow/{index.js → index.ts} +0 -0
package/src/commands/start.js
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import chalk from "chalk";
|
|
2
|
-
import figures from "figures";
|
|
3
|
-
|
|
4
|
-
import { git } from "../common/cli/git.js";
|
|
5
|
-
import { WORKFLOW_CONFIGURATION } from "../workflow/index.js";
|
|
6
|
-
import { Fetch } from "./fetch.js";
|
|
7
|
-
import { branches } from "./prompts/branches.js";
|
|
8
|
-
import { updateDependencies } from "./tasks/update-dependencies.js";
|
|
9
|
-
|
|
10
|
-
function sanitize(name) {
|
|
11
|
-
return name
|
|
12
|
-
.replace(/[/\\_|. ]/gi, "-")
|
|
13
|
-
.split("-")
|
|
14
|
-
.filter(Boolean)
|
|
15
|
-
.join("-");
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export class Start extends Fetch {
|
|
19
|
-
mapContext(options, context) {
|
|
20
|
-
options.branchName = options.branchName || "";
|
|
21
|
-
const type = WORKFLOW_CONFIGURATION.map(({ type }) => type).find((t) => options.branchName.startsWith(`${t}-`));
|
|
22
|
-
|
|
23
|
-
if (!options.branchName && options.jiraId) {
|
|
24
|
-
options.branchName = options.jiraId;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
if (options.branchName.startsWith("CMAB-")) {
|
|
28
|
-
const [, key, ...rest] = options.branchName.split("-");
|
|
29
|
-
options.jiraId = `CMAB-${key}`;
|
|
30
|
-
options.branchName = rest.join("-");
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return {
|
|
34
|
-
...context,
|
|
35
|
-
origin: context.ORIGIN,
|
|
36
|
-
jiraId: options.jiraId,
|
|
37
|
-
branchName: options.branchName,
|
|
38
|
-
type
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
prompt(context) {
|
|
43
|
-
return [
|
|
44
|
-
{
|
|
45
|
-
type: "input",
|
|
46
|
-
name: "jiraId",
|
|
47
|
-
message: "What is the Jira ID ? (leave blank to skip)",
|
|
48
|
-
default: context.jiraId,
|
|
49
|
-
when: !context.jiraId
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
type: "list",
|
|
53
|
-
name: "type",
|
|
54
|
-
message: "Choose the type of your branch:",
|
|
55
|
-
choices: ["fix", "feat", "chore", "docs", "tech"],
|
|
56
|
-
default: context.type,
|
|
57
|
-
when: !context.type && !context.jiraId
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
type: "input",
|
|
61
|
-
name: "branchName",
|
|
62
|
-
message: "What is the branch name ?",
|
|
63
|
-
validate(branch) {
|
|
64
|
-
if (!branch.length) {
|
|
65
|
-
return "Branch name is required";
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if (git.branchExists(branch, context.origin)) {
|
|
69
|
-
return `${branch} already exists`;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return true;
|
|
73
|
-
},
|
|
74
|
-
|
|
75
|
-
when: !context.branchName
|
|
76
|
-
},
|
|
77
|
-
|
|
78
|
-
branches(context)
|
|
79
|
-
];
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
getTasks(context) {
|
|
83
|
-
context.branchName = sanitize(context.branchName);
|
|
84
|
-
|
|
85
|
-
context.featureBranch = context.jiraId
|
|
86
|
-
? `${context.jiraId}-${context.branchName}`
|
|
87
|
-
: context.branchName.includes(context.type + "-")
|
|
88
|
-
? context.branchName
|
|
89
|
-
: `${context.type}-${context.branchName}`;
|
|
90
|
-
|
|
91
|
-
context.fromBranch = context.fromBranch || context.PRODUCTION_BRANCH;
|
|
92
|
-
|
|
93
|
-
return [
|
|
94
|
-
...super.getTasks(context),
|
|
95
|
-
{
|
|
96
|
-
title: `Create branch from ${chalk.green(context.fromBranch)}`,
|
|
97
|
-
task: () => git.checkout("--no-track", "-b", context.featureBranch, context.fromBranch).toObservable()
|
|
98
|
-
},
|
|
99
|
-
updateDependencies(context)
|
|
100
|
-
];
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
success(context) {
|
|
104
|
-
console.log(
|
|
105
|
-
chalk.green(figures.tick),
|
|
106
|
-
`New branch ${chalk.green(context.featureBranch)} created from ${chalk.green(context.fromBranch)} HEAD`
|
|
107
|
-
);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { git } from "../../common/cli/git.js";
|
|
2
|
-
|
|
3
|
-
export function pushBranch({ origin = "origin", featureBranch, upstream = true, noVerify = true }) {
|
|
4
|
-
return {
|
|
5
|
-
title: `Push ${featureBranch}`,
|
|
6
|
-
task: () => {
|
|
7
|
-
return git.push(...[upstream ? "-u" : "", "-f", origin, featureBranch, noVerify ? "--no-verify" : ""].filter(Boolean)).toObservable();
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { getPackageManager, git } from "../../common/index.js";
|
|
2
|
-
|
|
3
|
-
export const runTest = ({ E2E_CMD, PACKAGE_MANAGER, skipTest, skipUnit, skipE2E }) => {
|
|
4
|
-
return [
|
|
5
|
-
{
|
|
6
|
-
title: "Unit test",
|
|
7
|
-
skip: () => skipTest || skipUnit,
|
|
8
|
-
task: () => getPackageManager(PACKAGE_MANAGER).run("test")
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
title: "E2E test",
|
|
12
|
-
skip: () => skipTest || skipE2E,
|
|
13
|
-
task: () => getPackageManager(PACKAGE_MANAGER).run(E2E_CMD || "test_e2e")
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
title: "Reset changes",
|
|
17
|
-
skip: () => skipTest,
|
|
18
|
-
task: () => git.reset("--hard") // reset files updated unit test
|
|
19
|
-
}
|
|
20
|
-
];
|
|
21
|
-
};
|
package/src/common/cli/cli.js
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import "any-observable/register/rxjs-all.js";
|
|
2
|
-
|
|
3
|
-
import { spawnSync } from "child_process";
|
|
4
|
-
import execa from "execa";
|
|
5
|
-
import { filter, fromEvent, map, merge, takeUntil } from "rxjs";
|
|
6
|
-
export class Cli {
|
|
7
|
-
constructor(cmd) {
|
|
8
|
-
this.cmd = cmd;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
sync(...args) {
|
|
12
|
-
return Cli.run(this.cmd, args).sync();
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
run(...args) {
|
|
16
|
-
return Cli.run(this.cmd, args);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
get(...args) {
|
|
20
|
-
return Cli.run(this.cmd, args).get();
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
static run(cmd, args = [], options = {}) {
|
|
24
|
-
const run = (opt = {}) => {
|
|
25
|
-
return execa(cmd, args, {
|
|
26
|
-
cwd: process.cwd(),
|
|
27
|
-
...opt,
|
|
28
|
-
...options
|
|
29
|
-
});
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
let isPromise = true;
|
|
33
|
-
|
|
34
|
-
const promise = new Promise((resolve, reject) => {
|
|
35
|
-
setTimeout(async () => {
|
|
36
|
-
if (isPromise) {
|
|
37
|
-
try {
|
|
38
|
-
const result = await run({
|
|
39
|
-
stdio: "inherit"
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
resolve(result);
|
|
43
|
-
} catch (err) {
|
|
44
|
-
reject(err);
|
|
45
|
-
}
|
|
46
|
-
} else {
|
|
47
|
-
resolve();
|
|
48
|
-
}
|
|
49
|
-
}, 10);
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
promise.toObservable = (opt) => {
|
|
53
|
-
isPromise = false;
|
|
54
|
-
const cp = run(opt);
|
|
55
|
-
const end$ = fromEvent(cp, "close");
|
|
56
|
-
const stdout$ = fromEvent(cp.stdout, "data").pipe(
|
|
57
|
-
takeUntil(end$),
|
|
58
|
-
map((data) => data.toString())
|
|
59
|
-
);
|
|
60
|
-
const stderr$ = fromEvent(cp.stderr, "data").pipe(
|
|
61
|
-
takeUntil(end$),
|
|
62
|
-
map((data) => data.toString())
|
|
63
|
-
);
|
|
64
|
-
|
|
65
|
-
return merge(stdout$, stderr$).pipe(filter(Boolean));
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
promise.toStream = (opt) => {
|
|
69
|
-
isPromise = false;
|
|
70
|
-
|
|
71
|
-
return run(opt);
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
promise.cwd = (cwd) => {
|
|
75
|
-
options.cwd = cwd;
|
|
76
|
-
return promise;
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
promise.sync = (opt) => {
|
|
80
|
-
isPromise = false;
|
|
81
|
-
return execa.sync(cmd, args, {
|
|
82
|
-
cwd: process.cwd(),
|
|
83
|
-
stdio: "inherit",
|
|
84
|
-
...options,
|
|
85
|
-
...opt
|
|
86
|
-
});
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
promise.getRaw = (opt) => {
|
|
90
|
-
isPromise = false;
|
|
91
|
-
return Cli.getRaw(cmd, args, {
|
|
92
|
-
cwd: process.cwd(),
|
|
93
|
-
...options,
|
|
94
|
-
...opt
|
|
95
|
-
});
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
promise.get = promise.getRaw;
|
|
99
|
-
|
|
100
|
-
return promise;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
static getRaw(cmd, args, options) {
|
|
104
|
-
return spawnSync(cmd, args, options)
|
|
105
|
-
.output.filter((o) => !!o)
|
|
106
|
-
.map((o) => o.toString())
|
|
107
|
-
.join("\n")
|
|
108
|
-
.trim();
|
|
109
|
-
}
|
|
110
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { git } from "./cli/git.js";
|
|
2
|
-
|
|
3
|
-
export function configureGitWorkspace(context) {
|
|
4
|
-
const {
|
|
5
|
-
logger,
|
|
6
|
-
config: { SCM_TOKEN, REPOSITORY_URL, ORIGIN, GIT_USER_NAME, GIT_USER_EMAIL, GIT_DISABLE_SSL }
|
|
7
|
-
} = context;
|
|
8
|
-
|
|
9
|
-
if (GIT_USER_NAME && GIT_USER_EMAIL) {
|
|
10
|
-
git.config("--global", "user.name", `"${GIT_USER_NAME}"`);
|
|
11
|
-
git.config("--global", "user.email", `"${GIT_USER_EMAIL}"`);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
if (GIT_DISABLE_SSL) {
|
|
15
|
-
logger.info("Disable SSL verification");
|
|
16
|
-
git.config("--global", "http.sslVerify", "false");
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
if (SCM_TOKEN) {
|
|
20
|
-
const repository = REPOSITORY_URL.replace("https://", "");
|
|
21
|
-
|
|
22
|
-
logger.info(`Configure remote repository ${repository}`);
|
|
23
|
-
git.remote("remove", ORIGIN).sync();
|
|
24
|
-
git.remote("add", ORIGIN, `https://${SCM_TOKEN}@${repository}`).sync();
|
|
25
|
-
}
|
|
26
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import chalk from "chalk";
|
|
2
|
-
import figures from "figures";
|
|
3
|
-
import inquirer from "inquirer";
|
|
4
|
-
import Listr from "listr";
|
|
5
|
-
|
|
6
|
-
import { getConfig } from "./get-config.js";
|
|
7
|
-
import { getReleaseConfig } from "./get-release-config.js";
|
|
8
|
-
|
|
9
|
-
function createTasksRunner(tasks, ctx) {
|
|
10
|
-
return new Listr(tasks, {
|
|
11
|
-
concurrent: false,
|
|
12
|
-
renderer: !ctx.verbose ? "default" : "verbose"
|
|
13
|
-
}).run(ctx);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export async function runCommand(klass, commander) {
|
|
17
|
-
try {
|
|
18
|
-
const config = getConfig();
|
|
19
|
-
let context = {
|
|
20
|
-
...getReleaseConfig(),
|
|
21
|
-
...config,
|
|
22
|
-
branch: { name: config.BRANCH_NAME },
|
|
23
|
-
config,
|
|
24
|
-
logger: console,
|
|
25
|
-
verbose: commander.verbose
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const command = new klass();
|
|
29
|
-
|
|
30
|
-
// Map context from commander and current context
|
|
31
|
-
if (command.mapContext) {
|
|
32
|
-
context = command.mapContext(commander, context);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// show prompts
|
|
36
|
-
if (command.prompt) {
|
|
37
|
-
context = {
|
|
38
|
-
...context,
|
|
39
|
-
...(await inquirer.prompt(command.prompt(context)))
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Verify conditions
|
|
44
|
-
command.verifyConditions && command.verifyConditions(context);
|
|
45
|
-
|
|
46
|
-
// Get tasks
|
|
47
|
-
const tasks = command.getTasks(context);
|
|
48
|
-
|
|
49
|
-
// Run tasks
|
|
50
|
-
await createTasksRunner(tasks, context);
|
|
51
|
-
|
|
52
|
-
command.success && command.success(context);
|
|
53
|
-
} catch (er) {
|
|
54
|
-
console.error(chalk.red(figures.cross + " " + String(er)));
|
|
55
|
-
if (commander.verbose) {
|
|
56
|
-
console.error(String(er.stack).replace(String(er), ""));
|
|
57
|
-
}
|
|
58
|
-
process.exit(-1);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
process.on("unhandledRejection", () => {
|
|
63
|
-
// avoid extra promise rejection when using toObservable
|
|
64
|
-
});
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { getConfig, git } from "../../common/index.js";
|
|
2
|
-
|
|
3
|
-
export default async function syncRepository(pluginConfig, context) {
|
|
4
|
-
context.config = getConfig();
|
|
5
|
-
|
|
6
|
-
const {
|
|
7
|
-
logger,
|
|
8
|
-
config: { PRODUCTION_BRANCH, ORIGIN, DEVELOP_BRANCH }
|
|
9
|
-
} = context;
|
|
10
|
-
|
|
11
|
-
logger.info("Prepare release");
|
|
12
|
-
|
|
13
|
-
async function asyncCatchError(fn) {
|
|
14
|
-
try {
|
|
15
|
-
return await fn();
|
|
16
|
-
} catch (er) {
|
|
17
|
-
context.logger.error(String(er), er.stack);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
await asyncCatchError(() => git.fetch());
|
|
22
|
-
|
|
23
|
-
const candidateBranches =
|
|
24
|
-
pluginConfig.includes ||
|
|
25
|
-
context.options.branches?.map((branch) => {
|
|
26
|
-
return branch.name || branch;
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
logger.info(`Candidate branches to sync: ${candidateBranches.join(", ")}`);
|
|
30
|
-
|
|
31
|
-
if (candidateBranches.includes(context.branch.name)) {
|
|
32
|
-
logger.info(`Push ${context.branch.name}`);
|
|
33
|
-
|
|
34
|
-
await asyncCatchError(() => {
|
|
35
|
-
logger.info(`git push --quiet --set-upstream ${ORIGIN} ${context.branch.name}`);
|
|
36
|
-
|
|
37
|
-
return git.push("--quiet", "--set-upstream", ORIGIN, context.branch.name);
|
|
38
|
-
});
|
|
39
|
-
} else {
|
|
40
|
-
logger.info(`Skip push for ${context.branch.name}`);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
if (PRODUCTION_BRANCH !== DEVELOP_BRANCH) {
|
|
44
|
-
logger.info(`Sync ${DEVELOP_BRANCH} with ${PRODUCTION_BRANCH}`);
|
|
45
|
-
logger.info(`git push -f ${ORIGIN} ${PRODUCTION_BRANCH}:refs/heads/${DEVELOP_BRANCH}`);
|
|
46
|
-
|
|
47
|
-
await asyncCatchError(async () => {
|
|
48
|
-
await git.push("-f", ORIGIN, `${PRODUCTION_BRANCH}:refs/heads/${DEVELOP_BRANCH}`);
|
|
49
|
-
logger.success(`${ORIGIN}/${DEVELOP_BRANCH} branch correctly updated`);
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import semver from "semver";
|
|
2
|
-
|
|
3
|
-
import { getConfig, git } from "../../common/index.js";
|
|
4
|
-
|
|
5
|
-
export function calculateSnapshotVersion(context) {
|
|
6
|
-
context.config = getConfig();
|
|
7
|
-
const {
|
|
8
|
-
nextRelease: { type },
|
|
9
|
-
lastRelease,
|
|
10
|
-
config: { REF_COMMIT }
|
|
11
|
-
} = context;
|
|
12
|
-
const { major, minor, patch } = semver.parse(lastRelease.version);
|
|
13
|
-
|
|
14
|
-
return `${semver.inc(`${major}.${minor}.${patch}`, type)}-beta${git.getCommitTag(REF_COMMIT)}`;
|
|
15
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { logSection } from "./log-section.js";
|
|
2
|
-
|
|
3
|
-
export function displayPackageInfo(context) {
|
|
4
|
-
logSection("Package Info", context);
|
|
5
|
-
context.logger.info("Name : " + context.config.PROJECT_NAME);
|
|
6
|
-
context.logger.info("Version : " + context.lastRelease.version);
|
|
7
|
-
context.logger.info("Repository : " + context.config.REPOSITORY_URL);
|
|
8
|
-
context.logger.info("Branch : " + context.branch.name);
|
|
9
|
-
context.logger.info("Tag : " + context.lastRelease.gitTag);
|
|
10
|
-
context.logger.info("GitHead : " + context.lastRelease.gitHead);
|
|
11
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { logSection } from "./log-section.js";
|
|
2
|
-
|
|
3
|
-
export function displayReleaseInfo(context) {
|
|
4
|
-
logSection("Release Info", context);
|
|
5
|
-
context.logger.info("Branch : " + context.branch.name);
|
|
6
|
-
context.logger.info("Build N° : " + context.config.BUILD_NUMBER);
|
|
7
|
-
context.logger.info("Version : " + context.nextRelease.version);
|
|
8
|
-
context.logger.info("Tag : " + context.nextRelease.gitTag);
|
|
9
|
-
context.logger.info("GitHead : " + context.nextRelease.gitHead);
|
|
10
|
-
context.logger.info("Type : " + context.nextRelease.type);
|
|
11
|
-
context.logger.info("Channel : " + context.nextRelease.channel);
|
|
12
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|