@soybeanjs/cli 0.8.9 → 1.0.0-beta.0

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,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
- "use strict";const process=require("node:process"),d$1=require("cac"),path=require("node:path"),node_fs=require("node:fs"),l$1=require("enquirer"),kolorist=require("kolorist"),cryptoJs=require("crypto-js"),rimraf=require("rimraf"),changelog=require("@soybeanjs/changelog"),r=require("bumpp"),fs=require("node:fs/promises"),c12=require("c12");function _interopDefaultCompat(e){return e&&typeof e=="object"&&"default"in e?e.default:e}const process__default=_interopDefaultCompat(process),d__default=_interopDefaultCompat(d$1),path__default=_interopDefaultCompat(path),l__default=_interopDefaultCompat(l$1),r__default=_interopDefaultCompat(r),version="0.8.9";var c=Object.defineProperty,a$1=(e,t,o)=>t in e?c(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,n=(e,t,o)=>(a$1(e,typeof t!="symbol"?t+"":t,o),o);async function execCommand(e,t,o){const{execa:s}=await import("execa");return(await s(e,t,o))?.stdout?.trim()||""}class Crypto{constructor(t){n(this,"secret"),this.secret=t}enCrypto(t){const o=JSON.stringify(t);return cryptoJs.AES.encrypt(o,this.secret).toString()}deCrypto(t){const o=cryptoJs.AES.decrypt(t,this.secret).toString(cryptoJs.enc.Utf8);if(o)try{return JSON.parse(o)}catch{return null}return null}}async function gitCommit(e,t){const o=e.map(([u,h])=>{const f=`${`${u}:`.padEnd(12)}${h}`;return{name:u,message:f}}),s=t.map(([u,h])=>({name:u,message:`${u.padEnd(30)} (${h})`})),p=await l__default.prompt([{name:"types",type:"select",message:"Please select a type",choices:o},{name:"scopes",type:"select",message:"Please select a scope",choices:s},{name:"description",type:"text",message:"Please enter a description"}]),g=`${p.types}(${p.scopes}): ${p.description}`;await execCommand("git",["commit","-m",g],{stdio:"inherit"})}async function gitCommitVerify(){const e=await execCommand("git",["rev-parse","--show-toplevel"]),t=path__default.join(e,".git","COMMIT_EDITMSG"),o=node_fs.readFileSync(t,"utf8").trim();if(!/(?<type>[a-z]+)(?:\((?<scope>.+)\))?(?<breaking>!)?: (?<description>.+)/i.test(o))throw new Error(`${kolorist.bgRed(" ERROR ")} ${kolorist.red("git commit message must match the Conventional Commits standard!")}
2
+ "use strict";const m$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"),changelog=require("@soybeanjs/changelog"),r=require("bumpp"),i=require("node:process"),promises=require("node:fs/promises"),c12=require("c12");function _interopDefaultCompat(e){return e&&typeof e=="object"&&"default"in e?e.default:e}const m__default=_interopDefaultCompat(m$1),a__default=_interopDefaultCompat(a$1),l__default=_interopDefaultCompat(l$1),r__default=_interopDefaultCompat(r),i__default=_interopDefaultCompat(i),version="1.0.0-beta.0";var c=Object.defineProperty,a=(e,t,o)=>t in e?c(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,n=(e,t,o)=>(a(e,typeof t!="symbol"?t+"":t,o),o);async function execCommand(e,t,o){const{execa:s}=await import("execa");return(await s(e,t,o))?.stdout?.trim()||""}class Crypto{constructor(t){n(this,"secret"),this.secret=t}enCrypto(t){const o=JSON.stringify(t);return cryptoJs.AES.encrypt(o,this.secret).toString()}deCrypto(t){const o=cryptoJs.AES.decrypt(t,this.secret).toString(cryptoJs.enc.Utf8);if(o)try{return JSON.parse(o)}catch{return null}return null}}async function gitCommit(e,t){const o=e.map(([g,h])=>{const y=`${`${g}:`.padEnd(12)}${h}`;return{name:g,message:y}}),s=t.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:o},{name:"scopes",type:"select",message:"Please select a scope",choices:s},{name:"description",type:"text",message:"Please enter a description"}]),p=`${u.types}(${u.scopes}): ${u.description}`;await execCommand("git",["commit","-m",p],{stdio:"inherit"})}async function gitCommitVerify(){const e=await execCommand("git",["rev-parse","--show-toplevel"]),t=a__default.join(e,".git","COMMIT_EDITMSG"),o=node_fs.readFileSync(t,"utf8").trim();if(!/(?<type>[a-z]+)(?:\((?<scope>.+)\))?(?<breaking>!)?: (?<description>.+)/i.test(o))throw new Error(`${kolorist.bgRed(" ERROR ")} ${kolorist.red("git commit message must match the Conventional Commits standard!")}
3
3
 
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(e){await rimraf.rimraf(e,{glob:!0})}async function ncu(e=["--deep","-u"]){execCommand("npx",["ncu",...e],{stdio:"inherit"})}async function genChangelog(e,t=!1){t?await changelog.generateTotalChangelog(e):await changelog.generateChangelog(e)}async function release(e="npx soy changelog",t=!0){await r__default({files:["**/package.json","!**/node_modules"],execute:e,all:!0,tag:!0,commit:"chore(projects): release v%s",push:t})}async function execLintStaged(e){const t=(await import("./chunks/index.cjs").then(function(o){return o.index})).default;return t({config:e,allowEmpty:!0})}async function initSimpleGitHooks(e=process__default.cwd()){const t=path__default.join(e,".husky"),o=node_fs.existsSync(t),s=path__default.join(e,".git","hooks");o&&(await rimraf.rimraf(t),await execCommand("git",["config","core.hooksPath",s],{stdio:"inherit"})),await rimraf.rimraf(s),await execCommand("npx",["simple-git-hooks"],{stdio:"inherit"})}async function prettierWrite(e){await execCommand("npx",["prettier","--write",".",...e],{stdio:"inherit"})}async function eslintPrettier(){await execCommand("npx",["eslint",".","--fix"],{stdio:"inherit"}),await execCommand("npx",["soy","prettier-format"],{stdio:"inherit"})}const a="*.{js,jsx,mjs,cjs,json,ts,tsx,mts,cts,vue,svelte,astro}",l={cwd:process__default.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:[`!**/${a}`,"!*.min.*","!CHANGELOG.md","!dist","!LICENSE*","!output","!coverage","!public","!temp","!package-lock.json","!pnpm-lock.yaml","!yarn.lock","!.github","!__snapshots__","!node_modules"],lintStagedConfig:{[a]:"eslint --fix","*":"soy prettier-write"}},m="U2FsdGVkX18dc7x8PmAq30sl+nyGmi5VJJwninmYBRs8vVILEIjY+kT/F8ajm/6gRTMbDAEmx5WKInQBzeNSig==";async function loadCliOptions(e,t=process__default.cwd()){const{config:o}=await c12.loadConfig({name:"soybean",defaults:l,overrides:e,cwd:t,packageJson:!0}),s=await d(t);if(o&&s){const p=new Crypto("SOYBEAN_JS");o.changelogOptions={...o.changelogOptions,github:{repo:"",token:p.deCrypto(m)||""}}}return o}async function d(e){let t=!1;const o="soybean";try{const s=await fs.readFile(`${e}/package.json`,"utf-8"),p=JSON.parse(s);t=p.name?.includes(o)||p.repository?.url?.includes(o)||p.author?.includes(o)||p.author?.name?.includes(o)||p.author?.url?.includes(o)}catch{}return t}const i="the command is deprecated, it will be removed in the next major version 1.0.0";async function v(){const e=await loadCliOptions(),t=d__default("soybean");t.version(version).option("--execute [command]","Execute additional command after bumping and before git commit. Defaults to 'npx soy changelog'").option("--push","Indicates whether to push the git commit and tag").option("--total","Generate changelog by total tags").option("--syncName [name]",'The package name of sync npmmirror, if it has multiple packages, you can use "," to separate them').option("--syncLog","Whether show sync package log").help();const o={cleanup:{desc:"delete dirs: node_modules, dist, etc.",action:async()=>{await cleanup(e.cleanupDirs)}},ncu:{desc:"npm-check-updates, it can update package.json dependencies to the latest version",action:async()=>{await ncu(e.ncuCommandArgs)}},"git-commit":{desc:"git commit, generate commit message which match Conventional Commits standard",action:async()=>{await gitCommit(e.gitCommitTypes,e.gitCommitScopes)}},"git-commit-verify":{desc:"verify git commit message, make sure it match Conventional Commits standard",action:async()=>{await gitCommitVerify()}},changelog:{desc:"generate changelog",action:async s=>{await genChangelog(e.changelogOptions,s?.total)}},release:{desc:"release: update version, generate changelog, commit code",action:async s=>{await release(s?.execute,s?.push)}},"prettier-write":{desc:`run prettier --write (${i})`,action:async()=>{await prettierWrite(e.prettierWriteGlob)}},"lint-staged":{desc:`run lint-staged (${i})`,action:async()=>{const s=await execLintStaged(e.lintStagedConfig).catch(()=>{process__default.exitCode=1});process__default.exitCode=s?0:1}},"init-simple-git-hooks":{desc:`init simple-git-hooks and remove husky (${i})`,action:async()=>{await initSimpleGitHooks(e.cwd)}},"init-git-hooks":{desc:`same as init-simple-git-hooks (${i})`,action:async()=>{await initSimpleGitHooks(e.cwd)}},"update-pkg":{desc:`same as ncu (${i})`,action:async()=>{await ncu(e.ncuCommandArgs)}},"prettier-format":{desc:`same as prettier-write (${i})`,action:async()=>{await prettierWrite(e.prettierWriteGlob)}},"eslint-prettier":{desc:i,action:async()=>{await eslintPrettier()}}};for await(const[s,{desc:p,action:g}]of Object.entries(o))t.command(s,p).action(g);t.parse()}v();function defineConfig(e){return e}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(e){await rimraf.rimraf(e,{glob:!0})}async function ncu(e=["--deep","-u"]){execCommand("npx",["ncu",...e],{stdio:"inherit"})}async function genChangelog(e,t=!1){t?await changelog.generateTotalChangelog(e):await changelog.generateChangelog(e)}async function release(e="npx soy changelog",t=!0){await r__default({files:["**/package.json","!**/node_modules"],execute:e,all:!0,tag:!0,commit:"chore(projects): release v%s",push:t})}const l={cwd:i__default.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:{}},d="U2FsdGVkX18dc7x8PmAq30sl+nyGmi5VJJwninmYBRs8vVILEIjY+kT/F8ajm/6gRTMbDAEmx5WKInQBzeNSig==";async function loadCliOptions(e,t=i__default.cwd()){const{config:o}=await c12.loadConfig({name:"soybean",defaults:l,overrides:e,cwd:t,packageJson:!0}),s=await m(t);if(o&&s){const u=new Crypto("SOYBEAN_JS");o.changelogOptions={...o.changelogOptions,github:{repo:"",token:u.deCrypto(d)||""}}}return o}async function m(e){let t=!1;const o="soybean";try{const s=await promises.readFile(a__default.join(e,"package.json"),"utf-8"),u=JSON.parse(s);t=u.name?.includes(o)||u.repository?.url?.includes(o)||u.author?.includes(o)||u.author?.name?.includes(o)||u.author?.url?.includes(o)}catch{}return t}async function f(){const e=await loadCliOptions(),t=m__default("soybean");t.version(version).option("-e, --execute [command]","Execute additional command after bumping and before git commit. Defaults to 'npx soy changelog'").option("-p, --push","Indicates whether to push the git commit and tag").option("-t, --total","Generate changelog by total tags").option("-c, --cleanupDir <dir>",'The glob pattern of dirs to cleanup, If not set, it will use the default value, Multiple values use "," to separate them').help();const o={cleanup:{desc:"delete dirs: node_modules, dist, etc.",action:async s=>{const u=(s?.cleanupDir?.split(",")||[]).map(p=>p.trim()).filter(Boolean);u.length&&(e.cleanupDirs=u),await cleanup(e.cleanupDirs)}},ncu:{desc:"npm-check-updates, it can update package.json dependencies to the latest version",action:async()=>{await ncu(e.ncuCommandArgs)}},"git-commit":{desc:"git commit, generate commit message which match Conventional Commits standard",action:async()=>{await gitCommit(e.gitCommitTypes,e.gitCommitScopes)}},"git-commit-verify":{desc:"verify git commit message, make sure it match Conventional Commits standard",action:async()=>{await gitCommitVerify()}},changelog:{desc:"generate changelog",action:async s=>{await genChangelog(e.changelogOptions,s?.total)}},release:{desc:"release: update version, generate changelog, commit code",action:async s=>{await release(s?.execute,s?.push)}}};for await(const[s,{desc:u,action:p}]of Object.entries(o))t.command(s,u).action(p);t.parse()}f();function defineConfig(e){return e}exports.defineConfig=defineConfig;
package/dist/index.d.cts CHANGED
@@ -30,14 +30,6 @@ interface CliOption {
30
30
  * @link https://github.com/soybeanjs/changelog
31
31
  */
32
32
  changelogOptions: Partial<ChangelogOption>;
33
- /**
34
- * Prettier write glob
35
- *
36
- * Glob pattern syntax {@link https://github.com/micromatch/micromatch}
37
- */
38
- prettierWriteGlob: string[];
39
- /** Lint-staged config */
40
- lintStagedConfig: Record<string, string | string[]>;
41
33
  }
42
34
 
43
35
  declare function defineConfig(config?: Partial<CliOption>): Partial<CliOption> | undefined;
package/dist/index.d.mts CHANGED
@@ -30,14 +30,6 @@ interface CliOption {
30
30
  * @link https://github.com/soybeanjs/changelog
31
31
  */
32
32
  changelogOptions: Partial<ChangelogOption>;
33
- /**
34
- * Prettier write glob
35
- *
36
- * Glob pattern syntax {@link https://github.com/micromatch/micromatch}
37
- */
38
- prettierWriteGlob: string[];
39
- /** Lint-staged config */
40
- lintStagedConfig: Record<string, string | string[]>;
41
33
  }
42
34
 
43
35
  declare function defineConfig(config?: Partial<CliOption>): Partial<CliOption> | undefined;
package/dist/index.d.ts CHANGED
@@ -30,14 +30,6 @@ interface CliOption {
30
30
  * @link https://github.com/soybeanjs/changelog
31
31
  */
32
32
  changelogOptions: Partial<ChangelogOption>;
33
- /**
34
- * Prettier write glob
35
- *
36
- * Glob pattern syntax {@link https://github.com/micromatch/micromatch}
37
- */
38
- prettierWriteGlob: string[];
39
- /** Lint-staged config */
40
- lintStagedConfig: Record<string, string | string[]>;
41
33
  }
42
34
 
43
35
  declare function defineConfig(config?: Partial<CliOption>): Partial<CliOption> | undefined;
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import r from"node:process";import C from"cac";import d from"node:path";import{readFileSync as k,existsSync as v}from"node:fs";import x from"enquirer";import{bgRed as b,red as j,green as $}from"kolorist";import{AES as g,enc as S}from"crypto-js";import{rimraf as l}from"rimraf";import{generateTotalChangelog as O,generateChangelog as E}from"@soybeanjs/changelog";import A from"bumpp";import{readFile as G}from"node:fs/promises";import{loadConfig as _}from"c12";const T="0.8.9";var I=Object.defineProperty,N=(e,t,n)=>t in e?I(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,R=(e,t,n)=>(N(e,typeof t!="symbol"?t+"":t,n),n);async function a(e,t,n){const{execa:o}=await import("execa");return(await o(e,t,n))?.stdout?.trim()||""}class J{constructor(t){R(this,"secret"),this.secret=t}enCrypto(t){const n=JSON.stringify(t);return g.encrypt(n,this.secret).toString()}deCrypto(t){const n=g.decrypt(t,this.secret).toString(S.Utf8);if(n)try{return JSON.parse(n)}catch{return null}return null}}async function P(e,t){const n=e.map(([c,p])=>{const w=`${`${c}:`.padEnd(12)}${p}`;return{name:c,message:w}}),o=t.map(([c,p])=>({name:c,message:`${c.padEnd(30)} (${p})`})),i=await x.prompt([{name:"types",type:"select",message:"Please select a type",choices:n},{name:"scopes",type:"select",message:"Please select a scope",choices:o},{name:"description",type:"text",message:"Please enter a description"}]),m=`${i.types}(${i.scopes}): ${i.description}`;await a("git",["commit","-m",m],{stdio:"inherit"})}async function D(){const e=await a("git",["rev-parse","--show-toplevel"]),t=d.join(e,".git","COMMIT_EDITMSG"),n=k(t,"utf8").trim();if(!/(?<type>[a-z]+)(?:\((?<scope>.+)\))?(?<breaking>!)?: (?<description>.+)/i.test(n))throw new Error(`${b(" ERROR ")} ${j("git commit message must match the Conventional Commits standard!")}
2
+ import g from"cac";import m from"node:path";import{readFileSync as u}from"node:fs";import f from"enquirer";import{bgRed as h,red as y,green as w}from"kolorist";import{AES as p,enc as C}from"crypto-js";import{rimraf as v}from"rimraf";import{generateTotalChangelog as b,generateChangelog as x}from"@soybeanjs/changelog";import k from"bumpp";import l from"node:process";import{readFile as j}from"node:fs/promises";import{loadConfig as O}from"c12";const S="1.0.0-beta.0";var $=Object.defineProperty,A=(e,t,o)=>t in e?$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,E=(e,t,o)=>(A(e,typeof t!="symbol"?t+"":t,o),o);async function r(e,t,o){const{execa:n}=await import("execa");return(await n(e,t,o))?.stdout?.trim()||""}class D{constructor(t){E(this,"secret"),this.secret=t}enCrypto(t){const o=JSON.stringify(t);return p.encrypt(o,this.secret).toString()}deCrypto(t){const o=p.decrypt(t,this.secret).toString(C.Utf8);if(o)try{return JSON.parse(o)}catch{return null}return null}}async function T(e,t){const o=e.map(([s,c])=>{const d=`${`${s}:`.padEnd(12)}${c}`;return{name:s,message:d}}),n=t.map(([s,c])=>({name:s,message:`${s.padEnd(30)} (${c})`})),a=await f.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"}]),i=`${a.types}(${a.scopes}): ${a.description}`;await r("git",["commit","-m",i],{stdio:"inherit"})}async function I(){const e=await r("git",["rev-parse","--show-toplevel"]),t=m.join(e,".git","COMMIT_EDITMSG"),o=u(t,"utf8").trim();if(!/(?<type>[a-z]+)(?:\((?<scope>.+)\))?(?<breaking>!)?: (?<description>.+)/i.test(o))throw new Error(`${h(" ERROR ")} ${y("git commit message must match the Conventional Commits standard!")}
3
3
 
4
- ${$("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 W(e){await l(e,{glob:!0})}async function u(e=["--deep","-u"]){a("npx",["ncu",...e],{stdio:"inherit"})}async function L(e,t=!1){t?await O(e):await E(e)}async function F(e="npx soy changelog",t=!0){await A({files:["**/package.json","!**/node_modules"],execute:e,all:!0,tag:!0,commit:"chore(projects): release v%s",push:t})}async function M(e){const t=(await import("./chunks/index.mjs").then(function(n){return n.i})).default;return t({config:e,allowEmpty:!0})}async function h(e=r.cwd()){const t=d.join(e,".husky"),n=v(t),o=d.join(e,".git","hooks");n&&(await l(t),await a("git",["config","core.hooksPath",o],{stdio:"inherit"})),await l(o),await a("npx",["simple-git-hooks"],{stdio:"inherit"})}async function f(e){await a("npx",["prettier","--write",".",...e],{stdio:"inherit"})}async function V(){await a("npx",["eslint",".","--fix"],{stdio:"inherit"}),await a("npx",["soy","prettier-format"],{stdio:"inherit"})}const y="*.{js,jsx,mjs,cjs,json,ts,tsx,mts,cts,vue,svelte,astro}",B={cwd:r.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:[`!**/${y}`,"!*.min.*","!CHANGELOG.md","!dist","!LICENSE*","!output","!coverage","!public","!temp","!package-lock.json","!pnpm-lock.yaml","!yarn.lock","!.github","!__snapshots__","!node_modules"],lintStagedConfig:{[y]:"eslint --fix","*":"soy prettier-write"}},Y="U2FsdGVkX18dc7x8PmAq30sl+nyGmi5VJJwninmYBRs8vVILEIjY+kT/F8ajm/6gRTMbDAEmx5WKInQBzeNSig==";async function z(e,t=r.cwd()){const{config:n}=await _({name:"soybean",defaults:B,overrides:e,cwd:t,packageJson:!0}),o=await H(t);if(n&&o){const i=new J("SOYBEAN_JS");n.changelogOptions={...n.changelogOptions,github:{repo:"",token:i.deCrypto(Y)||""}}}return n}async function H(e){let t=!1;const n="soybean";try{const o=await G(`${e}/package.json`,"utf-8"),i=JSON.parse(o);t=i.name?.includes(n)||i.repository?.url?.includes(n)||i.author?.includes(n)||i.author?.name?.includes(n)||i.author?.url?.includes(n)}catch{}return t}const s="the command is deprecated, it will be removed in the next major version 1.0.0";async function U(){const e=await z(),t=C("soybean");t.version(T).option("--execute [command]","Execute additional command after bumping and before git commit. Defaults to 'npx soy changelog'").option("--push","Indicates whether to push the git commit and tag").option("--total","Generate changelog by total tags").option("--syncName [name]",'The package name of sync npmmirror, if it has multiple packages, you can use "," to separate them').option("--syncLog","Whether show sync package log").help();const n={cleanup:{desc:"delete dirs: node_modules, dist, etc.",action:async()=>{await W(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 D()}},changelog:{desc:"generate changelog",action:async o=>{await L(e.changelogOptions,o?.total)}},release:{desc:"release: update version, generate changelog, commit code",action:async o=>{await F(o?.execute,o?.push)}},"prettier-write":{desc:`run prettier --write (${s})`,action:async()=>{await f(e.prettierWriteGlob)}},"lint-staged":{desc:`run lint-staged (${s})`,action:async()=>{const o=await M(e.lintStagedConfig).catch(()=>{r.exitCode=1});r.exitCode=o?0:1}},"init-simple-git-hooks":{desc:`init simple-git-hooks and remove husky (${s})`,action:async()=>{await h(e.cwd)}},"init-git-hooks":{desc:`same as init-simple-git-hooks (${s})`,action:async()=>{await h(e.cwd)}},"update-pkg":{desc:`same as ncu (${s})`,action:async()=>{await u(e.ncuCommandArgs)}},"prettier-format":{desc:`same as prettier-write (${s})`,action:async()=>{await f(e.prettierWriteGlob)}},"eslint-prettier":{desc:s,action:async()=>{await V()}}};for await(const[o,{desc:i,action:m}]of Object.entries(n))t.command(o,i).action(m);t.parse()}U();function q(e){return e}export{q as defineConfig};
4
+ ${w("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 R(e){await v(e,{glob:!0})}async function J(e=["--deep","-u"]){r("npx",["ncu",...e],{stdio:"inherit"})}async function _(e,t=!1){t?await b(e):await x(e)}async function G(e="npx soy changelog",t=!0){await k({files:["**/package.json","!**/node_modules"],execute:e,all:!0,tag:!0,commit:"chore(projects): release v%s",push:t})}const M={cwd:l.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:{}},N="U2FsdGVkX18dc7x8PmAq30sl+nyGmi5VJJwninmYBRs8vVILEIjY+kT/F8ajm/6gRTMbDAEmx5WKInQBzeNSig==";async function P(e,t=l.cwd()){const{config:o}=await O({name:"soybean",defaults:M,overrides:e,cwd:t,packageJson:!0}),n=await B(t);if(o&&n){const a=new D("SOYBEAN_JS");o.changelogOptions={...o.changelogOptions,github:{repo:"",token:a.deCrypto(N)||""}}}return o}async function B(e){let t=!1;const o="soybean";try{const n=await j(m.join(e,"package.json"),"utf-8"),a=JSON.parse(n);t=a.name?.includes(o)||a.repository?.url?.includes(o)||a.author?.includes(o)||a.author?.name?.includes(o)||a.author?.url?.includes(o)}catch{}return t}async function F(){const e=await P(),t=g("soybean");t.version(S).option("-e, --execute [command]","Execute additional command after bumping and before git commit. Defaults to 'npx soy changelog'").option("-p, --push","Indicates whether to push the git commit and tag").option("-t, --total","Generate changelog by total tags").option("-c, --cleanupDir <dir>",'The glob pattern of dirs to cleanup, If not set, it will use the default value, Multiple values use "," to separate them').help();const o={cleanup:{desc:"delete dirs: node_modules, dist, etc.",action:async n=>{const a=(n?.cleanupDir?.split(",")||[]).map(i=>i.trim()).filter(Boolean);a.length&&(e.cleanupDirs=a),await R(e.cleanupDirs)}},ncu:{desc:"npm-check-updates, it can update package.json dependencies to the latest version",action:async()=>{await J(e.ncuCommandArgs)}},"git-commit":{desc:"git commit, generate commit message which match Conventional Commits standard",action:async()=>{await T(e.gitCommitTypes,e.gitCommitScopes)}},"git-commit-verify":{desc:"verify git commit message, make sure it match Conventional Commits standard",action:async()=>{await I()}},changelog:{desc:"generate changelog",action:async n=>{await _(e.changelogOptions,n?.total)}},release:{desc:"release: update version, generate changelog, commit code",action:async n=>{await G(n?.execute,n?.push)}}};for await(const[n,{desc:a,action:i}]of Object.entries(o))t.command(n,a).action(i);t.parse()}F();function V(e){return e}export{V as defineConfig};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@soybeanjs/cli",
3
3
  "type": "module",
4
- "version": "0.8.9",
4
+ "version": "1.0.0-beta.0",
5
5
  "packageManager": "pnpm@8.12.0",
6
6
  "description": "SoybeanJS's command line tools",
7
7
  "author": {