create-done-coding 0.2.3 → 0.2.5-alpha.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.js +1 -1
- package/package.json +9 -4
- package/types/injectInfo.d.ts +0 -4
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const l=require("prompts"),c=require("node:child_process"),t=require("node:fs"),d=require("node:path"),a="node-cli-template",f=[{title:"typescript",value:"ts-template"},{title:"node-cli",value:a}],m=process.cwd();console.log(m);async function p(){return await l([{type:"text",name:"projectName",message:"Project name:"},{type:"select",name:"template",message:"请选择模板",choices:f},{type:"confirm",name:"saveGitHistory",message:"保留git历史"}])}p().then(async({projectName:n,template:i,saveGitHistory:r})=>{if(console.log(n,r),!n.trim()){console.log("项目名称不能为空");return}if(n.includes(" ")||n.includes("\\")||n.includes("/")){console.log("项目名称不能包含空格或者\\或者/");return}const e=d.resolve(m,n);if(console.log(e),t.existsSync(e)){const{isRemove:o}=await l({type:"confirm",name:"isRemove",message:"项目已存在,是否删除"});if(o===!0)t.rmSync(e,{recursive:!0,force:!0});else throw new Error("项目已存在")}if(console.log("正在初始化项目,请稍等..."),c.execSync(`git clone https://gitee.com/justsosu/${i} ${n}`),r===!1){const o=`${e}/.git`;if(!t.existsSync(o))throw new Error("git目录不存在");t.rmSync(`${e}/.git`,{recursive:!0,force:!0})}else c.execSync(`cd ${e}`),c.execSync("git remote rename origin upstream");const u=t.readFileSync(`${e}/package.json`,"utf-8"),s=JSON.parse(u),{name:g}=s;if(s.name=n,t.rmSync(`${e}/package.json`),i===a){const o=s.bin;s.bin={[n]:Object.values(o)[0]}}t.writeFileSync(`${e}/package.json`,JSON.stringify(s,null,2));const y=t.readFileSync(`${e}/README.md`,"utf-8").replace(g,n);t.rmSync(`${e}/README.md`),t.writeFileSync(`${e}/README.md`,y),console.log("初始化完成")});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-done-coding",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5-alpha.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "types/index.d.ts",
|
|
6
6
|
"bin": "dist/index.js",
|
|
@@ -9,8 +9,12 @@
|
|
|
9
9
|
"types"
|
|
10
10
|
],
|
|
11
11
|
"scripts": {
|
|
12
|
-
"
|
|
12
|
+
"clean": "rimraf es lib dist types",
|
|
13
|
+
"serve": "vite",
|
|
14
|
+
"dev": "vite build -w",
|
|
15
|
+
"predev": "pnpm run clean",
|
|
13
16
|
"build": "vite build",
|
|
17
|
+
"prebuild": "pnpm run clean",
|
|
14
18
|
"prepack": "pnpm build",
|
|
15
19
|
"push": "dc-publish npm"
|
|
16
20
|
},
|
|
@@ -24,8 +28,8 @@
|
|
|
24
28
|
"devDependencies": {
|
|
25
29
|
"@commitlint/cli": "^16.3.0",
|
|
26
30
|
"@commitlint/config-conventional": "^16.2.4",
|
|
27
|
-
"@done-coding/publish": "0.0.
|
|
28
|
-
"@types/node": "^16",
|
|
31
|
+
"@done-coding/publish": "0.0.8",
|
|
32
|
+
"@types/node": "^16.18.58",
|
|
29
33
|
"@types/prompts": "^2.4.6",
|
|
30
34
|
"@typescript-eslint/eslint-plugin": "^6.7.0",
|
|
31
35
|
"@typescript-eslint/parser": "^6.7.0",
|
|
@@ -34,6 +38,7 @@
|
|
|
34
38
|
"husky": "^8.0.3",
|
|
35
39
|
"lint-staged": "^12.5.0",
|
|
36
40
|
"prettier": "^3.0.3",
|
|
41
|
+
"rimraf": "^5.0.1",
|
|
37
42
|
"typescript": "^5.2.2",
|
|
38
43
|
"vite": "^4.4.11",
|
|
39
44
|
"vite-plugin-dts": "^3.6.0"
|
package/types/injectInfo.d.ts
DELETED