@tomjs/create-app 0.1.1 → 0.1.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/README.md +2 -2
- package/README.zh_CN.md +2 -2
- package/dist/index.mjs +4 -4
- package/package.json +6 -6
- package/template-electron-react/package.json +7 -7
- package/template-electron-vue/package.json +7 -7
- package/template-node/package.json +6 -6
- package/template-node-github/README.md +1 -1
- package/template-node-github/README.zh_CN.md +1 -1
- package/template-node-github/package.json +6 -6
- package/template-react/package.json +5 -5
- package/template-vue/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# @tomjs/create-app
|
|
2
2
|
|
|
3
|
-
   
|
|
4
4
|
|
|
5
|
-
Create a web application based on [vite](https://github.com/vitejs/vite) + [tomjs](https://github.com/tomgao365/tomjs)
|
|
5
|
+
Create a web application based on [vite](https://github.com/vitejs/vite) + [tomjs](https://github.com/tomgao365/tomjs).
|
|
6
6
|
|
|
7
7
|
**English** | [中文](./README.zh_CN.md)
|
|
8
8
|
|
package/README.zh_CN.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# @tomjs/create-app
|
|
2
2
|
|
|
3
|
-
   
|
|
4
4
|
|
|
5
|
-
创建基于 [vite](https://github.com/vitejs/vite) + [tomjs](https://github.com/tomgao365/tomjs) 的 web
|
|
5
|
+
创建基于 [vite](https://github.com/vitejs/vite) + [tomjs](https://github.com/tomgao365/tomjs) 的 web 应用。
|
|
6
6
|
|
|
7
7
|
[English](./README.md) | **中文**
|
|
8
8
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
3
|
-
Scaffolding project in ${i}...`);let y=
|
|
4
|
-
`),
|
|
2
|
+
import c from"fs";import X from"os";import s from"path";import{fileURLToPath as Y}from"url";import{blue as h,cyan as Z,green as ee,red as I,reset as d,yellow as j}from"kolorist";import te from"minimist";import ne from"prompts";import k from"shelljs";import m from"fs";import E from"path";function T(e){return[["t","template"]].forEach(([t,r])=>{e[r]=e[r]??e[t]}),e}function M(e){let t=m.readdirSync(e);return t.length===0||t.length===1&&t[0]===".git"}function N(e){return e?.trim().replace(/\/+$/g,"")}function Q(e,t){m.mkdirSync(t,{recursive:!0});for(let r of m.readdirSync(e)){let p=E.resolve(e,r),f=E.resolve(t,r);F(p,f)}}function F(e,t){m.statSync(e).isDirectory()?Q(e,t):m.copyFileSync(e,t)}function O(e){if(m.existsSync(e))for(let t of m.readdirSync(e))t!==".git"&&m.rmSync(E.resolve(e,t),{recursive:!0,force:!0})}function b(e){return/^(?:@[a-z\d\-*~][a-z\d\-*._~]*\/)?[a-z\d\-~][a-z\d\-._~]*$/.test(e)}function V(e){return e.trim().toLowerCase().replace(/\s+/g,"-").replace(/^[._]/,"").replace(/[^a-z\d\-~]+/g,"-")}function z(e){if(!e)return;let r=e.split(" ")[0].split("/");return{name:r[0],version:r[1]}}var $=T(te(process.argv.slice(2),{string:["_"]})),P=process.cwd(),L=[{name:"vue",display:"Vue",color:ee,variants:[{name:"vue",display:"Web",color:h},{name:"electron-vue",display:"Electron",color:j}]},{name:"react",display:"React",color:Z,variants:[{name:"react",display:"Web",color:h},{name:"electron-react",display:"Electron",color:j}]},{name:"node",display:"Node",color:h,variants:[{name:"node",display:"base",color:h},{name:"node-github",display:"Github + NPM",color:j}]}],W=L.map(e=>e.variants&&e.variants.map(t=>t.name)||[e.name]).reduce((e,t)=>e.concat(t),[]),re={_gitignore:".gitignore","_lintstagedrc.cjs":".lintstagedrc.cjs"},R="my-app";function G(e){let t=k.exec(`git config --get ${e}`,{silent:!0});if(t.code===0)return t.stdout.trim()}async function oe(){let e=N($._[0]),t=$.template||$.t,r=e||R,p=()=>r==="."?s.basename(s.resolve()):r,f={};f=await ne([{type:e?null:"text",name:"projectName",message:d("Project name:"),initial:R,onState:n=>{r=N(n.value)||R}},{type:()=>!c.existsSync(r)||M(r)?null:"toggle",name:"overwrite",message:()=>(r==="."?"Current directory":`Target directory "${r}"`)+" is not empty. Remove existing files and continue?",initial:!1,active:"yes",inactive:"no"},{type:(n,{overwrite:o})=>{if(o===!1)throw console.log(I("\u2716")+" Operation cancelled"),new Error;return null},name:"overwriteChecker"},{type:()=>b(p())?null:"text",name:"packageName",message:d("Package name:"),initial:()=>V(p()),validate:n=>b(n)||"Invalid package.json name"},{type:t&&W.includes(t)?null:"select",name:"framework",message:typeof t=="string"&&!W.includes(t)?d(`"${t}" isn't a valid template. Please choose from below: `):d("Select a framework:"),initial:0,choices:L.map(n=>{let o=n.color;return{title:o(n.display||n.name),value:n}})},{type:n=>n&&n.variants?"select":null,name:"variant",message:d("Select a variant:"),choices:n=>n?.variants?.map(o=>{let a=o.color;return{title:a(o.display||o.name),value:o.name}})}],{onCancel:()=>{throw console.log(I("\u2716")+" Operation cancelled"),new Error}});let{framework:U,overwrite:J,packageName:H,variant:K}=f,i=s.join(P,r.substring(r.indexOf("/")+1));J?O(i):c.existsSync(i)||c.mkdirSync(i,{recursive:!0}),console.log(`
|
|
3
|
+
Scaffolding project in ${i}...`);let y=K||U?.name||t||"",A=n=>s.join(Y(import.meta.url),"../..",`template-${n}`),C=A(y),q=y.includes("node");[C,A("config")].forEach(n=>{let o=c.readdirSync(n);for(let a of o){let v=re[a]??a;if(q&&a.includes("stylelint"))continue;let x=s.join(i,v);F(s.join(n,a),x)}});let D=y.includes("github"),B=`template-${y}`,u=JSON.parse(c.readFileSync(s.join(C,"package.json"),"utf-8")),l=H||p();u.name=l;let g={name:"Tom Gao",email:"tom@tomgao.cc"};if(D){k.which("git")&&(g.name=G("user.name")||X.userInfo().username,g.email=G("user.email")||"",u.author=Object.assign(u.author,g));let n=l.startsWith("@")?l.split("/")[0].substring(1):g.name;u.repository.url=`https://github.com/${n}/${l.substring(l.indexOf("/")+1)}.git`}c.writeFileSync(s.join(i,"package.json"),JSON.stringify(u,null,2)+`
|
|
4
|
+
`),D&&["LICENSE","README.md","README.zh_CN.md"].forEach(n=>{let o=s.join(i,n);if(!c.existsSync(o))return;let a=c.readFileSync(o,"utf-8").replace(new RegExp(B,"g"),l).replace(new RegExp("{{user.name}}","g"),g.name).replace(new RegExp("{{user.email}}","g"),g.email);if(n.startsWith("README")){let v=l.replace("@","%40"),x=l.replace("@","%40").replace(new RegExp("/","g"),"%2F");a=a.replace("{{badges}}",[``,``,``].join(" "))}c.writeFileSync(o,a)});let _=z(process.env.npm_config_user_agent),w=_?_.name:"npm";k.which("git")&&k.exec(`cd ${i} && git init`);let S=s.relative(P,i);switch(console.log(`
|
|
5
5
|
Done. Now run:
|
|
6
|
-
`),i!==
|
|
6
|
+
`),i!==P&&console.log(` cd ${S.includes(" ")?`"${S}"`:S}`),w){case"yarn":console.log(" yarn"),console.log(" yarn dev");break;default:console.log(` ${w} install`),console.log(` ${w} run dev`);break}}oe().catch(e=>{e.message&&console.error(e)});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tomjs/create-app",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "create tomjs web app",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"tomjs",
|
|
@@ -50,12 +50,12 @@
|
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@commitlint/cli": "^18.4.3",
|
|
53
|
-
"@tomjs/commitlint": "^2.0.
|
|
54
|
-
"@tomjs/eslint": "^1.0
|
|
55
|
-
"@tomjs/prettier": "^1.0.
|
|
56
|
-
"@tomjs/tsconfig": "^1.0.
|
|
53
|
+
"@tomjs/commitlint": "^2.0.5",
|
|
54
|
+
"@tomjs/eslint": "^1.1.0",
|
|
55
|
+
"@tomjs/prettier": "^1.0.6",
|
|
56
|
+
"@tomjs/tsconfig": "^1.0.8",
|
|
57
57
|
"@types/minimist": "^1.2.5",
|
|
58
|
-
"@types/node": "^18.
|
|
58
|
+
"@types/node": "^18.19.0",
|
|
59
59
|
"@types/prompts": "^2.4.9",
|
|
60
60
|
"@types/shelljs": "^0.8.15",
|
|
61
61
|
"eslint": "^8.54.0",
|
|
@@ -28,17 +28,17 @@
|
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@commitlint/cli": "^18.4.3",
|
|
31
|
-
"@tomjs/commitlint": "^2.0.
|
|
32
|
-
"@tomjs/eslint": "^1.0
|
|
33
|
-
"@tomjs/prettier": "^1.0.
|
|
31
|
+
"@tomjs/commitlint": "^2.0.5",
|
|
32
|
+
"@tomjs/eslint": "^1.1.0",
|
|
33
|
+
"@tomjs/prettier": "^1.0.6",
|
|
34
34
|
"@tomjs/stylelint": "^1.0.5",
|
|
35
|
-
"@tomjs/tsconfig": "^1.0.
|
|
36
|
-
"@types/node": "^18.
|
|
35
|
+
"@tomjs/tsconfig": "^1.0.8",
|
|
36
|
+
"@types/node": "^18.19.0",
|
|
37
37
|
"@types/react": "^18.2.37",
|
|
38
38
|
"@types/react-dom": "^18.2.15",
|
|
39
39
|
"@types/shelljs": "^0.8.15",
|
|
40
40
|
"@vitejs/plugin-react-swc": "^3.5.0",
|
|
41
|
-
"electron": "^27.1.
|
|
41
|
+
"electron": "^27.1.3",
|
|
42
42
|
"electron-builder": "^24.6.4",
|
|
43
43
|
"eslint": "^8.54.0",
|
|
44
44
|
"husky": "^8.0.3",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"shelljs": "^0.8.5",
|
|
50
50
|
"stylelint": "^15.11.0",
|
|
51
51
|
"tree-kill": "^1.2.2",
|
|
52
|
-
"tsx": "^4.6.
|
|
52
|
+
"tsx": "^4.6.1",
|
|
53
53
|
"typescript": "~5.2.2",
|
|
54
54
|
"vite": "^5.0.2",
|
|
55
55
|
"vite-plugin-electron": "^0.15.4",
|
|
@@ -26,15 +26,15 @@
|
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@commitlint/cli": "^18.4.3",
|
|
29
|
-
"@tomjs/commitlint": "^2.0.
|
|
30
|
-
"@tomjs/eslint": "^1.0
|
|
31
|
-
"@tomjs/prettier": "^1.0.
|
|
29
|
+
"@tomjs/commitlint": "^2.0.5",
|
|
30
|
+
"@tomjs/eslint": "^1.1.0",
|
|
31
|
+
"@tomjs/prettier": "^1.0.6",
|
|
32
32
|
"@tomjs/stylelint": "^1.0.5",
|
|
33
|
-
"@tomjs/tsconfig": "^1.0.
|
|
34
|
-
"@types/node": "^18.
|
|
33
|
+
"@tomjs/tsconfig": "^1.0.8",
|
|
34
|
+
"@types/node": "^18.19.0",
|
|
35
35
|
"@types/shelljs": "^0.8.15",
|
|
36
36
|
"@vitejs/plugin-vue": "^4.5.0",
|
|
37
|
-
"electron": "^27.1.
|
|
37
|
+
"electron": "^27.1.3",
|
|
38
38
|
"electron-builder": "^24.6.4",
|
|
39
39
|
"eslint": "^8.54.0",
|
|
40
40
|
"husky": "^8.0.3",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"shelljs": "^0.8.5",
|
|
46
46
|
"stylelint": "^15.11.0",
|
|
47
47
|
"tree-kill": "^1.2.2",
|
|
48
|
-
"tsx": "^4.6.
|
|
48
|
+
"tsx": "^4.6.1",
|
|
49
49
|
"typescript": "~5.2.2",
|
|
50
50
|
"vite": "^5.0.2",
|
|
51
51
|
"vite-plugin-electron": "^0.15.4",
|
|
@@ -37,11 +37,11 @@
|
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@commitlint/cli": "^18.4.3",
|
|
40
|
-
"@tomjs/commitlint": "^2.0.
|
|
41
|
-
"@tomjs/eslint": "^1.0
|
|
42
|
-
"@tomjs/prettier": "^1.0.
|
|
43
|
-
"@tomjs/tsconfig": "^1.0.
|
|
44
|
-
"@types/node": "^18.
|
|
40
|
+
"@tomjs/commitlint": "^2.0.5",
|
|
41
|
+
"@tomjs/eslint": "^1.1.0",
|
|
42
|
+
"@tomjs/prettier": "^1.0.6",
|
|
43
|
+
"@tomjs/tsconfig": "^1.0.8",
|
|
44
|
+
"@types/node": "^18.19.0",
|
|
45
45
|
"eslint": "^8.54.0",
|
|
46
46
|
"husky": "^8.0.3",
|
|
47
47
|
"lint-staged": "^15.1.0",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"prettier": "^3.1.0",
|
|
50
50
|
"rimraf": "^5.0.5",
|
|
51
51
|
"tsup": "^8.0.1",
|
|
52
|
-
"tsx": "^4.6.
|
|
52
|
+
"tsx": "^4.6.1",
|
|
53
53
|
"typescript": "~5.2.2"
|
|
54
54
|
}
|
|
55
55
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# template-node-github
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
{{badges}}
|
|
4
4
|
|
|
5
5
|
> Basic node template
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# template-node-github
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
{{badges}}
|
|
4
4
|
|
|
5
5
|
> 基础 node 模板
|
|
6
6
|
|
|
@@ -52,11 +52,11 @@
|
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@commitlint/cli": "^18.4.3",
|
|
55
|
-
"@tomjs/commitlint": "^2.0.
|
|
56
|
-
"@tomjs/eslint": "^1.0
|
|
57
|
-
"@tomjs/prettier": "^1.0.
|
|
58
|
-
"@tomjs/tsconfig": "^1.0.
|
|
59
|
-
"@types/node": "^18.
|
|
55
|
+
"@tomjs/commitlint": "^2.0.5",
|
|
56
|
+
"@tomjs/eslint": "^1.1.0",
|
|
57
|
+
"@tomjs/prettier": "^1.0.6",
|
|
58
|
+
"@tomjs/tsconfig": "^1.0.8",
|
|
59
|
+
"@types/node": "^18.19.0",
|
|
60
60
|
"eslint": "^8.54.0",
|
|
61
61
|
"husky": "^8.0.3",
|
|
62
62
|
"lint-staged": "^15.1.0",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"prettier": "^3.1.0",
|
|
66
66
|
"rimraf": "^5.0.5",
|
|
67
67
|
"tsup": "^8.0.1",
|
|
68
|
-
"tsx": "^4.6.
|
|
68
|
+
"tsx": "^4.6.1",
|
|
69
69
|
"typescript": "~5.2.2"
|
|
70
70
|
}
|
|
71
71
|
}
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@commitlint/cli": "^18.4.3",
|
|
25
|
-
"@tomjs/commitlint": "^2.0.
|
|
26
|
-
"@tomjs/eslint": "^1.0
|
|
27
|
-
"@tomjs/prettier": "^1.0.
|
|
25
|
+
"@tomjs/commitlint": "^2.0.5",
|
|
26
|
+
"@tomjs/eslint": "^1.1.0",
|
|
27
|
+
"@tomjs/prettier": "^1.0.6",
|
|
28
28
|
"@tomjs/stylelint": "^1.0.5",
|
|
29
|
-
"@tomjs/tsconfig": "^1.0.
|
|
30
|
-
"@types/node": "^18.
|
|
29
|
+
"@tomjs/tsconfig": "^1.0.8",
|
|
30
|
+
"@types/node": "^18.19.0",
|
|
31
31
|
"@types/react": "^18.2.37",
|
|
32
32
|
"@types/react-dom": "^18.2.15",
|
|
33
33
|
"@vitejs/plugin-react-swc": "^3.5.0",
|
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@commitlint/cli": "^18.4.3",
|
|
24
|
-
"@tomjs/commitlint": "^2.0.
|
|
25
|
-
"@tomjs/eslint": "^1.0
|
|
26
|
-
"@tomjs/prettier": "^1.0.
|
|
24
|
+
"@tomjs/commitlint": "^2.0.5",
|
|
25
|
+
"@tomjs/eslint": "^1.1.0",
|
|
26
|
+
"@tomjs/prettier": "^1.0.6",
|
|
27
27
|
"@tomjs/stylelint": "^1.0.5",
|
|
28
|
-
"@tomjs/tsconfig": "^1.0.
|
|
29
|
-
"@types/node": "^18.
|
|
28
|
+
"@tomjs/tsconfig": "^1.0.8",
|
|
29
|
+
"@types/node": "^18.19.0",
|
|
30
30
|
"@vitejs/plugin-vue": "^4.5.0",
|
|
31
31
|
"eslint": "^8.54.0",
|
|
32
32
|
"husky": "^8.0.3",
|