@soybeanjs/cli 1.4.0-beta.4 → 1.4.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/dist/index.js +8 -15
- package/package.json +13 -13
package/dist/index.js
CHANGED
|
@@ -11,14 +11,13 @@ import process from "node:process";
|
|
|
11
11
|
import { loadConfig } from "c12";
|
|
12
12
|
|
|
13
13
|
//#region package.json
|
|
14
|
-
var version = "1.4.
|
|
14
|
+
var version = "1.4.1";
|
|
15
15
|
|
|
16
16
|
//#endregion
|
|
17
17
|
//#region src/shared/index.ts
|
|
18
18
|
async function execCommand(cmd, args, options) {
|
|
19
19
|
const { execa } = await import("execa");
|
|
20
|
-
|
|
21
|
-
return (res?.stdout)?.trim() || "";
|
|
20
|
+
return ((await execa(cmd, args, options))?.stdout)?.trim() || "";
|
|
22
21
|
}
|
|
23
22
|
|
|
24
23
|
//#endregion
|
|
@@ -104,11 +103,9 @@ const locales = {
|
|
|
104
103
|
async function gitCommit(lang = "en-us") {
|
|
105
104
|
const { gitCommitMessages, gitCommitTypes, gitCommitScopes } = locales[lang];
|
|
106
105
|
const typesChoices = gitCommitTypes.map(([value, msg]) => {
|
|
107
|
-
const nameWithSuffix = `${value}:`;
|
|
108
|
-
const message = `${nameWithSuffix.padEnd(12)}${msg}`;
|
|
109
106
|
return {
|
|
110
107
|
name: value,
|
|
111
|
-
message
|
|
108
|
+
message: `${`${value}:`.padEnd(12)}${msg}`
|
|
112
109
|
};
|
|
113
110
|
});
|
|
114
111
|
const scopesChoices = gitCommitScopes.map(([value, msg]) => ({
|
|
@@ -136,21 +133,18 @@ async function gitCommit(lang = "en-us") {
|
|
|
136
133
|
]);
|
|
137
134
|
const breaking = result.description.startsWith("!") ? "!" : "";
|
|
138
135
|
const description = result.description.replace(/^!/, "").trim();
|
|
139
|
-
const commitMsg = `${result.types}(${result.scopes})${breaking}: ${description}`;
|
|
140
136
|
await execCommand("git", [
|
|
141
137
|
"commit",
|
|
142
138
|
"-m",
|
|
143
|
-
|
|
139
|
+
`${result.types}(${result.scopes})${breaking}: ${description}`
|
|
144
140
|
], { stdio: "inherit" });
|
|
145
141
|
}
|
|
146
142
|
/** Git commit message verify */
|
|
147
143
|
async function gitCommitVerify(lang = "en-us", ignores = []) {
|
|
148
144
|
const gitPath = await execCommand("git", ["rev-parse", "--show-toplevel"]);
|
|
149
|
-
const
|
|
150
|
-
const commitMsg = readFileSync(gitMsgPath, "utf8").trim();
|
|
145
|
+
const commitMsg = readFileSync(path.join(gitPath, ".git", "COMMIT_EDITMSG"), "utf8").trim();
|
|
151
146
|
if (ignores.some((regExp) => regExp.test(commitMsg))) return;
|
|
152
|
-
|
|
153
|
-
if (!REG_EXP.test(commitMsg)) {
|
|
147
|
+
if (!/(?<type>[a-z]+)(?:\((?<scope>.+)\))?(?<breaking>!)?: (?<description>.+)/i.test(commitMsg)) {
|
|
154
148
|
const errorMsg = locales[lang].gitCommitVerify;
|
|
155
149
|
throw new Error(errorMsg);
|
|
156
150
|
}
|
|
@@ -165,7 +159,7 @@ async function cleanup(paths) {
|
|
|
165
159
|
//#endregion
|
|
166
160
|
//#region src/command/ncu.ts
|
|
167
161
|
async function ncu(args = ["--deep", "-u"]) {
|
|
168
|
-
execCommand("npx", ["
|
|
162
|
+
execCommand("npx", ["npm-check-updates", ...args], { stdio: "inherit" });
|
|
169
163
|
}
|
|
170
164
|
|
|
171
165
|
//#endregion
|
|
@@ -237,8 +231,7 @@ async function setupCli() {
|
|
|
237
231
|
cleanup: {
|
|
238
232
|
desc: "delete dirs: node_modules, dist, etc.",
|
|
239
233
|
action: async (args) => {
|
|
240
|
-
const
|
|
241
|
-
const formattedDirs = cleanupDirs.map((dir) => dir.trim()).filter(Boolean);
|
|
234
|
+
const formattedDirs = (args?.cleanupDir?.split(",") || []).map((dir) => dir.trim()).filter(Boolean);
|
|
242
235
|
if (formattedDirs.length) cliOptions.cleanupDirs = formattedDirs;
|
|
243
236
|
await cleanup(cliOptions.cleanupDirs);
|
|
244
237
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soybeanjs/cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.4.
|
|
4
|
+
"version": "1.4.1",
|
|
5
5
|
"description": "SoybeanJS's command line tools",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Soybean",
|
|
@@ -37,29 +37,29 @@
|
|
|
37
37
|
"dist"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@soybeanjs/changelog": "0.
|
|
41
|
-
"bumpp": "10.
|
|
42
|
-
"c12": "3.
|
|
40
|
+
"@soybeanjs/changelog": "0.4.0-beta.1",
|
|
41
|
+
"bumpp": "10.3.1",
|
|
42
|
+
"c12": "3.3.1",
|
|
43
43
|
"cac": "6.7.14",
|
|
44
44
|
"consola": "3.4.2",
|
|
45
45
|
"enquirer": "2.4.1",
|
|
46
46
|
"execa": "9.6.0",
|
|
47
47
|
"kolorist": "1.8.0",
|
|
48
|
-
"npm-check-updates": "
|
|
48
|
+
"npm-check-updates": "19.1.2",
|
|
49
49
|
"rimraf": "6.0.1",
|
|
50
|
-
"tinyglobby": "0.2.
|
|
50
|
+
"tinyglobby": "0.2.15"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@soybeanjs/cli": "link:",
|
|
54
54
|
"@soybeanjs/eslint-config": "1.7.1",
|
|
55
|
-
"@types/node": "24.
|
|
56
|
-
"eslint": "9.
|
|
57
|
-
"eslint-plugin-vue": "10.
|
|
58
|
-
"lint-staged": "16.
|
|
55
|
+
"@types/node": "24.9.2",
|
|
56
|
+
"eslint": "9.38.0",
|
|
57
|
+
"eslint-plugin-vue": "10.5.1",
|
|
58
|
+
"lint-staged": "16.2.6",
|
|
59
59
|
"simple-git-hooks": "2.13.1",
|
|
60
|
-
"tsdown": "0.
|
|
61
|
-
"tsx": "4.20.
|
|
62
|
-
"typescript": "5.9.
|
|
60
|
+
"tsdown": "0.15.11",
|
|
61
|
+
"tsx": "4.20.6",
|
|
62
|
+
"typescript": "5.9.3",
|
|
63
63
|
"vue-eslint-parser": "10.2.0"
|
|
64
64
|
},
|
|
65
65
|
"simple-git-hooks": {
|