create-done-coding 0.1.1-0 → 0.2.1-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 CHANGED
@@ -1 +1 @@
1
- "use strict";const c=require("prompts"),g=require("node:child_process"),t=require("node:fs"),d=require("node:path"),r=process.cwd();console.log(r);async function y(){return await c([{type:"text",name:"projectName",message:"Project name:"},{type:"select",name:"template",message:"请选择模板",choices:[{title:"typescript",value:"ts-template"},{title:"node-cli",value:"node-cli-template"}]},{type:"confirm",name:"saveGitHistory",message:"保留git历史"}])}y().then(async({projectName:e,template:i,saveGitHistory:o})=>{if(console.log(e,o),!e.trim()){console.log("项目名称不能为空");return}if(e.includes(" ")||e.includes("\\")||e.includes("/")){console.log("项目名称不能包含空格或者\\或者/");return}const n=d.resolve(r,e);if(console.log(n),t.existsSync(n)){const{isRemove:u}=await c({type:"confirm",name:"isRemove",message:"项目已存在,是否删除"});if(u===!0)t.rmSync(n,{recursive:!0,force:!0});else throw new Error("项目已存在")}console.log("正在初始化项目,请稍等..."),g.execSync(`git clone https://gitee.com/justsosu/${i} ${e}`),o===!1&&t.rmSync(`${n}/.git`,{recursive:!0,force:!0});const l=t.readFileSync(`${n}/package.json`,"utf-8"),s=JSON.parse(l),{name:a}=s;s.name=e,t.rmSync(`${n}/package.json`),t.writeFileSync(`${n}/package.json`,JSON.stringify(s,null,2));const m=t.readFileSync(`${n}/README.md`,"utf-8").replace(a,e);t.rmSync(`${n}/README.md`),t.writeFileSync(`${n}/README.md`,m),console.log("初始化完成")});
1
+ "use strict";const r=require("prompts"),d=require("node:child_process"),t=require("node:fs"),f=require("node:path"),l="node-cli-template",y=[{title:"typescript",value:"ts-template"},{title:"node-cli",value:l}],a=process.cwd();console.log(a);async function p(){return await r([{type:"text",name:"projectName",message:"Project name:"},{type:"select",name:"template",message:"请选择模板",choices:y},{type:"confirm",name:"saveGitHistory",message:"保留git历史"}])}p().then(async({projectName:e,template:c,saveGitHistory:i})=>{if(console.log(e,i),!e.trim()){console.log("项目名称不能为空");return}if(e.includes(" ")||e.includes("\\")||e.includes("/")){console.log("项目名称不能包含空格或者\\或者/");return}const n=f.resolve(a,e);if(console.log(n),t.existsSync(n)){const{isRemove:o}=await r({type:"confirm",name:"isRemove",message:"项目已存在,是否删除"});if(o===!0)t.rmSync(n,{recursive:!0,force:!0});else throw new Error("项目已存在")}console.log("正在初始化项目,请稍等..."),d.execSync(`git clone https://gitee.com/justsosu/${c} ${e}`),i===!1&&t.rmSync(`${n}/.git`,{recursive:!0,force:!0});const u=t.readFileSync(`${n}/package.json`,"utf-8"),s=JSON.parse(u),{name:m}=s;if(s.name=e,t.rmSync(`${n}/package.json`),t.writeFileSync(`${n}/package.json`,JSON.stringify(s,null,2)),c===l){const o=s.bin;s.bin={[e]:Object.values(o)[0]}}const g=t.readFileSync(`${n}/README.md`,"utf-8").replace(m,e);t.rmSync(`${n}/README.md`),t.writeFileSync(`${n}/README.md`,g),console.log("初始化完成")});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-done-coding",
3
- "version": "0.1.1-0",
3
+ "version": "0.2.1-alpha.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "types/index.d.ts",
6
6
  "bin": "dist/index.js",
@@ -8,6 +8,13 @@
8
8
  "dist",
9
9
  "types"
10
10
  ],
11
+ "scripts": {
12
+ "inject": "node ./scripts/generateInject.js",
13
+ "dev": "pnpm run inject && vite",
14
+ "build": "pnpm run inject && vite build",
15
+ "prepack": "pnpm build",
16
+ "push": "cross-env TARGET_ENV=$npm_config_t dc-publish npm -t $TARGET_ENV"
17
+ },
11
18
  "repository": {
12
19
  "type": "git",
13
20
  "url": "https://gitee.com/justsosu/create-done-coding"
@@ -18,10 +25,12 @@
18
25
  "devDependencies": {
19
26
  "@commitlint/cli": "^16.3.0",
20
27
  "@commitlint/config-conventional": "^16.2.4",
28
+ "@done-coding/publish": "0.0.3-alpha.2",
21
29
  "@types/node": "^16",
22
30
  "@types/prompts": "^2.4.6",
23
31
  "@typescript-eslint/eslint-plugin": "^6.7.0",
24
32
  "@typescript-eslint/parser": "^6.7.0",
33
+ "cross-env": "^7.0.3",
25
34
  "eslint": "^8.49.0",
26
35
  "eslint-config-alloy": "^5.1.2",
27
36
  "husky": "^8.0.3",
@@ -42,24 +51,5 @@
42
51
  },
43
52
  "dependencies": {
44
53
  "prompts": "^2.4.2"
45
- },
46
- "scripts": {
47
- "inject": "node ./scripts/generateInject.js",
48
- "dev": "pnpm run inject && vite",
49
- "build": "pnpm run inject && vite build",
50
- "publish:prepatch": "pnpm version prepatch && pnpm publish --tag next",
51
- "publish:patch": "pnpm version patch && pnpm publish",
52
- "publish:preminor": "pnpm version preminor && pnpm publish --tag next",
53
- "publish:minor": "pnpm version minor && pnpm publish",
54
- "publish:premajor": "pnpm version premajor && pnpm publish --tag next",
55
- "publish:major": "pnpm version major && pnpm publish",
56
- "postPublishNext": "git push --follow-tags origin next",
57
- "postPublishFormal": "git push --follow-tags origin master",
58
- "postpublish:prepatch": "pnpm run postPublishNext",
59
- "postpublish:patch": "pnpm run postPublishFormal",
60
- "postpublish:preminor": "pnpm run postPublishNext",
61
- "postpublish:minor": "pnpm run postPublishFormal",
62
- "postpublish:premajor": "pnpm run postPublishNext",
63
- "postpublish:major": "pnpm run postPublishFormal"
64
54
  }
65
- }
55
+ }
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * 版本号
3
3
  */
4
- export declare const version = "0.1.1-0";
4
+ export declare const version = "0.2.1-alpha.0";