@soybeanjs/cli 1.6.0 → 1.6.2

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.
Files changed (2) hide show
  1. package/dist/index.js +13 -8
  2. package/package.json +24 -25
package/dist/index.js CHANGED
@@ -5,13 +5,15 @@ import { readFileSync } from "node:fs";
5
5
  import enquirer from "enquirer";
6
6
  import { bgRed, green, red, yellow } from "kolorist";
7
7
  import { rimraf } from "rimraf";
8
+ import { join } from "path";
9
+ import { existsSync } from "fs";
8
10
  import { generateChangelog, generateTotalChangelog } from "@soybeanjs/changelog";
9
11
  import { versionBump } from "bumpp";
10
- import process from "node:process";
12
+ import process$1 from "node:process";
11
13
  import { loadConfig } from "c12";
12
14
 
13
15
  //#region package.json
14
- var version = "1.6.0";
16
+ var version = "1.6.2";
15
17
 
16
18
  //#endregion
17
19
  //#region src/shared/index.ts
@@ -159,19 +161,22 @@ async function cleanup(paths) {
159
161
  //#endregion
160
162
  //#region src/command/ncu.ts
161
163
  async function ncu(args = ["--deep", "-u"]) {
162
- execCommand("pnpx", ["npm-check-updates", ...args], { stdio: "inherit" });
164
+ await execCommand("pnpm", ["npm-check-updates", ...args], { stdio: "inherit" });
163
165
  }
164
166
 
165
167
  //#endregion
166
168
  //#region src/command/changelog.ts
167
169
  async function genChangelog(options, total = false) {
170
+ const changelogPath = join(process.cwd(), "CHANGELOG.md");
171
+ const hasChangelog = existsSync(changelogPath);
168
172
  if (total) await generateTotalChangelog(options);
169
173
  else await generateChangelog(options);
174
+ if (!hasChangelog) await execCommand("git", [`add ${changelogPath}`]);
170
175
  }
171
176
 
172
177
  //#endregion
173
178
  //#region src/command/release.ts
174
- async function release(execute = "pnpx soy changelog", push = true) {
179
+ async function release(execute = "pnpm soy changelog", push = true) {
175
180
  await versionBump({
176
181
  files: ["**/package.json", "!**/node_modules"],
177
182
  execute,
@@ -185,7 +190,7 @@ async function release(execute = "pnpx soy changelog", push = true) {
185
190
  //#endregion
186
191
  //#region src/config/index.ts
187
192
  const defaultOptions = {
188
- cwd: process.cwd(),
193
+ cwd: process$1.cwd(),
189
194
  cleanupDirs: [
190
195
  "**/dist",
191
196
  "**/package-lock.json",
@@ -207,7 +212,7 @@ const defaultOptions = {
207
212
  /^Auto-merged (.*?) into (.*)/
208
213
  ]
209
214
  };
210
- async function loadCliOptions(overrides, cwd = process.cwd()) {
215
+ async function loadCliOptions(overrides, cwd = process$1.cwd()) {
211
216
  const { config } = await loadConfig({
212
217
  name: "soybean",
213
218
  defaults: defaultOptions,
@@ -223,7 +228,7 @@ async function loadCliOptions(overrides, cwd = process.cwd()) {
223
228
  async function setupCli() {
224
229
  const cliOptions = await loadCliOptions();
225
230
  const cli = cac("soybean");
226
- cli.version(version).option("-e, --execute [command]", "Execute additional command after bumping and before git commit. Defaults to 'pnpx soy changelog'").option("-p, --push", "Indicates whether to push the git commit and tag").option("-t, --total", "Generate changelog by total tags").option("-c, --cleanupDir <dir>", "The glob pattern of dirs to cleanup, If not set, it will use the default value, Multiple values use \",\" to separate them").option("-l, --lang <lang>", "display lang of cli", {
231
+ cli.version(version).option("-e, --execute [command]", "Execute additional command after bumping and before git commit. Defaults to 'pnpm soy changelog'").option("-p, --push", "Indicates whether to push the git commit and tag").option("-t, --total", "Generate changelog by total tags").option("-c, --cleanupDir <dir>", "The glob pattern of dirs to cleanup, If not set, it will use the default value, Multiple values use \",\" to separate them").option("-l, --lang <lang>", "display lang of cli", {
227
232
  default: "en-us",
228
233
  type: [String]
229
234
  }).help();
@@ -243,7 +248,7 @@ async function setupCli() {
243
248
  }
244
249
  },
245
250
  "update-pkg": {
246
- desc: "equal to command \"ncu\"",
251
+ desc: "it is deprecated, use \"ncu\" command instead, it will be removed in future version",
247
252
  action: async () => {
248
253
  await ncu();
249
254
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soybeanjs/cli",
3
- "version": "1.6.0",
3
+ "version": "1.6.2",
4
4
  "description": "SoybeanJS's command line tools",
5
5
  "homepage": "https://github.com/soybeanjs/cli",
6
6
  "bugs": {
@@ -37,28 +37,28 @@
37
37
  "registry": "https://registry.npmjs.org/"
38
38
  },
39
39
  "dependencies": {
40
- "@soybeanjs/changelog": "0.4.3",
41
- "bumpp": "10.4.1",
42
- "c12": "3.3.3",
43
- "cac": "7.0.0",
44
- "consola": "3.4.2",
45
- "enquirer": "2.4.1",
46
- "execa": "9.6.1",
47
- "kolorist": "1.8.0",
48
- "npm-check-updates": "19.6.3",
49
- "rimraf": "6.1.3",
50
- "tinyglobby": "0.2.15"
40
+ "@soybeanjs/changelog": "^0.4.4",
41
+ "bumpp": "^11.0.1",
42
+ "c12": "^3.3.3",
43
+ "cac": "^7.0.0",
44
+ "consola": "^3.4.2",
45
+ "enquirer": "^2.4.1",
46
+ "execa": "^9.6.1",
47
+ "kolorist": "^1.8.0",
48
+ "npm-check-updates": "^19.6.5",
49
+ "rimraf": "^6.1.3",
50
+ "tinyglobby": "^0.2.15"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@soybeanjs/cli": "link:",
54
- "@types/node": "25.3.3",
55
- "lint-staged": "16.3.2",
56
- "oxfmt": "^0.36.0",
57
- "oxlint": "^1.51.0",
58
- "simple-git-hooks": "2.13.1",
59
- "tsdown": "0.21.0",
60
- "tsx": "4.21.0",
61
- "typescript": "5.9.3"
54
+ "@types/node": "^25.5.0",
55
+ "lint-staged": "^16.4.0",
56
+ "oxfmt": "^0.41.0",
57
+ "oxlint": "^1.56.0",
58
+ "simple-git-hooks": "^2.13.1",
59
+ "tsdown": "^0.21.4",
60
+ "tsx": "^4.21.0",
61
+ "typescript": "^5.9.3"
62
62
  },
63
63
  "simple-git-hooks": {
64
64
  "commit-msg": "pnpm soy git-commit-verify",
@@ -68,18 +68,17 @@
68
68
  "*": "oxlint --fix && oxfmt"
69
69
  },
70
70
  "scripts": {
71
- "build": "tsdown && pnpm build-pkg",
72
- "build-pkg": "pnpm -r --filter='./packages/*' run build",
71
+ "build": "tsdown",
73
72
  "cleanup": "soy cleanup",
74
73
  "commit": "soy git-commit",
75
74
  "commit:zh": "soy git-commit -l=zh-cn",
76
75
  "lint": "oxlint --fix",
77
76
  "fmt": "oxfmt",
78
77
  "publish-pkg": "pnpm -r publish --access public",
79
- "release": "soy release -e 'pnpm release-execute'",
80
- "release-execute": "tsx ./scripts/release.ts && pnpm soy changelog",
78
+ "release": "soy release",
81
79
  "stub": "pnpm -r run stub",
82
80
  "typecheck": "tsc --noEmit --skipLibCheck",
83
- "upkg": "soy update-pkg"
81
+ "upkg": "soy ncu",
82
+ "rei": "pnpm cleanup && pnpm i"
84
83
  }
85
84
  }