@soybeanjs/cli 1.7.2 → 1.7.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.d.ts +1 -2
- package/dist/index.js +45 -55
- package/package.json +20 -30
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ChangelogOption } from "@soybeanjs/changelog";
|
|
2
|
-
|
|
3
2
|
//#region src/types/index.d.ts
|
|
4
3
|
interface CliOption {
|
|
5
4
|
/** The project root directory */
|
|
@@ -18,7 +17,7 @@ interface CliOption {
|
|
|
18
17
|
/**
|
|
19
18
|
* Npm-check-updates command args
|
|
20
19
|
*
|
|
21
|
-
|
|
20
|
+
* If not set, soybean-cli will resolve workspace package.json files automatically and fall back to package.json in single-package repos.
|
|
22
21
|
*/
|
|
23
22
|
ncuCommandArgs: string[];
|
|
24
23
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,29 +1,61 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { cac } from "cac";
|
|
3
|
-
import
|
|
3
|
+
import process$1 from "node:process";
|
|
4
|
+
import { loadConfig } from "c12";
|
|
4
5
|
import { readFileSync } from "node:fs";
|
|
6
|
+
import path, { join, posix } from "node:path";
|
|
5
7
|
import enquirer from "enquirer";
|
|
6
8
|
import { bgRed, green, red, yellow } from "kolorist";
|
|
7
9
|
import { rimraf } from "rimraf";
|
|
8
10
|
import { readFile } from "node:fs/promises";
|
|
9
|
-
import process$1 from "node:process";
|
|
10
11
|
import { glob } from "tinyglobby";
|
|
11
|
-
import { join as join$1 } from "path";
|
|
12
12
|
import { existsSync } from "fs";
|
|
13
|
+
import { join as join$1 } from "path";
|
|
13
14
|
import { generateChangelog, generateTotalChangelog } from "@soybeanjs/changelog";
|
|
14
15
|
import { versionBump } from "bumpp";
|
|
15
|
-
import { loadConfig } from "c12";
|
|
16
|
-
|
|
17
16
|
//#region package.json
|
|
18
|
-
var version = "1.7.
|
|
19
|
-
|
|
17
|
+
var version = "1.7.4";
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/config/index.ts
|
|
20
|
+
const defaultOptions = {
|
|
21
|
+
cwd: process$1.cwd(),
|
|
22
|
+
cleanupDirs: [
|
|
23
|
+
"**/dist",
|
|
24
|
+
"**/package-lock.json",
|
|
25
|
+
"**/yarn.lock",
|
|
26
|
+
"**/pnpm-lock.yaml",
|
|
27
|
+
"**/node_modules",
|
|
28
|
+
"!node_modules/**"
|
|
29
|
+
],
|
|
30
|
+
ncuCommandArgs: [],
|
|
31
|
+
changelogOptions: {},
|
|
32
|
+
gitCommitVerifyIgnores: [
|
|
33
|
+
/^((Merge pull request)|(Merge (.*?) into (.*?)|(Merge branch (.*?)))(?:\r?\n)*$)/m,
|
|
34
|
+
/^(Merge tag (.*?))(?:\r?\n)*$/m,
|
|
35
|
+
/^(R|r)evert (.*)/,
|
|
36
|
+
/^(amend|fixup|squash)!/,
|
|
37
|
+
/^(Merged (.*?)(in|into) (.*)|Merged PR (.*): (.*))/,
|
|
38
|
+
/^Merge remote-tracking branch(\s*)(.*)/,
|
|
39
|
+
/^Automatic merge(.*)/,
|
|
40
|
+
/^Auto-merged (.*?) into (.*)/
|
|
41
|
+
]
|
|
42
|
+
};
|
|
43
|
+
async function loadCliOptions(overrides, cwd = process$1.cwd()) {
|
|
44
|
+
const { config } = await loadConfig({
|
|
45
|
+
name: "soybean",
|
|
46
|
+
defaults: defaultOptions,
|
|
47
|
+
overrides,
|
|
48
|
+
cwd,
|
|
49
|
+
packageJson: true
|
|
50
|
+
});
|
|
51
|
+
return config;
|
|
52
|
+
}
|
|
20
53
|
//#endregion
|
|
21
54
|
//#region src/shared/index.ts
|
|
22
55
|
async function execCommand(cmd, args, options) {
|
|
23
56
|
const { execa } = await import("execa");
|
|
24
57
|
return ((await execa(cmd, args, options))?.stdout)?.trim() || "";
|
|
25
58
|
}
|
|
26
|
-
|
|
27
59
|
//#endregion
|
|
28
60
|
//#region src/locales/index.ts
|
|
29
61
|
const locales = {
|
|
@@ -96,7 +128,6 @@ const locales = {
|
|
|
96
128
|
gitCommitVerify: `${bgRed(" ERROR ")} ${red("git commit message must match the Conventional Commits standard!")}\n\n${green("Recommended to use the command `pnpm commit` to generate Conventional Commits compliant commit information.\nGet more info about Conventional Commits, follow this link: https://conventionalcommits.org")}`
|
|
97
129
|
}
|
|
98
130
|
};
|
|
99
|
-
|
|
100
131
|
//#endregion
|
|
101
132
|
//#region src/command/git-commit.ts
|
|
102
133
|
/**
|
|
@@ -153,13 +184,11 @@ async function gitCommitVerify(lang = "en-us", ignores = []) {
|
|
|
153
184
|
throw new Error(errorMsg);
|
|
154
185
|
}
|
|
155
186
|
}
|
|
156
|
-
|
|
157
187
|
//#endregion
|
|
158
188
|
//#region src/command/cleanup.ts
|
|
159
189
|
async function cleanup(paths) {
|
|
160
190
|
await rimraf(paths, { glob: true });
|
|
161
191
|
}
|
|
162
|
-
|
|
163
192
|
//#endregion
|
|
164
193
|
//#region src/command/ncu.ts
|
|
165
194
|
async function ncu(args = []) {
|
|
@@ -185,7 +214,7 @@ function parsePnpmWorkspacePackages(content) {
|
|
|
185
214
|
function resolveWorkspacePatterns(packageJson, pnpmWorkspaceContent) {
|
|
186
215
|
const workspaces = Array.isArray(packageJson?.workspaces) ? packageJson.workspaces : packageJson?.workspaces?.packages ?? [];
|
|
187
216
|
const pnpmWorkspacePackages = pnpmWorkspaceContent ? parsePnpmWorkspacePackages(pnpmWorkspaceContent) : [];
|
|
188
|
-
return [
|
|
217
|
+
return [.../* @__PURE__ */ new Set([...workspaces, ...pnpmWorkspacePackages])];
|
|
189
218
|
}
|
|
190
219
|
function toPackageFilePattern(pattern) {
|
|
191
220
|
const normalizedPattern = pattern.trim();
|
|
@@ -218,13 +247,13 @@ async function resolveDefaultNcuArgs(cwd = process$1.cwd()) {
|
|
|
218
247
|
"--packageFile",
|
|
219
248
|
"package.json"
|
|
220
249
|
];
|
|
221
|
-
return [
|
|
250
|
+
if (uniquePackageFiles.length === 1) return [
|
|
222
251
|
"-u",
|
|
223
252
|
"--packageFile",
|
|
224
|
-
|
|
253
|
+
uniquePackageFiles[0]
|
|
225
254
|
];
|
|
255
|
+
return ["-u", ...uniquePackageFiles.flatMap((file) => ["--packageFile", file])];
|
|
226
256
|
}
|
|
227
|
-
|
|
228
257
|
//#endregion
|
|
229
258
|
//#region src/command/changelog.ts
|
|
230
259
|
async function genChangelog(options, total = false) {
|
|
@@ -233,7 +262,6 @@ async function genChangelog(options, total = false) {
|
|
|
233
262
|
else await generateChangelog(options);
|
|
234
263
|
if (!hasChangelog) await execCommand("git", ["add", "CHANGELOG.md"]);
|
|
235
264
|
}
|
|
236
|
-
|
|
237
265
|
//#endregion
|
|
238
266
|
//#region src/command/release.ts
|
|
239
267
|
async function release(execute = "pnpm soy changelog", push = true) {
|
|
@@ -246,43 +274,6 @@ async function release(execute = "pnpm soy changelog", push = true) {
|
|
|
246
274
|
push
|
|
247
275
|
});
|
|
248
276
|
}
|
|
249
|
-
|
|
250
|
-
//#endregion
|
|
251
|
-
//#region src/config/index.ts
|
|
252
|
-
const defaultOptions = {
|
|
253
|
-
cwd: process$1.cwd(),
|
|
254
|
-
cleanupDirs: [
|
|
255
|
-
"**/dist",
|
|
256
|
-
"**/package-lock.json",
|
|
257
|
-
"**/yarn.lock",
|
|
258
|
-
"**/pnpm-lock.yaml",
|
|
259
|
-
"**/node_modules",
|
|
260
|
-
"!node_modules/**"
|
|
261
|
-
],
|
|
262
|
-
ncuCommandArgs: [],
|
|
263
|
-
changelogOptions: {},
|
|
264
|
-
gitCommitVerifyIgnores: [
|
|
265
|
-
/^((Merge pull request)|(Merge (.*?) into (.*?)|(Merge branch (.*?)))(?:\r?\n)*$)/m,
|
|
266
|
-
/^(Merge tag (.*?))(?:\r?\n)*$/m,
|
|
267
|
-
/^(R|r)evert (.*)/,
|
|
268
|
-
/^(amend|fixup|squash)!/,
|
|
269
|
-
/^(Merged (.*?)(in|into) (.*)|Merged PR (.*): (.*))/,
|
|
270
|
-
/^Merge remote-tracking branch(\s*)(.*)/,
|
|
271
|
-
/^Automatic merge(.*)/,
|
|
272
|
-
/^Auto-merged (.*?) into (.*)/
|
|
273
|
-
]
|
|
274
|
-
};
|
|
275
|
-
async function loadCliOptions(overrides, cwd = process$1.cwd()) {
|
|
276
|
-
const { config } = await loadConfig({
|
|
277
|
-
name: "soybean",
|
|
278
|
-
defaults: defaultOptions,
|
|
279
|
-
overrides,
|
|
280
|
-
cwd,
|
|
281
|
-
packageJson: true
|
|
282
|
-
});
|
|
283
|
-
return config;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
277
|
//#endregion
|
|
287
278
|
//#region src/index.ts
|
|
288
279
|
async function setupCli() {
|
|
@@ -345,6 +336,5 @@ setupCli();
|
|
|
345
336
|
function defineConfig(config) {
|
|
346
337
|
return config;
|
|
347
338
|
}
|
|
348
|
-
|
|
349
339
|
//#endregion
|
|
350
|
-
export { defineConfig };
|
|
340
|
+
export { defineConfig };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soybeanjs/cli",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.4",
|
|
4
4
|
"description": "SoybeanJS's command line tools",
|
|
5
5
|
"homepage": "https://github.com/soybeanjs/cli",
|
|
6
6
|
"bugs": {
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"url": "https://github.com/soybeanjs/cli.git"
|
|
17
17
|
},
|
|
18
18
|
"bin": {
|
|
19
|
-
"
|
|
20
|
-
"
|
|
19
|
+
"soy": "dist/index.js",
|
|
20
|
+
"soybean": "dist/index.js"
|
|
21
21
|
},
|
|
22
22
|
"files": [
|
|
23
23
|
"dist"
|
|
@@ -37,48 +37,38 @@
|
|
|
37
37
|
"registry": "https://registry.npmjs.org/"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@soybeanjs/changelog": "^0.4.
|
|
41
|
-
"bumpp": "^
|
|
40
|
+
"@soybeanjs/changelog": "^0.4.7",
|
|
41
|
+
"bumpp": "^12.0.0",
|
|
42
42
|
"c12": "^3.3.4",
|
|
43
43
|
"cac": "^7.0.0",
|
|
44
44
|
"consola": "^3.4.2",
|
|
45
45
|
"enquirer": "^2.4.1",
|
|
46
|
-
"execa": "^
|
|
46
|
+
"execa": "^10.0.0",
|
|
47
47
|
"kolorist": "^1.8.0",
|
|
48
|
-
"npm-check-updates": "^22.
|
|
48
|
+
"npm-check-updates": "^22.2.9",
|
|
49
49
|
"rimraf": "^6.1.3",
|
|
50
|
-
"tinyglobby": "^0.2.
|
|
50
|
+
"tinyglobby": "^0.2.17"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@soybeanjs/cli": "link:",
|
|
54
|
-
"@
|
|
55
|
-
"
|
|
56
|
-
"oxfmt": "^0.
|
|
57
|
-
"oxlint": "^1.
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
},
|
|
63
|
-
"simple-git-hooks": {
|
|
64
|
-
"commit-msg": "pnpm soy git-commit-verify",
|
|
65
|
-
"pre-commit": "pnpm typecheck && pnpm lint-staged"
|
|
66
|
-
},
|
|
67
|
-
"lint-staged": {
|
|
68
|
-
"*": "oxlint . --fix && oxfmt"
|
|
54
|
+
"@soybeanjs/oxc-config": "^0.2.3",
|
|
55
|
+
"@types/node": "^26.1.1",
|
|
56
|
+
"oxfmt": "^0.60.0",
|
|
57
|
+
"oxlint": "^1.75.0",
|
|
58
|
+
"tsdown": "^0.22.14",
|
|
59
|
+
"tsx": "^4.23.1",
|
|
60
|
+
"typescript": "^7.0.2",
|
|
61
|
+
"vite-plus": "0.2.6"
|
|
69
62
|
},
|
|
70
63
|
"scripts": {
|
|
71
|
-
"build": "
|
|
72
|
-
"cleanup": "soy cleanup",
|
|
64
|
+
"build": "vp pack",
|
|
73
65
|
"commit": "soy git-commit",
|
|
74
66
|
"commit:zh": "soy git-commit -l=zh-cn",
|
|
75
|
-
"
|
|
76
|
-
"
|
|
67
|
+
"fmt": "vp fmt",
|
|
68
|
+
"lint": "vp lint",
|
|
77
69
|
"publish-pkg": "pnpm -r publish --access public",
|
|
78
70
|
"release": "soy release",
|
|
79
|
-
"stub": "pnpm -r run stub",
|
|
80
71
|
"typecheck": "tsc --noEmit --skipLibCheck",
|
|
81
|
-
"upkg": "soy ncu"
|
|
82
|
-
"rei": "pnpm cleanup && pnpm i"
|
|
72
|
+
"upkg": "soy ncu"
|
|
83
73
|
}
|
|
84
74
|
}
|