@soybeanjs/cli 0.2.5 → 0.2.9

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 (3) hide show
  1. package/bin/index.js +33 -27
  2. package/bin/index.mjs +33 -27
  3. package/package.json +3 -4
package/bin/index.js CHANGED
@@ -271,7 +271,7 @@ var import_kolorist2 = require("kolorist");
271
271
  // package.json
272
272
  var package_default = {
273
273
  name: "@soybeanjs/cli",
274
- version: "0.2.0",
274
+ version: "0.2.6",
275
275
  description: "SoybeanJS's command lint tools",
276
276
  author: {
277
277
  name: "Soybean",
@@ -303,12 +303,11 @@ var package_default = {
303
303
  commit: "soy git-commit",
304
304
  cleanup: "soy cleanup",
305
305
  "update-pkg": "soy update-pkg",
306
- "update-version": 'bumpp package.json --execute="pnpm gen-log" --commit --all --push --tag',
307
- "publish-pkg": "pnpm -r publish --access public",
308
- release: "pnpm update-version && pnpm publish-pkg",
309
- "gen-log": "conventional-changelog -p angular -i CHANGELOG.md -s"
306
+ release: "soy release",
307
+ "publish-pkg": "pnpm -r publish --access public"
310
308
  },
311
309
  dependencies: {
310
+ changelogen: "0.5.3",
312
311
  commander: "10.0.1",
313
312
  enquirer: "2.3.6",
314
313
  execa: "7.1.1",
@@ -320,8 +319,6 @@ var package_default = {
320
319
  devDependencies: {
321
320
  "@soybeanjs/cli": "link:",
322
321
  "@types/node": "^20.2.3",
323
- bumpp: "9.1.0",
324
- "conventional-changelog-cli": "^2.2.2",
325
322
  eslint: "8.41.0",
326
323
  "eslint-config-soybeanjs": "0.3.8",
327
324
  "lint-staged": "13.2.2",
@@ -331,22 +328,22 @@ var package_default = {
331
328
  typescript: "5.0.4"
332
329
  },
333
330
  "simple-git-hooks": {
334
- "commit-msg": "pnpm soybean git-commit-verify",
335
- "pre-commit": "pnpm exec lint-staged --concurrent false"
331
+ "commit-msg": "pnpm soy git-commit-verify",
332
+ "pre-commit": "pnpm lint-staged"
336
333
  },
337
334
  "lint-staged": {
338
- "*.{js,jsx,mjs,cjs,json,ts,tsx,mts,cts,vue,svelte,astro}": [
335
+ "*.{js,json,ts}": [
339
336
  "eslint . --fix"
340
337
  ]
341
338
  }
342
339
  };
343
340
 
344
- // src/command/git/commit.ts
341
+ // src/command/git-commit.ts
345
342
  var import_enquirer = __toESM(require("enquirer"));
346
343
  var import_execa = require("execa");
347
344
 
348
- // src/command/git/config.ts
349
- var types = [
345
+ // src/configs/git.ts
346
+ var gitCommitTypes = [
350
347
  { value: "init", title: "init: \u9879\u76EE\u521D\u59CB\u5316" },
351
348
  { value: "feat", title: "feat: \u6DFB\u52A0\u65B0\u7279\u6027" },
352
349
  { value: "fix", title: "fix: \u4FEE\u590Dbug" },
@@ -355,11 +352,12 @@ var types = [
355
352
  { value: "refactor", title: "refactor: \u4EE3\u7801\u91CD\u6784\uFF0C\u6CA1\u6709\u52A0\u65B0\u529F\u80FD\u6216\u8005\u4FEE\u590Dbug" },
356
353
  { value: "perf", title: "perf: \u4F18\u5316\u76F8\u5173\uFF0C\u6BD4\u5982\u63D0\u5347\u6027\u80FD\u3001\u4F53\u9A8C" },
357
354
  { value: "test", title: "test: \u6DFB\u52A0\u6D4B\u8BD5\u7528\u4F8B" },
355
+ { value: "build", title: "build: \u4F9D\u8D56\u76F8\u5173\u7684\u5185\u5BB9" },
358
356
  { value: "ci", title: "ci: CI\u914D\u7F6E\u76F8\u5173\uFF0C\u4F8B\u5982\u5BF9k8s\uFF0Cdocker\u7684\u914D\u7F6E\u6587\u4EF6\u7684\u4FEE\u6539" },
359
357
  { value: "chore", title: "chore: \u6539\u53D8\u6784\u5EFA\u6D41\u7A0B\u3001\u6216\u8005\u589E\u52A0\u4F9D\u8D56\u5E93\u3001\u5DE5\u5177\u7B49" },
360
358
  { value: "revert", title: "revert: \u56DE\u6EDA\u5230\u4E0A\u4E00\u4E2A\u7248\u672C" }
361
359
  ];
362
- var scopes = [
360
+ var gitCommitScopes = [
363
361
  ["projects", "\u9879\u76EE\u642D\u5EFA"],
364
362
  ["components", "\u7EC4\u4EF6\u76F8\u5173"],
365
363
  ["hooks", "hook \u76F8\u5173"],
@@ -377,20 +375,20 @@ var scopes = [
377
375
  };
378
376
  });
379
377
 
380
- // src/command/git/commit.ts
378
+ // src/command/git-commit.ts
381
379
  async function gitCommit() {
382
380
  const result = await import_enquirer.default.prompt([
383
381
  {
384
382
  name: "types",
385
383
  type: "select",
386
384
  message: "\u8BF7\u9009\u62E9\u63D0\u4EA4\u7684\u7C7B\u578B",
387
- choices: types.map((item) => ({ name: item.value, message: item.title }))
385
+ choices: gitCommitTypes.map((item) => ({ name: item.value, message: item.title }))
388
386
  },
389
387
  {
390
388
  name: "scopes",
391
389
  type: "select",
392
390
  message: "\u9009\u62E9\u4E00\u4E2Ascope",
393
- choices: scopes.map((item) => ({ name: item.value, message: item.title }))
391
+ choices: gitCommitScopes.map((item) => ({ name: item.value, message: item.title }))
394
392
  },
395
393
  {
396
394
  name: "description",
@@ -402,17 +400,16 @@ async function gitCommit() {
402
400
  (0, import_execa.execa)("git", ["commit", "-m", commitMsg], { stdio: "inherit" });
403
401
  }
404
402
 
405
- // src/command/git/verify-commit.ts
403
+ // src/command/git-verify.ts
406
404
  var import_fs = require("fs");
407
405
  var import_kolorist = require("kolorist");
408
- function verifyGitCommit() {
406
+ function gitCommitVerify() {
409
407
  const gitMsgPath = "./.git/COMMIT_EDITMSG";
410
408
  const commitMsg = (0, import_fs.readFileSync)(gitMsgPath, "utf-8").trim();
411
- const RELEASE_MSG = "chore: release";
412
- const REG_EXP = new RegExp(
413
- `(${types.map((item) => item.value).join("|")})\\((${scopes.map((item) => item.value).join("|")})\\):\\s.{1,50}`
414
- );
415
- if (!REG_EXP.test(commitMsg) && !commitMsg.includes(RELEASE_MSG)) {
409
+ const types2 = gitCommitTypes.map((item) => item.value).join("|");
410
+ const scopes = gitCommitScopes.map((item) => item.value).join("|");
411
+ const REG_EXP = new RegExp(`(${types2})!*(\\((${scopes})\\))*!*:\\s.{1,100}`);
412
+ if (!REG_EXP.test(commitMsg)) {
416
413
  throw new Error(
417
414
  `${(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)(
418
415
  "\u63A8\u8350\u4F7F\u7528\u547D\u4EE4 pnpm commit \u751F\u6210\u7B26\u5408\u89C4\u8303\u7684Git\u63D0\u4EA4\u4FE1\u606F"
@@ -554,8 +551,8 @@ var unescape = (s, { windowsPathsNoEscape = false } = {}) => {
554
551
  };
555
552
 
556
553
  // node_modules/.pnpm/minimatch@9.0.1/node_modules/minimatch/dist/mjs/ast.js
557
- var types2 = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]);
558
- var isExtglobType = (c) => types2.has(c);
554
+ var types = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]);
555
+ var isExtglobType = (c) => types.has(c);
559
556
  var startNoTraversal = "(?!\\.\\.?(?:$|/))";
560
557
  var startNoDot = "(?!\\.)";
561
558
  var addPatternStart = /* @__PURE__ */ new Set(["[", "."]);
@@ -6367,12 +6364,18 @@ function prettierFormat() {
6367
6364
  });
6368
6365
  }
6369
6366
 
6367
+ // src/scripts/release.ts
6368
+ var import_execa5 = require("execa");
6369
+ async function release() {
6370
+ await (0, import_execa5.execa)("npx", ["changelogen", "--release", "--push", "--no-github"], { stdio: "inherit" });
6371
+ }
6372
+
6370
6373
  // src/index.ts
6371
6374
  import_commander.program.command("git-commit").description("\u751F\u6210\u7B26\u5408 Angular \u89C4\u8303\u7684 git commit").action(() => {
6372
6375
  gitCommit();
6373
6376
  });
6374
6377
  import_commander.program.command("git-commit-verify").description("\u6821\u9A8Cgit\u7684commit\u662F\u5426\u7B26\u5408 Angular \u89C4\u8303").action(() => {
6375
- verifyGitCommit();
6378
+ gitCommitVerify();
6376
6379
  });
6377
6380
  import_commander.program.command("cleanup").description("\u6E05\u7A7A\u4F9D\u8D56\u548C\u6784\u5EFA\u4EA7\u7269").action(() => {
6378
6381
  cleanup();
@@ -6386,5 +6389,8 @@ import_commander.program.command("update-pkg").description("\u5347\u7EA7\u4F9D\u
6386
6389
  import_commander.program.command("prettier-format").description("prettier\u683C\u5F0F\u5316").action(() => {
6387
6390
  prettierFormat();
6388
6391
  });
6392
+ import_commander.program.command("release").description("\u7248\u672C\u53D1\u5E03").action(() => {
6393
+ release();
6394
+ });
6389
6395
  import_commander.program.version(package_default.version).description((0, import_kolorist2.blue)("soybean alias soy\n\nhttps://github.com/soybeanjs/cli"));
6390
6396
  import_commander.program.parse(process.argv);
package/bin/index.mjs CHANGED
@@ -270,7 +270,7 @@ import { blue } from "kolorist";
270
270
  // package.json
271
271
  var package_default = {
272
272
  name: "@soybeanjs/cli",
273
- version: "0.2.0",
273
+ version: "0.2.6",
274
274
  description: "SoybeanJS's command lint tools",
275
275
  author: {
276
276
  name: "Soybean",
@@ -302,12 +302,11 @@ var package_default = {
302
302
  commit: "soy git-commit",
303
303
  cleanup: "soy cleanup",
304
304
  "update-pkg": "soy update-pkg",
305
- "update-version": 'bumpp package.json --execute="pnpm gen-log" --commit --all --push --tag',
306
- "publish-pkg": "pnpm -r publish --access public",
307
- release: "pnpm update-version && pnpm publish-pkg",
308
- "gen-log": "conventional-changelog -p angular -i CHANGELOG.md -s"
305
+ release: "soy release",
306
+ "publish-pkg": "pnpm -r publish --access public"
309
307
  },
310
308
  dependencies: {
309
+ changelogen: "0.5.3",
311
310
  commander: "10.0.1",
312
311
  enquirer: "2.3.6",
313
312
  execa: "7.1.1",
@@ -319,8 +318,6 @@ var package_default = {
319
318
  devDependencies: {
320
319
  "@soybeanjs/cli": "link:",
321
320
  "@types/node": "^20.2.3",
322
- bumpp: "9.1.0",
323
- "conventional-changelog-cli": "^2.2.2",
324
321
  eslint: "8.41.0",
325
322
  "eslint-config-soybeanjs": "0.3.8",
326
323
  "lint-staged": "13.2.2",
@@ -330,22 +327,22 @@ var package_default = {
330
327
  typescript: "5.0.4"
331
328
  },
332
329
  "simple-git-hooks": {
333
- "commit-msg": "pnpm soybean git-commit-verify",
334
- "pre-commit": "pnpm exec lint-staged --concurrent false"
330
+ "commit-msg": "pnpm soy git-commit-verify",
331
+ "pre-commit": "pnpm lint-staged"
335
332
  },
336
333
  "lint-staged": {
337
- "*.{js,jsx,mjs,cjs,json,ts,tsx,mts,cts,vue,svelte,astro}": [
334
+ "*.{js,json,ts}": [
338
335
  "eslint . --fix"
339
336
  ]
340
337
  }
341
338
  };
342
339
 
343
- // src/command/git/commit.ts
340
+ // src/command/git-commit.ts
344
341
  import enquirer from "enquirer";
345
342
  import { execa } from "execa";
346
343
 
347
- // src/command/git/config.ts
348
- var types = [
344
+ // src/configs/git.ts
345
+ var gitCommitTypes = [
349
346
  { value: "init", title: "init: \u9879\u76EE\u521D\u59CB\u5316" },
350
347
  { value: "feat", title: "feat: \u6DFB\u52A0\u65B0\u7279\u6027" },
351
348
  { value: "fix", title: "fix: \u4FEE\u590Dbug" },
@@ -354,11 +351,12 @@ var types = [
354
351
  { value: "refactor", title: "refactor: \u4EE3\u7801\u91CD\u6784\uFF0C\u6CA1\u6709\u52A0\u65B0\u529F\u80FD\u6216\u8005\u4FEE\u590Dbug" },
355
352
  { value: "perf", title: "perf: \u4F18\u5316\u76F8\u5173\uFF0C\u6BD4\u5982\u63D0\u5347\u6027\u80FD\u3001\u4F53\u9A8C" },
356
353
  { value: "test", title: "test: \u6DFB\u52A0\u6D4B\u8BD5\u7528\u4F8B" },
354
+ { value: "build", title: "build: \u4F9D\u8D56\u76F8\u5173\u7684\u5185\u5BB9" },
357
355
  { value: "ci", title: "ci: CI\u914D\u7F6E\u76F8\u5173\uFF0C\u4F8B\u5982\u5BF9k8s\uFF0Cdocker\u7684\u914D\u7F6E\u6587\u4EF6\u7684\u4FEE\u6539" },
358
356
  { value: "chore", title: "chore: \u6539\u53D8\u6784\u5EFA\u6D41\u7A0B\u3001\u6216\u8005\u589E\u52A0\u4F9D\u8D56\u5E93\u3001\u5DE5\u5177\u7B49" },
359
357
  { value: "revert", title: "revert: \u56DE\u6EDA\u5230\u4E0A\u4E00\u4E2A\u7248\u672C" }
360
358
  ];
361
- var scopes = [
359
+ var gitCommitScopes = [
362
360
  ["projects", "\u9879\u76EE\u642D\u5EFA"],
363
361
  ["components", "\u7EC4\u4EF6\u76F8\u5173"],
364
362
  ["hooks", "hook \u76F8\u5173"],
@@ -376,20 +374,20 @@ var scopes = [
376
374
  };
377
375
  });
378
376
 
379
- // src/command/git/commit.ts
377
+ // src/command/git-commit.ts
380
378
  async function gitCommit() {
381
379
  const result = await enquirer.prompt([
382
380
  {
383
381
  name: "types",
384
382
  type: "select",
385
383
  message: "\u8BF7\u9009\u62E9\u63D0\u4EA4\u7684\u7C7B\u578B",
386
- choices: types.map((item) => ({ name: item.value, message: item.title }))
384
+ choices: gitCommitTypes.map((item) => ({ name: item.value, message: item.title }))
387
385
  },
388
386
  {
389
387
  name: "scopes",
390
388
  type: "select",
391
389
  message: "\u9009\u62E9\u4E00\u4E2Ascope",
392
- choices: scopes.map((item) => ({ name: item.value, message: item.title }))
390
+ choices: gitCommitScopes.map((item) => ({ name: item.value, message: item.title }))
393
391
  },
394
392
  {
395
393
  name: "description",
@@ -401,17 +399,16 @@ async function gitCommit() {
401
399
  execa("git", ["commit", "-m", commitMsg], { stdio: "inherit" });
402
400
  }
403
401
 
404
- // src/command/git/verify-commit.ts
402
+ // src/command/git-verify.ts
405
403
  import { readFileSync } from "fs";
406
404
  import { bgRed, red, green } from "kolorist";
407
- function verifyGitCommit() {
405
+ function gitCommitVerify() {
408
406
  const gitMsgPath = "./.git/COMMIT_EDITMSG";
409
407
  const commitMsg = readFileSync(gitMsgPath, "utf-8").trim();
410
- const RELEASE_MSG = "chore: release";
411
- const REG_EXP = new RegExp(
412
- `(${types.map((item) => item.value).join("|")})\\((${scopes.map((item) => item.value).join("|")})\\):\\s.{1,50}`
413
- );
414
- if (!REG_EXP.test(commitMsg) && !commitMsg.includes(RELEASE_MSG)) {
408
+ const types2 = gitCommitTypes.map((item) => item.value).join("|");
409
+ const scopes = gitCommitScopes.map((item) => item.value).join("|");
410
+ const REG_EXP = new RegExp(`(${types2})!*(\\((${scopes})\\))*!*:\\s.{1,100}`);
411
+ if (!REG_EXP.test(commitMsg)) {
415
412
  throw new Error(
416
413
  `${bgRed(" ERROR ")} ${red("Git\u63D0\u4EA4\u4FE1\u606F\u4E0D\u7B26\u5408 Angular \u89C4\u8303!\n\n")}${green(
417
414
  "\u63A8\u8350\u4F7F\u7528\u547D\u4EE4 pnpm commit \u751F\u6210\u7B26\u5408\u89C4\u8303\u7684Git\u63D0\u4EA4\u4FE1\u606F"
@@ -553,8 +550,8 @@ var unescape = (s, { windowsPathsNoEscape = false } = {}) => {
553
550
  };
554
551
 
555
552
  // node_modules/.pnpm/minimatch@9.0.1/node_modules/minimatch/dist/mjs/ast.js
556
- var types2 = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]);
557
- var isExtglobType = (c) => types2.has(c);
553
+ var types = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]);
554
+ var isExtglobType = (c) => types.has(c);
558
555
  var startNoTraversal = "(?!\\.\\.?(?:$|/))";
559
556
  var startNoDot = "(?!\\.)";
560
557
  var addPatternStart = /* @__PURE__ */ new Set(["[", "."]);
@@ -6366,12 +6363,18 @@ function prettierFormat() {
6366
6363
  });
6367
6364
  }
6368
6365
 
6366
+ // src/scripts/release.ts
6367
+ import { execa as execa5 } from "execa";
6368
+ async function release() {
6369
+ await execa5("npx", ["changelogen", "--release", "--push", "--no-github"], { stdio: "inherit" });
6370
+ }
6371
+
6369
6372
  // src/index.ts
6370
6373
  program.command("git-commit").description("\u751F\u6210\u7B26\u5408 Angular \u89C4\u8303\u7684 git commit").action(() => {
6371
6374
  gitCommit();
6372
6375
  });
6373
6376
  program.command("git-commit-verify").description("\u6821\u9A8Cgit\u7684commit\u662F\u5426\u7B26\u5408 Angular \u89C4\u8303").action(() => {
6374
- verifyGitCommit();
6377
+ gitCommitVerify();
6375
6378
  });
6376
6379
  program.command("cleanup").description("\u6E05\u7A7A\u4F9D\u8D56\u548C\u6784\u5EFA\u4EA7\u7269").action(() => {
6377
6380
  cleanup();
@@ -6385,5 +6388,8 @@ program.command("update-pkg").description("\u5347\u7EA7\u4F9D\u8D56").action(()
6385
6388
  program.command("prettier-format").description("prettier\u683C\u5F0F\u5316").action(() => {
6386
6389
  prettierFormat();
6387
6390
  });
6391
+ program.command("release").description("\u7248\u672C\u53D1\u5E03").action(() => {
6392
+ release();
6393
+ });
6388
6394
  program.version(package_default.version).description(blue("soybean alias soy\n\nhttps://github.com/soybeanjs/cli"));
6389
6395
  program.parse(process.argv);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soybeanjs/cli",
3
- "version": "0.2.5",
3
+ "version": "0.2.9",
4
4
  "description": "SoybeanJS's command lint tools",
5
5
  "author": {
6
6
  "name": "Soybean",
@@ -26,6 +26,7 @@
26
26
  "bin"
27
27
  ],
28
28
  "dependencies": {
29
+ "changelogen": "0.5.3",
29
30
  "commander": "10.0.1",
30
31
  "enquirer": "2.3.6",
31
32
  "execa": "7.1.1",
@@ -37,7 +38,6 @@
37
38
  "devDependencies": {
38
39
  "@soybeanjs/cli": "link:",
39
40
  "@types/node": "^20.2.3",
40
- "bumpp": "^9.1.0",
41
41
  "eslint": "8.41.0",
42
42
  "eslint-config-soybeanjs": "0.3.8",
43
43
  "lint-staged": "13.2.2",
@@ -62,8 +62,7 @@
62
62
  "commit": "soy git-commit",
63
63
  "cleanup": "soy cleanup",
64
64
  "update-pkg": "soy update-pkg",
65
- "update-version": "bumpp package.json",
66
65
  "publish-pkg": "pnpm -r publish --access public",
67
- "release": "pnpm update-version && pnpm publish-pkg"
66
+ "release": "soy release && pnpm publish-pkg"
68
67
  }
69
68
  }