@soybeanjs/cli 0.1.0 → 0.1.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/package.json +20 -5
- package/dist/commit.js +0 -80
- package/dist/commit.mjs +0 -61
- package/dist/index.js +0 -156
- package/dist/index.mjs +0 -138
- package/dist/scope.json +0 -1
- package/dist/verify-commit.js +0 -46
- package/dist/verify-commit.mjs +0 -46
package/package.json
CHANGED
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soybeanjs/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "SoybeanJS's command lint tools",
|
|
5
|
-
"author":
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Soybean",
|
|
7
|
+
"email": "honghuangdc@gmail.com",
|
|
8
|
+
"url": "https://github.com/honghuangdc"
|
|
9
|
+
},
|
|
6
10
|
"license": "MIT",
|
|
11
|
+
"homepage": "https://github.com/honghuangdc/soybean-cli",
|
|
12
|
+
"repository": {
|
|
13
|
+
"url": "https://github.com/honghuangdc/soybean-cli.git"
|
|
14
|
+
},
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/honghuangdc/soybean-cli/issues"
|
|
17
|
+
},
|
|
7
18
|
"bin": {
|
|
8
19
|
"soybean": "dist/index.js"
|
|
9
20
|
},
|
|
@@ -21,24 +32,28 @@
|
|
|
21
32
|
"prompts": "^2.4.2"
|
|
22
33
|
},
|
|
23
34
|
"devDependencies": {
|
|
24
|
-
"@soybeanjs/cli": "^0.0
|
|
35
|
+
"@soybeanjs/cli": "^0.1.0",
|
|
25
36
|
"@types/prompts": "^2.4.1",
|
|
26
37
|
"bumpp": "^8.2.1",
|
|
27
38
|
"eslint": "^8.26.0",
|
|
28
39
|
"eslint-config-soybeanjs": "0.1.1",
|
|
29
40
|
"esno": "^0.16.3",
|
|
30
41
|
"husky": "^8.0.1",
|
|
42
|
+
"npm-check-updates": "^16.3.16",
|
|
31
43
|
"tsup": "^6.3.0",
|
|
32
44
|
"typescript": "^4.8.4",
|
|
33
45
|
"zx": "^7.1.1"
|
|
34
46
|
},
|
|
35
47
|
"scripts": {
|
|
36
48
|
"build": "tsup",
|
|
37
|
-
"esno": "esno",
|
|
38
49
|
"lint": "eslint . --fix",
|
|
50
|
+
"commit": "soybean git-commit",
|
|
51
|
+
"esno": "esno",
|
|
52
|
+
"cleanup": "esno ./scripts/cleanup.ts",
|
|
53
|
+
"update-pkg": "ncu --deep -u",
|
|
39
54
|
"update-version": "bumpp package.json",
|
|
40
55
|
"publish-pkg": "pnpm -r publish --access public",
|
|
41
56
|
"release": "pnpm update-version && pnpm publish-pkg",
|
|
42
|
-
"
|
|
57
|
+
"sync-pkg": "esno ./scripts/sync.ts"
|
|
43
58
|
}
|
|
44
59
|
}
|
package/dist/commit.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __copyProps = (to, from, except, desc) => {
|
|
8
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
9
|
-
for (let key of __getOwnPropNames(from))
|
|
10
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
11
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
|
-
}
|
|
13
|
-
return to;
|
|
14
|
-
};
|
|
15
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
16
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
17
|
-
mod
|
|
18
|
-
));
|
|
19
|
-
|
|
20
|
-
// src/commit.ts
|
|
21
|
-
var import_prompts = __toESM(require("prompts"));
|
|
22
|
-
var import_execa = __toESM(require("execa"));
|
|
23
|
-
|
|
24
|
-
// src/config.ts
|
|
25
|
-
var types = [
|
|
26
|
-
{ value: "init", title: "init: \u9879\u76EE\u521D\u59CB\u5316" },
|
|
27
|
-
{ value: "feat", title: "feat: \u6DFB\u52A0\u65B0\u7279\u6027" },
|
|
28
|
-
{ value: "fix", title: "fix: \u4FEE\u590Dbug" },
|
|
29
|
-
{ value: "docs", title: "docs: \u4EC5\u4EC5\u4FEE\u6539\u6587\u6863" },
|
|
30
|
-
{ 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" },
|
|
31
|
-
{ value: "refactor", title: "refactor: \u4EE3\u7801\u91CD\u6784\uFF0C\u6CA1\u6709\u52A0\u65B0\u529F\u80FD\u6216\u8005\u4FEE\u590Dbug" },
|
|
32
|
-
{ value: "perf", title: "perf: \u4F18\u5316\u76F8\u5173\uFF0C\u6BD4\u5982\u63D0\u5347\u6027\u80FD\u3001\u4F53\u9A8C" },
|
|
33
|
-
{ value: "test", title: "test: \u6DFB\u52A0\u6D4B\u8BD5\u7528\u4F8B" },
|
|
34
|
-
{ value: "build", title: "build: \u4F9D\u8D56\u76F8\u5173\u7684\u5185\u5BB9" },
|
|
35
|
-
{ value: "ci", title: "ci: CI\u914D\u7F6E\u76F8\u5173\uFF0C\u4F8B\u5982\u5BF9k8s\uFF0Cdocker\u7684\u914D\u7F6E\u6587\u4EF6\u7684\u4FEE\u6539" },
|
|
36
|
-
{ value: "chore", title: "chore: \u6539\u53D8\u6784\u5EFA\u6D41\u7A0B\u3001\u6216\u8005\u589E\u52A0\u4F9D\u8D56\u5E93\u3001\u5DE5\u5177\u7B49" },
|
|
37
|
-
{ value: "revert", title: "revert: \u56DE\u6EDA\u5230\u4E0A\u4E00\u4E2A\u7248\u672C" }
|
|
38
|
-
];
|
|
39
|
-
var scopes = [
|
|
40
|
-
["projects", "\u9879\u76EE\u642D\u5EFA"],
|
|
41
|
-
["components", "\u7EC4\u4EF6\u76F8\u5173"],
|
|
42
|
-
["hooks", "hook \u76F8\u5173"],
|
|
43
|
-
["utils", "utils \u76F8\u5173"],
|
|
44
|
-
["types", "ts\u7C7B\u578B\u76F8\u5173"],
|
|
45
|
-
["styles", "\u6837\u5F0F\u76F8\u5173"],
|
|
46
|
-
["deps", "\u9879\u76EE\u4F9D\u8D56"],
|
|
47
|
-
["auth", "\u5BF9 auth \u4FEE\u6539"],
|
|
48
|
-
["other", "\u5176\u4ED6\u4FEE\u6539"]
|
|
49
|
-
].map(([value, description]) => {
|
|
50
|
-
return {
|
|
51
|
-
value,
|
|
52
|
-
title: `${value.padEnd(30)} (${description})`
|
|
53
|
-
};
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
// src/commit.ts
|
|
57
|
-
async function init() {
|
|
58
|
-
const result = await (0, import_prompts.default)([
|
|
59
|
-
{
|
|
60
|
-
name: "types",
|
|
61
|
-
type: "select",
|
|
62
|
-
message: "\u8BF7\u9009\u62E9\u63D0\u4EA4\u7684\u7C7B\u578B",
|
|
63
|
-
choices: types
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
name: "scopes",
|
|
67
|
-
type: "select",
|
|
68
|
-
message: "\u9009\u62E9\u4E00\u4E2Ascope",
|
|
69
|
-
choices: scopes
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
name: "description",
|
|
73
|
-
type: "text",
|
|
74
|
-
message: "\u8BF7\u8F93\u5165\u63D0\u4EA4\u63CF\u8FF0"
|
|
75
|
-
}
|
|
76
|
-
]);
|
|
77
|
-
const commitMsg = `${result.types}(${result.scopes}): ${result.description}`;
|
|
78
|
-
await (0, import_execa.default)("git", ["commit", "-m", commitMsg]);
|
|
79
|
-
}
|
|
80
|
-
init();
|
package/dist/commit.mjs
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
// src/commit.ts
|
|
2
|
-
import promptos from "prompts";
|
|
3
|
-
import execa from "execa";
|
|
4
|
-
|
|
5
|
-
// src/config.ts
|
|
6
|
-
var types = [
|
|
7
|
-
{ value: "init", title: "init: \u9879\u76EE\u521D\u59CB\u5316" },
|
|
8
|
-
{ value: "feat", title: "feat: \u6DFB\u52A0\u65B0\u7279\u6027" },
|
|
9
|
-
{ value: "fix", title: "fix: \u4FEE\u590Dbug" },
|
|
10
|
-
{ value: "docs", title: "docs: \u4EC5\u4EC5\u4FEE\u6539\u6587\u6863" },
|
|
11
|
-
{ 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" },
|
|
12
|
-
{ value: "refactor", title: "refactor: \u4EE3\u7801\u91CD\u6784\uFF0C\u6CA1\u6709\u52A0\u65B0\u529F\u80FD\u6216\u8005\u4FEE\u590Dbug" },
|
|
13
|
-
{ value: "perf", title: "perf: \u4F18\u5316\u76F8\u5173\uFF0C\u6BD4\u5982\u63D0\u5347\u6027\u80FD\u3001\u4F53\u9A8C" },
|
|
14
|
-
{ value: "test", title: "test: \u6DFB\u52A0\u6D4B\u8BD5\u7528\u4F8B" },
|
|
15
|
-
{ value: "build", title: "build: \u4F9D\u8D56\u76F8\u5173\u7684\u5185\u5BB9" },
|
|
16
|
-
{ value: "ci", title: "ci: CI\u914D\u7F6E\u76F8\u5173\uFF0C\u4F8B\u5982\u5BF9k8s\uFF0Cdocker\u7684\u914D\u7F6E\u6587\u4EF6\u7684\u4FEE\u6539" },
|
|
17
|
-
{ value: "chore", title: "chore: \u6539\u53D8\u6784\u5EFA\u6D41\u7A0B\u3001\u6216\u8005\u589E\u52A0\u4F9D\u8D56\u5E93\u3001\u5DE5\u5177\u7B49" },
|
|
18
|
-
{ value: "revert", title: "revert: \u56DE\u6EDA\u5230\u4E0A\u4E00\u4E2A\u7248\u672C" }
|
|
19
|
-
];
|
|
20
|
-
var scopes = [
|
|
21
|
-
["projects", "\u9879\u76EE\u642D\u5EFA"],
|
|
22
|
-
["components", "\u7EC4\u4EF6\u76F8\u5173"],
|
|
23
|
-
["hooks", "hook \u76F8\u5173"],
|
|
24
|
-
["utils", "utils \u76F8\u5173"],
|
|
25
|
-
["types", "ts\u7C7B\u578B\u76F8\u5173"],
|
|
26
|
-
["styles", "\u6837\u5F0F\u76F8\u5173"],
|
|
27
|
-
["deps", "\u9879\u76EE\u4F9D\u8D56"],
|
|
28
|
-
["auth", "\u5BF9 auth \u4FEE\u6539"],
|
|
29
|
-
["other", "\u5176\u4ED6\u4FEE\u6539"]
|
|
30
|
-
].map(([value, description]) => {
|
|
31
|
-
return {
|
|
32
|
-
value,
|
|
33
|
-
title: `${value.padEnd(30)} (${description})`
|
|
34
|
-
};
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
// src/commit.ts
|
|
38
|
-
async function init() {
|
|
39
|
-
const result = await promptos([
|
|
40
|
-
{
|
|
41
|
-
name: "types",
|
|
42
|
-
type: "select",
|
|
43
|
-
message: "\u8BF7\u9009\u62E9\u63D0\u4EA4\u7684\u7C7B\u578B",
|
|
44
|
-
choices: types
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
name: "scopes",
|
|
48
|
-
type: "select",
|
|
49
|
-
message: "\u9009\u62E9\u4E00\u4E2Ascope",
|
|
50
|
-
choices: scopes
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
name: "description",
|
|
54
|
-
type: "text",
|
|
55
|
-
message: "\u8BF7\u8F93\u5165\u63D0\u4EA4\u63CF\u8FF0"
|
|
56
|
-
}
|
|
57
|
-
]);
|
|
58
|
-
const commitMsg = `${result.types}(${result.scopes}): ${result.description}`;
|
|
59
|
-
await execa("git", ["commit", "-m", commitMsg]);
|
|
60
|
-
}
|
|
61
|
-
init();
|
package/dist/index.js
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
-
for (let key of __getOwnPropNames(from))
|
|
11
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
-
}
|
|
14
|
-
return to;
|
|
15
|
-
};
|
|
16
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
18
|
-
mod
|
|
19
|
-
));
|
|
20
|
-
|
|
21
|
-
// src/index.ts
|
|
22
|
-
var import_commander = require("commander");
|
|
23
|
-
var import_kolorist2 = require("kolorist");
|
|
24
|
-
|
|
25
|
-
// package.json
|
|
26
|
-
var package_default = {
|
|
27
|
-
name: "@soybeanjs/cli",
|
|
28
|
-
version: "0.0.1",
|
|
29
|
-
description: "SoybeanJS's command lint tools",
|
|
30
|
-
author: "Soybean <honghuangdc@gmail.com> (https://github.com/honghuangdc)",
|
|
31
|
-
license: "MIT",
|
|
32
|
-
bin: {
|
|
33
|
-
soybean: "dist/index.js"
|
|
34
|
-
},
|
|
35
|
-
files: [
|
|
36
|
-
"dist"
|
|
37
|
-
],
|
|
38
|
-
publishConfig: {
|
|
39
|
-
registry: "https://registry.npmjs.org/"
|
|
40
|
-
},
|
|
41
|
-
scripts: {
|
|
42
|
-
build: "tsup",
|
|
43
|
-
esno: "esno",
|
|
44
|
-
lint: "eslint . --fix",
|
|
45
|
-
"update-version": "bumpp package.json",
|
|
46
|
-
"publish-pkg": "pnpm -r publish --access public",
|
|
47
|
-
release: "pnpm update-version && pnpm publish-pkg",
|
|
48
|
-
prepare: "husky install",
|
|
49
|
-
commit: "soybean git-commit"
|
|
50
|
-
},
|
|
51
|
-
dependencies: {
|
|
52
|
-
commander: "^9.4.1",
|
|
53
|
-
execa: "5.1.1",
|
|
54
|
-
kolorist: "^1.6.0",
|
|
55
|
-
minimist: "^1.2.7",
|
|
56
|
-
prompts: "^2.4.2"
|
|
57
|
-
},
|
|
58
|
-
devDependencies: {
|
|
59
|
-
"@soybeanjs/cli": "^0.0.1",
|
|
60
|
-
"@types/prompts": "^2.4.1",
|
|
61
|
-
bumpp: "^8.2.1",
|
|
62
|
-
eslint: "^8.26.0",
|
|
63
|
-
"eslint-config-soybeanjs": "0.1.1",
|
|
64
|
-
esno: "^0.16.3",
|
|
65
|
-
husky: "^8.0.1",
|
|
66
|
-
tsup: "^6.3.0",
|
|
67
|
-
typescript: "^4.8.4",
|
|
68
|
-
zx: "^7.1.1"
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
// src/command/git/commit.ts
|
|
73
|
-
var import_prompts = __toESM(require("prompts"));
|
|
74
|
-
var import_execa = __toESM(require("execa"));
|
|
75
|
-
|
|
76
|
-
// src/command/git/config.ts
|
|
77
|
-
var types = [
|
|
78
|
-
{ value: "init", title: "init: \u9879\u76EE\u521D\u59CB\u5316" },
|
|
79
|
-
{ value: "feat", title: "feat: \u6DFB\u52A0\u65B0\u7279\u6027" },
|
|
80
|
-
{ value: "fix", title: "fix: \u4FEE\u590Dbug" },
|
|
81
|
-
{ value: "docs", title: "docs: \u4EC5\u4EC5\u4FEE\u6539\u6587\u6863" },
|
|
82
|
-
{ 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" },
|
|
83
|
-
{ value: "refactor", title: "refactor: \u4EE3\u7801\u91CD\u6784\uFF0C\u6CA1\u6709\u52A0\u65B0\u529F\u80FD\u6216\u8005\u4FEE\u590Dbug" },
|
|
84
|
-
{ value: "perf", title: "perf: \u4F18\u5316\u76F8\u5173\uFF0C\u6BD4\u5982\u63D0\u5347\u6027\u80FD\u3001\u4F53\u9A8C" },
|
|
85
|
-
{ value: "test", title: "test: \u6DFB\u52A0\u6D4B\u8BD5\u7528\u4F8B" },
|
|
86
|
-
{ value: "build", title: "build: \u4F9D\u8D56\u76F8\u5173\u7684\u5185\u5BB9" },
|
|
87
|
-
{ value: "ci", title: "ci: CI\u914D\u7F6E\u76F8\u5173\uFF0C\u4F8B\u5982\u5BF9k8s\uFF0Cdocker\u7684\u914D\u7F6E\u6587\u4EF6\u7684\u4FEE\u6539" },
|
|
88
|
-
{ value: "chore", title: "chore: \u6539\u53D8\u6784\u5EFA\u6D41\u7A0B\u3001\u6216\u8005\u589E\u52A0\u4F9D\u8D56\u5E93\u3001\u5DE5\u5177\u7B49" },
|
|
89
|
-
{ value: "revert", title: "revert: \u56DE\u6EDA\u5230\u4E0A\u4E00\u4E2A\u7248\u672C" }
|
|
90
|
-
];
|
|
91
|
-
var scopes = [
|
|
92
|
-
["projects", "\u9879\u76EE\u642D\u5EFA"],
|
|
93
|
-
["components", "\u7EC4\u4EF6\u76F8\u5173"],
|
|
94
|
-
["hooks", "hook \u76F8\u5173"],
|
|
95
|
-
["utils", "utils \u76F8\u5173"],
|
|
96
|
-
["types", "ts\u7C7B\u578B\u76F8\u5173"],
|
|
97
|
-
["styles", "\u6837\u5F0F\u76F8\u5173"],
|
|
98
|
-
["deps", "\u9879\u76EE\u4F9D\u8D56"],
|
|
99
|
-
["auth", "\u5BF9 auth \u4FEE\u6539"],
|
|
100
|
-
["other", "\u5176\u4ED6\u4FEE\u6539"]
|
|
101
|
-
].map(([value, description]) => {
|
|
102
|
-
return {
|
|
103
|
-
value,
|
|
104
|
-
title: `${value.padEnd(30)} (${description})`
|
|
105
|
-
};
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
// src/command/git/commit.ts
|
|
109
|
-
async function gitCommit() {
|
|
110
|
-
const result = await (0, import_prompts.default)([
|
|
111
|
-
{
|
|
112
|
-
name: "types",
|
|
113
|
-
type: "select",
|
|
114
|
-
message: "\u8BF7\u9009\u62E9\u63D0\u4EA4\u7684\u7C7B\u578B",
|
|
115
|
-
choices: types
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
name: "scopes",
|
|
119
|
-
type: "select",
|
|
120
|
-
message: "\u9009\u62E9\u4E00\u4E2Ascope",
|
|
121
|
-
choices: scopes
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
name: "description",
|
|
125
|
-
type: "text",
|
|
126
|
-
message: "\u8BF7\u8F93\u5165\u63D0\u4EA4\u63CF\u8FF0"
|
|
127
|
-
}
|
|
128
|
-
]);
|
|
129
|
-
const commitMsg = `${result.types}(${result.scopes}): ${result.description}`;
|
|
130
|
-
await (0, import_execa.default)("git", ["commit", "-m", commitMsg]);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
// src/command/git/verify-commit.ts
|
|
134
|
-
var import_fs = require("fs");
|
|
135
|
-
var import_kolorist = require("kolorist");
|
|
136
|
-
function verifyGitCommit() {
|
|
137
|
-
const gitMsgPath = "./.git/COMMIT_EDITMSG";
|
|
138
|
-
const commitMsg = (0, import_fs.readFileSync)(gitMsgPath, "utf-8").trim();
|
|
139
|
-
const RELEASE_MSG = "chore: release";
|
|
140
|
-
const REG_EXP = new RegExp(
|
|
141
|
-
`(${types.map((item) => item.value).join("|")})\\((${scopes.map((item) => item.value).join("|")})\\):\\s.{1,50}`
|
|
142
|
-
);
|
|
143
|
-
if (!REG_EXP.test(commitMsg) && !commitMsg.includes(RELEASE_MSG)) {
|
|
144
|
-
throw new Error((0, import_kolorist.red)("\u63D0\u4EA4\u4FE1\u606F\u4E0D\u7B26\u5408 Angular \u89C4\u8303"));
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// src/index.ts
|
|
149
|
-
import_commander.program.command("git-commit").description("\u751F\u6210\u7B26\u5408 Angular \u89C4\u8303\u7684 git commit").action(() => {
|
|
150
|
-
gitCommit();
|
|
151
|
-
});
|
|
152
|
-
import_commander.program.command("git-commit-verify").description("\u6821\u9A8Cgit\u7684commit\u662F\u5426\u7B26\u5408 Angular \u89C4\u8303").action(() => {
|
|
153
|
-
verifyGitCommit();
|
|
154
|
-
});
|
|
155
|
-
import_commander.program.version(package_default.version).description((0, import_kolorist2.blue)("soybeanjs https://soybean.pro"));
|
|
156
|
-
import_commander.program.parse(process.argv);
|
package/dist/index.mjs
DELETED
|
@@ -1,138 +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.0.1",
|
|
11
|
-
description: "SoybeanJS's command lint tools",
|
|
12
|
-
author: "Soybean <honghuangdc@gmail.com> (https://github.com/honghuangdc)",
|
|
13
|
-
license: "MIT",
|
|
14
|
-
bin: {
|
|
15
|
-
soybean: "dist/index.js"
|
|
16
|
-
},
|
|
17
|
-
files: [
|
|
18
|
-
"dist"
|
|
19
|
-
],
|
|
20
|
-
publishConfig: {
|
|
21
|
-
registry: "https://registry.npmjs.org/"
|
|
22
|
-
},
|
|
23
|
-
scripts: {
|
|
24
|
-
build: "tsup",
|
|
25
|
-
esno: "esno",
|
|
26
|
-
lint: "eslint . --fix",
|
|
27
|
-
"update-version": "bumpp package.json",
|
|
28
|
-
"publish-pkg": "pnpm -r publish --access public",
|
|
29
|
-
release: "pnpm update-version && pnpm publish-pkg",
|
|
30
|
-
prepare: "husky install",
|
|
31
|
-
commit: "soybean git-commit"
|
|
32
|
-
},
|
|
33
|
-
dependencies: {
|
|
34
|
-
commander: "^9.4.1",
|
|
35
|
-
execa: "5.1.1",
|
|
36
|
-
kolorist: "^1.6.0",
|
|
37
|
-
minimist: "^1.2.7",
|
|
38
|
-
prompts: "^2.4.2"
|
|
39
|
-
},
|
|
40
|
-
devDependencies: {
|
|
41
|
-
"@soybeanjs/cli": "^0.0.1",
|
|
42
|
-
"@types/prompts": "^2.4.1",
|
|
43
|
-
bumpp: "^8.2.1",
|
|
44
|
-
eslint: "^8.26.0",
|
|
45
|
-
"eslint-config-soybeanjs": "0.1.1",
|
|
46
|
-
esno: "^0.16.3",
|
|
47
|
-
husky: "^8.0.1",
|
|
48
|
-
tsup: "^6.3.0",
|
|
49
|
-
typescript: "^4.8.4",
|
|
50
|
-
zx: "^7.1.1"
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
// src/command/git/commit.ts
|
|
55
|
-
import promptos from "prompts";
|
|
56
|
-
import execa from "execa";
|
|
57
|
-
|
|
58
|
-
// src/command/git/config.ts
|
|
59
|
-
var types = [
|
|
60
|
-
{ value: "init", title: "init: \u9879\u76EE\u521D\u59CB\u5316" },
|
|
61
|
-
{ value: "feat", title: "feat: \u6DFB\u52A0\u65B0\u7279\u6027" },
|
|
62
|
-
{ value: "fix", title: "fix: \u4FEE\u590Dbug" },
|
|
63
|
-
{ value: "docs", title: "docs: \u4EC5\u4EC5\u4FEE\u6539\u6587\u6863" },
|
|
64
|
-
{ 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" },
|
|
65
|
-
{ value: "refactor", title: "refactor: \u4EE3\u7801\u91CD\u6784\uFF0C\u6CA1\u6709\u52A0\u65B0\u529F\u80FD\u6216\u8005\u4FEE\u590Dbug" },
|
|
66
|
-
{ value: "perf", title: "perf: \u4F18\u5316\u76F8\u5173\uFF0C\u6BD4\u5982\u63D0\u5347\u6027\u80FD\u3001\u4F53\u9A8C" },
|
|
67
|
-
{ value: "test", title: "test: \u6DFB\u52A0\u6D4B\u8BD5\u7528\u4F8B" },
|
|
68
|
-
{ value: "build", title: "build: \u4F9D\u8D56\u76F8\u5173\u7684\u5185\u5BB9" },
|
|
69
|
-
{ value: "ci", title: "ci: CI\u914D\u7F6E\u76F8\u5173\uFF0C\u4F8B\u5982\u5BF9k8s\uFF0Cdocker\u7684\u914D\u7F6E\u6587\u4EF6\u7684\u4FEE\u6539" },
|
|
70
|
-
{ value: "chore", title: "chore: \u6539\u53D8\u6784\u5EFA\u6D41\u7A0B\u3001\u6216\u8005\u589E\u52A0\u4F9D\u8D56\u5E93\u3001\u5DE5\u5177\u7B49" },
|
|
71
|
-
{ value: "revert", title: "revert: \u56DE\u6EDA\u5230\u4E0A\u4E00\u4E2A\u7248\u672C" }
|
|
72
|
-
];
|
|
73
|
-
var scopes = [
|
|
74
|
-
["projects", "\u9879\u76EE\u642D\u5EFA"],
|
|
75
|
-
["components", "\u7EC4\u4EF6\u76F8\u5173"],
|
|
76
|
-
["hooks", "hook \u76F8\u5173"],
|
|
77
|
-
["utils", "utils \u76F8\u5173"],
|
|
78
|
-
["types", "ts\u7C7B\u578B\u76F8\u5173"],
|
|
79
|
-
["styles", "\u6837\u5F0F\u76F8\u5173"],
|
|
80
|
-
["deps", "\u9879\u76EE\u4F9D\u8D56"],
|
|
81
|
-
["auth", "\u5BF9 auth \u4FEE\u6539"],
|
|
82
|
-
["other", "\u5176\u4ED6\u4FEE\u6539"]
|
|
83
|
-
].map(([value, description]) => {
|
|
84
|
-
return {
|
|
85
|
-
value,
|
|
86
|
-
title: `${value.padEnd(30)} (${description})`
|
|
87
|
-
};
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
// src/command/git/commit.ts
|
|
91
|
-
async function gitCommit() {
|
|
92
|
-
const result = await promptos([
|
|
93
|
-
{
|
|
94
|
-
name: "types",
|
|
95
|
-
type: "select",
|
|
96
|
-
message: "\u8BF7\u9009\u62E9\u63D0\u4EA4\u7684\u7C7B\u578B",
|
|
97
|
-
choices: types
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
name: "scopes",
|
|
101
|
-
type: "select",
|
|
102
|
-
message: "\u9009\u62E9\u4E00\u4E2Ascope",
|
|
103
|
-
choices: scopes
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
name: "description",
|
|
107
|
-
type: "text",
|
|
108
|
-
message: "\u8BF7\u8F93\u5165\u63D0\u4EA4\u63CF\u8FF0"
|
|
109
|
-
}
|
|
110
|
-
]);
|
|
111
|
-
const commitMsg = `${result.types}(${result.scopes}): ${result.description}`;
|
|
112
|
-
await execa("git", ["commit", "-m", commitMsg]);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// src/command/git/verify-commit.ts
|
|
116
|
-
import { readFileSync } from "fs";
|
|
117
|
-
import { red } from "kolorist";
|
|
118
|
-
function verifyGitCommit() {
|
|
119
|
-
const gitMsgPath = "./.git/COMMIT_EDITMSG";
|
|
120
|
-
const commitMsg = readFileSync(gitMsgPath, "utf-8").trim();
|
|
121
|
-
const RELEASE_MSG = "chore: release";
|
|
122
|
-
const REG_EXP = new RegExp(
|
|
123
|
-
`(${types.map((item) => item.value).join("|")})\\((${scopes.map((item) => item.value).join("|")})\\):\\s.{1,50}`
|
|
124
|
-
);
|
|
125
|
-
if (!REG_EXP.test(commitMsg) && !commitMsg.includes(RELEASE_MSG)) {
|
|
126
|
-
throw new Error(red("\u63D0\u4EA4\u4FE1\u606F\u4E0D\u7B26\u5408 Angular \u89C4\u8303"));
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
// src/index.ts
|
|
131
|
-
program.command("git-commit").description("\u751F\u6210\u7B26\u5408 Angular \u89C4\u8303\u7684 git commit").action(() => {
|
|
132
|
-
gitCommit();
|
|
133
|
-
});
|
|
134
|
-
program.command("git-commit-verify").description("\u6821\u9A8Cgit\u7684commit\u662F\u5426\u7B26\u5408 Angular \u89C4\u8303").action(() => {
|
|
135
|
-
verifyGitCommit();
|
|
136
|
-
});
|
|
137
|
-
program.version(package_default.version).description(blue("soybeanjs https://soybean.pro"));
|
|
138
|
-
program.parse(process.argv);
|
package/dist/scope.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{ "scope": "" }
|
package/dist/verify-commit.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
// src/verify-commit.ts
|
|
2
|
-
var import_fs = require("fs");
|
|
3
|
-
var import_kolorist = require("kolorist");
|
|
4
|
-
|
|
5
|
-
// src/config.ts
|
|
6
|
-
var types = [
|
|
7
|
-
{ value: "init", title: "init: \u9879\u76EE\u521D\u59CB\u5316" },
|
|
8
|
-
{ value: "feat", title: "feat: \u6DFB\u52A0\u65B0\u7279\u6027" },
|
|
9
|
-
{ value: "fix", title: "fix: \u4FEE\u590Dbug" },
|
|
10
|
-
{ value: "docs", title: "docs: \u4EC5\u4EC5\u4FEE\u6539\u6587\u6863" },
|
|
11
|
-
{ 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" },
|
|
12
|
-
{ value: "refactor", title: "refactor: \u4EE3\u7801\u91CD\u6784\uFF0C\u6CA1\u6709\u52A0\u65B0\u529F\u80FD\u6216\u8005\u4FEE\u590Dbug" },
|
|
13
|
-
{ value: "perf", title: "perf: \u4F18\u5316\u76F8\u5173\uFF0C\u6BD4\u5982\u63D0\u5347\u6027\u80FD\u3001\u4F53\u9A8C" },
|
|
14
|
-
{ value: "test", title: "test: \u6DFB\u52A0\u6D4B\u8BD5\u7528\u4F8B" },
|
|
15
|
-
{ value: "build", title: "build: \u4F9D\u8D56\u76F8\u5173\u7684\u5185\u5BB9" },
|
|
16
|
-
{ value: "ci", title: "ci: CI\u914D\u7F6E\u76F8\u5173\uFF0C\u4F8B\u5982\u5BF9k8s\uFF0Cdocker\u7684\u914D\u7F6E\u6587\u4EF6\u7684\u4FEE\u6539" },
|
|
17
|
-
{ value: "chore", title: "chore: \u6539\u53D8\u6784\u5EFA\u6D41\u7A0B\u3001\u6216\u8005\u589E\u52A0\u4F9D\u8D56\u5E93\u3001\u5DE5\u5177\u7B49" },
|
|
18
|
-
{ value: "revert", title: "revert: \u56DE\u6EDA\u5230\u4E0A\u4E00\u4E2A\u7248\u672C" }
|
|
19
|
-
];
|
|
20
|
-
var scopes = [
|
|
21
|
-
["projects", "\u9879\u76EE\u642D\u5EFA"],
|
|
22
|
-
["components", "\u7EC4\u4EF6\u76F8\u5173"],
|
|
23
|
-
["hooks", "hook \u76F8\u5173"],
|
|
24
|
-
["utils", "utils \u76F8\u5173"],
|
|
25
|
-
["types", "ts\u7C7B\u578B\u76F8\u5173"],
|
|
26
|
-
["styles", "\u6837\u5F0F\u76F8\u5173"],
|
|
27
|
-
["deps", "\u9879\u76EE\u4F9D\u8D56"],
|
|
28
|
-
["auth", "\u5BF9 auth \u4FEE\u6539"],
|
|
29
|
-
["other", "\u5176\u4ED6\u4FEE\u6539"]
|
|
30
|
-
].map(([value, description]) => {
|
|
31
|
-
return {
|
|
32
|
-
value,
|
|
33
|
-
title: `${value.padEnd(30)} (${description})`
|
|
34
|
-
};
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
// src/verify-commit.ts
|
|
38
|
-
var gitMsgPath = "./.git/COMMIT_EDITMSG";
|
|
39
|
-
var commitMsg = (0, import_fs.readFileSync)(gitMsgPath, "utf-8").trim();
|
|
40
|
-
var RELEASE_MSG = "chore: release";
|
|
41
|
-
var REG_EXP = new RegExp(
|
|
42
|
-
`(${types.map((item) => item.value).join("|")})\\((${scopes.map((item) => item.value).join("|")})\\):\\s.{1,50}`
|
|
43
|
-
);
|
|
44
|
-
if (!REG_EXP.test(commitMsg) && !commitMsg.includes(RELEASE_MSG)) {
|
|
45
|
-
throw new Error((0, import_kolorist.red)("\u63D0\u4EA4\u4FE1\u606F\u4E0D\u7B26\u5408 Angular \u89C4\u8303"));
|
|
46
|
-
}
|
package/dist/verify-commit.mjs
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
// src/verify-commit.ts
|
|
2
|
-
import { readFileSync } from "fs";
|
|
3
|
-
import { red } from "kolorist";
|
|
4
|
-
|
|
5
|
-
// src/config.ts
|
|
6
|
-
var types = [
|
|
7
|
-
{ value: "init", title: "init: \u9879\u76EE\u521D\u59CB\u5316" },
|
|
8
|
-
{ value: "feat", title: "feat: \u6DFB\u52A0\u65B0\u7279\u6027" },
|
|
9
|
-
{ value: "fix", title: "fix: \u4FEE\u590Dbug" },
|
|
10
|
-
{ value: "docs", title: "docs: \u4EC5\u4EC5\u4FEE\u6539\u6587\u6863" },
|
|
11
|
-
{ 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" },
|
|
12
|
-
{ value: "refactor", title: "refactor: \u4EE3\u7801\u91CD\u6784\uFF0C\u6CA1\u6709\u52A0\u65B0\u529F\u80FD\u6216\u8005\u4FEE\u590Dbug" },
|
|
13
|
-
{ value: "perf", title: "perf: \u4F18\u5316\u76F8\u5173\uFF0C\u6BD4\u5982\u63D0\u5347\u6027\u80FD\u3001\u4F53\u9A8C" },
|
|
14
|
-
{ value: "test", title: "test: \u6DFB\u52A0\u6D4B\u8BD5\u7528\u4F8B" },
|
|
15
|
-
{ value: "build", title: "build: \u4F9D\u8D56\u76F8\u5173\u7684\u5185\u5BB9" },
|
|
16
|
-
{ value: "ci", title: "ci: CI\u914D\u7F6E\u76F8\u5173\uFF0C\u4F8B\u5982\u5BF9k8s\uFF0Cdocker\u7684\u914D\u7F6E\u6587\u4EF6\u7684\u4FEE\u6539" },
|
|
17
|
-
{ value: "chore", title: "chore: \u6539\u53D8\u6784\u5EFA\u6D41\u7A0B\u3001\u6216\u8005\u589E\u52A0\u4F9D\u8D56\u5E93\u3001\u5DE5\u5177\u7B49" },
|
|
18
|
-
{ value: "revert", title: "revert: \u56DE\u6EDA\u5230\u4E0A\u4E00\u4E2A\u7248\u672C" }
|
|
19
|
-
];
|
|
20
|
-
var scopes = [
|
|
21
|
-
["projects", "\u9879\u76EE\u642D\u5EFA"],
|
|
22
|
-
["components", "\u7EC4\u4EF6\u76F8\u5173"],
|
|
23
|
-
["hooks", "hook \u76F8\u5173"],
|
|
24
|
-
["utils", "utils \u76F8\u5173"],
|
|
25
|
-
["types", "ts\u7C7B\u578B\u76F8\u5173"],
|
|
26
|
-
["styles", "\u6837\u5F0F\u76F8\u5173"],
|
|
27
|
-
["deps", "\u9879\u76EE\u4F9D\u8D56"],
|
|
28
|
-
["auth", "\u5BF9 auth \u4FEE\u6539"],
|
|
29
|
-
["other", "\u5176\u4ED6\u4FEE\u6539"]
|
|
30
|
-
].map(([value, description]) => {
|
|
31
|
-
return {
|
|
32
|
-
value,
|
|
33
|
-
title: `${value.padEnd(30)} (${description})`
|
|
34
|
-
};
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
// src/verify-commit.ts
|
|
38
|
-
var gitMsgPath = "./.git/COMMIT_EDITMSG";
|
|
39
|
-
var commitMsg = readFileSync(gitMsgPath, "utf-8").trim();
|
|
40
|
-
var RELEASE_MSG = "chore: release";
|
|
41
|
-
var REG_EXP = new RegExp(
|
|
42
|
-
`(${types.map((item) => item.value).join("|")})\\((${scopes.map((item) => item.value).join("|")})\\):\\s.{1,50}`
|
|
43
|
-
);
|
|
44
|
-
if (!REG_EXP.test(commitMsg) && !commitMsg.includes(RELEASE_MSG)) {
|
|
45
|
-
throw new Error(red("\u63D0\u4EA4\u4FE1\u606F\u4E0D\u7B26\u5408 Angular \u89C4\u8303"));
|
|
46
|
-
}
|