@lntvow/dev 5.6.1 → 5.6.2

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/cli.mjs CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- (e=>e.major>20||e.major===20&&e.minor>=19)((e=>{let[t=`0`,n=`0`]=e.split(`.`);return{major:Number(t),minor:Number(n)}})(process.versions.node))||(process.stderr.write(`@lntvow/dev: Node.js v20.19+ is required (current: v${process.versions.node}).\nIf you use nvm, run:\n nvm install 20\n nvm use 20\n nvm alias default 20\n`),process.exit(1)),import(`./main-BMHwzhZi.mjs`);export{};
2
+ (e=>e.major>20||e.major===20&&e.minor>=19)((e=>{let[t=`0`,n=`0`]=e.split(`.`);return{major:Number(t),minor:Number(n)}})(process.versions.node))||(process.stderr.write(`@lntvow/dev: Node.js v20.19+ is required (current: v${process.versions.node}).\nIf you use nvm, run:\n nvm install 20\n nvm use 20\n nvm alias default 20\n`),process.exit(1)),import(`./main-Hd9jNTKA.mjs`);export{};
@@ -1 +1 @@
1
- import{Option as e,program as t}from"commander";import{copyFileSync as n,existsSync as r,mkdirSync as i,readFileSync as a,readdirSync as o,statSync as s,writeFileSync as c}from"node:fs";import{basename as l,resolve as u}from"node:path";import{fileURLToPath as d}from"node:url";import{execSync as f}from"node:child_process";import p from"picocolors";import m from"dayjs";import h from"simple-git";var g=`@lntvow/dev`,_=`5.6.1`;const v={prepare:`simple-git-hooks`,rimraf:`rimraf ./node_modules/`,ncu:`ncu -u --reject @types/node && pnpm install`,"sort:pkg":`sort-package-json`,commit:`git add . && git-cz && git push`,release:`git add . && bumpp package.json --all --no-tag --no-print-commits`,"lint:eslint":`eslint --fix --cache`,"lint:tsc":`tsc --noEmit`,lint:`run-p lint:eslint lint:tsc`},y=[`@commitlint/cli`,`@commitlint/config-conventional`,`@lntvow/eslint-config`,`bumpp`,`commitizen`,`cz-conventional-changelog`,`eslint`,`lint-staged`,`npm-run-all`,`prettier`,`simple-git-hooks`,`typescript`].sort((e,t)=>e.localeCompare(t)),b={info:e=>console.log(p.blue(`● ${e}`)),success:e=>console.log(p.green(`✓ ${e}`)),warn:e=>console.log(p.yellow(`▲ ${e}`)),error:e=>console.log(p.red(`✗ ${e}`))};function x(e,t={}){try{return f(e,{stdio:`inherit`,...t})}catch(t){throw b.error(`命令执行失败: ${e}`),t}}function S(){for(let{file:e,manager:t}of[{file:`pnpm-lock.yaml`,manager:`pnpm`},{file:`yarn.lock`,manager:`yarn`},{file:`package-lock.json`,manager:`npm`}])if(r(u(process.cwd(),e)))return t;let e=process.env.npm_config_user_agent||``;return e.startsWith(`pnpm`)?`pnpm`:e.startsWith(`yarn`)?`yarn`:`npm`}function C(e,t){if(s(e).isDirectory()){if(l(e)===`node_modules`)return;i(t,{recursive:!0}),o(e).forEach(n=>{C(u(e,n),u(t,n))})}else{if(r(t))return;n(e,t)}}function w(t){t.command(`init`).description(`init project`).option(`-t, --temp`,`copy template files`,!0).option(`--no-temp`,`not copy template files`).option(`-s, --scripts`,`init scripts`,!0).option(`--no-scripts`,`not init scripts`).option(`-g, --git`,`init simple-git-hooks`,!0).option(`--no-git`,`not init simple-git-hooks`).addOption(new e(`--pm <manager>`,`package manager`).choices([`pnpm`,`npm`,`yarn`]).default(S(),`auto-detect if not specified`)).action(T)}function T(e){b.success(`Init project by @lntvow/dev`),b.info(`Cwd is ${process.cwd()}`);let{temp:t,git:n,scripts:r,pm:i}=e;try{t&&E(),k(i),r&&O(),n&&D(),b.success(`Project initialization completed successfully!`)}catch(e){b.error(`Initialization failed: ${e.message}`),process.exit(1)}}function E(){try{let e=d(new URL(`./configs`,import.meta.url)),t=process.cwd();b.info(`Copying template files from "${e}" to "${t}"`),C(e,t),b.success(`Template files copied successfully`)}catch(e){throw b.error(`Failed to copy template files: ${e.message}`),e}}function D(){try{b.info(`Initializing Git hooks...`),x(`npx simple-git-hooks`),b.success(`Git hooks initialized successfully`)}catch(e){throw b.error(`Failed to initialize Git hooks: ${e.message}`),e}}function O(){let e,t=u(process.cwd(),`package.json`);try{b.info(`Updating package.json scripts...`),e=a(t,`utf-8`);let n=JSON.parse(e),r={...n,scripts:{...v,...n.scripts}};c(t,JSON.stringify(r,null,2)),b.success(`Package.json scripts updated successfully`)}catch(n){throw e&&c(t,e),b.error(`Failed to update package.json: ${n.message}`),n}}function k(e){try{let t=y.map(e=>`${e}@latest`).join(` `),n=e??S(),r={pnpm:`pnpm add -D ${t}`,yarn:`yarn add -D ${t}`,npm:`npm install -D ${t}`}[n];b.info(`Installing dependencies: ${r}`),x(r),b.success(`Dependencies installed successfully`)}catch(e){throw b.error(`Dependency installation failed: ${e.message}`),e}}function A(e){e.command(`release`).description(`git release`).action(j)}async function j(){console.log(p.green(`Release project...`));try{await M(),b.success(`Release completed successfully!`)}catch(e){b.error(`Release failed: ${e.message}`),process.exit(1)}}async function M(){let e=h(process.cwd());try{let t=m().format(`YYYYMMDD`);await e.pull(),await e.add(`.`),await e.commit(t,[`--no-verify`]),await e.push(`origin`),b.success(`提交成功: ${t}`)}catch(e){b.error(`Git操作失败: ${e.message}`),process.exit(1)}}t.name(g).version(_,`-v, --version`,`output the version number`),w(t),A(t),t.parse();export{};
1
+ import{Option as e,program as t}from"commander";import{copyFileSync as n,existsSync as r,mkdirSync as i,readFileSync as a,readdirSync as o,statSync as s,writeFileSync as c}from"node:fs";import{basename as l,resolve as u}from"node:path";import{fileURLToPath as d}from"node:url";import{execSync as f}from"node:child_process";import p from"picocolors";import m from"dayjs";import h from"simple-git";var g=`@lntvow/dev`,_=`5.6.2`;const v={prepare:`simple-git-hooks`,rimraf:`rimraf ./node_modules/`,ncu:`ncu -u --reject @types/node && pnpm install`,"sort:pkg":`sort-package-json`,commit:`git add . && git-cz && git push`,release:`git add . && bumpp package.json --all --no-tag --no-print-commits`,"lint:eslint":`eslint --fix --cache`,"lint:tsc":`tsc --noEmit`,lint:`run-p lint:eslint lint:tsc`},y=[`@commitlint/cli`,`@commitlint/config-conventional`,`@lntvow/eslint-config`,`bumpp`,`commitizen`,`cz-conventional-changelog`,`eslint`,`lint-staged`,`npm-run-all`,`prettier`,`simple-git-hooks`,`typescript`].sort((e,t)=>e.localeCompare(t)),b={info:e=>console.log(p.blue(`● ${e}`)),success:e=>console.log(p.green(`✓ ${e}`)),warn:e=>console.log(p.yellow(`▲ ${e}`)),error:e=>console.log(p.red(`✗ ${e}`))};function x(e,t={}){try{return f(e,{stdio:`inherit`,...t})}catch(t){throw b.error(`命令执行失败: ${e}`),t}}function S(){for(let{file:e,manager:t}of[{file:`pnpm-lock.yaml`,manager:`pnpm`},{file:`yarn.lock`,manager:`yarn`},{file:`package-lock.json`,manager:`npm`}])if(r(u(process.cwd(),e)))return t;let e=process.env.npm_config_user_agent||``;return e.startsWith(`pnpm`)?`pnpm`:e.startsWith(`yarn`)?`yarn`:`npm`}function C(e,t){if(s(e).isDirectory()){if(l(e)===`node_modules`)return;i(t,{recursive:!0}),o(e).forEach(n=>{C(u(e,n),u(t,n))})}else{if(r(t))return;n(e,t)}}function w(t){t.command(`init`).description(`init project`).option(`-t, --temp`,`copy template files`,!0).option(`--no-temp`,`not copy template files`).option(`-s, --scripts`,`init scripts`,!0).option(`--no-scripts`,`not init scripts`).option(`-g, --git`,`init simple-git-hooks`,!0).option(`--no-git`,`not init simple-git-hooks`).addOption(new e(`--pm <manager>`,`package manager`).choices([`pnpm`,`npm`,`yarn`]).default(S(),`auto-detect if not specified`)).action(T)}function T(e){b.success(`Init project by @lntvow/dev`),b.info(`Cwd is ${process.cwd()}`);let{temp:t,git:n,scripts:r,pm:i}=e;try{t&&E(),k(i),r&&O(),n&&D(),b.success(`Project initialization completed successfully!`)}catch(e){b.error(`Initialization failed: ${e.message}`),process.exit(1)}}function E(){try{let e=d(new URL(`./configs`,import.meta.url)),t=process.cwd();b.info(`Copying template files from "${e}" to "${t}"`),C(e,t),b.success(`Template files copied successfully`)}catch(e){throw b.error(`Failed to copy template files: ${e.message}`),e}}function D(){try{b.info(`Initializing Git hooks...`),x(`npx simple-git-hooks`),b.success(`Git hooks initialized successfully`)}catch(e){throw b.error(`Failed to initialize Git hooks: ${e.message}`),e}}function O(){let e,t=u(process.cwd(),`package.json`);try{b.info(`Updating package.json scripts...`),e=a(t,`utf-8`);let n=JSON.parse(e),r={...n,scripts:{...v,...n.scripts}};c(t,JSON.stringify(r,null,2)),b.success(`Package.json scripts updated successfully`)}catch(n){throw e&&c(t,e),b.error(`Failed to update package.json: ${n.message}`),n}}function k(e){try{let t=y.map(e=>`${e}@latest`).join(` `),n=e??S(),r={pnpm:`pnpm add -D ${t}`,yarn:`yarn add -D ${t}`,npm:`npm install -D ${t}`}[n];b.info(`Installing dependencies: ${r}`),x(r),b.success(`Dependencies installed successfully`)}catch(e){throw b.error(`Dependency installation failed: ${e.message}`),e}}function A(e){e.command(`release`).description(`git release`).action(j)}async function j(){console.log(p.green(`Release project...`));try{await M(),b.success(`Release completed successfully!`)}catch(e){b.error(`Release failed: ${e.message}`),process.exit(1)}}async function M(){let e=h(process.cwd());try{let t=m().format(`YYYYMMDD`);await e.pull(),await e.add(`.`),await e.commit(t,[`--no-verify`]),await e.push(`origin`),b.success(`提交成功: ${t}`)}catch(e){b.error(`Git操作失败: ${e.message}`),process.exit(1)}}t.name(g).version(_,`-v, --version`,`output the version number`),w(t),A(t),t.parse();export{};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lntvow/dev",
3
- "version": "5.6.1",
3
+ "version": "5.6.2",
4
4
  "description": "Development environment dependencies package",
5
5
  "keywords": [
6
6
  "dev"