@soybeanjs/cli 0.7.0 → 0.7.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 CHANGED
@@ -1,336 +1,4 @@
1
1
  #!/usr/bin/env node
2
- 'use strict';
2
+ "use strict";const d$1=require("cac"),a$1=require("node:path"),node_fs=require("node:fs"),l$1=require("enquirer"),kolorist=require("kolorist"),cryptoJs=require("crypto-js"),rimraf=require("rimraf"),s=require("path"),fs=require("fs"),changelog=require("@soybeanjs/changelog"),e=require("bumpp"),c12=require("c12"),promises=require("fs/promises");function _interopDefaultCompat(t){return t&&typeof t=="object"&&"default"in t?t.default:t}const d__default=_interopDefaultCompat(d$1),a__default=_interopDefaultCompat(a$1),l__default=_interopDefaultCompat(l$1),s__default=_interopDefaultCompat(s),e__default=_interopDefaultCompat(e),version="0.7.3";var c=Object.defineProperty,a=(t,o,r)=>o in t?c(t,o,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[o]=r,n=(t,o,r)=>(a(t,typeof o!="symbol"?o+"":o,r),r);async function execCommand(t,o,r){const{execa:m}=await import("execa");return(await m(t,o,r))?.stdout?.trim()||""}class Crypto{constructor(o){n(this,"secret"),this.secret=o}enCrypto(o){const r=JSON.stringify(o);return cryptoJs.AES.encrypt(r,this.secret).toString()}deCrypto(o){const r=cryptoJs.AES.decrypt(o,this.secret).toString(cryptoJs.enc.Utf8);if(r)try{return JSON.parse(r)}catch{return null}return null}}async function gitCommit(t,o){const r=t.map(([g,h])=>{const y=`${`${g}:`.padEnd(12)}${h}`;return{name:g,message:y}}),m=o.map(([g,h])=>({name:g,message:`${g.padEnd(30)} (${h})`})),u=await l__default.prompt([{name:"types",type:"select",message:"Please select a type",choices:r},{name:"scopes",type:"select",message:"Please select a scope",choices:m},{name:"description",type:"text",message:"Please enter a description"}]),f=`${u.types}(${u.scopes}): ${u.description}`;await execCommand("git",["commit","-m",f],{stdio:"inherit"})}async function gitCommitVerify(){const t=await execCommand("git",["rev-parse","--show-toplevel"]),o=a__default.join(t,".git","COMMIT_EDITMSG"),r=node_fs.readFileSync(o,"utf8").trim();if(!/(?<type>[a-z]+)(\((?<scope>.+)\))?(?<breaking>!)?: (?<description>.+)/i.test(r))throw new Error(`${kolorist.bgRed(" ERROR ")} ${kolorist.red("git commit message must match the Conventional Commits standard!")}
3
3
 
4
- const cac = require('cac');
5
- const enquirer = require('enquirer');
6
- const path = require('path');
7
- const fs = require('fs');
8
- const kolorist = require('kolorist');
9
- const rimraf = require('rimraf');
10
- const changelog = require('@soybeanjs/changelog');
11
- const versionBump = require('bumpp');
12
- const c12 = require('c12');
13
- const promises = require('fs/promises');
14
-
15
- function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
16
-
17
- const cac__default = /*#__PURE__*/_interopDefaultCompat(cac);
18
- const enquirer__default = /*#__PURE__*/_interopDefaultCompat(enquirer);
19
- const path__default = /*#__PURE__*/_interopDefaultCompat(path);
20
- const versionBump__default = /*#__PURE__*/_interopDefaultCompat(versionBump);
21
-
22
- const version = "0.7.0";
23
-
24
- async function execCommand(cmd, args, options) {
25
- const { execa } = await import('execa');
26
- const res = await execa(cmd, args, options);
27
- return res?.stdout?.trim() || "";
28
- }
29
-
30
- async function gitCommit(gitCommitTypes, gitCommitScopes) {
31
- const typesChoices = gitCommitTypes.map(([name, title]) => {
32
- const nameWithSuffix = `${name}:`;
33
- const message = `${nameWithSuffix.padEnd(12)}${title}`;
34
- return {
35
- name,
36
- message
37
- };
38
- });
39
- const scopesChoices = gitCommitScopes.map(([name, title]) => ({
40
- name,
41
- message: `${name.padEnd(30)} (${title})`
42
- }));
43
- const result = await enquirer__default.prompt([
44
- {
45
- name: "types",
46
- type: "select",
47
- message: "\u8BF7\u9009\u62E9\u63D0\u4EA4\u7684\u7C7B\u578B",
48
- choices: typesChoices
49
- },
50
- {
51
- name: "scopes",
52
- type: "select",
53
- message: "\u9009\u62E9\u4E00\u4E2Ascope",
54
- choices: scopesChoices
55
- },
56
- {
57
- name: "description",
58
- type: "text",
59
- message: "\u8BF7\u8F93\u5165\u63D0\u4EA4\u63CF\u8FF0"
60
- }
61
- ]);
62
- const commitMsg = `${result.types}(${result.scopes}): ${result.description}`;
63
- execCommand("git", ["commit", "-m", commitMsg], { stdio: "inherit" });
64
- }
65
-
66
- async function gitCommitVerify() {
67
- const gitPath = await execCommand("git", ["rev-parse", "--show-toplevel"]);
68
- const gitMsgPath = path__default.join(gitPath, ".git", "COMMIT_EDITMSG");
69
- const commitMsg = fs.readFileSync(gitMsgPath, "utf-8").trim();
70
- const REG_EXP = /(?<type>[a-z]+)(\((?<scope>.+)\))?(?<breaking>!)?: (?<description>.+)/i;
71
- if (!REG_EXP.test(commitMsg)) {
72
- throw new Error(
73
- `${kolorist.bgRed(" ERROR ")} ${kolorist.red("Git\u63D0\u4EA4\u4FE1\u606F\u4E0D\u7B26\u5408 Angular \u89C4\u8303!\n\n")}${kolorist.green(
74
- "\u63A8\u8350\u4F7F\u7528\u547D\u4EE4 pnpm commit \u751F\u6210\u7B26\u5408\u89C4\u8303\u7684Git\u63D0\u4EA4\u4FE1\u606F"
75
- )}`
76
- );
77
- }
78
- }
79
-
80
- async function cleanup(paths) {
81
- await rimraf.rimraf(paths, { glob: true });
82
- }
83
-
84
- async function initSimpleGitHooks(cwd = process.cwd()) {
85
- const huskyDir = path__default.join(cwd, ".husky");
86
- const existHusky = fs.existsSync(huskyDir);
87
- const gitHooksDir = path__default.join(cwd, ".git", "hooks");
88
- if (existHusky) {
89
- await rimraf.rimraf(huskyDir);
90
- await execCommand("git", ["config", "core.hooksPath", gitHooksDir], { stdio: "inherit" });
91
- }
92
- await rimraf.rimraf(gitHooksDir);
93
- await execCommand("npx", ["simple-git-hooks"], { stdio: "inherit" });
94
- }
95
-
96
- async function ncu(args = ["--deep", "-u"]) {
97
- execCommand("npx", ["ncu", ...args], { stdio: "inherit" });
98
- }
99
-
100
- async function prettierWrite(writeGlob) {
101
- await execCommand("npx", ["prettier", "--write", ".", ...writeGlob], {
102
- stdio: "inherit"
103
- });
104
- }
105
-
106
- async function eslintPrettier() {
107
- await execCommand("npx", ["eslint", ".", "--fix"], {
108
- stdio: "inherit"
109
- });
110
- await execCommand("npx", ["soy", "prettier-format"], {
111
- stdio: "inherit"
112
- });
113
- }
114
-
115
- async function execLintStaged(config) {
116
- const lintStaged = (await import('lint-staged')).default;
117
- return lintStaged({ config, allowEmpty: true });
118
- }
119
-
120
- async function genChangelog(options, total = false) {
121
- if (total) {
122
- await changelog.generateTotalChangelog(options);
123
- } else {
124
- await changelog.generateChangelog(options);
125
- }
126
- }
127
-
128
- async function release() {
129
- await versionBump__default({
130
- files: ["**/package.json", "!**/node_modules"],
131
- execute: "npx soy changelog",
132
- all: true,
133
- tag: true,
134
- commit: "chore(projects): release v%s",
135
- push: true
136
- });
137
- }
138
-
139
- const eslintExt = "*.{js,jsx,mjs,cjs,json,ts,tsx,mts,cts,vue,svelte,astro}";
140
- const defaultOptions = {
141
- cwd: process.cwd(),
142
- cleanupDirs: [
143
- "**/dist",
144
- "**/package-lock.json",
145
- "**/yarn.lock",
146
- "**/pnpm-lock.yaml",
147
- "**/node_modules",
148
- "!node_modules/**"
149
- ],
150
- gitCommitTypes: [
151
- ["init", "\u9879\u76EE\u521D\u59CB\u5316"],
152
- ["feat", "\u6DFB\u52A0\u65B0\u7279\u6027"],
153
- ["fix", "\u4FEE\u590Dbug"],
154
- ["docs", "\u4EC5\u4EC5\u4FEE\u6539\u6587\u6863"],
155
- ["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"],
156
- ["refactor", "\u4EE3\u7801\u91CD\u6784\uFF0C\u6CA1\u6709\u52A0\u65B0\u529F\u80FD\u6216\u8005\u4FEE\u590Dbug"],
157
- ["perf", "\u4F18\u5316\u76F8\u5173\uFF0C\u6BD4\u5982\u63D0\u5347\u6027\u80FD\u3001\u4F53\u9A8C"],
158
- ["test", "\u6DFB\u52A0\u6D4B\u8BD5\u7528\u4F8B"],
159
- ["build", "\u4F9D\u8D56\u76F8\u5173\u7684\u5185\u5BB9"],
160
- ["ci", "CI\u914D\u7F6E\u76F8\u5173\uFF0C\u4F8B\u5982\u5BF9k8s\uFF0Cdocker\u7684\u914D\u7F6E\u6587\u4EF6\u7684\u4FEE\u6539"],
161
- ["chore", "\u6539\u53D8\u6784\u5EFA\u6D41\u7A0B\u3001\u6216\u8005\u589E\u52A0\u4F9D\u8D56\u5E93\u3001\u5DE5\u5177\u7B49"],
162
- ["revert", "\u56DE\u6EDA\u5230\u4E0A\u4E00\u4E2A\u7248\u672C"]
163
- ],
164
- gitCommitScopes: [
165
- ["projects", "\u9879\u76EE\u642D\u5EFA"],
166
- ["components", "\u7EC4\u4EF6\u76F8\u5173"],
167
- ["hooks", "hook \u76F8\u5173"],
168
- ["utils", "utils \u76F8\u5173"],
169
- ["types", "ts\u7C7B\u578B\u76F8\u5173"],
170
- ["styles", "\u6837\u5F0F\u76F8\u5173"],
171
- ["deps", "\u9879\u76EE\u4F9D\u8D56"],
172
- ["auth", "\u5BF9 auth \u4FEE\u6539"],
173
- ["release", "\u7248\u672C\u53D1\u5E03"],
174
- ["other", "\u5176\u4ED6\u4FEE\u6539"]
175
- ],
176
- ncuCommandArgs: ["--deep", "-u"],
177
- changelogOptions: {},
178
- prettierWriteGlob: [
179
- `!**/${eslintExt}`,
180
- "!*.min.*",
181
- "!CHANGELOG.md",
182
- "!dist",
183
- "!LICENSE*",
184
- "!output",
185
- "!coverage",
186
- "!public",
187
- "!temp",
188
- "!package-lock.json",
189
- "!pnpm-lock.yaml",
190
- "!yarn.lock",
191
- "!.github",
192
- "!__snapshots__",
193
- "!node_modules"
194
- ],
195
- lintStagedConfig: {
196
- [eslintExt]: "eslint --fix",
197
- "*": "soy prettier-write"
198
- }
199
- };
200
- const SOYBEAN_GITHUB_TOKEN = "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";
201
- async function loadCliOptions(overrides, cwd = process.cwd()) {
202
- const { config } = await c12.loadConfig({
203
- name: "soybean",
204
- defaults: defaultOptions,
205
- overrides,
206
- cwd,
207
- packageJson: true
208
- });
209
- const has = await hasSoybeanInfoFromPkgJson(cwd);
210
- if (config && has) {
211
- config.changelogOptions = { ...config.changelogOptions, github: { repo: "", token: SOYBEAN_GITHUB_TOKEN } };
212
- }
213
- return config;
214
- }
215
- async function hasSoybeanInfoFromPkgJson(cwd) {
216
- let hasSoybeanInfo = false;
217
- const REG = "soybean";
218
- try {
219
- const pkgJson = await promises.readFile(`${cwd}/package.json`, "utf-8");
220
- const pkg = JSON.parse(pkgJson);
221
- hasSoybeanInfo = pkg.name?.includes(REG) || pkg.repository?.url?.includes(REG) || pkg.author?.includes(REG) || pkg.author?.name?.includes(REG) || pkg.author?.url?.includes(REG);
222
- } catch {
223
- }
224
- return hasSoybeanInfo;
225
- }
226
-
227
- async function setupCli() {
228
- const cliOptions = await loadCliOptions();
229
- const cli = cac__default("soybean");
230
- cli.version(version).option("--total", "Generate changelog by total tags").help();
231
- const commands = {
232
- "git-commit": {
233
- desc: "\u751F\u6210\u7B26\u5408 Conventional Commits \u89C4\u8303\u7684\u63D0\u4EA4\u4FE1\u606F",
234
- action: async () => {
235
- await gitCommit(cliOptions.gitCommitTypes, cliOptions.gitCommitScopes);
236
- }
237
- },
238
- "git-commit-verify": {
239
- desc: "\u6821\u9A8C git \u63D0\u4EA4\u4FE1\u606F\u662F\u5426\u7B26\u5408 Conventional Commits \u89C4\u8303",
240
- action: async () => {
241
- await gitCommitVerify();
242
- }
243
- },
244
- cleanup: {
245
- desc: "\u6E05\u7A7A\u4F9D\u8D56\u548C\u6784\u5EFA\u4EA7\u7269",
246
- action: async () => {
247
- await cleanup(cliOptions.cleanupDirs);
248
- }
249
- },
250
- "init-simple-git-hooks": {
251
- desc: "\u521D\u59CB\u5316 simple-git-hooks \u94A9\u5B50",
252
- action: async () => {
253
- await initSimpleGitHooks(cliOptions.cwd);
254
- }
255
- },
256
- ncu: {
257
- desc: "\u547D\u4EE4 npm-check-updates, \u5347\u7EA7\u4F9D\u8D56",
258
- action: async () => {
259
- await ncu(cliOptions.ncuCommandArgs);
260
- }
261
- },
262
- "prettier-write": {
263
- desc: "\u6267\u884C prettier --write \u683C\u5F0F\u5316",
264
- action: async () => {
265
- await prettierWrite(cliOptions.prettierWriteGlob);
266
- }
267
- },
268
- "lint-staged": {
269
- desc: "\u6267\u884Clint-staged",
270
- action: async () => {
271
- const passed = await execLintStaged(cliOptions.lintStagedConfig).catch(() => {
272
- process.exitCode = 1;
273
- });
274
- process.exitCode = passed ? 0 : 1;
275
- }
276
- },
277
- changelog: {
278
- desc: "\u751F\u6210changelog",
279
- action: async (args) => {
280
- await genChangelog(cliOptions.changelogOptions, args?.total);
281
- }
282
- },
283
- release: {
284
- desc: "\u53D1\u5E03\uFF1A\u66F4\u65B0\u7248\u672C\u53F7\u3001\u751F\u6210changelog\u3001\u63D0\u4EA4\u4EE3\u7801",
285
- action: async () => {
286
- await release();
287
- }
288
- },
289
- /**
290
- * @deprecated
291
- */
292
- "init-git-hooks": {
293
- desc: "\u8BE5\u547D\u4EE4\u5DF2\u5E9F\u5F03\uFF0C\u8BF7\u4F7F\u7528 init-simple-git-hooks",
294
- action: async () => {
295
- await initSimpleGitHooks(cliOptions.cwd);
296
- }
297
- },
298
- /**
299
- * @deprecated
300
- */
301
- "update-pkg": {
302
- desc: "\u8BE5\u547D\u4EE4\u5DF2\u5E9F\u5F03\uFF0C\u8BF7\u4F7F\u7528 ncu",
303
- action: async () => {
304
- await ncu(cliOptions.ncuCommandArgs);
305
- }
306
- },
307
- /**
308
- * @deprecated
309
- */
310
- "prettier-format": {
311
- desc: "\u8BE5\u547D\u4EE4\u5DF2\u5E9F\u5F03\uFF0C\u8BF7\u4F7F\u7528 prettier-write",
312
- action: async () => {
313
- await prettierWrite(cliOptions.prettierWriteGlob);
314
- }
315
- },
316
- /**
317
- * @deprecated
318
- */
319
- "eslint-prettier": {
320
- desc: "\u8BE5\u547D\u4EE4\u5DF2\u5E9F\u5F03",
321
- action: async () => {
322
- await eslintPrettier();
323
- }
324
- }
325
- };
326
- for await (const [command, { desc, action }] of Object.entries(commands)) {
327
- cli.command(command, desc).action(action);
328
- }
329
- cli.parse();
330
- }
331
- setupCli();
332
- function defineConfig(config) {
333
- return config;
334
- }
335
-
336
- exports.defineConfig = defineConfig;
4
+ ${kolorist.green("Recommended to use the command `pnpm commit` to generate Conventional Commits compliant commit information.\nGet more info about Conventional Commits, follow this link: https://conventionalcommits.org")}`)}async function cleanup(t){await rimraf.rimraf(t,{glob:!0})}async function initSimpleGitHooks(t=process.cwd()){const o=s__default.join(t,".husky"),r=fs.existsSync(o),m=s__default.join(t,".git","hooks");r&&(await rimraf.rimraf(o),await execCommand("git",["config","core.hooksPath",m],{stdio:"inherit"})),await rimraf.rimraf(m),await execCommand("npx",["simple-git-hooks"],{stdio:"inherit"})}async function ncu(t=["--deep","-u"]){execCommand("npx",["ncu",...t],{stdio:"inherit"})}async function prettierWrite(t){await execCommand("npx",["prettier","--write",".",...t],{stdio:"inherit"})}async function eslintPrettier(){await execCommand("npx",["eslint",".","--fix"],{stdio:"inherit"}),await execCommand("npx",["soy","prettier-format"],{stdio:"inherit"})}async function execLintStaged(t){const o=(await import("lint-staged")).default;return o({config:t,allowEmpty:!0})}async function genChangelog(t,o=!1){o?await changelog.generateTotalChangelog(t):await changelog.generateChangelog(t)}async function release(){await e__default({files:["**/package.json","!**/node_modules"],execute:"npx soy changelog",all:!0,tag:!0,commit:"chore(projects): release v%s",push:!0})}const i$1="*.{js,jsx,mjs,cjs,json,ts,tsx,mts,cts,vue,svelte,astro}",p={cwd:process.cwd(),cleanupDirs:["**/dist","**/package-lock.json","**/yarn.lock","**/pnpm-lock.yaml","**/node_modules","!node_modules/**"],gitCommitTypes:[["feat","A new feature"],["fix","A bug fix"],["docs","Documentation only changes"],["style","Changes that do not affect the meaning of the code"],["refactor","A code change that neither fixes a bug nor adds a feature"],["perf","A code change that improves performance"],["test","Adding missing tests or correcting existing tests"],["build","Changes that affect the build system or external dependencies"],["ci","Changes to our CI configuration files and scripts"],["chore","Other changes that don't modify src or test files"],["revert","Reverts a previous commit"]],gitCommitScopes:[["projects","project"],["components","components"],["hooks","hook functions"],["utils","utils functions"],["types","TS declaration"],["styles","style"],["deps","project dependencies"],["release","release project"],["other","other changes"]],ncuCommandArgs:["--deep","-u"],changelogOptions:{},prettierWriteGlob:[`!**/${i$1}`,"!*.min.*","!CHANGELOG.md","!dist","!LICENSE*","!output","!coverage","!public","!temp","!package-lock.json","!pnpm-lock.yaml","!yarn.lock","!.github","!__snapshots__","!node_modules"],lintStagedConfig:{[i$1]:"eslint --fix","*":"soy prettier-write"}},l="U2FsdGVkX1+vLW5S5+vcx+LKGSR2PtJOAZUZsVCTKM0+ecI3hDuARJn6kdLzzR1LVl0179NmgMoX6fV28TMu3A==";async function loadCliOptions(t,o=process.cwd()){const{config:r}=await c12.loadConfig({name:"soybean",defaults:p,overrides:t,cwd:o,packageJson:!0}),m=await d(o);if(r&&m){const u=new Crypto("SOYBEAN_JS");r.changelogOptions={...r.changelogOptions,github:{repo:"",token:u.deCrypto(l)||""}}}return r}async function d(t){let o=!1;const r="soybean";try{const m=await promises.readFile(`${t}/package.json`,"utf-8"),u=JSON.parse(m);o=u.name?.includes(r)||u.repository?.url?.includes(r)||u.author?.includes(r)||u.author?.name?.includes(r)||u.author?.url?.includes(r)}catch{}return o}const i="the command is deprecated, it will be removed in the next major version 1.0.0";async function v(){const t=await loadCliOptions(),o=d__default("soybean");o.version(version).option("--total","Generate changelog by total tags").help();const r={cleanup:{desc:"delete dirs: node_modules, dist, etc.",action:async()=>{await cleanup(t.cleanupDirs)}},ncu:{desc:"npm-check-updates, it can update package.json dependencies to the latest version",action:async()=>{await ncu(t.ncuCommandArgs)}},"git-commit":{desc:"git commit, generate commit message which match Conventional Commits standard",action:async()=>{await gitCommit(t.gitCommitTypes,t.gitCommitScopes)}},"git-commit-verify":{desc:"verify git commit message, make sure it match Conventional Commits standard",action:async()=>{await gitCommitVerify()}},"prettier-write":{desc:"run prettier --write",action:async()=>{await prettierWrite(t.prettierWriteGlob)}},"lint-staged":{desc:"run lint-staged",action:async()=>{const m=await execLintStaged(t.lintStagedConfig).catch(()=>{process.exitCode=1});process.exitCode=m?0:1}},changelog:{desc:"generate changelog",action:async m=>{await genChangelog(t.changelogOptions,m?.total)}},release:{desc:"release: update version, generate changelog, commit code",action:async()=>{await release()}},"init-simple-git-hooks":{desc:`init simple-git-hooks and remove husky (${i})`,action:async()=>{await initSimpleGitHooks(t.cwd)}},"init-git-hooks":{desc:`same as init-simple-git-hooks (${i})`,action:async()=>{await initSimpleGitHooks(t.cwd)}},"update-pkg":{desc:`same as ncu (${i})`,action:async()=>{await ncu(t.ncuCommandArgs)}},"prettier-format":{desc:`same as prettier-write (${i})`,action:async()=>{await prettierWrite(t.prettierWriteGlob)}},"eslint-prettier":{desc:i,action:async()=>{await eslintPrettier()}}};for await(const[m,{desc:u,action:f}]of Object.entries(r))o.command(m,u).action(f);o.parse()}v();function defineConfig(t){return t}exports.defineConfig=defineConfig;
@@ -0,0 +1,48 @@
1
+ import { ChangelogOption } from '@soybeanjs/changelog';
2
+
3
+ interface CliOption {
4
+ /**
5
+ * the project root directory
6
+ */
7
+ cwd: string;
8
+ /**
9
+ * cleanup dirs
10
+ * @default
11
+ * ```json
12
+ * ["** /dist", "** /pnpm-lock.yaml", "** /node_modules", "!node_modules/**"]
13
+ * ```
14
+ * @description glob pattern syntax {@link https://github.com/isaacs/minimatch}
15
+ */
16
+ cleanupDirs: string[];
17
+ /**
18
+ * git commit types
19
+ */
20
+ gitCommitTypes: [string, string][];
21
+ /**
22
+ * git commit scopes
23
+ */
24
+ gitCommitScopes: [string, string][];
25
+ /**
26
+ * npm-check-updates command args
27
+ * @default ["--deep","-u"]
28
+ */
29
+ ncuCommandArgs: string[];
30
+ /**
31
+ * options of generate changelog
32
+ * @link https://github.com/soybeanjs/changelog
33
+ */
34
+ changelogOptions: Partial<ChangelogOption>;
35
+ /**
36
+ * prettier write glob
37
+ * @description glob pattern syntax {@link https://github.com/micromatch/micromatch}
38
+ */
39
+ prettierWriteGlob: string[];
40
+ /**
41
+ * lint-staged config
42
+ */
43
+ lintStagedConfig: Record<string, string | string[]>;
44
+ }
45
+
46
+ declare function defineConfig(config?: Partial<CliOption>): Partial<CliOption> | undefined;
47
+
48
+ export { type CliOption, defineConfig };
@@ -0,0 +1,48 @@
1
+ import { ChangelogOption } from '@soybeanjs/changelog';
2
+
3
+ interface CliOption {
4
+ /**
5
+ * the project root directory
6
+ */
7
+ cwd: string;
8
+ /**
9
+ * cleanup dirs
10
+ * @default
11
+ * ```json
12
+ * ["** /dist", "** /pnpm-lock.yaml", "** /node_modules", "!node_modules/**"]
13
+ * ```
14
+ * @description glob pattern syntax {@link https://github.com/isaacs/minimatch}
15
+ */
16
+ cleanupDirs: string[];
17
+ /**
18
+ * git commit types
19
+ */
20
+ gitCommitTypes: [string, string][];
21
+ /**
22
+ * git commit scopes
23
+ */
24
+ gitCommitScopes: [string, string][];
25
+ /**
26
+ * npm-check-updates command args
27
+ * @default ["--deep","-u"]
28
+ */
29
+ ncuCommandArgs: string[];
30
+ /**
31
+ * options of generate changelog
32
+ * @link https://github.com/soybeanjs/changelog
33
+ */
34
+ changelogOptions: Partial<ChangelogOption>;
35
+ /**
36
+ * prettier write glob
37
+ * @description glob pattern syntax {@link https://github.com/micromatch/micromatch}
38
+ */
39
+ prettierWriteGlob: string[];
40
+ /**
41
+ * lint-staged config
42
+ */
43
+ lintStagedConfig: Record<string, string | string[]>;
44
+ }
45
+
46
+ declare function defineConfig(config?: Partial<CliOption>): Partial<CliOption> | undefined;
47
+
48
+ export { type CliOption, defineConfig };
package/dist/index.d.ts CHANGED
@@ -45,4 +45,4 @@ interface CliOption {
45
45
 
46
46
  declare function defineConfig(config?: Partial<CliOption>): Partial<CliOption> | undefined;
47
47
 
48
- export { CliOption, defineConfig };
48
+ export { type CliOption, defineConfig };
package/dist/index.mjs CHANGED
@@ -1,327 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import cac from 'cac';
3
- import enquirer from 'enquirer';
4
- import path from 'path';
5
- import { readFileSync, existsSync } from 'fs';
6
- import { bgRed, red, green } from 'kolorist';
7
- import { rimraf } from 'rimraf';
8
- import { generateTotalChangelog, generateChangelog } from '@soybeanjs/changelog';
9
- import versionBump from 'bumpp';
10
- import { loadConfig } from 'c12';
11
- import { readFile } from 'fs/promises';
2
+ import w from"cac";import C from"node:path";import{readFileSync as v}from"node:fs";import k from"enquirer";import{bgRed as b,red as x,green as j}from"kolorist";import{AES as d,enc as S}from"crypto-js";import{rimraf as p}from"rimraf";import l from"path";import{existsSync as $}from"fs";import{generateTotalChangelog as O,generateChangelog as A}from"@soybeanjs/changelog";import E from"bumpp";import{loadConfig as G}from"c12";import{readFile as _}from"fs/promises";const R="0.7.3";var T=Object.defineProperty,J=(e,t,o)=>t in e?T(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,L=(e,t,o)=>(J(e,typeof t!="symbol"?t+"":t,o),o);async function a(e,t,o){const{execa:n}=await import("execa");return(await n(e,t,o))?.stdout?.trim()||""}class N{constructor(t){L(this,"secret"),this.secret=t}enCrypto(t){const o=JSON.stringify(t);return d.encrypt(o,this.secret).toString()}deCrypto(t){const o=d.decrypt(t,this.secret).toString(S.Utf8);if(o)try{return JSON.parse(o)}catch{return null}return null}}async function P(e,t){const o=e.map(([s,m])=>{const y=`${`${s}:`.padEnd(12)}${m}`;return{name:s,message:y}}),n=t.map(([s,m])=>({name:s,message:`${s.padEnd(30)} (${m})`})),i=await k.prompt([{name:"types",type:"select",message:"Please select a type",choices:o},{name:"scopes",type:"select",message:"Please select a scope",choices:n},{name:"description",type:"text",message:"Please enter a description"}]),r=`${i.types}(${i.scopes}): ${i.description}`;await a("git",["commit","-m",r],{stdio:"inherit"})}async function M(){const e=await a("git",["rev-parse","--show-toplevel"]),t=C.join(e,".git","COMMIT_EDITMSG"),o=v(t,"utf8").trim();if(!/(?<type>[a-z]+)(\((?<scope>.+)\))?(?<breaking>!)?: (?<description>.+)/i.test(o))throw new Error(`${b(" ERROR ")} ${x("git commit message must match the Conventional Commits standard!")}
12
3
 
13
- const version = "0.7.0";
14
-
15
- async function execCommand(cmd, args, options) {
16
- const { execa } = await import('execa');
17
- const res = await execa(cmd, args, options);
18
- return res?.stdout?.trim() || "";
19
- }
20
-
21
- async function gitCommit(gitCommitTypes, gitCommitScopes) {
22
- const typesChoices = gitCommitTypes.map(([name, title]) => {
23
- const nameWithSuffix = `${name}:`;
24
- const message = `${nameWithSuffix.padEnd(12)}${title}`;
25
- return {
26
- name,
27
- message
28
- };
29
- });
30
- const scopesChoices = gitCommitScopes.map(([name, title]) => ({
31
- name,
32
- message: `${name.padEnd(30)} (${title})`
33
- }));
34
- const result = await enquirer.prompt([
35
- {
36
- name: "types",
37
- type: "select",
38
- message: "\u8BF7\u9009\u62E9\u63D0\u4EA4\u7684\u7C7B\u578B",
39
- choices: typesChoices
40
- },
41
- {
42
- name: "scopes",
43
- type: "select",
44
- message: "\u9009\u62E9\u4E00\u4E2Ascope",
45
- choices: scopesChoices
46
- },
47
- {
48
- name: "description",
49
- type: "text",
50
- message: "\u8BF7\u8F93\u5165\u63D0\u4EA4\u63CF\u8FF0"
51
- }
52
- ]);
53
- const commitMsg = `${result.types}(${result.scopes}): ${result.description}`;
54
- execCommand("git", ["commit", "-m", commitMsg], { stdio: "inherit" });
55
- }
56
-
57
- async function gitCommitVerify() {
58
- const gitPath = await execCommand("git", ["rev-parse", "--show-toplevel"]);
59
- const gitMsgPath = path.join(gitPath, ".git", "COMMIT_EDITMSG");
60
- const commitMsg = readFileSync(gitMsgPath, "utf-8").trim();
61
- const REG_EXP = /(?<type>[a-z]+)(\((?<scope>.+)\))?(?<breaking>!)?: (?<description>.+)/i;
62
- if (!REG_EXP.test(commitMsg)) {
63
- throw new Error(
64
- `${bgRed(" ERROR ")} ${red("Git\u63D0\u4EA4\u4FE1\u606F\u4E0D\u7B26\u5408 Angular \u89C4\u8303!\n\n")}${green(
65
- "\u63A8\u8350\u4F7F\u7528\u547D\u4EE4 pnpm commit \u751F\u6210\u7B26\u5408\u89C4\u8303\u7684Git\u63D0\u4EA4\u4FE1\u606F"
66
- )}`
67
- );
68
- }
69
- }
70
-
71
- async function cleanup(paths) {
72
- await rimraf(paths, { glob: true });
73
- }
74
-
75
- async function initSimpleGitHooks(cwd = process.cwd()) {
76
- const huskyDir = path.join(cwd, ".husky");
77
- const existHusky = existsSync(huskyDir);
78
- const gitHooksDir = path.join(cwd, ".git", "hooks");
79
- if (existHusky) {
80
- await rimraf(huskyDir);
81
- await execCommand("git", ["config", "core.hooksPath", gitHooksDir], { stdio: "inherit" });
82
- }
83
- await rimraf(gitHooksDir);
84
- await execCommand("npx", ["simple-git-hooks"], { stdio: "inherit" });
85
- }
86
-
87
- async function ncu(args = ["--deep", "-u"]) {
88
- execCommand("npx", ["ncu", ...args], { stdio: "inherit" });
89
- }
90
-
91
- async function prettierWrite(writeGlob) {
92
- await execCommand("npx", ["prettier", "--write", ".", ...writeGlob], {
93
- stdio: "inherit"
94
- });
95
- }
96
-
97
- async function eslintPrettier() {
98
- await execCommand("npx", ["eslint", ".", "--fix"], {
99
- stdio: "inherit"
100
- });
101
- await execCommand("npx", ["soy", "prettier-format"], {
102
- stdio: "inherit"
103
- });
104
- }
105
-
106
- async function execLintStaged(config) {
107
- const lintStaged = (await import('lint-staged')).default;
108
- return lintStaged({ config, allowEmpty: true });
109
- }
110
-
111
- async function genChangelog(options, total = false) {
112
- if (total) {
113
- await generateTotalChangelog(options);
114
- } else {
115
- await generateChangelog(options);
116
- }
117
- }
118
-
119
- async function release() {
120
- await versionBump({
121
- files: ["**/package.json", "!**/node_modules"],
122
- execute: "npx soy changelog",
123
- all: true,
124
- tag: true,
125
- commit: "chore(projects): release v%s",
126
- push: true
127
- });
128
- }
129
-
130
- const eslintExt = "*.{js,jsx,mjs,cjs,json,ts,tsx,mts,cts,vue,svelte,astro}";
131
- const defaultOptions = {
132
- cwd: process.cwd(),
133
- cleanupDirs: [
134
- "**/dist",
135
- "**/package-lock.json",
136
- "**/yarn.lock",
137
- "**/pnpm-lock.yaml",
138
- "**/node_modules",
139
- "!node_modules/**"
140
- ],
141
- gitCommitTypes: [
142
- ["init", "\u9879\u76EE\u521D\u59CB\u5316"],
143
- ["feat", "\u6DFB\u52A0\u65B0\u7279\u6027"],
144
- ["fix", "\u4FEE\u590Dbug"],
145
- ["docs", "\u4EC5\u4EC5\u4FEE\u6539\u6587\u6863"],
146
- ["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"],
147
- ["refactor", "\u4EE3\u7801\u91CD\u6784\uFF0C\u6CA1\u6709\u52A0\u65B0\u529F\u80FD\u6216\u8005\u4FEE\u590Dbug"],
148
- ["perf", "\u4F18\u5316\u76F8\u5173\uFF0C\u6BD4\u5982\u63D0\u5347\u6027\u80FD\u3001\u4F53\u9A8C"],
149
- ["test", "\u6DFB\u52A0\u6D4B\u8BD5\u7528\u4F8B"],
150
- ["build", "\u4F9D\u8D56\u76F8\u5173\u7684\u5185\u5BB9"],
151
- ["ci", "CI\u914D\u7F6E\u76F8\u5173\uFF0C\u4F8B\u5982\u5BF9k8s\uFF0Cdocker\u7684\u914D\u7F6E\u6587\u4EF6\u7684\u4FEE\u6539"],
152
- ["chore", "\u6539\u53D8\u6784\u5EFA\u6D41\u7A0B\u3001\u6216\u8005\u589E\u52A0\u4F9D\u8D56\u5E93\u3001\u5DE5\u5177\u7B49"],
153
- ["revert", "\u56DE\u6EDA\u5230\u4E0A\u4E00\u4E2A\u7248\u672C"]
154
- ],
155
- gitCommitScopes: [
156
- ["projects", "\u9879\u76EE\u642D\u5EFA"],
157
- ["components", "\u7EC4\u4EF6\u76F8\u5173"],
158
- ["hooks", "hook \u76F8\u5173"],
159
- ["utils", "utils \u76F8\u5173"],
160
- ["types", "ts\u7C7B\u578B\u76F8\u5173"],
161
- ["styles", "\u6837\u5F0F\u76F8\u5173"],
162
- ["deps", "\u9879\u76EE\u4F9D\u8D56"],
163
- ["auth", "\u5BF9 auth \u4FEE\u6539"],
164
- ["release", "\u7248\u672C\u53D1\u5E03"],
165
- ["other", "\u5176\u4ED6\u4FEE\u6539"]
166
- ],
167
- ncuCommandArgs: ["--deep", "-u"],
168
- changelogOptions: {},
169
- prettierWriteGlob: [
170
- `!**/${eslintExt}`,
171
- "!*.min.*",
172
- "!CHANGELOG.md",
173
- "!dist",
174
- "!LICENSE*",
175
- "!output",
176
- "!coverage",
177
- "!public",
178
- "!temp",
179
- "!package-lock.json",
180
- "!pnpm-lock.yaml",
181
- "!yarn.lock",
182
- "!.github",
183
- "!__snapshots__",
184
- "!node_modules"
185
- ],
186
- lintStagedConfig: {
187
- [eslintExt]: "eslint --fix",
188
- "*": "soy prettier-write"
189
- }
190
- };
191
- const SOYBEAN_GITHUB_TOKEN = "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";
192
- async function loadCliOptions(overrides, cwd = process.cwd()) {
193
- const { config } = await loadConfig({
194
- name: "soybean",
195
- defaults: defaultOptions,
196
- overrides,
197
- cwd,
198
- packageJson: true
199
- });
200
- const has = await hasSoybeanInfoFromPkgJson(cwd);
201
- if (config && has) {
202
- config.changelogOptions = { ...config.changelogOptions, github: { repo: "", token: SOYBEAN_GITHUB_TOKEN } };
203
- }
204
- return config;
205
- }
206
- async function hasSoybeanInfoFromPkgJson(cwd) {
207
- let hasSoybeanInfo = false;
208
- const REG = "soybean";
209
- try {
210
- const pkgJson = await readFile(`${cwd}/package.json`, "utf-8");
211
- const pkg = JSON.parse(pkgJson);
212
- hasSoybeanInfo = pkg.name?.includes(REG) || pkg.repository?.url?.includes(REG) || pkg.author?.includes(REG) || pkg.author?.name?.includes(REG) || pkg.author?.url?.includes(REG);
213
- } catch {
214
- }
215
- return hasSoybeanInfo;
216
- }
217
-
218
- async function setupCli() {
219
- const cliOptions = await loadCliOptions();
220
- const cli = cac("soybean");
221
- cli.version(version).option("--total", "Generate changelog by total tags").help();
222
- const commands = {
223
- "git-commit": {
224
- desc: "\u751F\u6210\u7B26\u5408 Conventional Commits \u89C4\u8303\u7684\u63D0\u4EA4\u4FE1\u606F",
225
- action: async () => {
226
- await gitCommit(cliOptions.gitCommitTypes, cliOptions.gitCommitScopes);
227
- }
228
- },
229
- "git-commit-verify": {
230
- desc: "\u6821\u9A8C git \u63D0\u4EA4\u4FE1\u606F\u662F\u5426\u7B26\u5408 Conventional Commits \u89C4\u8303",
231
- action: async () => {
232
- await gitCommitVerify();
233
- }
234
- },
235
- cleanup: {
236
- desc: "\u6E05\u7A7A\u4F9D\u8D56\u548C\u6784\u5EFA\u4EA7\u7269",
237
- action: async () => {
238
- await cleanup(cliOptions.cleanupDirs);
239
- }
240
- },
241
- "init-simple-git-hooks": {
242
- desc: "\u521D\u59CB\u5316 simple-git-hooks \u94A9\u5B50",
243
- action: async () => {
244
- await initSimpleGitHooks(cliOptions.cwd);
245
- }
246
- },
247
- ncu: {
248
- desc: "\u547D\u4EE4 npm-check-updates, \u5347\u7EA7\u4F9D\u8D56",
249
- action: async () => {
250
- await ncu(cliOptions.ncuCommandArgs);
251
- }
252
- },
253
- "prettier-write": {
254
- desc: "\u6267\u884C prettier --write \u683C\u5F0F\u5316",
255
- action: async () => {
256
- await prettierWrite(cliOptions.prettierWriteGlob);
257
- }
258
- },
259
- "lint-staged": {
260
- desc: "\u6267\u884Clint-staged",
261
- action: async () => {
262
- const passed = await execLintStaged(cliOptions.lintStagedConfig).catch(() => {
263
- process.exitCode = 1;
264
- });
265
- process.exitCode = passed ? 0 : 1;
266
- }
267
- },
268
- changelog: {
269
- desc: "\u751F\u6210changelog",
270
- action: async (args) => {
271
- await genChangelog(cliOptions.changelogOptions, args?.total);
272
- }
273
- },
274
- release: {
275
- desc: "\u53D1\u5E03\uFF1A\u66F4\u65B0\u7248\u672C\u53F7\u3001\u751F\u6210changelog\u3001\u63D0\u4EA4\u4EE3\u7801",
276
- action: async () => {
277
- await release();
278
- }
279
- },
280
- /**
281
- * @deprecated
282
- */
283
- "init-git-hooks": {
284
- desc: "\u8BE5\u547D\u4EE4\u5DF2\u5E9F\u5F03\uFF0C\u8BF7\u4F7F\u7528 init-simple-git-hooks",
285
- action: async () => {
286
- await initSimpleGitHooks(cliOptions.cwd);
287
- }
288
- },
289
- /**
290
- * @deprecated
291
- */
292
- "update-pkg": {
293
- desc: "\u8BE5\u547D\u4EE4\u5DF2\u5E9F\u5F03\uFF0C\u8BF7\u4F7F\u7528 ncu",
294
- action: async () => {
295
- await ncu(cliOptions.ncuCommandArgs);
296
- }
297
- },
298
- /**
299
- * @deprecated
300
- */
301
- "prettier-format": {
302
- desc: "\u8BE5\u547D\u4EE4\u5DF2\u5E9F\u5F03\uFF0C\u8BF7\u4F7F\u7528 prettier-write",
303
- action: async () => {
304
- await prettierWrite(cliOptions.prettierWriteGlob);
305
- }
306
- },
307
- /**
308
- * @deprecated
309
- */
310
- "eslint-prettier": {
311
- desc: "\u8BE5\u547D\u4EE4\u5DF2\u5E9F\u5F03",
312
- action: async () => {
313
- await eslintPrettier();
314
- }
315
- }
316
- };
317
- for await (const [command, { desc, action }] of Object.entries(commands)) {
318
- cli.command(command, desc).action(action);
319
- }
320
- cli.parse();
321
- }
322
- setupCli();
323
- function defineConfig(config) {
324
- return config;
325
- }
326
-
327
- export { defineConfig };
4
+ ${j("Recommended to use the command `pnpm commit` to generate Conventional Commits compliant commit information.\nGet more info about Conventional Commits, follow this link: https://conventionalcommits.org")}`)}async function D(e){await p(e,{glob:!0})}async function g(e=process.cwd()){const t=l.join(e,".husky"),o=$(t),n=l.join(e,".git","hooks");o&&(await p(t),await a("git",["config","core.hooksPath",n],{stdio:"inherit"})),await p(n),await a("npx",["simple-git-hooks"],{stdio:"inherit"})}async function u(e=["--deep","-u"]){a("npx",["ncu",...e],{stdio:"inherit"})}async function h(e){await a("npx",["prettier","--write",".",...e],{stdio:"inherit"})}async function I(){await a("npx",["eslint",".","--fix"],{stdio:"inherit"}),await a("npx",["soy","prettier-format"],{stdio:"inherit"})}async function V(e){const t=(await import("lint-staged")).default;return t({config:e,allowEmpty:!0})}async function W(e,t=!1){t?await O(e):await A(e)}async function z(){await E({files:["**/package.json","!**/node_modules"],execute:"npx soy changelog",all:!0,tag:!0,commit:"chore(projects): release v%s",push:!0})}const f="*.{js,jsx,mjs,cjs,json,ts,tsx,mts,cts,vue,svelte,astro}",F={cwd:process.cwd(),cleanupDirs:["**/dist","**/package-lock.json","**/yarn.lock","**/pnpm-lock.yaml","**/node_modules","!node_modules/**"],gitCommitTypes:[["feat","A new feature"],["fix","A bug fix"],["docs","Documentation only changes"],["style","Changes that do not affect the meaning of the code"],["refactor","A code change that neither fixes a bug nor adds a feature"],["perf","A code change that improves performance"],["test","Adding missing tests or correcting existing tests"],["build","Changes that affect the build system or external dependencies"],["ci","Changes to our CI configuration files and scripts"],["chore","Other changes that don't modify src or test files"],["revert","Reverts a previous commit"]],gitCommitScopes:[["projects","project"],["components","components"],["hooks","hook functions"],["utils","utils functions"],["types","TS declaration"],["styles","style"],["deps","project dependencies"],["release","release project"],["other","other changes"]],ncuCommandArgs:["--deep","-u"],changelogOptions:{},prettierWriteGlob:[`!**/${f}`,"!*.min.*","!CHANGELOG.md","!dist","!LICENSE*","!output","!coverage","!public","!temp","!package-lock.json","!pnpm-lock.yaml","!yarn.lock","!.github","!__snapshots__","!node_modules"],lintStagedConfig:{[f]:"eslint --fix","*":"soy prettier-write"}},U="U2FsdGVkX1+vLW5S5+vcx+LKGSR2PtJOAZUZsVCTKM0+ecI3hDuARJn6kdLzzR1LVl0179NmgMoX6fV28TMu3A==";async function H(e,t=process.cwd()){const{config:o}=await G({name:"soybean",defaults:F,overrides:e,cwd:t,packageJson:!0}),n=await K(t);if(o&&n){const i=new N("SOYBEAN_JS");o.changelogOptions={...o.changelogOptions,github:{repo:"",token:i.deCrypto(U)||""}}}return o}async function K(e){let t=!1;const o="soybean";try{const n=await _(`${e}/package.json`,"utf-8"),i=JSON.parse(n);t=i.name?.includes(o)||i.repository?.url?.includes(o)||i.author?.includes(o)||i.author?.name?.includes(o)||i.author?.url?.includes(o)}catch{}return t}const c="the command is deprecated, it will be removed in the next major version 1.0.0";async function X(){const e=await H(),t=w("soybean");t.version(R).option("--total","Generate changelog by total tags").help();const o={cleanup:{desc:"delete dirs: node_modules, dist, etc.",action:async()=>{await D(e.cleanupDirs)}},ncu:{desc:"npm-check-updates, it can update package.json dependencies to the latest version",action:async()=>{await u(e.ncuCommandArgs)}},"git-commit":{desc:"git commit, generate commit message which match Conventional Commits standard",action:async()=>{await P(e.gitCommitTypes,e.gitCommitScopes)}},"git-commit-verify":{desc:"verify git commit message, make sure it match Conventional Commits standard",action:async()=>{await M()}},"prettier-write":{desc:"run prettier --write",action:async()=>{await h(e.prettierWriteGlob)}},"lint-staged":{desc:"run lint-staged",action:async()=>{const n=await V(e.lintStagedConfig).catch(()=>{process.exitCode=1});process.exitCode=n?0:1}},changelog:{desc:"generate changelog",action:async n=>{await W(e.changelogOptions,n?.total)}},release:{desc:"release: update version, generate changelog, commit code",action:async()=>{await z()}},"init-simple-git-hooks":{desc:`init simple-git-hooks and remove husky (${c})`,action:async()=>{await g(e.cwd)}},"init-git-hooks":{desc:`same as init-simple-git-hooks (${c})`,action:async()=>{await g(e.cwd)}},"update-pkg":{desc:`same as ncu (${c})`,action:async()=>{await u(e.ncuCommandArgs)}},"prettier-format":{desc:`same as prettier-write (${c})`,action:async()=>{await h(e.prettierWriteGlob)}},"eslint-prettier":{desc:c,action:async()=>{await I()}}};for await(const[n,{desc:i,action:r}]of Object.entries(o))t.command(n,i).action(r);t.parse()}X();function Z(e){return e}export{Z as defineConfig};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soybeanjs/cli",
3
- "version": "0.7.0",
3
+ "version": "0.7.3",
4
4
  "description": "SoybeanJS's command line tools",
5
5
  "author": {
6
6
  "name": "Soybean",
@@ -36,37 +36,40 @@
36
36
  "dist"
37
37
  ],
38
38
  "dependencies": {
39
- "@soybeanjs/changelog": "0.3.2",
40
- "bumpp": "9.1.1",
39
+ "@soybeanjs/changelog": "0.3.4",
40
+ "bumpp": "9.2.0",
41
41
  "c12": "1.4.2",
42
42
  "cac": "6.7.14",
43
43
  "consola": "3.2.3",
44
+ "crypto-js": "4.1.1",
44
45
  "enquirer": "2.4.1",
45
46
  "execa": "8.0.1",
46
47
  "kolorist": "1.8.0",
47
48
  "lint-staged": "14.0.1",
48
49
  "minimist": "1.2.8",
49
- "npm-check-updates": "16.13.0",
50
- "rimraf": "5.0.1"
50
+ "npm-check-updates": "16.14.5",
51
+ "rimraf": "5.0.5"
51
52
  },
52
53
  "devDependencies": {
53
54
  "@soybeanjs/cli": "link:",
54
- "@types/node": "20.5.2",
55
- "eslint": "8.47.0",
56
- "eslint-config-soybeanjs": "0.5.5",
55
+ "@types/crypto-js": "4.1.2",
56
+ "@types/node": "20.8.4",
57
+ "eslint": "8.51.0",
58
+ "eslint-config-soybeanjs": "0.5.7",
57
59
  "simple-git-hooks": "2.9.0",
58
- "tsx": "3.12.7",
59
- "typescript": "5.1.6",
60
- "unbuild": "1.2.1"
60
+ "tsx": "3.13.0",
61
+ "typescript": "5.2.2",
62
+ "unbuild": "2.0.0"
61
63
  },
62
64
  "scripts": {
63
65
  "build": "pnpm typecheck && unbuild && pnpm build-pkg",
64
66
  "build-pkg": "pnpm -r --filter='./packages/*' run build",
67
+ "stub": "pnpm -r run stub",
65
68
  "lint": "eslint . --fix",
66
69
  "format": "soy prettier-write",
67
70
  "commit": "soy git-commit",
68
71
  "cleanup": "soy cleanup",
69
- "ncu": "soy ncu",
72
+ "update-pkg": "soy ncu",
70
73
  "publish-pkg": "pnpm -r publish --access public",
71
74
  "typecheck": "tsc --noEmit",
72
75
  "release": "soy release && pnpm build && pnpm publish-pkg"