@lntvow/dev 5.0.20 → 5.0.21
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.cjs +1 -1
- package/dist/cli.mjs +1 -1
- package/package.json +1 -3
package/dist/cli.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var I=Object.create;var y=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var F=Object.getPrototypeOf,R=Object.prototype.hasOwnProperty;var U=(e,t,i,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of T(t))!R.call(e,r)&&r!==i&&y(e,r,{get:()=>t[r],enumerable:!(o=P(t,r))||o.enumerable});return e};var d=(e,t,i)=>(i=e!=null?I(F(e)):{},U(t||!e||!e.__esModule?y(i,"default",{value:e,enumerable:!0}):i,e));var G=()=>typeof document>"u"?new URL(`file:${__filename}`).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href,c=G();var l=require("fs"),m=require("path"),E=require("url"),g=require("commander"),_=d(require("picocolors"),1),b=d(require("dayjs"),1),z=d(require("simple-git"),1),C=require("local-pkg");var k="@lntvow/dev",v="5.0.
|
|
2
|
+
"use strict";var I=Object.create;var y=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var F=Object.getPrototypeOf,R=Object.prototype.hasOwnProperty;var U=(e,t,i,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of T(t))!R.call(e,r)&&r!==i&&y(e,r,{get:()=>t[r],enumerable:!(o=P(t,r))||o.enumerable});return e};var d=(e,t,i)=>(i=e!=null?I(F(e)):{},U(t||!e||!e.__esModule?y(i,"default",{value:e,enumerable:!0}):i,e));var G=()=>typeof document>"u"?new URL(`file:${__filename}`).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href,c=G();var l=require("fs"),m=require("path"),E=require("url"),g=require("commander"),_=d(require("picocolors"),1),b=d(require("dayjs"),1),z=d(require("simple-git"),1),C=require("local-pkg");var k="@lntvow/dev",v="5.0.21";var x=require("child_process"),w=require("fs"),S=require("path"),a=d(require("picocolors"),1),n={info:e=>console.log(a.default.blue(`\u25CF ${e}`)),success:e=>console.log(a.default.green(`\u2713 ${e}`)),warn:e=>console.log(a.default.yellow(`\u25B2 ${e}`)),error:e=>console.log(a.default.red(`\u2717 ${e}`))};function f(e,t={}){try{return(0,x.execSync)(e,{stdio:"inherit",...t})}catch(i){throw n.error(`\u547D\u4EE4\u6267\u884C\u5931\u8D25: ${e}`),i}}function j(){let e=[{file:"pnpm-lock.yaml",manager:"pnpm"},{file:"yarn.lock",manager:"yarn"},{file:"package-lock.json",manager:"npm"}];for(let{file:i,manager:o}of e)if((0,w.existsSync)((0,S.resolve)(process.cwd(),i)))return o;let t=process.env.npm_config_user_agent||"";return t.startsWith("pnpm")?"pnpm":t.startsWith("yarn")?"yarn":"npm"}var D={postinstall:"simple-git-hooks",rimraf:"rimraf ./node_modules/",ncu:"ncu -u --reject @types/node && pnpm install",commit:"git add . && git-cz && pnpm release -y",release:"git add . && bumpp package.json --all --no-tag --no-print-commits","lint:eslint":'eslint "src/**/*.{js,jsx,ts,tsx,vue}" --fix',"lint:tsc":"tsc --noEmit",lint:"run-p lint:eslint lint:tsc"},$=["@commitlint/cli","@commitlint/config-conventional","@lntvow/eslint-config","bumpp","commitizen","cz-conventional-changelog","lint-staged","npm-run-all","simple-git-hooks","typescript"].sort((e,t)=>e.localeCompare(t));var s=require("fs"),p=require("path");function u(e,t){if((0,s.statSync)(e).isDirectory()){if((0,p.basename)(e)==="node_modules")return;(0,s.mkdirSync)(t,{recursive:!0}),(0,s.readdirSync)(e).forEach(o=>{u((0,p.resolve)(e,o),(0,p.resolve)(t,o))})}else{if((0,s.existsSync)(t))return;(0,s.copyFileSync)(e,t)}}var M=(0,E.fileURLToPath)(c),N=(0,m.dirname)(M);g.program.name(k).version(v,"-v, --version","output the version number");g.program.command("init").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").description("init project").action(async e=>{n.success("Init project by @lntvow/dev"),n.info(`Cwd is ${process.cwd()}`);let{temp:t,git:i,scripts:o}=e;try{A(),t&&L(),o&&Y(),i&&O(),n.success("Project initialization completed successfully!")}catch(r){n.error(`Initialization failed: ${r.message}`),process.exit(1)}});function L(){n.info("Copying template files..."),u((0,m.resolve)(N,"./configs"),process.cwd()),n.success("Template files copied successfully")}function O(){if(!(0,C.isPackageExists)("simple-git-hooks")){n.warn("simple-git-hooks not installed, skipping initialization");return}try{n.info("Initializing Git hooks..."),f("npx simple-git-hooks"),n.success("Git hooks initialized successfully")}catch(e){n.error(`Failed to initialize Git hooks: ${e.message}`)}}function Y(){n.info("Updating package.json scripts...");let e=(0,m.resolve)(process.cwd(),"package.json"),t;try{t=(0,l.readFileSync)(e,"utf-8");let i=JSON.parse(t),o={...i,scripts:{...D,...i.scripts}};(0,l.writeFileSync)(e,JSON.stringify(o,null,2)),n.success("Package.json scripts updated successfully")}catch(i){t&&(0,l.writeFileSync)(e,t),n.error(`Failed to update package.json: ${i.message}`),process.exit(1)}}function A(){try{let e=$.map(o=>`${o}@latest`).join(" "),t=j(),i="";t==="pnpm"?i=`pnpm add -D ${e}`:t==="yarn"?i=`yarn add -D ${e}`:i=`npm install -D ${e}`,n.info(`Installing dependencies: ${i}`),f(i),n.success("Dependencies installed successfully")}catch(e){n.error(`Dependency installation failed: ${e.message}`),process.exit(1)}}g.program.command("release").description("git release").action(async()=>{console.log(_.default.green("Release project..."));try{await H(),n.success("Release completed successfully!")}catch(e){n.error(`Release failed: ${e.message}`),process.exit(1)}});async function H(){let e=(0,z.default)(process.cwd());try{let t=(0,b.default)().format("YYYYMMDD HH:mm");await e.pull(),await e.add("."),await e.commit(t,["--no-verify"]),await e.push("origin"),n.success(`\u63D0\u4EA4\u6210\u529F: ${t}`)}catch(t){n.error(`Git\u64CD\u4F5C\u5931\u8D25: ${t.message}`),process.exit(1)}}g.program.parse();
|
package/dist/cli.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{readFileSync as C,writeFileSync as v}from"fs";import{dirname as P,resolve as h}from"path";import{fileURLToPath as T}from"url";import{program as r}from"commander";import F from"picocolors";import I from"dayjs";import G from"simple-git";import{isPackageExists as N}from"local-pkg";var p="@lntvow/dev",m="5.0.
|
|
2
|
+
import{readFileSync as C,writeFileSync as v}from"fs";import{dirname as P,resolve as h}from"path";import{fileURLToPath as T}from"url";import{program as r}from"commander";import F from"picocolors";import I from"dayjs";import G from"simple-git";import{isPackageExists as N}from"local-pkg";var p="@lntvow/dev",m="5.0.21";import{execSync as w}from"child_process";import{existsSync as j}from"fs";import{resolve as S}from"path";import o from"picocolors";var i={info:e=>console.log(o.blue(`\u25CF ${e}`)),success:e=>console.log(o.green(`\u2713 ${e}`)),warn:e=>console.log(o.yellow(`\u25B2 ${e}`)),error:e=>console.log(o.red(`\u2717 ${e}`))};function c(e,t={}){try{return w(e,{stdio:"inherit",...t})}catch(n){throw i.error(`\u547D\u4EE4\u6267\u884C\u5931\u8D25: ${e}`),n}}function f(){let e=[{file:"pnpm-lock.yaml",manager:"pnpm"},{file:"yarn.lock",manager:"yarn"},{file:"package-lock.json",manager:"npm"}];for(let{file:n,manager:s}of e)if(j(S(process.cwd(),n)))return s;let t=process.env.npm_config_user_agent||"";return t.startsWith("pnpm")?"pnpm":t.startsWith("yarn")?"yarn":"npm"}var u={postinstall:"simple-git-hooks",rimraf:"rimraf ./node_modules/",ncu:"ncu -u --reject @types/node && pnpm install",commit:"git add . && git-cz && pnpm release -y",release:"git add . && bumpp package.json --all --no-tag --no-print-commits","lint:eslint":'eslint "src/**/*.{js,jsx,ts,tsx,vue}" --fix',"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","lint-staged","npm-run-all","simple-git-hooks","typescript"].sort((e,t)=>e.localeCompare(t));import{statSync as D,mkdirSync as E,readdirSync as $,existsSync as _,copyFileSync as b}from"fs";import{basename as z,resolve as k}from"path";function a(e,t){if(D(e).isDirectory()){if(z(e)==="node_modules")return;E(t,{recursive:!0}),$(e).forEach(s=>{a(k(e,s),k(t,s))})}else{if(_(t))return;b(e,t)}}var R=T(import.meta.url),M=P(R);r.name(p).version(m,"-v, --version","output the version number");r.command("init").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").description("init project").action(async e=>{i.success("Init project by @lntvow/dev"),i.info(`Cwd is ${process.cwd()}`);let{temp:t,git:n,scripts:s}=e;try{A(),t&&O(),s&&Y(),n&&U(),i.success("Project initialization completed successfully!")}catch(x){i.error(`Initialization failed: ${x.message}`),process.exit(1)}});function O(){i.info("Copying template files..."),a(h(M,"./configs"),process.cwd()),i.success("Template files copied successfully")}function U(){if(!N("simple-git-hooks")){i.warn("simple-git-hooks not installed, skipping initialization");return}try{i.info("Initializing Git hooks..."),c("npx simple-git-hooks"),i.success("Git hooks initialized successfully")}catch(e){i.error(`Failed to initialize Git hooks: ${e.message}`)}}function Y(){i.info("Updating package.json scripts...");let e=h(process.cwd(),"package.json"),t;try{t=C(e,"utf-8");let n=JSON.parse(t),s={...n,scripts:{...u,...n.scripts}};v(e,JSON.stringify(s,null,2)),i.success("Package.json scripts updated successfully")}catch(n){t&&v(e,t),i.error(`Failed to update package.json: ${n.message}`),process.exit(1)}}function A(){try{let e=y.map(s=>`${s}@latest`).join(" "),t=f(),n="";t==="pnpm"?n=`pnpm add -D ${e}`:t==="yarn"?n=`yarn add -D ${e}`:n=`npm install -D ${e}`,i.info(`Installing dependencies: ${n}`),c(n),i.success("Dependencies installed successfully")}catch(e){i.error(`Dependency installation failed: ${e.message}`),process.exit(1)}}r.command("release").description("git release").action(async()=>{console.log(F.green("Release project..."));try{await H(),i.success("Release completed successfully!")}catch(e){i.error(`Release failed: ${e.message}`),process.exit(1)}});async function H(){let e=G(process.cwd());try{let t=I().format("YYYYMMDD HH:mm");await e.pull(),await e.add("."),await e.commit(t,["--no-verify"]),await e.push("origin"),i.success(`\u63D0\u4EA4\u6210\u529F: ${t}`)}catch(t){i.error(`Git\u64CD\u4F5C\u5931\u8D25: ${t.message}`),process.exit(1)}}r.parse();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lntvow/dev",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.21",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Development environment dependencies package",
|
|
6
6
|
"keywords": [
|
|
@@ -34,10 +34,8 @@
|
|
|
34
34
|
"bumpp": "^10.2.0",
|
|
35
35
|
"commitizen": "^4.3.1",
|
|
36
36
|
"cz-conventional-changelog": "^3.3.0",
|
|
37
|
-
"eslint": "^9.29.0",
|
|
38
37
|
"lint-staged": "^16.1.2",
|
|
39
38
|
"npm-run-all": "^4.1.5",
|
|
40
|
-
"prettier": "^3.6.0",
|
|
41
39
|
"simple-git-hooks": "^2.13.0",
|
|
42
40
|
"tsup": "^8.5.0",
|
|
43
41
|
"typescript": "^5.8.3"
|