@soybeanjs/cli 1.8.0 → 1.8.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.d.ts CHANGED
@@ -67,7 +67,7 @@ interface CliOption {
67
67
  */
68
68
  cleanupDirs: string[];
69
69
  /**
70
- * Npm-check-updates command args
70
+ * npm-check-updates command args
71
71
  *
72
72
  * If not set, soybean-cli will resolve workspace package.json files automatically and fall back to package.json in single-package repos.
73
73
  */
package/dist/index.js CHANGED
@@ -4,18 +4,16 @@ import { existsSync, readFileSync, writeFileSync } from "node:fs";
4
4
  import process$1 from "node:process";
5
5
  import { loadConfig } from "c12";
6
6
  import { bgRed, green, red, yellow } from "kolorist";
7
- import path, { join, posix } from "node:path";
7
+ import path from "node:path";
8
8
  import enquirer from "enquirer";
9
9
  import { rimraf } from "rimraf";
10
- import { readFile } from "node:fs/promises";
11
- import { glob } from "tinyglobby";
12
10
  import { existsSync as existsSync$1 } from "fs";
13
- import { join as join$1 } from "path";
11
+ import { join } from "path";
14
12
  import { generateChangelog, generateTotalChangelog } from "@soybeanjs/changelog";
15
13
  import { versionBump } from "bumpp";
16
14
  import { consola } from "consola";
17
15
  //#region package.json
18
- var version = "1.8.0";
16
+ var version = "1.8.1";
19
17
  //#endregion
20
18
  //#region src/locales/index.ts
21
19
  const locales = {
@@ -255,73 +253,13 @@ async function cleanup(paths) {
255
253
  }
256
254
  //#endregion
257
255
  //#region src/command/ncu.ts
258
- async function ncu(args = []) {
259
- await execCommand("pnpm", ["npm-check-updates", ...args.length ? args : await resolveDefaultNcuArgs()], { stdio: "inherit" });
260
- }
261
- function parsePnpmWorkspacePackages(content) {
262
- const lines = content.split(/\r?\n/u);
263
- const packages = [];
264
- let inPackages = false;
265
- for (const line of lines) {
266
- const trimmedLine = line.trim();
267
- if (!inPackages) {
268
- if (trimmedLine === "packages:") inPackages = true;
269
- continue;
270
- }
271
- if (!trimmedLine || trimmedLine.startsWith("#")) continue;
272
- if (/^\S/u.test(line)) break;
273
- const match = line.match(/^\s*-\s*['"]?(.+?)['"]?\s*$/u);
274
- if (match?.[1]) packages.push(match[1]);
275
- }
276
- return packages;
277
- }
278
- function resolveWorkspacePatterns(packageJson, pnpmWorkspaceContent) {
279
- const workspaces = Array.isArray(packageJson?.workspaces) ? packageJson.workspaces : packageJson?.workspaces?.packages ?? [];
280
- const pnpmWorkspacePackages = pnpmWorkspaceContent ? parsePnpmWorkspacePackages(pnpmWorkspaceContent) : [];
281
- return [.../* @__PURE__ */ new Set([...workspaces, ...pnpmWorkspacePackages])];
282
- }
283
- function toPackageFilePattern(pattern) {
284
- const normalizedPattern = pattern.trim();
285
- if (!normalizedPattern) return "";
286
- const isNegated = normalizedPattern.startsWith("!");
287
- const cleanPattern = (isNegated ? normalizedPattern.slice(1) : normalizedPattern).replace(/\/$/u, "");
288
- const packageFilePattern = cleanPattern.endsWith("package.json") ? cleanPattern : posix.join(cleanPattern, "package.json");
289
- return isNegated ? `!${packageFilePattern}` : packageFilePattern;
290
- }
291
- async function resolveDefaultNcuArgs(cwd = process$1.cwd()) {
292
- const [packageJsonContent, pnpmWorkspaceContent] = await Promise.all([readFile(join(cwd, "package.json"), "utf8").catch(() => null), readFile(join(cwd, "pnpm-workspace.yaml"), "utf8").catch(() => null)]);
293
- const workspacePatterns = resolveWorkspacePatterns(packageJsonContent ? JSON.parse(packageJsonContent) : null, pnpmWorkspaceContent).map(toPackageFilePattern).filter(Boolean);
294
- if (!workspacePatterns.length) return [
295
- "-u",
296
- "--packageFile",
297
- "package.json"
298
- ];
299
- const packageFiles = await glob(["package.json", ...workspacePatterns], {
300
- cwd,
301
- followSymbolicLinks: false,
302
- onlyFiles: true
303
- });
304
- const uniquePackageFiles = [...new Set(packageFiles)].sort((left, right) => {
305
- if (left === "package.json") return -1;
306
- if (right === "package.json") return 1;
307
- return left.localeCompare(right);
308
- });
309
- if (!uniquePackageFiles.length) return [
310
- "-u",
311
- "--packageFile",
312
- "package.json"
313
- ];
314
- if (uniquePackageFiles.length === 1) return [
315
- "-u",
316
- "--packageFile",
317
- uniquePackageFiles[0]
318
- ];
319
- return ["-u", ...uniquePackageFiles.flatMap((file) => ["--packageFile", file])];
256
+ async function ncu(args = ["-u", "-w"]) {
257
+ await execCommand("pnpm", ["npm-check-updates", ...args], { stdio: "inherit" });
320
258
  }
321
259
  //#endregion
322
260
  //#region src/command/changelog.ts
323
261
  async function genChangelog(options, total = false) {
324
- const hasChangelog = existsSync$1(join$1(process.cwd(), "CHANGELOG.md"));
262
+ const hasChangelog = existsSync$1(join(process.cwd(), "CHANGELOG.md"));
325
263
  if (total) await generateTotalChangelog(options);
326
264
  else await generateChangelog(options);
327
265
  if (!hasChangelog) await execCommand("git", ["add", "CHANGELOG.md"]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soybeanjs/cli",
3
- "version": "1.8.0",
3
+ "version": "1.8.1",
4
4
  "description": "SoybeanJS's command line tools",
5
5
  "homepage": "https://github.com/soybeanjs/cli",
6
6
  "bugs": {
@@ -53,9 +53,6 @@
53
53
  "@soybeanjs/cli": "link:",
54
54
  "@soybeanjs/oxc-config": "^0.2.3",
55
55
  "@types/node": "^26.1.1",
56
- "oxfmt": "^0.60.0",
57
- "oxlint": "^1.75.0",
58
- "tsdown": "^0.22.14",
59
56
  "tsx": "^4.23.1",
60
57
  "typescript": "^7.0.2",
61
58
  "vite-plus": "0.2.6"
@@ -63,7 +60,6 @@
63
60
  "scripts": {
64
61
  "build": "vp pack",
65
62
  "commit": "soy git-commit",
66
- "commit:zh": "soy git-commit -l=zh-cn",
67
63
  "fmt": "vp fmt",
68
64
  "lint": "vp lint",
69
65
  "publish-pkg": "pnpm -r publish --access public",