@cmflow/cli 1.1.0 → 1.1.1-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/.prettierignore +5 -0
- package/.prettierrc +10 -0
- package/README.md +106 -32
- package/bin/cm-changelog.js +20 -12
- package/bin/cm-clean.js +4 -7
- package/bin/cm-config.js +8 -8
- package/bin/cm-deploy.js +4 -8
- package/bin/cm-fetch.js +7 -7
- package/bin/cm-finish.js +9 -9
- package/bin/cm-merge.js +7 -7
- package/bin/cm-publish.js +10 -10
- package/bin/cm-push.js +10 -10
- package/bin/cm-rebase.js +10 -10
- package/bin/cm-republish.js +7 -7
- package/bin/cm-start.js +10 -10
- package/bin/cm.js +20 -20
- package/bin/cmrelease.js +2 -2
- package/eslint.config.mjs +67 -0
- package/package.json +27 -21
- package/release.config.mjs +49 -19
- package/src/commands/changelog.js +23 -23
- package/src/commands/clean.js +13 -13
- package/src/commands/config.js +8 -8
- package/src/commands/deploy.js +15 -20
- package/src/commands/fetch.js +7 -10
- package/src/commands/finish.js +18 -19
- package/src/commands/index.js +10 -11
- package/src/commands/merge.js +30 -14
- package/src/commands/prompts/branches.js +20 -20
- package/src/commands/push.js +11 -14
- package/src/commands/rebase.js +17 -19
- package/src/commands/release.js +10 -11
- package/src/commands/republish.js +11 -14
- package/src/commands/start.js +52 -48
- package/src/commands/tasks/merge-branch.js +41 -37
- package/src/commands/tasks/push-branch.js +5 -11
- package/src/commands/tasks/rebase-all-branches.js +19 -24
- package/src/commands/tasks/refresh-repository.js +26 -24
- package/src/commands/tasks/run-test.js +11 -17
- package/src/commands/tasks/update-branch.js +33 -30
- package/src/commands/tasks/update-dependencies.js +38 -32
- package/src/commands/utils/check-install.js +16 -15
- package/src/common/cli/cli.js +55 -57
- package/src/common/cli/docker.js +31 -28
- package/src/common/cli/docker.test.js +94 -96
- package/src/common/cli/git.js +59 -68
- package/src/common/cli/git.test.js +187 -189
- package/src/common/cli/lerna.js +12 -12
- package/src/common/cli/lerna.test.js +38 -40
- package/src/common/cli/npm.js +17 -17
- package/src/common/cli/npm.test.js +38 -40
- package/src/common/cli/yarn.js +17 -17
- package/src/common/cli/yarn.test.js +40 -40
- package/src/common/configure-git-workspace.js +11 -17
- package/src/common/get-config.js +63 -119
- package/src/common/get-package-json.js +4 -4
- package/src/common/get-release-config.js +4 -5
- package/src/common/index.js +10 -10
- package/src/common/run-command.js +26 -28
- package/src/common/run-command.test.js +35 -39
- package/src/index.js +10 -1
- package/src/semantic/core/analyze-commits.js +17 -0
- package/src/semantic/core/fail.js +29 -0
- package/src/semantic/core/generate-notes.js +11 -0
- package/src/semantic/core/prepare/bump-version.js +38 -0
- package/src/semantic/core/prepare/post.js +38 -0
- package/src/semantic/core/prepare/run.js +22 -0
- package/src/semantic/core/publish.js +9 -0
- package/src/semantic/core/success.js +37 -0
- package/src/semantic/core/verify-conditions.js +32 -0
- package/src/semantic/core/verify-release.js +9 -0
- package/src/semantic/define-config.js +68 -0
- package/src/semantic/docker/publish.js +5 -0
- package/src/semantic/docker/success.js +9 -0
- package/src/semantic/utils/bump-packages-version.js +52 -0
- package/src/semantic/utils/bump-packages-version.test.js +75 -0
- package/src/semantic/utils/calculate-snapshot-version.js +15 -0
- package/src/semantic/utils/calculate-snapshot-version.test.js +67 -0
- package/src/semantic/utils/display-package-info.js +11 -0
- package/src/semantic/utils/display-release-info.js +12 -0
- package/src/semantic/utils/docker-clean-tags.js +51 -0
- package/src/semantic/utils/docker-clean-tags.test.js +61 -0
- package/src/semantic/utils/docker-publish.js +23 -0
- package/src/semantic/utils/docker-publish.test.js +44 -0
- package/src/semantic/utils/log-section.js +5 -0
- package/src/semantic/utils/release-rules.js +5 -0
- package/src/semantic/utils/transform-writer.js +75 -0
- package/src/workflow/index.js +22 -22
- package/tsconfig.json +54 -0
- package/vitest.config.mts +10 -0
- package/bin/cm-publish-pages.js +0 -12
- package/semantic.js +0 -1
- package/src/commands/publish-pages.js +0 -29
- package/src/common/cli/heroku.js +0 -21
- package/src/common/cli/heroku.test.js +0 -62
- package/src/main.js +0 -10
- package/src/semantic-release/actions/analyze-commits.js +0 -14
- package/src/semantic-release/actions/fail.js +0 -16
- package/src/semantic-release/actions/generate-notes.js +0 -12
- package/src/semantic-release/actions/index.js +0 -8
- package/src/semantic-release/actions/prepare.js +0 -114
- package/src/semantic-release/actions/publish.js +0 -17
- package/src/semantic-release/actions/success.js +0 -32
- package/src/semantic-release/actions/verify-conditions.js +0 -30
- package/src/semantic-release/actions/verify-release.js +0 -9
- package/src/semantic-release/get-semantic-config.js +0 -115
- package/src/semantic-release/utils/bump-packages-version.js +0 -51
- package/src/semantic-release/utils/bump-packages-version.test.js +0 -78
- package/src/semantic-release/utils/calculate-snapshot-version.js +0 -10
- package/src/semantic-release/utils/calculate-snapshot-version.test.js +0 -69
- package/src/semantic-release/utils/display-package-info.js +0 -11
- package/src/semantic-release/utils/display-release-info.js +0 -12
- package/src/semantic-release/utils/docker-clean-tags.js +0 -45
- package/src/semantic-release/utils/docker-clean-tags.test.js +0 -63
- package/src/semantic-release/utils/docker-publish.js +0 -47
- package/src/semantic-release/utils/docker-publish.test.js +0 -67
- package/src/semantic-release/utils/ghpages-publish.js +0 -16
- package/src/semantic-release/utils/log-section.js +0 -5
- /package/src/{semantic-release → semantic}/utils/__mock__/test1/package.json +0 -0
- /package/src/{semantic-release → semantic}/utils/__mock__/test1/packages/a/package.json +0 -0
- /package/src/{semantic-release → semantic}/utils/__mock__/test1/packages/b/package.json +0 -0
- /package/src/{semantic-release → semantic}/utils/__mock__/test2/package.json +0 -0
- /package/src/{semantic-release → semantic}/utils/__mock__/test2/packages/a/package.json +0 -0
- /package/src/{semantic-release → semantic}/utils/__mock__/test2/packages/b/package.json +0 -0
package/src/common/cli/git.js
CHANGED
|
@@ -1,130 +1,121 @@
|
|
|
1
|
-
import { Cli } from
|
|
1
|
+
import { Cli } from "./cli.js";
|
|
2
2
|
|
|
3
3
|
class GitCli extends Cli {
|
|
4
|
-
constructor
|
|
5
|
-
super(
|
|
4
|
+
constructor() {
|
|
5
|
+
super("git");
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
init
|
|
9
|
-
return this.run(
|
|
8
|
+
init(...args) {
|
|
9
|
+
return this.run("init", ...args);
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
add
|
|
13
|
-
return this.run(
|
|
12
|
+
add(...args) {
|
|
13
|
+
return this.run("add", ...args);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
status
|
|
17
|
-
return this.sync(
|
|
16
|
+
status(...args) {
|
|
17
|
+
return this.sync("status", ...args);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
branch
|
|
21
|
-
return this.run(
|
|
20
|
+
branch(...args) {
|
|
21
|
+
return this.run("branch", ...args);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
clean
|
|
25
|
-
return this.run(
|
|
24
|
+
clean(...args) {
|
|
25
|
+
return this.run("clean", ...args);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
config
|
|
29
|
-
return this.run(
|
|
28
|
+
config(...args) {
|
|
29
|
+
return this.run("config", ...args).get();
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
checkout
|
|
33
|
-
return this.run(
|
|
32
|
+
checkout(...args) {
|
|
33
|
+
return this.run("checkout", ...args);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
commit
|
|
37
|
-
return this.run(
|
|
36
|
+
commit(...args) {
|
|
37
|
+
return this.run("commit", ...args);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
fetch
|
|
41
|
-
return this.run(
|
|
40
|
+
fetch(...args) {
|
|
41
|
+
return this.run("fetch", ...args);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
prune
|
|
45
|
-
return this.run(
|
|
44
|
+
prune(...args) {
|
|
45
|
+
return this.run("prune", ...args);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
merge
|
|
49
|
-
return this.sync(
|
|
48
|
+
merge(...args) {
|
|
49
|
+
return this.sync("merge", ...args);
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
reset
|
|
53
|
-
return this.sync(
|
|
52
|
+
reset(...args) {
|
|
53
|
+
return this.sync("reset", ...args);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
remote
|
|
57
|
-
return this.run(
|
|
56
|
+
remote(...args) {
|
|
57
|
+
return this.run("remote", ...args);
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
rebase
|
|
61
|
-
return this.run(
|
|
60
|
+
rebase(...args) {
|
|
61
|
+
return this.run("rebase", ...args);
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
getCommitTag
|
|
65
|
-
return this.get(
|
|
64
|
+
getCommitTag(ref = "HEAD") {
|
|
65
|
+
return this.get("rev-parse", "--short", ref);
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
getBranchName
|
|
69
|
-
return this.get(
|
|
68
|
+
getBranchName(ref = "HEAD") {
|
|
69
|
+
return this.get("rev-parse", "--abbrev-ref", ref);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
getLastCommitMsg
|
|
73
|
-
return this.get(
|
|
72
|
+
getLastCommitMsg() {
|
|
73
|
+
return this.get("log", "-1", "--pretty=%B");
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
push
|
|
77
|
-
return this.run(
|
|
76
|
+
push(...args) {
|
|
77
|
+
return this.run("push", ...args);
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
branchExists
|
|
81
|
-
return (
|
|
82
|
-
this.branch('-a')
|
|
83
|
-
.getRaw()
|
|
84
|
-
.trim()
|
|
85
|
-
.includes(`remotes/${origin}/${branch}`)
|
|
86
|
-
)
|
|
80
|
+
branchExists(branch, origin = "origin") {
|
|
81
|
+
return this.branch("-a").getRaw().trim().includes(`remotes/${origin}/${branch}`);
|
|
87
82
|
}
|
|
88
83
|
|
|
89
|
-
checkBranchRemoteStatus
|
|
90
|
-
return this.run(
|
|
84
|
+
checkBranchRemoteStatus(branch, origin = "origin") {
|
|
85
|
+
return this.run("cherry", branch, `${origin}/${branch}`).get();
|
|
91
86
|
}
|
|
92
87
|
|
|
93
|
-
branches
|
|
88
|
+
branches(...args) {
|
|
94
89
|
return this.branch(...args)
|
|
95
90
|
.get()
|
|
96
|
-
.split(
|
|
97
|
-
.map(branch => branch.trim().replace(
|
|
98
|
-
.filter(branch => !!branch)
|
|
99
|
-
.filter(branch => !String(branch).includes(
|
|
91
|
+
.split("\n")
|
|
92
|
+
.map((branch) => branch.trim().replace("* ", ""))
|
|
93
|
+
.filter((branch) => !!branch)
|
|
94
|
+
.filter((branch) => !String(branch).includes("/HEAD"));
|
|
100
95
|
}
|
|
101
96
|
|
|
102
|
-
show
|
|
103
|
-
return this.run(
|
|
104
|
-
.getRaw()
|
|
105
|
-
.split('\n')[0]
|
|
106
|
-
.trim()
|
|
97
|
+
show(branch) {
|
|
98
|
+
return this.run("show", '--format="%ci|%cr|%an"', branch, "--").getRaw().split("\n")[0].trim();
|
|
107
99
|
}
|
|
108
100
|
|
|
109
|
-
branchesInfos
|
|
110
|
-
return this
|
|
111
|
-
.
|
|
112
|
-
.map(branch => {
|
|
101
|
+
branchesInfos(...args) {
|
|
102
|
+
return this.branches(...args)
|
|
103
|
+
.map((branch) => {
|
|
113
104
|
try {
|
|
114
|
-
const [date, creation, author] = this.show(branch).split(
|
|
105
|
+
const [date, creation, author] = this.show(branch).split("|");
|
|
115
106
|
return {
|
|
116
107
|
branch,
|
|
117
108
|
date,
|
|
118
109
|
creation,
|
|
119
110
|
author
|
|
120
|
-
}
|
|
121
|
-
} catch
|
|
122
|
-
return undefined
|
|
111
|
+
};
|
|
112
|
+
} catch {
|
|
113
|
+
return undefined;
|
|
123
114
|
}
|
|
124
115
|
})
|
|
125
116
|
.filter((b) => !!b)
|
|
126
|
-
.sort((info1, info2) => info1.date < info2.date)
|
|
117
|
+
.sort((info1, info2) => info1.date < info2.date);
|
|
127
118
|
}
|
|
128
119
|
}
|
|
129
120
|
|
|
130
|
-
export const git = new GitCli()
|
|
121
|
+
export const git = new GitCli();
|
|
@@ -1,209 +1,207 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
})
|
|
8
|
-
const {
|
|
9
|
-
const { git } = await import('./git.js')
|
|
10
|
-
const { Cli } = await import('./cli.js')
|
|
1
|
+
vi.mock("execa", () => {
|
|
2
|
+
const execaMock = vi.fn();
|
|
3
|
+
execaMock.sync = vi.fn();
|
|
4
|
+
return { default: execaMock };
|
|
5
|
+
});
|
|
6
|
+
const { default: execa } = await import("execa");
|
|
7
|
+
const { git } = await import("./git.js");
|
|
8
|
+
const { Cli } = await import("./cli.js");
|
|
11
9
|
execa.sync.mockImplementation((...args) => {
|
|
12
10
|
return {
|
|
13
|
-
stdout: `CMD: ${[].concat(...args.filter(arg => typeof arg ===
|
|
14
|
-
}
|
|
15
|
-
})
|
|
11
|
+
stdout: `CMD: ${[].concat(...args.filter((arg) => typeof arg === "string" || Array.isArray(arg))).join(" ")}`
|
|
12
|
+
};
|
|
13
|
+
});
|
|
16
14
|
|
|
17
|
-
execa.mockReturnValue({})
|
|
15
|
+
execa.mockReturnValue({});
|
|
18
16
|
|
|
19
|
-
describe(
|
|
17
|
+
describe("GitCli", () => {
|
|
20
18
|
beforeEach(() => {
|
|
21
|
-
|
|
22
|
-
return `CMD: ${[].concat(...args.filter(arg => typeof arg ===
|
|
23
|
-
})
|
|
24
|
-
})
|
|
25
|
-
describe(
|
|
26
|
-
it(
|
|
27
|
-
const result = git.init(
|
|
28
|
-
|
|
29
|
-
expect(result.stdout).toEqual(
|
|
30
|
-
expect(execa.sync).toHaveBeenCalledWith(
|
|
19
|
+
vi.spyOn(Cli, "getRaw").mockImplementation((...args) => {
|
|
20
|
+
return `CMD: ${[].concat(...args.filter((arg) => typeof arg === "string" || Array.isArray(arg))).join(" ")}`;
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
describe("init", () => {
|
|
24
|
+
it("should run init cmd", () => {
|
|
25
|
+
const result = git.init("init-arg").sync();
|
|
26
|
+
|
|
27
|
+
expect(result.stdout).toEqual("CMD: git init init-arg");
|
|
28
|
+
expect(execa.sync).toHaveBeenCalledWith("git", ["init", "init-arg"], {
|
|
31
29
|
cwd: process.cwd(),
|
|
32
|
-
stdio:
|
|
33
|
-
})
|
|
34
|
-
})
|
|
35
|
-
})
|
|
36
|
-
describe(
|
|
37
|
-
it(
|
|
38
|
-
const result = git.add(
|
|
39
|
-
|
|
40
|
-
expect(result.stdout).toEqual(
|
|
41
|
-
expect(execa.sync).toHaveBeenCalledWith(
|
|
30
|
+
stdio: "inherit"
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
describe("add", () => {
|
|
35
|
+
it("should run add cmd", () => {
|
|
36
|
+
const result = git.add("add-arg").sync();
|
|
37
|
+
|
|
38
|
+
expect(result.stdout).toEqual("CMD: git add add-arg");
|
|
39
|
+
expect(execa.sync).toHaveBeenCalledWith("git", ["add", "add-arg"], {
|
|
42
40
|
cwd: process.cwd(),
|
|
43
|
-
stdio:
|
|
44
|
-
})
|
|
45
|
-
})
|
|
46
|
-
})
|
|
47
|
-
describe(
|
|
48
|
-
it(
|
|
49
|
-
const result = git.branch(
|
|
50
|
-
|
|
51
|
-
expect(result.stdout).toEqual(
|
|
52
|
-
expect(execa.sync).toHaveBeenCalledWith(
|
|
41
|
+
stdio: "inherit"
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
describe("branch", () => {
|
|
46
|
+
it("should run branch cmd", () => {
|
|
47
|
+
const result = git.branch("branch-arg").sync();
|
|
48
|
+
|
|
49
|
+
expect(result.stdout).toEqual("CMD: git branch branch-arg");
|
|
50
|
+
expect(execa.sync).toHaveBeenCalledWith("git", ["branch", "branch-arg"], {
|
|
53
51
|
cwd: process.cwd(),
|
|
54
|
-
stdio:
|
|
55
|
-
})
|
|
56
|
-
})
|
|
57
|
-
})
|
|
58
|
-
describe(
|
|
59
|
-
it(
|
|
60
|
-
const result = git.clean(
|
|
61
|
-
|
|
62
|
-
expect(result.stdout).toEqual(
|
|
63
|
-
expect(execa.sync).toHaveBeenCalledWith(
|
|
52
|
+
stdio: "inherit"
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
describe("clean", () => {
|
|
57
|
+
it("should run branch cmd", () => {
|
|
58
|
+
const result = git.clean("clean-arg").sync();
|
|
59
|
+
|
|
60
|
+
expect(result.stdout).toEqual("CMD: git clean clean-arg");
|
|
61
|
+
expect(execa.sync).toHaveBeenCalledWith("git", ["clean", "clean-arg"], {
|
|
64
62
|
cwd: process.cwd(),
|
|
65
|
-
stdio:
|
|
66
|
-
})
|
|
67
|
-
})
|
|
68
|
-
})
|
|
69
|
-
describe(
|
|
70
|
-
it(
|
|
71
|
-
const result = git.config(
|
|
72
|
-
|
|
73
|
-
expect(result).toEqual(
|
|
74
|
-
expect(Cli.getRaw).toHaveBeenCalledWith(
|
|
63
|
+
stdio: "inherit"
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
describe("config", () => {
|
|
68
|
+
it("should run config cmd", () => {
|
|
69
|
+
const result = git.config("config-arg");
|
|
70
|
+
|
|
71
|
+
expect(result).toEqual("CMD: git config config-arg");
|
|
72
|
+
expect(Cli.getRaw).toHaveBeenCalledWith("git", ["config", "config-arg"], {
|
|
75
73
|
cwd: process.cwd()
|
|
76
|
-
})
|
|
77
|
-
})
|
|
78
|
-
})
|
|
79
|
-
describe(
|
|
80
|
-
it(
|
|
81
|
-
const result = git.checkout(
|
|
82
|
-
|
|
83
|
-
expect(result.stdout).toEqual(
|
|
84
|
-
expect(execa.sync).toHaveBeenCalledWith(
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
describe("checkout", () => {
|
|
78
|
+
it("should run checkout cmd", () => {
|
|
79
|
+
const result = git.checkout("checkout-arg").sync();
|
|
80
|
+
|
|
81
|
+
expect(result.stdout).toEqual("CMD: git checkout checkout-arg");
|
|
82
|
+
expect(execa.sync).toHaveBeenCalledWith("git", ["checkout", "checkout-arg"], {
|
|
85
83
|
cwd: process.cwd(),
|
|
86
|
-
stdio:
|
|
87
|
-
})
|
|
88
|
-
})
|
|
89
|
-
})
|
|
90
|
-
describe(
|
|
91
|
-
it(
|
|
92
|
-
const result = git.commit(
|
|
93
|
-
|
|
94
|
-
expect(result.stdout).toEqual(
|
|
95
|
-
expect(execa.sync).toHaveBeenCalledWith(
|
|
84
|
+
stdio: "inherit"
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
describe("commit", () => {
|
|
89
|
+
it("should run commit cmd", () => {
|
|
90
|
+
const result = git.commit("commit-arg").sync();
|
|
91
|
+
|
|
92
|
+
expect(result.stdout).toEqual("CMD: git commit commit-arg");
|
|
93
|
+
expect(execa.sync).toHaveBeenCalledWith("git", ["commit", "commit-arg"], {
|
|
96
94
|
cwd: process.cwd(),
|
|
97
|
-
stdio:
|
|
98
|
-
})
|
|
99
|
-
})
|
|
100
|
-
})
|
|
101
|
-
describe(
|
|
102
|
-
it(
|
|
103
|
-
const result = git.fetch(
|
|
104
|
-
|
|
105
|
-
expect(result.stdout).toEqual(
|
|
106
|
-
expect(execa.sync).toHaveBeenCalledWith(
|
|
95
|
+
stdio: "inherit"
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
describe("fetch", () => {
|
|
100
|
+
it("should run fetch cmd", () => {
|
|
101
|
+
const result = git.fetch("fetch-arg").sync();
|
|
102
|
+
|
|
103
|
+
expect(result.stdout).toEqual("CMD: git fetch fetch-arg");
|
|
104
|
+
expect(execa.sync).toHaveBeenCalledWith("git", ["fetch", "fetch-arg"], {
|
|
107
105
|
cwd: process.cwd(),
|
|
108
|
-
stdio:
|
|
109
|
-
})
|
|
110
|
-
})
|
|
111
|
-
})
|
|
112
|
-
describe(
|
|
113
|
-
it(
|
|
114
|
-
const result = git.prune(
|
|
115
|
-
|
|
116
|
-
expect(result.stdout).toEqual(
|
|
117
|
-
expect(execa.sync).toHaveBeenCalledWith(
|
|
106
|
+
stdio: "inherit"
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
describe("prune", () => {
|
|
111
|
+
it("should run fetch cmd", () => {
|
|
112
|
+
const result = git.prune("prune-arg").sync();
|
|
113
|
+
|
|
114
|
+
expect(result.stdout).toEqual("CMD: git prune prune-arg");
|
|
115
|
+
expect(execa.sync).toHaveBeenCalledWith("git", ["prune", "prune-arg"], {
|
|
118
116
|
cwd: process.cwd(),
|
|
119
|
-
stdio:
|
|
120
|
-
})
|
|
121
|
-
})
|
|
122
|
-
})
|
|
123
|
-
describe(
|
|
124
|
-
it(
|
|
125
|
-
const result = git.merge(
|
|
126
|
-
|
|
127
|
-
expect(result.stdout).toEqual(
|
|
128
|
-
expect(execa.sync).toHaveBeenCalledWith(
|
|
117
|
+
stdio: "inherit"
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
describe("merge", () => {
|
|
122
|
+
it("should run fetch cmd", () => {
|
|
123
|
+
const result = git.merge("merge-arg");
|
|
124
|
+
|
|
125
|
+
expect(result.stdout).toEqual("CMD: git merge merge-arg");
|
|
126
|
+
expect(execa.sync).toHaveBeenCalledWith("git", ["merge", "merge-arg"], {
|
|
129
127
|
cwd: process.cwd(),
|
|
130
|
-
stdio:
|
|
131
|
-
})
|
|
132
|
-
})
|
|
133
|
-
})
|
|
134
|
-
describe(
|
|
135
|
-
it(
|
|
136
|
-
const result = git.reset(
|
|
137
|
-
|
|
138
|
-
expect(result.stdout).toEqual(
|
|
139
|
-
expect(execa.sync).toHaveBeenCalledWith(
|
|
128
|
+
stdio: "inherit"
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
describe("reset", () => {
|
|
133
|
+
it("should run reset cmd", () => {
|
|
134
|
+
const result = git.reset("reset-arg");
|
|
135
|
+
|
|
136
|
+
expect(result.stdout).toEqual("CMD: git reset reset-arg");
|
|
137
|
+
expect(execa.sync).toHaveBeenCalledWith("git", ["reset", "reset-arg"], {
|
|
140
138
|
cwd: process.cwd(),
|
|
141
|
-
stdio:
|
|
142
|
-
})
|
|
143
|
-
})
|
|
144
|
-
})
|
|
145
|
-
describe(
|
|
146
|
-
it(
|
|
147
|
-
const result = git.remote(
|
|
148
|
-
|
|
149
|
-
expect(result.stdout).toEqual(
|
|
150
|
-
expect(execa.sync).toHaveBeenCalledWith(
|
|
139
|
+
stdio: "inherit"
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
describe("remote", () => {
|
|
144
|
+
it("should run remote cmd", () => {
|
|
145
|
+
const result = git.remote("remote-arg").sync();
|
|
146
|
+
|
|
147
|
+
expect(result.stdout).toEqual("CMD: git remote remote-arg");
|
|
148
|
+
expect(execa.sync).toHaveBeenCalledWith("git", ["remote", "remote-arg"], {
|
|
151
149
|
cwd: process.cwd(),
|
|
152
|
-
stdio:
|
|
153
|
-
})
|
|
154
|
-
})
|
|
155
|
-
})
|
|
156
|
-
describe(
|
|
157
|
-
it(
|
|
158
|
-
const result = git.rebase(
|
|
159
|
-
|
|
160
|
-
expect(result.stdout).toEqual(
|
|
161
|
-
expect(execa.sync).toHaveBeenCalledWith(
|
|
150
|
+
stdio: "inherit"
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
describe("rebase", () => {
|
|
155
|
+
it("should run rebase cmd", () => {
|
|
156
|
+
const result = git.rebase("rebase-arg").sync();
|
|
157
|
+
|
|
158
|
+
expect(result.stdout).toEqual("CMD: git rebase rebase-arg");
|
|
159
|
+
expect(execa.sync).toHaveBeenCalledWith("git", ["rebase", "rebase-arg"], {
|
|
162
160
|
cwd: process.cwd(),
|
|
163
|
-
stdio:
|
|
164
|
-
})
|
|
165
|
-
})
|
|
166
|
-
})
|
|
167
|
-
describe(
|
|
168
|
-
it(
|
|
169
|
-
const result = git.status(
|
|
170
|
-
|
|
171
|
-
expect(result.stdout).toEqual(
|
|
172
|
-
expect(execa.sync).toHaveBeenCalledWith(
|
|
161
|
+
stdio: "inherit"
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
describe("status", () => {
|
|
166
|
+
it("should run status cmd", () => {
|
|
167
|
+
const result = git.status("status-arg");
|
|
168
|
+
|
|
169
|
+
expect(result.stdout).toEqual("CMD: git status status-arg");
|
|
170
|
+
expect(execa.sync).toHaveBeenCalledWith("git", ["status", "status-arg"], {
|
|
173
171
|
cwd: process.cwd(),
|
|
174
|
-
stdio:
|
|
175
|
-
})
|
|
176
|
-
})
|
|
177
|
-
})
|
|
178
|
-
describe(
|
|
179
|
-
it(
|
|
180
|
-
const result = git.getCommitTag(
|
|
181
|
-
|
|
182
|
-
expect(result).toEqual(
|
|
183
|
-
})
|
|
184
|
-
})
|
|
185
|
-
describe(
|
|
186
|
-
it(
|
|
187
|
-
const result = git.getBranchName(
|
|
188
|
-
|
|
189
|
-
expect(result).toEqual(
|
|
190
|
-
})
|
|
191
|
-
})
|
|
192
|
-
describe(
|
|
193
|
-
it(
|
|
194
|
-
const result = git.getLastCommitMsg()
|
|
195
|
-
|
|
196
|
-
expect(result).toEqual(
|
|
197
|
-
})
|
|
198
|
-
})
|
|
199
|
-
describe(
|
|
200
|
-
it(
|
|
201
|
-
await git.push(
|
|
202
|
-
|
|
203
|
-
expect(execa).toHaveBeenCalledWith(
|
|
172
|
+
stdio: "inherit"
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
describe("getCommitTag", () => {
|
|
177
|
+
it("should run revParse cmd", () => {
|
|
178
|
+
const result = git.getCommitTag("ref");
|
|
179
|
+
|
|
180
|
+
expect(result).toEqual("CMD: git rev-parse --short ref");
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
describe("getBranchName", () => {
|
|
184
|
+
it("should run revParse cmd", () => {
|
|
185
|
+
const result = git.getBranchName("ref");
|
|
186
|
+
|
|
187
|
+
expect(result).toEqual("CMD: git rev-parse --abbrev-ref ref");
|
|
188
|
+
});
|
|
189
|
+
});
|
|
190
|
+
describe("getLastCommitMsg", () => {
|
|
191
|
+
it("should run revParse cmd", () => {
|
|
192
|
+
const result = git.getLastCommitMsg();
|
|
193
|
+
|
|
194
|
+
expect(result).toEqual("CMD: git log -1 --pretty=%B");
|
|
195
|
+
});
|
|
196
|
+
});
|
|
197
|
+
describe("push", () => {
|
|
198
|
+
it("should run push cmd", async () => {
|
|
199
|
+
await git.push("push-arg");
|
|
200
|
+
|
|
201
|
+
expect(execa).toHaveBeenCalledWith("git", ["push", "push-arg"], {
|
|
204
202
|
cwd: process.cwd(),
|
|
205
|
-
stdio:
|
|
206
|
-
})
|
|
207
|
-
})
|
|
208
|
-
})
|
|
209
|
-
})
|
|
203
|
+
stdio: "inherit"
|
|
204
|
+
});
|
|
205
|
+
});
|
|
206
|
+
});
|
|
207
|
+
});
|
package/src/common/cli/lerna.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { Cli } from
|
|
1
|
+
import { Cli } from "./cli.js";
|
|
2
2
|
|
|
3
3
|
class LernaCli extends Cli {
|
|
4
|
-
constructor
|
|
5
|
-
super(
|
|
4
|
+
constructor() {
|
|
5
|
+
super("lerna");
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
newVersion
|
|
9
|
-
return this.version(version,
|
|
8
|
+
newVersion(version) {
|
|
9
|
+
return this.version(version, "--exact", "--yes", "--no-git-tag-version", "--no-push");
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
version
|
|
13
|
-
return this.sync(
|
|
12
|
+
version(...args) {
|
|
13
|
+
return this.sync("version", ...args);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
run
|
|
17
|
-
return super.run(
|
|
16
|
+
run(...args) {
|
|
17
|
+
return super.run("run", ...args);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
install
|
|
21
|
-
return super.run(
|
|
20
|
+
install(...args) {
|
|
21
|
+
return super.run("install", ...args);
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
export const lerna = new LernaCli()
|
|
25
|
+
export const lerna = new LernaCli();
|