@lntvow/dev 4.1.0 → 4.1.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.cjs CHANGED
@@ -1,90 +1,3 @@
1
1
  #!/usr/bin/env node
2
- 'use strict';
3
-
4
- const child_process = require('child_process');
5
- const fs$1 = require('fs');
6
- const path$1 = require('path');
7
- const commander = require('commander');
8
- const pc = require('picocolors');
9
- const fs = require('node:fs');
10
- const path = require('node:path');
11
- const node_url = require('node:url');
12
- const dayjs = require('dayjs');
13
- const utc = require('dayjs/plugin/utc.js');
14
- const timezone = require('dayjs/plugin/timezone.js');
15
-
16
- var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
17
- function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
18
-
19
- const pc__default = /*#__PURE__*/_interopDefaultCompat(pc);
20
- const fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
21
- const path__default = /*#__PURE__*/_interopDefaultCompat(path);
22
- const dayjs__default = /*#__PURE__*/_interopDefaultCompat(dayjs);
23
- const utc__default = /*#__PURE__*/_interopDefaultCompat(utc);
24
- const timezone__default = /*#__PURE__*/_interopDefaultCompat(timezone);
25
-
26
- const name = "@lntvow/dev";
27
- const version = "4.1.0";
28
-
29
- dayjs__default.extend(timezone__default);
30
- dayjs__default.extend(utc__default);
31
- const __filename$1 = node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.cjs', document.baseURI).href)));
32
- const __dirname$1 = path__default.dirname(__filename$1);
33
- const [cwd] = process.cwd().split("node_modules");
34
- console.log("cwd: ", cwd);
35
- function copyDirectorySync(source, target) {
36
- if (!fs__default.existsSync(target)) fs__default.mkdirSync(target);
37
- const files = fs__default.readdirSync(source, { withFileTypes: true });
38
- files.forEach((file) => {
39
- const sourcePath = path__default.resolve(source, file.name);
40
- const filePath = path__default.resolve(target, file.name);
41
- if (file.isDirectory()) {
42
- copyDirectorySync(sourcePath, filePath);
43
- } else {
44
- if (fs__default.existsSync(filePath)) return;
45
- fs__default.copyFileSync(sourcePath, filePath);
46
- }
47
- });
48
- }
49
- function postinstall() {
50
- console.log(pc__default.blue("Start copying template files"));
51
- copyDirectorySync(path__default.resolve(__dirname$1, "./temp"), cwd);
52
- console.log(pc__default.green("Template files copied successfully"));
53
- }
54
-
55
- commander.program.name(name).version(version, "-v, --version", "output the version number");
56
- commander.program.command("init").option("-t, --temp", "copy template files", true).option("--no-temp", "not copy template files").option("-g, --git", "init simple-git-hooks", true).option("--no-git", "not init simple-git-hooks").option("-s, --scripts", "init scripts", true).option("--no-scripts", "not init scripts").description("init project").action((options) => {
57
- console.log(pc__default.green("Init project by @lntvow/dev"));
58
- const { temp, git, scripts } = options;
59
- if (temp) postinstall();
60
- if (git) {
61
- console.log(pc__default.blue("Start init simple-git-hooks"));
62
- const output = child_process.execSync("npx simple-git-hooks");
63
- console.log(output.toString());
64
- }
65
- if (scripts) {
66
- console.log(pc__default.blue("Start init scripts"));
67
- try {
68
- const path = path$1.resolve(process.cwd(), "package.json");
69
- let data = JSON.parse(fs$1.readFileSync(path, "utf-8"));
70
- data = {
71
- ...data,
72
- scripts: {
73
- postinstall: "simple-git-hooks",
74
- check: "tsc --noEmit",
75
- lint: 'eslint "src/**/*.{js,jsx,ts,tsx,vue}"',
76
- rimraf: "rimraf ./node_modules/",
77
- commit: "git add . && git-cz && git push",
78
- release: "git add . && bumpp package.json --all --no-tag",
79
- ...data.scripts
80
- }
81
- };
82
- fs$1.writeFileSync(path, JSON.stringify(data, null, 2));
83
- console.log(pc__default.green("Scripts added successfully"));
84
- } catch {
85
- console.log(pc__default.yellow("No package.json file found ignoring scripts"));
86
- }
87
- }
88
- console.log(pc__default.yellow('\nYou may need to re-execute the "pnpm install" command'));
89
- });
90
- commander.program.parse();
2
+ "use strict";var j=Object.create;var u=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var z=Object.getPrototypeOf,E=Object.prototype.hasOwnProperty;var F=(t,o,i,s)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of U(o))!E.call(t,e)&&e!==i&&u(t,e,{get:()=>o[e],enumerable:!(s=_(o,e))||s.enumerable});return t};var p=(t,o,i)=>(i=t!=null?j(z(t)):{},F(o||!t||!t.__esModule?u(i,"default",{value:t,enumerable:!0}):i,t));var I=()=>typeof document>"u"?new URL(`file:${__filename}`).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href,d=I();var k=require("child_process"),m=require("fs"),b=require("path"),a=require("commander"),c=p(require("picocolors"),1);var y="@lntvow/dev",v="4.1.2";var r=p(require("fs"),1),l=p(require("path"),1),h=require("url"),g=p(require("picocolors"),1),R=(0,h.fileURLToPath)(d),T=l.default.dirname(R),[S]=process.cwd().split("node_modules");console.log("cwd: ",S);function w(t,o){r.default.existsSync(o)||r.default.mkdirSync(o),r.default.readdirSync(t,{withFileTypes:!0}).forEach(s=>{let e=l.default.resolve(t,s.name),n=l.default.resolve(o,s.name);if(s.isDirectory())w(e,n);else{if(r.default.existsSync(n))return;r.default.copyFileSync(e,n)}})}function x(){console.log(g.default.blue("Start copying template files")),w(l.default.resolve(T,"./template"),S),console.log(g.default.green("Template files copied successfully"))}a.program.name(y).version(v,"-v, --version","output the version number");a.program.command("init").option("-t, --temp","copy template files",!0).option("--no-temp","not copy template files").option("-g, --git","init simple-git-hooks",!0).option("--no-git","not init simple-git-hooks").option("-s, --scripts","init scripts",!0).option("--no-scripts","not init scripts").description("init project").action(t=>{console.log(c.default.green("Init project by @lntvow/dev"));let{temp:o,git:i,scripts:s}=t;if(o&&x(),i){console.log(c.default.blue("Start init simple-git-hooks"));let e=(0,k.execSync)("npx simple-git-hooks");console.log(e.toString())}if(s){console.log(c.default.blue("Start init scripts"));try{let e=(0,b.resolve)(process.cwd(),"package.json"),n=JSON.parse((0,m.readFileSync)(e,"utf-8"));n={...n,scripts:{postinstall:"simple-git-hooks",check:"tsc --noEmit",lint:'eslint "src/**/*.{js,jsx,ts,tsx,vue}"',rimraf:"rimraf ./node_modules/",commit:"git add . && git-cz && git push",release:"git add . && bumpp package.json --all --no-tag",...n.scripts}},(0,m.writeFileSync)(e,JSON.stringify(n,null,2)),console.log(c.default.green("Scripts added successfully"))}catch{console.log(c.default.yellow("No package.json file found ignoring scripts"))}}console.log(c.default.yellow(`
3
+ You may need to re-execute the "pnpm install" command`))});a.program.parse();
package/dist/cli.d.cts CHANGED
@@ -1 +1 @@
1
-
1
+ #!/usr/bin/env node
package/dist/cli.d.ts CHANGED
@@ -1 +1 @@
1
-
1
+ #!/usr/bin/env node
package/dist/cli.mjs CHANGED
@@ -1,78 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import { execSync } from 'child_process';
3
- import { readFileSync, writeFileSync } from 'fs';
4
- import { resolve } from 'path';
5
- import { program } from 'commander';
6
- import pc from 'picocolors';
7
- import fs from 'node:fs';
8
- import path from 'node:path';
9
- import { fileURLToPath } from 'node:url';
10
- import dayjs from 'dayjs';
11
- import utc from 'dayjs/plugin/utc.js';
12
- import timezone from 'dayjs/plugin/timezone.js';
13
-
14
- const name = "@lntvow/dev";
15
- const version = "4.1.0";
16
-
17
- dayjs.extend(timezone);
18
- dayjs.extend(utc);
19
- const __filename = fileURLToPath(import.meta.url);
20
- const __dirname = path.dirname(__filename);
21
- const [cwd] = process.cwd().split("node_modules");
22
- console.log("cwd: ", cwd);
23
- function copyDirectorySync(source, target) {
24
- if (!fs.existsSync(target)) fs.mkdirSync(target);
25
- const files = fs.readdirSync(source, { withFileTypes: true });
26
- files.forEach((file) => {
27
- const sourcePath = path.resolve(source, file.name);
28
- const filePath = path.resolve(target, file.name);
29
- if (file.isDirectory()) {
30
- copyDirectorySync(sourcePath, filePath);
31
- } else {
32
- if (fs.existsSync(filePath)) return;
33
- fs.copyFileSync(sourcePath, filePath);
34
- }
35
- });
36
- }
37
- function postinstall() {
38
- console.log(pc.blue("Start copying template files"));
39
- copyDirectorySync(path.resolve(__dirname, "./temp"), cwd);
40
- console.log(pc.green("Template files copied successfully"));
41
- }
42
-
43
- program.name(name).version(version, "-v, --version", "output the version number");
44
- program.command("init").option("-t, --temp", "copy template files", true).option("--no-temp", "not copy template files").option("-g, --git", "init simple-git-hooks", true).option("--no-git", "not init simple-git-hooks").option("-s, --scripts", "init scripts", true).option("--no-scripts", "not init scripts").description("init project").action((options) => {
45
- console.log(pc.green("Init project by @lntvow/dev"));
46
- const { temp, git, scripts } = options;
47
- if (temp) postinstall();
48
- if (git) {
49
- console.log(pc.blue("Start init simple-git-hooks"));
50
- const output = execSync("npx simple-git-hooks");
51
- console.log(output.toString());
52
- }
53
- if (scripts) {
54
- console.log(pc.blue("Start init scripts"));
55
- try {
56
- const path = resolve(process.cwd(), "package.json");
57
- let data = JSON.parse(readFileSync(path, "utf-8"));
58
- data = {
59
- ...data,
60
- scripts: {
61
- postinstall: "simple-git-hooks",
62
- check: "tsc --noEmit",
63
- lint: 'eslint "src/**/*.{js,jsx,ts,tsx,vue}"',
64
- rimraf: "rimraf ./node_modules/",
65
- commit: "git add . && git-cz && git push",
66
- release: "git add . && bumpp package.json --all --no-tag",
67
- ...data.scripts
68
- }
69
- };
70
- writeFileSync(path, JSON.stringify(data, null, 2));
71
- console.log(pc.green("Scripts added successfully"));
72
- } catch {
73
- console.log(pc.yellow("No package.json file found ignoring scripts"));
74
- }
75
- }
76
- console.log(pc.yellow('\nYou may need to re-execute the "pnpm install" command'));
77
- });
78
- program.parse();
2
+ import{execSync as k}from"child_process";import{readFileSync as x,writeFileSync as w}from"fs";import{resolve as b}from"path";import{program as r}from"commander";import i from"picocolors";var a="@lntvow/dev",d="4.1.2";import n from"node:fs";import l from"node:path";import{fileURLToPath as v}from"node:url";import g from"picocolors";var h=v(import.meta.url),S=l.dirname(h),[u]=process.cwd().split("node_modules");console.log("cwd: ",u);function f(c,e){n.existsSync(e)||n.mkdirSync(e),n.readdirSync(c,{withFileTypes:!0}).forEach(s=>{let o=l.resolve(c,s.name),t=l.resolve(e,s.name);if(s.isDirectory())f(o,t);else{if(n.existsSync(t))return;n.copyFileSync(o,t)}})}function y(){console.log(g.blue("Start copying template files")),f(l.resolve(S,"./template"),u),console.log(g.green("Template files copied successfully"))}r.name(a).version(d,"-v, --version","output the version number");r.command("init").option("-t, --temp","copy template files",!0).option("--no-temp","not copy template files").option("-g, --git","init simple-git-hooks",!0).option("--no-git","not init simple-git-hooks").option("-s, --scripts","init scripts",!0).option("--no-scripts","not init scripts").description("init project").action(c=>{console.log(i.green("Init project by @lntvow/dev"));let{temp:e,git:p,scripts:s}=c;if(e&&y(),p){console.log(i.blue("Start init simple-git-hooks"));let o=k("npx simple-git-hooks");console.log(o.toString())}if(s){console.log(i.blue("Start init scripts"));try{let o=b(process.cwd(),"package.json"),t=JSON.parse(x(o,"utf-8"));t={...t,scripts:{postinstall:"simple-git-hooks",check:"tsc --noEmit",lint:'eslint "src/**/*.{js,jsx,ts,tsx,vue}"',rimraf:"rimraf ./node_modules/",commit:"git add . && git-cz && git push",release:"git add . && bumpp package.json --all --no-tag",...t.scripts}},w(o,JSON.stringify(t,null,2)),console.log(i.green("Scripts added successfully"))}catch{console.log(i.yellow("No package.json file found ignoring scripts"))}}console.log(i.yellow(`
3
+ You may need to re-execute the "pnpm install" command`))});r.parse();
@@ -0,0 +1,10 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/prettierrc",
3
+ "printWidth": 120,
4
+ "semi": false,
5
+ "singleQuote": true,
6
+ "arrowParens": "avoid",
7
+ "trailingComma": "es5",
8
+ "htmlWhitespaceSensitivity": "ignore",
9
+ "quoteProps": "consistent"
10
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lntvow/dev",
3
- "version": "4.1.0",
3
+ "version": "4.1.2",
4
4
  "type": "module",
5
5
  "description": "开发环境依赖包",
6
6
  "keywords": [
@@ -12,37 +12,38 @@
12
12
  "url": "https://github.com/lntvow/dev.git"
13
13
  },
14
14
  "files": [
15
- "dist",
16
- "dist/temp/*"
15
+ "dist"
17
16
  ],
18
17
  "bin": {
19
18
  "lntvow": "./dist/cli.mjs"
20
19
  },
21
20
  "dependencies": {
22
- "@commitlint/cli": "^19.7.1",
23
- "@commitlint/config-conventional": "^19.7.1",
24
- "@lntvow/eslint-config": "^9.20.0",
25
- "bumpp": "^8.0.1",
21
+ "@commitlint/cli": "^19.8.0",
22
+ "@commitlint/config-conventional": "^19.8.0",
23
+ "@lntvow/eslint-config": "^9.23.2",
24
+ "bumpp": "^10.1.0",
26
25
  "commander": "^13.1.0",
27
26
  "commitizen": "^4.3.1",
28
27
  "cz-conventional-changelog": "^3.3.0",
29
- "dayjs": "^1.11.13",
30
- "lint-staged": "^15.4.3",
28
+ "lint-staged": "^15.5.1",
31
29
  "picocolors": "^1.1.1",
32
30
  "rimraf": "^6.0.1",
33
- "simple-git-hooks": "^2.11.1"
31
+ "simple-git-hooks": "^2.12.1"
34
32
  },
35
33
  "devDependencies": {
36
- "tsx": "^4.19.2",
37
- "unbuild": "^3.3.1"
34
+ "tsup": "^8.4.0",
35
+ "tsx": "^4.19.3"
38
36
  },
39
37
  "scripts": {
38
+ "postinstall": "simple-git-hooks",
40
39
  "check": "tsc --noEmit",
41
- "lint": "eslint \"src/**/*.{js,jsx,ts,tsx,vue}\"",
40
+ "lint": "run-p lint:eslint lint:tsc",
42
41
  "rimraf": "rimraf ./node_modules/",
43
42
  "commit": "git add . && git-cz && git push",
44
- "release": "git add . && bumpp package.json --all --no-tag",
43
+ "release": "git add . && bumpp package.json --all --no-tag --no-print-commits",
44
+ "lint:eslint": "eslint \"src/**/*.{js,jsx,ts,tsx,vue}\" --fix",
45
+ "lint:tsc": "tsc --noEmit",
45
46
  "dev": "tsx src/cli.ts",
46
- "build": "unbuild && tsx scripts/copy.ts"
47
+ "build": "tsup && tsx scripts/copy.ts"
47
48
  }
48
49
  }
package/dist/cli.d.mts DELETED
@@ -1 +0,0 @@
1
-
@@ -1,25 +0,0 @@
1
- # Logs
2
- logs
3
- *.log
4
- npm-debug.log*
5
- yarn-debug.log*
6
- yarn-error.log*
7
- pnpm-debug.log*
8
- lerna-debug.log*
9
-
10
- # Editor directories and files
11
- *.suo
12
- *.ntvs*
13
- *.njsproj
14
- *.sln
15
- *.sw?
16
-
17
-
18
- #
19
- node_modules
20
- .DS_Store
21
- dist
22
- dist-ssr
23
- coverage
24
- *.local
25
- _*
package/dist/temp/.npmrc DELETED
@@ -1,5 +0,0 @@
1
- shamefully-hoist=true
2
- auto-install-peers=true
3
-
4
- registry=https://registry.npmmirror.com
5
- # registry=https://registry.npmjs.org
@@ -1,8 +0,0 @@
1
- {
2
- "printWidth": 120,
3
- "semi": false,
4
- "singleQuote": true,
5
- "arrowParens": "avoid",
6
- "trailingComma": "es5",
7
- "htmlWhitespaceSensitivity": "ignore"
8
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes