@soybeanjs/cli 0.1.2 → 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 +31 -16
- package/dist/index.mjs +34 -19
- package/package.json +24 -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",
|
|
@@ -71,17 +67,31 @@ var package_default = {
|
|
|
71
67
|
prompts: "^2.4.2"
|
|
72
68
|
},
|
|
73
69
|
devDependencies: {
|
|
74
|
-
"@soybeanjs/cli": "
|
|
75
|
-
"@types/prompts": "^2.4.
|
|
70
|
+
"@soybeanjs/cli": "workspace:*",
|
|
71
|
+
"@types/prompts": "^2.4.2",
|
|
76
72
|
bumpp: "^8.2.1",
|
|
77
|
-
eslint: "^8.
|
|
78
|
-
"eslint-config-soybeanjs": "0.
|
|
73
|
+
eslint: "^8.29.0",
|
|
74
|
+
"eslint-config-soybeanjs": "0.2.1",
|
|
79
75
|
esno: "^0.16.3",
|
|
80
|
-
|
|
81
|
-
"npm-check-updates": "^16.
|
|
82
|
-
|
|
83
|
-
|
|
76
|
+
"lint-staged": "^13.1.0",
|
|
77
|
+
"npm-check-updates": "^16.5.5",
|
|
78
|
+
rimraf: "^3.0.2",
|
|
79
|
+
"simple-git-hooks": "^2.8.1",
|
|
80
|
+
tsup: "^6.5.0",
|
|
81
|
+
typescript: "^4.9.4",
|
|
84
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/"
|
|
85
95
|
}
|
|
86
96
|
};
|
|
87
97
|
|
|
@@ -113,6 +123,7 @@ var scopes = [
|
|
|
113
123
|
["styles", "\u6837\u5F0F\u76F8\u5173"],
|
|
114
124
|
["deps", "\u9879\u76EE\u4F9D\u8D56"],
|
|
115
125
|
["auth", "\u5BF9 auth \u4FEE\u6539"],
|
|
126
|
+
["release", "\u7248\u672C\u53D1\u5E03"],
|
|
116
127
|
["other", "\u5176\u4ED6\u4FEE\u6539"]
|
|
117
128
|
].map(([value, description]) => {
|
|
118
129
|
return {
|
|
@@ -143,7 +154,7 @@ async function gitCommit() {
|
|
|
143
154
|
}
|
|
144
155
|
]);
|
|
145
156
|
const commitMsg = `${result.types}(${result.scopes}): ${result.description}`;
|
|
146
|
-
|
|
157
|
+
(0, import_execa.default)("git", ["commit", "-m", commitMsg], { stdio: "inherit" });
|
|
147
158
|
}
|
|
148
159
|
|
|
149
160
|
// src/command/git/verify-commit.ts
|
|
@@ -157,7 +168,11 @@ function verifyGitCommit() {
|
|
|
157
168
|
`(${types.map((item) => item.value).join("|")})\\((${scopes.map((item) => item.value).join("|")})\\):\\s.{1,50}`
|
|
158
169
|
);
|
|
159
170
|
if (!REG_EXP.test(commitMsg) && !commitMsg.includes(RELEASE_MSG)) {
|
|
160
|
-
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
|
+
);
|
|
161
176
|
}
|
|
162
177
|
}
|
|
163
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",
|
|
@@ -52,22 +48,36 @@ var package_default = {
|
|
|
52
48
|
prompts: "^2.4.2"
|
|
53
49
|
},
|
|
54
50
|
devDependencies: {
|
|
55
|
-
"@soybeanjs/cli": "
|
|
56
|
-
"@types/prompts": "^2.4.
|
|
51
|
+
"@soybeanjs/cli": "workspace:*",
|
|
52
|
+
"@types/prompts": "^2.4.2",
|
|
57
53
|
bumpp: "^8.2.1",
|
|
58
|
-
eslint: "^8.
|
|
59
|
-
"eslint-config-soybeanjs": "0.
|
|
54
|
+
eslint: "^8.29.0",
|
|
55
|
+
"eslint-config-soybeanjs": "0.2.1",
|
|
60
56
|
esno: "^0.16.3",
|
|
61
|
-
|
|
62
|
-
"npm-check-updates": "^16.
|
|
63
|
-
|
|
64
|
-
|
|
57
|
+
"lint-staged": "^13.1.0",
|
|
58
|
+
"npm-check-updates": "^16.5.5",
|
|
59
|
+
rimraf: "^3.0.2",
|
|
60
|
+
"simple-git-hooks": "^2.8.1",
|
|
61
|
+
tsup: "^6.5.0",
|
|
62
|
+
typescript: "^4.9.4",
|
|
65
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/"
|
|
66
76
|
}
|
|
67
77
|
};
|
|
68
78
|
|
|
69
79
|
// src/command/git/commit.ts
|
|
70
|
-
import
|
|
80
|
+
import prompts from "prompts";
|
|
71
81
|
import execa from "execa";
|
|
72
82
|
|
|
73
83
|
// src/command/git/config.ts
|
|
@@ -94,6 +104,7 @@ var scopes = [
|
|
|
94
104
|
["styles", "\u6837\u5F0F\u76F8\u5173"],
|
|
95
105
|
["deps", "\u9879\u76EE\u4F9D\u8D56"],
|
|
96
106
|
["auth", "\u5BF9 auth \u4FEE\u6539"],
|
|
107
|
+
["release", "\u7248\u672C\u53D1\u5E03"],
|
|
97
108
|
["other", "\u5176\u4ED6\u4FEE\u6539"]
|
|
98
109
|
].map(([value, description]) => {
|
|
99
110
|
return {
|
|
@@ -104,7 +115,7 @@ var scopes = [
|
|
|
104
115
|
|
|
105
116
|
// src/command/git/commit.ts
|
|
106
117
|
async function gitCommit() {
|
|
107
|
-
const result = await
|
|
118
|
+
const result = await prompts([
|
|
108
119
|
{
|
|
109
120
|
name: "types",
|
|
110
121
|
type: "select",
|
|
@@ -124,12 +135,12 @@ async function gitCommit() {
|
|
|
124
135
|
}
|
|
125
136
|
]);
|
|
126
137
|
const commitMsg = `${result.types}(${result.scopes}): ${result.description}`;
|
|
127
|
-
|
|
138
|
+
execa("git", ["commit", "-m", commitMsg], { stdio: "inherit" });
|
|
128
139
|
}
|
|
129
140
|
|
|
130
141
|
// src/command/git/verify-commit.ts
|
|
131
142
|
import { readFileSync } from "fs";
|
|
132
|
-
import { red } from "kolorist";
|
|
143
|
+
import { bgRed, red, green } from "kolorist";
|
|
133
144
|
function verifyGitCommit() {
|
|
134
145
|
const gitMsgPath = "./.git/COMMIT_EDITMSG";
|
|
135
146
|
const commitMsg = readFileSync(gitMsgPath, "utf-8").trim();
|
|
@@ -138,7 +149,11 @@ function verifyGitCommit() {
|
|
|
138
149
|
`(${types.map((item) => item.value).join("|")})\\((${scopes.map((item) => item.value).join("|")})\\):\\s.{1,50}`
|
|
139
150
|
);
|
|
140
151
|
if (!REG_EXP.test(commitMsg) && !commitMsg.includes(RELEASE_MSG)) {
|
|
141
|
-
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
|
+
);
|
|
142
157
|
}
|
|
143
158
|
}
|
|
144
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,17 +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.
|
|
34
|
+
"eslint": "^8.29.0",
|
|
35
|
+
"eslint-config-soybeanjs": "0.2.1",
|
|
40
36
|
"esno": "^0.16.3",
|
|
41
|
-
"
|
|
42
|
-
"npm-check-updates": "^16.
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
37
|
+
"lint-staged": "^13.1.0",
|
|
38
|
+
"npm-check-updates": "^16.5.5",
|
|
39
|
+
"rimraf": "^3.0.2",
|
|
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/"
|
|
46
57
|
},
|
|
47
58
|
"scripts": {
|
|
48
59
|
"build": "tsup",
|