@soybeanjs/cli 0.1.3 → 0.1.4
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/dist/index.js +28 -15
- package/dist/index.mjs +31 -18
- package/package.json +23 -13
package/dist/index.js
CHANGED
|
@@ -26,7 +26,7 @@ var import_kolorist2 = require("kolorist");
|
|
|
26
26
|
// package.json
|
|
27
27
|
var package_default = {
|
|
28
28
|
name: "@soybeanjs/cli",
|
|
29
|
-
version: "0.1.
|
|
29
|
+
version: "0.1.3",
|
|
30
30
|
description: "SoybeanJS's command lint tools",
|
|
31
31
|
author: {
|
|
32
32
|
name: "Soybean",
|
|
@@ -47,9 +47,6 @@ var package_default = {
|
|
|
47
47
|
files: [
|
|
48
48
|
"dist"
|
|
49
49
|
],
|
|
50
|
-
publishConfig: {
|
|
51
|
-
registry: "https://registry.npmjs.org/"
|
|
52
|
-
},
|
|
53
50
|
scripts: {
|
|
54
51
|
build: "tsup",
|
|
55
52
|
lint: "eslint . --fix",
|
|
@@ -60,8 +57,7 @@ var package_default = {
|
|
|
60
57
|
"update-version": "bumpp package.json",
|
|
61
58
|
"publish-pkg": "pnpm -r publish --access public",
|
|
62
59
|
release: "pnpm update-version && pnpm publish-pkg",
|
|
63
|
-
"sync-pkg": "esno ./scripts/sync.ts"
|
|
64
|
-
prepare: "husky install"
|
|
60
|
+
"sync-pkg": "esno ./scripts/sync.ts"
|
|
65
61
|
},
|
|
66
62
|
dependencies: {
|
|
67
63
|
commander: "^9.4.1",
|
|
@@ -72,17 +68,30 @@ var package_default = {
|
|
|
72
68
|
},
|
|
73
69
|
devDependencies: {
|
|
74
70
|
"@soybeanjs/cli": "workspace:*",
|
|
75
|
-
"@types/prompts": "^2.4.
|
|
71
|
+
"@types/prompts": "^2.4.2",
|
|
76
72
|
bumpp: "^8.2.1",
|
|
77
|
-
eslint: "^8.
|
|
78
|
-
"eslint-config-soybeanjs": "0.1
|
|
73
|
+
eslint: "^8.29.0",
|
|
74
|
+
"eslint-config-soybeanjs": "0.2.1",
|
|
79
75
|
esno: "^0.16.3",
|
|
80
|
-
|
|
81
|
-
"npm-check-updates": "^16.
|
|
76
|
+
"lint-staged": "^13.1.0",
|
|
77
|
+
"npm-check-updates": "^16.5.5",
|
|
82
78
|
rimraf: "^3.0.2",
|
|
83
|
-
|
|
84
|
-
|
|
79
|
+
"simple-git-hooks": "^2.8.1",
|
|
80
|
+
tsup: "^6.5.0",
|
|
81
|
+
typescript: "^4.9.4",
|
|
85
82
|
zx: "^7.1.1"
|
|
83
|
+
},
|
|
84
|
+
"simple-git-hooks": {
|
|
85
|
+
"commit-msg": "pnpm soybean git-commit-verify",
|
|
86
|
+
"pre-commit": "pnpm exec lint-staged --concurrent false"
|
|
87
|
+
},
|
|
88
|
+
"lint-staged": {
|
|
89
|
+
"*": [
|
|
90
|
+
"eslint . --fix"
|
|
91
|
+
]
|
|
92
|
+
},
|
|
93
|
+
publishConfig: {
|
|
94
|
+
registry: "https://registry.npmjs.org/"
|
|
86
95
|
}
|
|
87
96
|
};
|
|
88
97
|
|
|
@@ -145,7 +154,7 @@ async function gitCommit() {
|
|
|
145
154
|
}
|
|
146
155
|
]);
|
|
147
156
|
const commitMsg = `${result.types}(${result.scopes}): ${result.description}`;
|
|
148
|
-
|
|
157
|
+
(0, import_execa.default)("git", ["commit", "-m", commitMsg], { stdio: "inherit" });
|
|
149
158
|
}
|
|
150
159
|
|
|
151
160
|
// src/command/git/verify-commit.ts
|
|
@@ -159,7 +168,11 @@ function verifyGitCommit() {
|
|
|
159
168
|
`(${types.map((item) => item.value).join("|")})\\((${scopes.map((item) => item.value).join("|")})\\):\\s.{1,50}`
|
|
160
169
|
);
|
|
161
170
|
if (!REG_EXP.test(commitMsg) && !commitMsg.includes(RELEASE_MSG)) {
|
|
162
|
-
throw new Error(
|
|
171
|
+
throw new Error(
|
|
172
|
+
`${(0, import_kolorist.bgRed)(" ERROR ")} ${(0, import_kolorist.red)("Git\u63D0\u4EA4\u4FE1\u606F\u4E0D\u7B26\u5408 Angular \u89C4\u8303!\n\n")}${(0, import_kolorist.green)(
|
|
173
|
+
"\u63A8\u8350\u4F7F\u7528\u547D\u4EE4 pnpm commit \u751F\u6210\u7B26\u5408\u89C4\u8303\u7684Git\u63D0\u4EA4\u4FE1\u606F"
|
|
174
|
+
)}`
|
|
175
|
+
);
|
|
163
176
|
}
|
|
164
177
|
}
|
|
165
178
|
|
package/dist/index.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import { blue } from "kolorist";
|
|
|
7
7
|
// package.json
|
|
8
8
|
var package_default = {
|
|
9
9
|
name: "@soybeanjs/cli",
|
|
10
|
-
version: "0.1.
|
|
10
|
+
version: "0.1.3",
|
|
11
11
|
description: "SoybeanJS's command lint tools",
|
|
12
12
|
author: {
|
|
13
13
|
name: "Soybean",
|
|
@@ -28,9 +28,6 @@ var package_default = {
|
|
|
28
28
|
files: [
|
|
29
29
|
"dist"
|
|
30
30
|
],
|
|
31
|
-
publishConfig: {
|
|
32
|
-
registry: "https://registry.npmjs.org/"
|
|
33
|
-
},
|
|
34
31
|
scripts: {
|
|
35
32
|
build: "tsup",
|
|
36
33
|
lint: "eslint . --fix",
|
|
@@ -41,8 +38,7 @@ var package_default = {
|
|
|
41
38
|
"update-version": "bumpp package.json",
|
|
42
39
|
"publish-pkg": "pnpm -r publish --access public",
|
|
43
40
|
release: "pnpm update-version && pnpm publish-pkg",
|
|
44
|
-
"sync-pkg": "esno ./scripts/sync.ts"
|
|
45
|
-
prepare: "husky install"
|
|
41
|
+
"sync-pkg": "esno ./scripts/sync.ts"
|
|
46
42
|
},
|
|
47
43
|
dependencies: {
|
|
48
44
|
commander: "^9.4.1",
|
|
@@ -53,22 +49,35 @@ var package_default = {
|
|
|
53
49
|
},
|
|
54
50
|
devDependencies: {
|
|
55
51
|
"@soybeanjs/cli": "workspace:*",
|
|
56
|
-
"@types/prompts": "^2.4.
|
|
52
|
+
"@types/prompts": "^2.4.2",
|
|
57
53
|
bumpp: "^8.2.1",
|
|
58
|
-
eslint: "^8.
|
|
59
|
-
"eslint-config-soybeanjs": "0.1
|
|
54
|
+
eslint: "^8.29.0",
|
|
55
|
+
"eslint-config-soybeanjs": "0.2.1",
|
|
60
56
|
esno: "^0.16.3",
|
|
61
|
-
|
|
62
|
-
"npm-check-updates": "^16.
|
|
57
|
+
"lint-staged": "^13.1.0",
|
|
58
|
+
"npm-check-updates": "^16.5.5",
|
|
63
59
|
rimraf: "^3.0.2",
|
|
64
|
-
|
|
65
|
-
|
|
60
|
+
"simple-git-hooks": "^2.8.1",
|
|
61
|
+
tsup: "^6.5.0",
|
|
62
|
+
typescript: "^4.9.4",
|
|
66
63
|
zx: "^7.1.1"
|
|
64
|
+
},
|
|
65
|
+
"simple-git-hooks": {
|
|
66
|
+
"commit-msg": "pnpm soybean git-commit-verify",
|
|
67
|
+
"pre-commit": "pnpm exec lint-staged --concurrent false"
|
|
68
|
+
},
|
|
69
|
+
"lint-staged": {
|
|
70
|
+
"*": [
|
|
71
|
+
"eslint . --fix"
|
|
72
|
+
]
|
|
73
|
+
},
|
|
74
|
+
publishConfig: {
|
|
75
|
+
registry: "https://registry.npmjs.org/"
|
|
67
76
|
}
|
|
68
77
|
};
|
|
69
78
|
|
|
70
79
|
// src/command/git/commit.ts
|
|
71
|
-
import
|
|
80
|
+
import prompts from "prompts";
|
|
72
81
|
import execa from "execa";
|
|
73
82
|
|
|
74
83
|
// src/command/git/config.ts
|
|
@@ -106,7 +115,7 @@ var scopes = [
|
|
|
106
115
|
|
|
107
116
|
// src/command/git/commit.ts
|
|
108
117
|
async function gitCommit() {
|
|
109
|
-
const result = await
|
|
118
|
+
const result = await prompts([
|
|
110
119
|
{
|
|
111
120
|
name: "types",
|
|
112
121
|
type: "select",
|
|
@@ -126,12 +135,12 @@ async function gitCommit() {
|
|
|
126
135
|
}
|
|
127
136
|
]);
|
|
128
137
|
const commitMsg = `${result.types}(${result.scopes}): ${result.description}`;
|
|
129
|
-
|
|
138
|
+
execa("git", ["commit", "-m", commitMsg], { stdio: "inherit" });
|
|
130
139
|
}
|
|
131
140
|
|
|
132
141
|
// src/command/git/verify-commit.ts
|
|
133
142
|
import { readFileSync } from "fs";
|
|
134
|
-
import { red } from "kolorist";
|
|
143
|
+
import { bgRed, red, green } from "kolorist";
|
|
135
144
|
function verifyGitCommit() {
|
|
136
145
|
const gitMsgPath = "./.git/COMMIT_EDITMSG";
|
|
137
146
|
const commitMsg = readFileSync(gitMsgPath, "utf-8").trim();
|
|
@@ -140,7 +149,11 @@ function verifyGitCommit() {
|
|
|
140
149
|
`(${types.map((item) => item.value).join("|")})\\((${scopes.map((item) => item.value).join("|")})\\):\\s.{1,50}`
|
|
141
150
|
);
|
|
142
151
|
if (!REG_EXP.test(commitMsg) && !commitMsg.includes(RELEASE_MSG)) {
|
|
143
|
-
throw new Error(
|
|
152
|
+
throw new Error(
|
|
153
|
+
`${bgRed(" ERROR ")} ${red("Git\u63D0\u4EA4\u4FE1\u606F\u4E0D\u7B26\u5408 Angular \u89C4\u8303!\n\n")}${green(
|
|
154
|
+
"\u63A8\u8350\u4F7F\u7528\u547D\u4EE4 pnpm commit \u751F\u6210\u7B26\u5408\u89C4\u8303\u7684Git\u63D0\u4EA4\u4FE1\u606F"
|
|
155
|
+
)}`
|
|
156
|
+
);
|
|
144
157
|
}
|
|
145
158
|
}
|
|
146
159
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soybeanjs/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "SoybeanJS's command lint tools",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Soybean",
|
|
@@ -21,9 +21,6 @@
|
|
|
21
21
|
"files": [
|
|
22
22
|
"dist"
|
|
23
23
|
],
|
|
24
|
-
"publishConfig": {
|
|
25
|
-
"registry": "https://registry.npmjs.org/"
|
|
26
|
-
},
|
|
27
24
|
"dependencies": {
|
|
28
25
|
"commander": "^9.4.1",
|
|
29
26
|
"execa": "5.1.1",
|
|
@@ -32,18 +29,31 @@
|
|
|
32
29
|
"prompts": "^2.4.2"
|
|
33
30
|
},
|
|
34
31
|
"devDependencies": {
|
|
35
|
-
"@
|
|
36
|
-
"@types/prompts": "^2.4.1",
|
|
32
|
+
"@types/prompts": "^2.4.2",
|
|
37
33
|
"bumpp": "^8.2.1",
|
|
38
|
-
"eslint": "^8.
|
|
39
|
-
"eslint-config-soybeanjs": "0.1
|
|
34
|
+
"eslint": "^8.29.0",
|
|
35
|
+
"eslint-config-soybeanjs": "0.2.1",
|
|
40
36
|
"esno": "^0.16.3",
|
|
41
|
-
"
|
|
42
|
-
"npm-check-updates": "^16.
|
|
37
|
+
"lint-staged": "^13.1.0",
|
|
38
|
+
"npm-check-updates": "^16.5.5",
|
|
43
39
|
"rimraf": "^3.0.2",
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
40
|
+
"simple-git-hooks": "^2.8.1",
|
|
41
|
+
"tsup": "^6.5.0",
|
|
42
|
+
"typescript": "^4.9.4",
|
|
43
|
+
"zx": "^7.1.1",
|
|
44
|
+
"@soybeanjs/cli": "0.1.4"
|
|
45
|
+
},
|
|
46
|
+
"simple-git-hooks": {
|
|
47
|
+
"commit-msg": "pnpm soybean git-commit-verify",
|
|
48
|
+
"pre-commit": "pnpm exec lint-staged --concurrent false"
|
|
49
|
+
},
|
|
50
|
+
"lint-staged": {
|
|
51
|
+
"*": [
|
|
52
|
+
"eslint . --fix"
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
"publishConfig": {
|
|
56
|
+
"registry": "https://registry.npmjs.org/"
|
|
47
57
|
},
|
|
48
58
|
"scripts": {
|
|
49
59
|
"build": "tsup",
|