create-a-pkg 1.0.1 → 1.0.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/package.json
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-a-pkg",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.3",
|
|
5
5
|
"description": "一个一键生成一个符合特定规则 <就是一个简单的代码模板库> 的 npm 包",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"devDependencies": {
|
|
8
|
-
"@eslint/js": "^9.
|
|
9
|
-
"@qqi/check-version": "^1.0.
|
|
10
|
-
"@qqi/rollup-external": "^1.0.
|
|
11
|
-
"@rollup/plugin-commonjs": "^28.0.
|
|
8
|
+
"@eslint/js": "^9.29.0",
|
|
9
|
+
"@qqi/check-version": "^1.0.3",
|
|
10
|
+
"@qqi/rollup-external": "^1.0.8",
|
|
11
|
+
"@rollup/plugin-commonjs": "^28.0.6",
|
|
12
12
|
"@rollup/plugin-json": "^6.1.0",
|
|
13
13
|
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
14
14
|
"@rollup/plugin-terser": "^0.4.4",
|
|
15
|
-
"@rollup/plugin-typescript": "^12.1.
|
|
16
|
-
"@types/node": "^24.0.
|
|
17
|
-
"eslint": "^9.
|
|
15
|
+
"@rollup/plugin-typescript": "^12.1.3",
|
|
16
|
+
"@types/node": "^24.0.3",
|
|
17
|
+
"eslint": "^9.29.0",
|
|
18
18
|
"eslint-config-prettier": "^10.1.5",
|
|
19
|
-
"eslint-plugin-jsdoc": "^51.
|
|
19
|
+
"eslint-plugin-jsdoc": "^51.1.1",
|
|
20
20
|
"globals": "^16.2.0",
|
|
21
|
-
"gvv": "^0.0
|
|
21
|
+
"gvv": "^0.1.0",
|
|
22
22
|
"husky": "^9.1.7",
|
|
23
|
-
"jja": "^2.3.
|
|
24
|
-
"lint-staged": "^16.1.
|
|
25
|
-
"pjj": "^1.0.
|
|
23
|
+
"jja": "^2.3.10",
|
|
24
|
+
"lint-staged": "^16.1.2",
|
|
25
|
+
"pjj": "^1.0.2",
|
|
26
26
|
"prettier": "^3.5.3",
|
|
27
|
-
"rollup": "^4.
|
|
27
|
+
"rollup": "^4.44.0",
|
|
28
28
|
"rollup-plugin-cleanup": "^3.2.1",
|
|
29
29
|
"rollup-plugin-copy": "^3.5.0",
|
|
30
30
|
"tslib": "^2.8.1",
|
|
31
31
|
"typescript": "^5.8.3",
|
|
32
|
-
"typescript-eslint": "^8.34.
|
|
33
|
-
"vjj": "^1.0.
|
|
32
|
+
"typescript-eslint": "^8.34.1",
|
|
33
|
+
"vjj": "^1.0.6"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@color-pen/static": "^1.0.0",
|
|
37
|
-
"@qqi/
|
|
38
|
-
"a-command": "^2.3.
|
|
37
|
+
"@qqi/log": "^0.0.1",
|
|
38
|
+
"a-command": "^2.3.10",
|
|
39
39
|
"a-js-tools": "^1.0.0",
|
|
40
|
-
"a-node-tools": "^4.2.
|
|
40
|
+
"a-node-tools": "^4.2.12",
|
|
41
41
|
"a-type-of-js": "^1.0.1",
|
|
42
42
|
"color-pen": "^2.0.10",
|
|
43
43
|
"colored-table": "^0.0.2",
|
|
44
|
-
"qqi": "^0.0.
|
|
44
|
+
"qqi": "^0.0.5"
|
|
45
45
|
},
|
|
46
46
|
"author": {
|
|
47
47
|
"name": "🥜",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{waiting as t}from"../waiting.mjs";import{command as r}from"../command.mjs";import{isUndefined as o}from"a-type-of-js";import{
|
|
1
|
+
import{waiting as t}from"../waiting.mjs";import{command as r}from"../command.mjs";import{isUndefined as o}from"a-type-of-js";import{isEmptyDir as a,getNpmPkgInfo as i}from"a-node-tools";import{brightRedPen as m,magentaPen as e,hexPen as n}from"color-pen";import{dataStore as s}from"../data-store/index.mjs";import{mkdirSync as p}from"node:fs";import{exitProgram as c}from"../utils.mjs";import{dog as f,dun as d}from"../dog.mjs";import{carryRange as u}from"./carryRange.mjs";async function g(g){s.childPkg=s.carryRange=!1,g.startsWith("@")&&(s.childPkg=!0,await u(g));const l=g.startsWith("@")?s.carryRange?g.replace(/@/,"").replace(/\//,"/packages/"):g.replace(/^.*\/(.*)$/,"$1"):g;f("获取当前的目录",l);const j=a(l);if(0==j){const t=["更换为其他名称","直接退出"],a=await r.question({text:`当前目录下存在非空同名文件夹(${m(g)})`,tip:t});return!(!o(a)&&a!==t[1])&&await c()}t.run({info:"正在检测 npm 是否有该同名包"});const w=d&&await i(g)||{data:void 0};if(t.destroyed(),f("获取线上的 npm 包数据",w),w.data){const t=["更改为其他名称","忽视并继续","直接退出"],a=await r.question({text:n("#f63")`当前包名称(${e(g)})已经存在于 npm 中`,tip:t});if(o(a)||a===t[2])return await c();if(a===t[0])return!1}return s.name=g,-1===j&&p(l,{recursive:!0}),!0}export{g as createCatalog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{writeFileSync as o}from"node:fs";import{dataStore as s}from"../data-store/index.mjs";function e(){const{author:e}=s.local,{name:n,url:
|
|
1
|
+
import{writeFileSync as o}from"node:fs";import{dataStore as s}from"../data-store/index.mjs";function e(){const{author:e}=s.local,{name:n,url:l}=e,r=s.name.replace(/^@/,""),t=r.split("/");o(s.pkgFile("README.md"),`# ${s.name}\n\r\n[&label=版本号&labelColor=rgb(73,73,228)&color=rgb(0,0,0)>)](https://www.npmjs.com/package/${s.name}) [?logo=github>)](https://github.com/${n.replace(/\s+/g,"_")}/${t[0]}/issues)\n \n## 文档地址\n\n参看 [${l}/${r}](${l}/${r})`)}export{e as createReadMe};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{pathJoin as n}from"a-node-tools";import{mkdirSync as e,writeFileSync as s}from"node:fs";import{dataStore as t}from"../data-store/index.mjs";function i(){e(n(t.pkgFile("scripts")),{recursive:!0});const{author:i}=t.local,o=t.name.replace(/^@/,"");s(t.pkgFile("scripts/clean-package-json.js"),`\nimport {\n pathJoin,\n readFileToJsonSync,\n getDirectoryBy,\n writeJsonFile,\n} from 'a-node-tools';\n\nlet packageJson = readFileToJsonSync('./package.json');\n\n['scripts', 'devDependencies', 'lint-staged', 'private'].forEach(\n key => delete packageJson[key],\n);\n\npackageJson = {\n main: 'index.cjs',\n module: 'index.mjs',\n types: 'index.d.ts',\n ...packageJson,\n publishConfig: {\n access: 'public',\n registry: 'https://registry.npmjs.org/',\n },\n files: ['index.d.ts', 'index.mjs', 'index.cjs', 'src'],\n exports: {\n '.': {\n import: {\n default: './index.mjs',\n types: './index.d.ts',\n },\n require: {\n default: './index.cjs',\n types: './index.d.ts',\n },\n },\n },\n repository: {\n type: 'git',\n url: 'git+https://github.com/${i.name}/${
|
|
1
|
+
import{pathJoin as n}from"a-node-tools";import{mkdirSync as e,writeFileSync as s}from"node:fs";import{dataStore as t}from"../data-store/index.mjs";function i(){e(n(t.pkgFile("scripts")),{recursive:!0});const{author:i}=t.local,o=t.name.replace(/^@/,"").split("/"),a=o[0];s(t.pkgFile("scripts/clean-package-json.js"),`\nimport {\n pathJoin,\n readFileToJsonSync,\n getDirectoryBy,\n writeJsonFile,\n} from 'a-node-tools';\n\nlet packageJson = readFileToJsonSync('./package.json');\n\n['scripts', 'devDependencies', 'lint-staged', 'private'].forEach(\n key => delete packageJson[key],\n);\n\npackageJson = {\n main: 'index.cjs',\n module: 'index.mjs',\n types: 'index.d.ts',\n ...packageJson,\n publishConfig: {\n access: 'public',\n registry: 'https://registry.npmjs.org/',\n },\n files: ['index.d.ts', 'index.mjs', 'index.cjs', 'src'],\n exports: {\n '.': {\n import: {\n default: './index.mjs',\n types: './index.d.ts',\n },\n require: {\n default: './index.cjs',\n types: './index.d.ts',\n },\n },\n },\n repository: {\n type: 'git',\n url: 'git+https://github.com/${i.name}/${a}.git',\n },\n author: {\n name: '${i.name}',\n email: '${i.email}',\n url: '${i.url}',\n },\n browserslist: ['node>=18.0.0'],\n engines: {\n node: '>=18.0.0',\n },\n keywords: ['${a}', '${o[0]}'],\n homepage: '${i.url}',\n bugs: {\n url: 'https://github.com/${i.name}/${a}/issues',\n email: '${i.email}',\n },${0!==t.bin?`\n bin: {\n ${t.name} : './bin.mjs',\n },\n `:""}\n};\n\n{\n const distPath = getDirectoryBy('dist', 'directory');\n\n const distPackagePath = pathJoin(distPath, './dist/package.json');\n\n writeJsonFile(distPackagePath, packageJson);\n}\n`)}export{i as createScripts};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function n(){return"\
|
|
1
|
+
function n(){return"\nnode_modules\ndist\n*.tgz\ncoverage\n.DS_Store\n.eg"}export{n as gitIgnoreText};
|
package/src/data-store/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{initializeFile as e,getDirectoryBy as l,readFileToJsonSync as n,pathJoin as i}from"a-node-tools";import{originDependencies as p}from"./origin-dependencies.mjs";import{dog as s}from"../dog.mjs";import{isUndefined as t}from"a-type-of-js";const[r]=e();let o=l("package.json","file",r);s("获取到的地址为",o),t(o)&&(o=process.cwd());const c=n(i(o,"package.json"));s("获取到的数据为:",c);const a={cwd:"",range:"",pkgFile(...e){return i(this.cwd,...e)},rangeFile(...e){return i(this.range,...e)},get name(){return this.package.name},set name(e){this.childPkg?this.carryRange?(this.range=e.replace(/^@(.*)\/.*$/g,"$1"),this.cwd=e.replace(/@/,"").replace(/\//,"/packages/")):this.cwd=e.replace(/^.*\/(.*)$/g,"$1"):this.cwd=e,this.package.name=e},bin:0,local:{author:{name:"",email:"",url:""},dependencies:p},package:{name:"",version:"0.0.0",description:"",author:{name:"",email:"",url:""},dependencies:c?.dependencies||{},devDependencies:c?.devDependencies||{}},install:!1,carryRange:!1,childPkg:!1,buildDevDependencies(){const{dependencies:e}=this.local,{devDependencies:l,dependencies:n}=this.package;s("获取的本地的包信息",e),s("获取本地的");const i={"@qqi/check-version":l["@qqi/check-version"]||"^1.0.2","@qqi/rollup-external":l["@qqi/rollup-external"]||"^1.0.6","@rollup/plugin-commonjs":l["@rollup/plugin-commonjs"]||"^28.0.3","@rollup/plugin-json":l["@rollup/plugin-json"]||"^6.1.0","@rollup/plugin-node-resolve":l["@rollup/plugin-node-resolve"]||"^16.0.1","@rollup/plugin-terser":l["@rollup/plugin-terser"]||"^0.4.4","a-command":n["a-command"]||"^2.3.8","a-node-tools":n["a-node-tools"]||"^4.2.6",gvv:l.gvv||"^0.0.7",jja:l.jja||"^2.3.8",pjj:l.pjj||"^1.0.1",vjj:l.vjj||"^1.0.5",rollup:l.rollup||"^4.43.0","rollup-plugin-cleanup":l["rollup-plugin-cleanup"]||"^3.2.1","rollup-plugin-copy":l["rollup-plugin-copy"]||"^3.5.0"};return e.includes("husky")&&e.includes("prettier")&&(i.husky=l.husky||"^9.1.7",i["lint-staged"]=l["lint-staged"]||"^16.1.0"),e.includes("eslint")&&(i.eslint=l.eslint||"^9.28.0",i["eslint-plugin-jsdoc"]=l["eslint-plugin-jsdoc"]||"^51.0.1",i.globals=l.globals||"^16.2.0",i["@eslint/js"]=l["@eslint/js"]||"^9.28.0",e.includes("typescript")&&(i["typescript-eslint"]=l["typescript-eslint"]||"^8.34.0"),e.includes("prettier")&&(i["eslint-config-prettier"]=l["eslint-config-prettier"]||"^10.1.5")),e.includes("prettier")&&(i.prettier=l.prettier||"^3.5.3"),e.includes("typescript")&&(i["@types/node"]=l["@types/node"]||"^24.0.1",i["@rollup/plugin-typescript"]=l["@rollup/plugin-typescript"]||"^12.1.2",i.typescript=l.typescript||"^5.8.3"),s("构建的依赖图",i),i}};export{a as dataStore};
|
|
1
|
+
import{initializeFile as e,getDirectoryBy as l,readFileToJsonSync as n,pathJoin as i}from"a-node-tools";import{originDependencies as p}from"./origin-dependencies.mjs";import{dog as s}from"../dog.mjs";import{isUndefined as t}from"a-type-of-js";const[r]=e();let o=l("package.json","file",r);s("获取到的地址为",o),t(o)&&(o=process.cwd());const c=n(i(o,"package.json"));s("获取到的数据为:",c);const a={cwd:"",range:"",pkgFile(...e){return i(this.cwd,...e)},rangeFile(...e){return i(this.range,...e)},get name(){return this.package.name},set name(e){this.childPkg?this.carryRange?(this.range=e.replace(/^@(.*)\/.*$/g,"$1"),this.cwd=e.replace(/@/,"").replace(/\//,"/packages/")):this.cwd=e.replace(/^.*\/(.*)$/g,"$1"):this.cwd=e,this.package.name=e},bin:0,local:{author:{name:"",email:"",url:""},dependencies:p},package:{name:"",version:"0.0.0",description:"",author:{name:"",email:"",url:""},dependencies:c?.dependencies||{},devDependencies:c?.devDependencies||{}},install:!1,carryRange:!1,childPkg:!1,buildDevDependencies(){const{dependencies:e}=this.local,{devDependencies:l,dependencies:n}=this.package;s("获取的本地的包信息",e),s("获取本地的");const i={"@qqi/check-version":l["@qqi/check-version"]||"^1.0.2","@qqi/rollup-external":l["@qqi/rollup-external"]||"^1.0.6","@rollup/plugin-commonjs":l["@rollup/plugin-commonjs"]||"^28.0.3","@rollup/plugin-json":l["@rollup/plugin-json"]||"^6.1.0","@rollup/plugin-node-resolve":l["@rollup/plugin-node-resolve"]||"^16.0.1","@rollup/plugin-terser":l["@rollup/plugin-terser"]||"^0.4.4","a-command":n["a-command"]||"^2.3.8","a-node-tools":n["a-node-tools"]||"^4.2.6",gvv:l.gvv||"^0.0.7",tslib:l.tslib||"^2.8.1",jja:l.jja||"^2.3.8",pjj:l.pjj||"^1.0.1",vjj:l.vjj||"^1.0.5",rollup:l.rollup||"^4.43.0","rollup-plugin-cleanup":l["rollup-plugin-cleanup"]||"^3.2.1","rollup-plugin-copy":l["rollup-plugin-copy"]||"^3.5.0"};return e.includes("husky")&&e.includes("prettier")&&(i.husky=l.husky||"^9.1.7",i["lint-staged"]=l["lint-staged"]||"^16.1.0"),e.includes("eslint")&&(i.eslint=l.eslint||"^9.28.0",i["eslint-plugin-jsdoc"]=l["eslint-plugin-jsdoc"]||"^51.0.1",i.globals=l.globals||"^16.2.0",i["@eslint/js"]=l["@eslint/js"]||"^9.28.0",e.includes("typescript")&&(i["typescript-eslint"]=l["typescript-eslint"]||"^8.34.0"),e.includes("prettier")&&(i["eslint-config-prettier"]=l["eslint-config-prettier"]||"^10.1.5")),e.includes("prettier")&&(i.prettier=l.prettier||"^3.5.3"),e.includes("typescript")&&(i["@types/node"]=l["@types/node"]||"^24.0.1",i["@rollup/plugin-typescript"]=l["@rollup/plugin-typescript"]||"^12.1.2",i.typescript=l.typescript||"^5.8.3"),s("构建的依赖图",i),i}};export{a as dataStore};
|
package/src/dog.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Dog as e}from"@qqi/
|
|
1
|
+
import{Dog as e}from"@qqi/log";import{isFalse as o}from"a-type-of-js";const t=new e({name:"create a npm",type:!1}),p=o(t.type);export{t as dog,p as dun};
|