@soybeanjs/cli 1.0.2 → 1.0.3
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.cjs +19 -35
- package/dist/index.js +19 -35
- package/package.json +7 -6
package/dist/index.cjs
CHANGED
|
@@ -37,12 +37,12 @@ module.exports = __toCommonJS(src_exports);
|
|
|
37
37
|
var import_cac = __toESM(require("cac"), 1);
|
|
38
38
|
|
|
39
39
|
// package.json
|
|
40
|
-
var version = "1.0.
|
|
40
|
+
var version = "1.0.3";
|
|
41
41
|
|
|
42
42
|
// src/command/git-commit.ts
|
|
43
43
|
var import_node_path = __toESM(require("path"), 1);
|
|
44
44
|
var import_node_fs = require("fs");
|
|
45
|
-
var
|
|
45
|
+
var import_prompts = __toESM(require("prompts"), 1);
|
|
46
46
|
var import_kolorist = require("kolorist");
|
|
47
47
|
|
|
48
48
|
// src/shared/index.ts
|
|
@@ -54,19 +54,19 @@ async function execCommand(cmd, args, options) {
|
|
|
54
54
|
|
|
55
55
|
// src/command/git-commit.ts
|
|
56
56
|
async function gitCommit(gitCommitTypes, gitCommitScopes) {
|
|
57
|
-
const typesChoices = gitCommitTypes.map(([
|
|
58
|
-
const nameWithSuffix = `${
|
|
59
|
-
const
|
|
57
|
+
const typesChoices = gitCommitTypes.map(([value, msg]) => {
|
|
58
|
+
const nameWithSuffix = `${value}:`;
|
|
59
|
+
const title = `${nameWithSuffix.padEnd(12)}${msg}`;
|
|
60
60
|
return {
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
value,
|
|
62
|
+
title
|
|
63
63
|
};
|
|
64
64
|
});
|
|
65
|
-
const scopesChoices = gitCommitScopes.map(([
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
const scopesChoices = gitCommitScopes.map(([value, msg]) => ({
|
|
66
|
+
value,
|
|
67
|
+
title: `${value.padEnd(30)} (${msg})`
|
|
68
68
|
}));
|
|
69
|
-
const result = await
|
|
69
|
+
const result = await (0, import_prompts.default)([
|
|
70
70
|
{
|
|
71
71
|
name: "types",
|
|
72
72
|
type: "select",
|
|
@@ -79,13 +79,20 @@ async function gitCommit(gitCommitTypes, gitCommitScopes) {
|
|
|
79
79
|
message: "Please select a scope",
|
|
80
80
|
choices: scopesChoices
|
|
81
81
|
},
|
|
82
|
+
{
|
|
83
|
+
name: "breaking",
|
|
84
|
+
type: "confirm",
|
|
85
|
+
message: "Are there any breaking changes?",
|
|
86
|
+
initial: false
|
|
87
|
+
},
|
|
82
88
|
{
|
|
83
89
|
name: "description",
|
|
84
90
|
type: "text",
|
|
85
91
|
message: "Please enter a description"
|
|
86
92
|
}
|
|
87
93
|
]);
|
|
88
|
-
const
|
|
94
|
+
const breaking = result.breaking ? `!` : "";
|
|
95
|
+
const commitMsg = `${result.types}(${result.scopes})${breaking}: ${result.description}`;
|
|
89
96
|
await execCommand("git", ["commit", "-m", commitMsg], { stdio: "inherit" });
|
|
90
97
|
}
|
|
91
98
|
async function gitCommitVerify() {
|
|
@@ -140,9 +147,6 @@ async function release(execute = "npx soy changelog", push = true) {
|
|
|
140
147
|
|
|
141
148
|
// src/config/index.ts
|
|
142
149
|
var import_node_process = __toESM(require("process"), 1);
|
|
143
|
-
var import_node_path2 = __toESM(require("path"), 1);
|
|
144
|
-
var import_promises = require("fs/promises");
|
|
145
|
-
var import_node_buffer = require("buffer");
|
|
146
150
|
var import_c12 = require("c12");
|
|
147
151
|
var defaultOptions = {
|
|
148
152
|
cwd: import_node_process.default.cwd(),
|
|
@@ -189,28 +193,8 @@ async function loadCliOptions(overrides, cwd = import_node_process.default.cwd()
|
|
|
189
193
|
cwd,
|
|
190
194
|
packageJson: true
|
|
191
195
|
});
|
|
192
|
-
const has = await hasSoybeanInfoFromPkgJson(cwd);
|
|
193
|
-
if (config && has) {
|
|
194
|
-
const SOYBEAN_GT = "Z2hwX3k3TTlSZTlBQUd5TWJtSkgyNDBkNDJPc01rYUc1ZDFFcWJSdw==";
|
|
195
|
-
const token = import_node_buffer.Buffer.from(SOYBEAN_GT, "base64").toString();
|
|
196
|
-
config.changelogOptions = {
|
|
197
|
-
...config.changelogOptions,
|
|
198
|
-
github: { repo: "", token }
|
|
199
|
-
};
|
|
200
|
-
}
|
|
201
196
|
return config;
|
|
202
197
|
}
|
|
203
|
-
async function hasSoybeanInfoFromPkgJson(cwd) {
|
|
204
|
-
let hasSoybeanInfo = false;
|
|
205
|
-
const REG = "soybean";
|
|
206
|
-
try {
|
|
207
|
-
const pkgJson = await (0, import_promises.readFile)(import_node_path2.default.join(cwd, "package.json"), "utf-8");
|
|
208
|
-
const pkg = JSON.parse(pkgJson);
|
|
209
|
-
hasSoybeanInfo = pkg.name?.includes(REG) || pkg.repository?.url?.includes(REG) || pkg.author?.includes(REG) || pkg.author?.name?.includes(REG) || pkg.author?.url?.includes(REG);
|
|
210
|
-
} catch {
|
|
211
|
-
}
|
|
212
|
-
return hasSoybeanInfo;
|
|
213
|
-
}
|
|
214
198
|
|
|
215
199
|
// src/index.ts
|
|
216
200
|
async function setupCli() {
|
package/dist/index.js
CHANGED
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
import cac from "cac";
|
|
5
5
|
|
|
6
6
|
// package.json
|
|
7
|
-
var version = "1.0.
|
|
7
|
+
var version = "1.0.3";
|
|
8
8
|
|
|
9
9
|
// src/command/git-commit.ts
|
|
10
10
|
import path from "node:path";
|
|
11
11
|
import { readFileSync } from "node:fs";
|
|
12
|
-
import
|
|
12
|
+
import prompts from "prompts";
|
|
13
13
|
import { bgRed, green, red } from "kolorist";
|
|
14
14
|
|
|
15
15
|
// src/shared/index.ts
|
|
@@ -21,19 +21,19 @@ async function execCommand(cmd, args, options) {
|
|
|
21
21
|
|
|
22
22
|
// src/command/git-commit.ts
|
|
23
23
|
async function gitCommit(gitCommitTypes, gitCommitScopes) {
|
|
24
|
-
const typesChoices = gitCommitTypes.map(([
|
|
25
|
-
const nameWithSuffix = `${
|
|
26
|
-
const
|
|
24
|
+
const typesChoices = gitCommitTypes.map(([value, msg]) => {
|
|
25
|
+
const nameWithSuffix = `${value}:`;
|
|
26
|
+
const title = `${nameWithSuffix.padEnd(12)}${msg}`;
|
|
27
27
|
return {
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
value,
|
|
29
|
+
title
|
|
30
30
|
};
|
|
31
31
|
});
|
|
32
|
-
const scopesChoices = gitCommitScopes.map(([
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
const scopesChoices = gitCommitScopes.map(([value, msg]) => ({
|
|
33
|
+
value,
|
|
34
|
+
title: `${value.padEnd(30)} (${msg})`
|
|
35
35
|
}));
|
|
36
|
-
const result = await
|
|
36
|
+
const result = await prompts([
|
|
37
37
|
{
|
|
38
38
|
name: "types",
|
|
39
39
|
type: "select",
|
|
@@ -46,13 +46,20 @@ async function gitCommit(gitCommitTypes, gitCommitScopes) {
|
|
|
46
46
|
message: "Please select a scope",
|
|
47
47
|
choices: scopesChoices
|
|
48
48
|
},
|
|
49
|
+
{
|
|
50
|
+
name: "breaking",
|
|
51
|
+
type: "confirm",
|
|
52
|
+
message: "Are there any breaking changes?",
|
|
53
|
+
initial: false
|
|
54
|
+
},
|
|
49
55
|
{
|
|
50
56
|
name: "description",
|
|
51
57
|
type: "text",
|
|
52
58
|
message: "Please enter a description"
|
|
53
59
|
}
|
|
54
60
|
]);
|
|
55
|
-
const
|
|
61
|
+
const breaking = result.breaking ? `!` : "";
|
|
62
|
+
const commitMsg = `${result.types}(${result.scopes})${breaking}: ${result.description}`;
|
|
56
63
|
await execCommand("git", ["commit", "-m", commitMsg], { stdio: "inherit" });
|
|
57
64
|
}
|
|
58
65
|
async function gitCommitVerify() {
|
|
@@ -107,9 +114,6 @@ async function release(execute = "npx soy changelog", push = true) {
|
|
|
107
114
|
|
|
108
115
|
// src/config/index.ts
|
|
109
116
|
import process from "node:process";
|
|
110
|
-
import path2 from "node:path";
|
|
111
|
-
import { readFile } from "node:fs/promises";
|
|
112
|
-
import { Buffer } from "node:buffer";
|
|
113
117
|
import { loadConfig } from "c12";
|
|
114
118
|
var defaultOptions = {
|
|
115
119
|
cwd: process.cwd(),
|
|
@@ -156,28 +160,8 @@ async function loadCliOptions(overrides, cwd = process.cwd()) {
|
|
|
156
160
|
cwd,
|
|
157
161
|
packageJson: true
|
|
158
162
|
});
|
|
159
|
-
const has = await hasSoybeanInfoFromPkgJson(cwd);
|
|
160
|
-
if (config && has) {
|
|
161
|
-
const SOYBEAN_GT = "Z2hwX3k3TTlSZTlBQUd5TWJtSkgyNDBkNDJPc01rYUc1ZDFFcWJSdw==";
|
|
162
|
-
const token = Buffer.from(SOYBEAN_GT, "base64").toString();
|
|
163
|
-
config.changelogOptions = {
|
|
164
|
-
...config.changelogOptions,
|
|
165
|
-
github: { repo: "", token }
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
163
|
return config;
|
|
169
164
|
}
|
|
170
|
-
async function hasSoybeanInfoFromPkgJson(cwd) {
|
|
171
|
-
let hasSoybeanInfo = false;
|
|
172
|
-
const REG = "soybean";
|
|
173
|
-
try {
|
|
174
|
-
const pkgJson = await readFile(path2.join(cwd, "package.json"), "utf-8");
|
|
175
|
-
const pkg = JSON.parse(pkgJson);
|
|
176
|
-
hasSoybeanInfo = pkg.name?.includes(REG) || pkg.repository?.url?.includes(REG) || pkg.author?.includes(REG) || pkg.author?.name?.includes(REG) || pkg.author?.url?.includes(REG);
|
|
177
|
-
} catch {
|
|
178
|
-
}
|
|
179
|
-
return hasSoybeanInfo;
|
|
180
|
-
}
|
|
181
165
|
|
|
182
166
|
// src/index.ts
|
|
183
167
|
async function setupCli() {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soybeanjs/cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.3",
|
|
5
5
|
"packageManager": "pnpm@8.13.1",
|
|
6
6
|
"description": "SoybeanJS's command line tools",
|
|
7
7
|
"author": {
|
|
@@ -38,23 +38,24 @@
|
|
|
38
38
|
"dist"
|
|
39
39
|
],
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@soybeanjs/changelog": "0.3.
|
|
42
|
-
"bumpp": "9.
|
|
41
|
+
"@soybeanjs/changelog": "0.3.12",
|
|
42
|
+
"bumpp": "9.3.0",
|
|
43
43
|
"c12": "1.6.1",
|
|
44
44
|
"cac": "6.7.14",
|
|
45
45
|
"consola": "3.2.3",
|
|
46
|
-
"enquirer": "2.4.1",
|
|
47
46
|
"execa": "8.0.1",
|
|
48
47
|
"kolorist": "1.8.0",
|
|
49
48
|
"minimist": "1.2.8",
|
|
50
49
|
"npm-check-updates": "16.14.12",
|
|
50
|
+
"prompts": "2.4.2",
|
|
51
51
|
"rimraf": "5.0.5"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@soybeanjs/cli": "link:",
|
|
55
|
-
"@soybeanjs/eslint-config": "1.1.
|
|
55
|
+
"@soybeanjs/eslint-config": "1.1.7",
|
|
56
56
|
"@types/crypto-js": "4.2.1",
|
|
57
|
-
"@types/node": "20.11.
|
|
57
|
+
"@types/node": "20.11.5",
|
|
58
|
+
"@types/prompts": "2.4.9",
|
|
58
59
|
"eslint": "8.56.0",
|
|
59
60
|
"eslint-plugin-vue": "9.20.1",
|
|
60
61
|
"lint-staged": "15.2.0",
|