@soybeanjs/cli 0.1.6 → 0.1.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soybeanjs/cli",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "SoybeanJS's command lint tools",
5
5
  "author": {
6
6
  "name": "Soybean",
@@ -16,40 +16,39 @@
16
16
  "url": "https://github.com/honghuangdc/soybean-cli/issues"
17
17
  },
18
18
  "bin": {
19
- "soybean": "dist/index.mjs",
20
- "soy": "dist/index.mjs"
19
+ "soybean": "bin/index.mjs",
20
+ "soy": "bin/index.mjs"
21
21
  },
22
22
  "files": [
23
- "dist"
23
+ "bin"
24
24
  ],
25
25
  "dependencies": {
26
- "commander": "^9.4.1",
27
- "execa": "5.1.1",
28
- "kolorist": "^1.6.0",
29
- "minimist": "^1.2.7",
30
- "npm-check-updates": "^16.6.2",
26
+ "commander": "^10.0.1",
27
+ "execa": "7.1.1",
28
+ "kolorist": "^1.7.0",
29
+ "minimist": "^1.2.8",
30
+ "npm-check-updates": "^16.10.9",
31
31
  "prompts": "^2.4.2",
32
- "rimraf": "^3.0.2",
33
- "zx": "^7.1.1"
32
+ "rimraf": "^5.0.0"
34
33
  },
35
34
  "devDependencies": {
36
- "@types/prompts": "^2.4.2",
37
- "bumpp": "^8.2.1",
38
- "eslint": "^8.31.0",
39
- "eslint-config-soybeanjs": "0.2.1",
40
- "esno": "^0.16.3",
41
- "lint-staged": "^13.1.0",
35
+ "@soybeanjs/cli": "link:",
36
+ "@types/prompts": "^2.4.4",
37
+ "bumpp": "^9.1.0",
38
+ "eslint": "^8.39.0",
39
+ "eslint-config-soybeanjs": "0.3.3",
40
+ "lint-staged": "^13.2.1",
42
41
  "simple-git-hooks": "^2.8.1",
43
- "tsup": "^6.5.0",
44
- "typescript": "^4.9.4",
45
- "@soybeanjs/cli": "0.1.6"
42
+ "tsup": "^6.7.0",
43
+ "tsx": "^3.12.6",
44
+ "typescript": "^5.0.4"
46
45
  },
47
46
  "simple-git-hooks": {
48
47
  "commit-msg": "pnpm soybean git-commit-verify",
49
48
  "pre-commit": "pnpm exec lint-staged --concurrent false"
50
49
  },
51
50
  "lint-staged": {
52
- "*": [
51
+ "*.{js,jsx,mjs,cjs,json,ts,tsx,mts,cts,vue,svelte,astro}": [
53
52
  "eslint . --fix"
54
53
  ]
55
54
  },
@@ -59,6 +58,7 @@
59
58
  "scripts": {
60
59
  "build": "tsup",
61
60
  "lint": "eslint . --fix",
61
+ "format": "soy prettier-format",
62
62
  "commit": "soy git-commit",
63
63
  "cleanup": "soy cleanup",
64
64
  "update-pkg": "soy update-pkg",
package/dist/index.d.ts DELETED
@@ -1 +0,0 @@
1
- #!/usr/bin/env node
package/dist/index.js DELETED
@@ -1,216 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- var __create = Object.create;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
18
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
19
- mod
20
- ));
21
-
22
- // src/index.ts
23
- var import_commander = require("commander");
24
- var import_kolorist2 = require("kolorist");
25
-
26
- // package.json
27
- var package_default = {
28
- name: "@soybeanjs/cli",
29
- version: "0.1.5",
30
- description: "SoybeanJS's command lint tools",
31
- author: {
32
- name: "Soybean",
33
- email: "honghuangdc@gmail.com",
34
- url: "https://github.com/honghuangdc"
35
- },
36
- license: "MIT",
37
- homepage: "https://github.com/honghuangdc/soybean-cli",
38
- repository: {
39
- url: "https://github.com/honghuangdc/soybean-cli.git"
40
- },
41
- bugs: {
42
- url: "https://github.com/honghuangdc/soybean-cli/issues"
43
- },
44
- bin: {
45
- soybean: "dist/index.mjs",
46
- soy: "dist/index.mjs"
47
- },
48
- files: [
49
- "dist"
50
- ],
51
- scripts: {
52
- build: "tsup",
53
- lint: "eslint . --fix",
54
- commit: "soy git-commit",
55
- cleanup: "soy cleanup",
56
- "update-pkg": "soy update-pkg",
57
- "update-version": "bumpp package.json",
58
- "publish-pkg": "pnpm -r publish --access public",
59
- release: "pnpm update-version && pnpm publish-pkg"
60
- },
61
- dependencies: {
62
- commander: "^9.4.1",
63
- execa: "5.1.1",
64
- kolorist: "^1.6.0",
65
- minimist: "^1.2.7",
66
- "npm-check-updates": "^16.6.2",
67
- prompts: "^2.4.2",
68
- rimraf: "^3.0.2",
69
- zx: "^7.1.1"
70
- },
71
- devDependencies: {
72
- "@soybeanjs/cli": "workspace:*",
73
- "@types/prompts": "^2.4.2",
74
- bumpp: "^8.2.1",
75
- eslint: "^8.31.0",
76
- "eslint-config-soybeanjs": "0.2.1",
77
- esno: "^0.16.3",
78
- "lint-staged": "^13.1.0",
79
- "simple-git-hooks": "^2.8.1",
80
- tsup: "^6.5.0",
81
- typescript: "^4.9.4"
82
- },
83
- "simple-git-hooks": {
84
- "commit-msg": "pnpm soybean git-commit-verify",
85
- "pre-commit": "pnpm exec lint-staged --concurrent false"
86
- },
87
- "lint-staged": {
88
- "*": [
89
- "eslint . --fix"
90
- ]
91
- },
92
- publishConfig: {
93
- registry: "https://registry.npmjs.org/"
94
- }
95
- };
96
-
97
- // src/command/git/commit.ts
98
- var import_prompts = __toESM(require("prompts"));
99
- var import_execa = __toESM(require("execa"));
100
-
101
- // src/command/git/config.ts
102
- var types = [
103
- { value: "init", title: "init: \u9879\u76EE\u521D\u59CB\u5316" },
104
- { value: "feat", title: "feat: \u6DFB\u52A0\u65B0\u7279\u6027" },
105
- { value: "fix", title: "fix: \u4FEE\u590Dbug" },
106
- { value: "docs", title: "docs: \u4EC5\u4EC5\u4FEE\u6539\u6587\u6863" },
107
- { value: "style", title: "style: \u4EC5\u4EC5\u4FEE\u6539\u4E86\u7A7A\u683C\u3001\u683C\u5F0F\u7F29\u8FDB\u3001\u9017\u53F7\u7B49\u7B49\uFF0C\u4E0D\u6539\u53D8\u4EE3\u7801\u903B\u8F91" },
108
- { value: "refactor", title: "refactor: \u4EE3\u7801\u91CD\u6784\uFF0C\u6CA1\u6709\u52A0\u65B0\u529F\u80FD\u6216\u8005\u4FEE\u590Dbug" },
109
- { value: "perf", title: "perf: \u4F18\u5316\u76F8\u5173\uFF0C\u6BD4\u5982\u63D0\u5347\u6027\u80FD\u3001\u4F53\u9A8C" },
110
- { value: "test", title: "test: \u6DFB\u52A0\u6D4B\u8BD5\u7528\u4F8B" },
111
- { value: "build", title: "build: \u4F9D\u8D56\u76F8\u5173\u7684\u5185\u5BB9" },
112
- { value: "ci", title: "ci: CI\u914D\u7F6E\u76F8\u5173\uFF0C\u4F8B\u5982\u5BF9k8s\uFF0Cdocker\u7684\u914D\u7F6E\u6587\u4EF6\u7684\u4FEE\u6539" },
113
- { value: "chore", title: "chore: \u6539\u53D8\u6784\u5EFA\u6D41\u7A0B\u3001\u6216\u8005\u589E\u52A0\u4F9D\u8D56\u5E93\u3001\u5DE5\u5177\u7B49" },
114
- { value: "revert", title: "revert: \u56DE\u6EDA\u5230\u4E0A\u4E00\u4E2A\u7248\u672C" }
115
- ];
116
- var scopes = [
117
- ["projects", "\u9879\u76EE\u642D\u5EFA"],
118
- ["components", "\u7EC4\u4EF6\u76F8\u5173"],
119
- ["hooks", "hook \u76F8\u5173"],
120
- ["utils", "utils \u76F8\u5173"],
121
- ["types", "ts\u7C7B\u578B\u76F8\u5173"],
122
- ["styles", "\u6837\u5F0F\u76F8\u5173"],
123
- ["deps", "\u9879\u76EE\u4F9D\u8D56"],
124
- ["auth", "\u5BF9 auth \u4FEE\u6539"],
125
- ["release", "\u7248\u672C\u53D1\u5E03"],
126
- ["other", "\u5176\u4ED6\u4FEE\u6539"]
127
- ].map(([value, description]) => {
128
- return {
129
- value,
130
- title: `${value.padEnd(30)} (${description})`
131
- };
132
- });
133
-
134
- // src/command/git/commit.ts
135
- async function gitCommit() {
136
- const result = await (0, import_prompts.default)([
137
- {
138
- name: "types",
139
- type: "select",
140
- message: "\u8BF7\u9009\u62E9\u63D0\u4EA4\u7684\u7C7B\u578B",
141
- choices: types
142
- },
143
- {
144
- name: "scopes",
145
- type: "select",
146
- message: "\u9009\u62E9\u4E00\u4E2Ascope",
147
- choices: scopes
148
- },
149
- {
150
- name: "description",
151
- type: "text",
152
- message: "\u8BF7\u8F93\u5165\u63D0\u4EA4\u63CF\u8FF0"
153
- }
154
- ]);
155
- const commitMsg = `${result.types}(${result.scopes}): ${result.description}`;
156
- (0, import_execa.default)("git", ["commit", "-m", commitMsg], { stdio: "inherit" });
157
- }
158
-
159
- // src/command/git/verify-commit.ts
160
- var import_fs = require("fs");
161
- var import_kolorist = require("kolorist");
162
- function verifyGitCommit() {
163
- const gitMsgPath = "./.git/COMMIT_EDITMSG";
164
- const commitMsg = (0, import_fs.readFileSync)(gitMsgPath, "utf-8").trim();
165
- const RELEASE_MSG = "chore: release";
166
- const REG_EXP = new RegExp(
167
- `(${types.map((item) => item.value).join("|")})\\((${scopes.map((item) => item.value).join("|")})\\):\\s.{1,50}`
168
- );
169
- if (!REG_EXP.test(commitMsg) && !commitMsg.includes(RELEASE_MSG)) {
170
- throw new Error(
171
- `${(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)(
172
- "\u63A8\u8350\u4F7F\u7528\u547D\u4EE4 pnpm commit \u751F\u6210\u7B26\u5408\u89C4\u8303\u7684Git\u63D0\u4EA4\u4FE1\u606F"
173
- )}`
174
- );
175
- }
176
- }
177
-
178
- // src/scripts/cleanup.ts
179
- var import_zx = require("zx");
180
- async function cleanup() {
181
- await import_zx.$`pnpm rimraf node_modules dist package-lock.json yarn.lock pnpm-lock.yaml ./**/node_modules ./**/dist ./**/package-lock.json ./**/yarn.lock ./**/pnpm-lock.yaml`;
182
- }
183
-
184
- // src/scripts/git-hooks.ts
185
- var import_zx2 = require("zx");
186
- async function initSimpleGitHooks() {
187
- await import_zx2.$`pnpm rimraf .husky`;
188
- await import_zx2.$`git config core.hooksPath .git/hooks/`;
189
- await import_zx2.$`rimraf .git/hooks`;
190
- await import_zx2.$`pnpm simple-git-hooks`;
191
- }
192
-
193
- // src/scripts/update-pkg.ts
194
- var import_zx3 = require("zx");
195
- async function updatePkg() {
196
- await import_zx3.$`ncu --deep -u`;
197
- }
198
-
199
- // src/index.ts
200
- import_commander.program.command("git-commit").description("\u751F\u6210\u7B26\u5408 Angular \u89C4\u8303\u7684 git commit").action(() => {
201
- gitCommit();
202
- });
203
- import_commander.program.command("git-commit-verify").description("\u6821\u9A8Cgit\u7684commit\u662F\u5426\u7B26\u5408 Angular \u89C4\u8303").action(() => {
204
- verifyGitCommit();
205
- });
206
- import_commander.program.command("cleanup").description("\u6E05\u7A7A\u4F9D\u8D56\u548C\u6784\u5EFA\u4EA7\u7269").action(() => {
207
- cleanup();
208
- });
209
- import_commander.program.command("init-git-hooks").description("\u521D\u59CB\u5316git\u94A9\u5B50").action(() => {
210
- initSimpleGitHooks();
211
- });
212
- import_commander.program.command("update-pkg").description("\u5347\u7EA7\u4F9D\u8D56").action(() => {
213
- updatePkg();
214
- });
215
- import_commander.program.version(package_default.version).description((0, import_kolorist2.blue)("soybean alias soy\n\nhttps://github.com/soybeanjs/cli"));
216
- import_commander.program.parse(process.argv);
package/dist/index.mjs DELETED
@@ -1,197 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- // src/index.ts
4
- import { program } from "commander";
5
- import { blue } from "kolorist";
6
-
7
- // package.json
8
- var package_default = {
9
- name: "@soybeanjs/cli",
10
- version: "0.1.5",
11
- description: "SoybeanJS's command lint tools",
12
- author: {
13
- name: "Soybean",
14
- email: "honghuangdc@gmail.com",
15
- url: "https://github.com/honghuangdc"
16
- },
17
- license: "MIT",
18
- homepage: "https://github.com/honghuangdc/soybean-cli",
19
- repository: {
20
- url: "https://github.com/honghuangdc/soybean-cli.git"
21
- },
22
- bugs: {
23
- url: "https://github.com/honghuangdc/soybean-cli/issues"
24
- },
25
- bin: {
26
- soybean: "dist/index.mjs",
27
- soy: "dist/index.mjs"
28
- },
29
- files: [
30
- "dist"
31
- ],
32
- scripts: {
33
- build: "tsup",
34
- lint: "eslint . --fix",
35
- commit: "soy git-commit",
36
- cleanup: "soy cleanup",
37
- "update-pkg": "soy update-pkg",
38
- "update-version": "bumpp package.json",
39
- "publish-pkg": "pnpm -r publish --access public",
40
- release: "pnpm update-version && pnpm publish-pkg"
41
- },
42
- dependencies: {
43
- commander: "^9.4.1",
44
- execa: "5.1.1",
45
- kolorist: "^1.6.0",
46
- minimist: "^1.2.7",
47
- "npm-check-updates": "^16.6.2",
48
- prompts: "^2.4.2",
49
- rimraf: "^3.0.2",
50
- zx: "^7.1.1"
51
- },
52
- devDependencies: {
53
- "@soybeanjs/cli": "workspace:*",
54
- "@types/prompts": "^2.4.2",
55
- bumpp: "^8.2.1",
56
- eslint: "^8.31.0",
57
- "eslint-config-soybeanjs": "0.2.1",
58
- esno: "^0.16.3",
59
- "lint-staged": "^13.1.0",
60
- "simple-git-hooks": "^2.8.1",
61
- tsup: "^6.5.0",
62
- typescript: "^4.9.4"
63
- },
64
- "simple-git-hooks": {
65
- "commit-msg": "pnpm soybean git-commit-verify",
66
- "pre-commit": "pnpm exec lint-staged --concurrent false"
67
- },
68
- "lint-staged": {
69
- "*": [
70
- "eslint . --fix"
71
- ]
72
- },
73
- publishConfig: {
74
- registry: "https://registry.npmjs.org/"
75
- }
76
- };
77
-
78
- // src/command/git/commit.ts
79
- import prompts from "prompts";
80
- import execa from "execa";
81
-
82
- // src/command/git/config.ts
83
- var types = [
84
- { value: "init", title: "init: \u9879\u76EE\u521D\u59CB\u5316" },
85
- { value: "feat", title: "feat: \u6DFB\u52A0\u65B0\u7279\u6027" },
86
- { value: "fix", title: "fix: \u4FEE\u590Dbug" },
87
- { value: "docs", title: "docs: \u4EC5\u4EC5\u4FEE\u6539\u6587\u6863" },
88
- { value: "style", title: "style: \u4EC5\u4EC5\u4FEE\u6539\u4E86\u7A7A\u683C\u3001\u683C\u5F0F\u7F29\u8FDB\u3001\u9017\u53F7\u7B49\u7B49\uFF0C\u4E0D\u6539\u53D8\u4EE3\u7801\u903B\u8F91" },
89
- { value: "refactor", title: "refactor: \u4EE3\u7801\u91CD\u6784\uFF0C\u6CA1\u6709\u52A0\u65B0\u529F\u80FD\u6216\u8005\u4FEE\u590Dbug" },
90
- { value: "perf", title: "perf: \u4F18\u5316\u76F8\u5173\uFF0C\u6BD4\u5982\u63D0\u5347\u6027\u80FD\u3001\u4F53\u9A8C" },
91
- { value: "test", title: "test: \u6DFB\u52A0\u6D4B\u8BD5\u7528\u4F8B" },
92
- { value: "build", title: "build: \u4F9D\u8D56\u76F8\u5173\u7684\u5185\u5BB9" },
93
- { value: "ci", title: "ci: CI\u914D\u7F6E\u76F8\u5173\uFF0C\u4F8B\u5982\u5BF9k8s\uFF0Cdocker\u7684\u914D\u7F6E\u6587\u4EF6\u7684\u4FEE\u6539" },
94
- { value: "chore", title: "chore: \u6539\u53D8\u6784\u5EFA\u6D41\u7A0B\u3001\u6216\u8005\u589E\u52A0\u4F9D\u8D56\u5E93\u3001\u5DE5\u5177\u7B49" },
95
- { value: "revert", title: "revert: \u56DE\u6EDA\u5230\u4E0A\u4E00\u4E2A\u7248\u672C" }
96
- ];
97
- var scopes = [
98
- ["projects", "\u9879\u76EE\u642D\u5EFA"],
99
- ["components", "\u7EC4\u4EF6\u76F8\u5173"],
100
- ["hooks", "hook \u76F8\u5173"],
101
- ["utils", "utils \u76F8\u5173"],
102
- ["types", "ts\u7C7B\u578B\u76F8\u5173"],
103
- ["styles", "\u6837\u5F0F\u76F8\u5173"],
104
- ["deps", "\u9879\u76EE\u4F9D\u8D56"],
105
- ["auth", "\u5BF9 auth \u4FEE\u6539"],
106
- ["release", "\u7248\u672C\u53D1\u5E03"],
107
- ["other", "\u5176\u4ED6\u4FEE\u6539"]
108
- ].map(([value, description]) => {
109
- return {
110
- value,
111
- title: `${value.padEnd(30)} (${description})`
112
- };
113
- });
114
-
115
- // src/command/git/commit.ts
116
- async function gitCommit() {
117
- const result = await prompts([
118
- {
119
- name: "types",
120
- type: "select",
121
- message: "\u8BF7\u9009\u62E9\u63D0\u4EA4\u7684\u7C7B\u578B",
122
- choices: types
123
- },
124
- {
125
- name: "scopes",
126
- type: "select",
127
- message: "\u9009\u62E9\u4E00\u4E2Ascope",
128
- choices: scopes
129
- },
130
- {
131
- name: "description",
132
- type: "text",
133
- message: "\u8BF7\u8F93\u5165\u63D0\u4EA4\u63CF\u8FF0"
134
- }
135
- ]);
136
- const commitMsg = `${result.types}(${result.scopes}): ${result.description}`;
137
- execa("git", ["commit", "-m", commitMsg], { stdio: "inherit" });
138
- }
139
-
140
- // src/command/git/verify-commit.ts
141
- import { readFileSync } from "fs";
142
- import { bgRed, red, green } from "kolorist";
143
- function verifyGitCommit() {
144
- const gitMsgPath = "./.git/COMMIT_EDITMSG";
145
- const commitMsg = readFileSync(gitMsgPath, "utf-8").trim();
146
- const RELEASE_MSG = "chore: release";
147
- const REG_EXP = new RegExp(
148
- `(${types.map((item) => item.value).join("|")})\\((${scopes.map((item) => item.value).join("|")})\\):\\s.{1,50}`
149
- );
150
- if (!REG_EXP.test(commitMsg) && !commitMsg.includes(RELEASE_MSG)) {
151
- throw new Error(
152
- `${bgRed(" ERROR ")} ${red("Git\u63D0\u4EA4\u4FE1\u606F\u4E0D\u7B26\u5408 Angular \u89C4\u8303!\n\n")}${green(
153
- "\u63A8\u8350\u4F7F\u7528\u547D\u4EE4 pnpm commit \u751F\u6210\u7B26\u5408\u89C4\u8303\u7684Git\u63D0\u4EA4\u4FE1\u606F"
154
- )}`
155
- );
156
- }
157
- }
158
-
159
- // src/scripts/cleanup.ts
160
- import { $ } from "zx";
161
- async function cleanup() {
162
- await $`pnpm rimraf node_modules dist package-lock.json yarn.lock pnpm-lock.yaml ./**/node_modules ./**/dist ./**/package-lock.json ./**/yarn.lock ./**/pnpm-lock.yaml`;
163
- }
164
-
165
- // src/scripts/git-hooks.ts
166
- import { $ as $2 } from "zx";
167
- async function initSimpleGitHooks() {
168
- await $2`pnpm rimraf .husky`;
169
- await $2`git config core.hooksPath .git/hooks/`;
170
- await $2`rimraf .git/hooks`;
171
- await $2`pnpm simple-git-hooks`;
172
- }
173
-
174
- // src/scripts/update-pkg.ts
175
- import { $ as $3 } from "zx";
176
- async function updatePkg() {
177
- await $3`ncu --deep -u`;
178
- }
179
-
180
- // src/index.ts
181
- program.command("git-commit").description("\u751F\u6210\u7B26\u5408 Angular \u89C4\u8303\u7684 git commit").action(() => {
182
- gitCommit();
183
- });
184
- program.command("git-commit-verify").description("\u6821\u9A8Cgit\u7684commit\u662F\u5426\u7B26\u5408 Angular \u89C4\u8303").action(() => {
185
- verifyGitCommit();
186
- });
187
- program.command("cleanup").description("\u6E05\u7A7A\u4F9D\u8D56\u548C\u6784\u5EFA\u4EA7\u7269").action(() => {
188
- cleanup();
189
- });
190
- program.command("init-git-hooks").description("\u521D\u59CB\u5316git\u94A9\u5B50").action(() => {
191
- initSimpleGitHooks();
192
- });
193
- program.command("update-pkg").description("\u5347\u7EA7\u4F9D\u8D56").action(() => {
194
- updatePkg();
195
- });
196
- program.version(package_default.version).description(blue("soybean alias soy\n\nhttps://github.com/soybeanjs/cli"));
197
- program.parse(process.argv);