@tomjs/create-app 0.2.4 → 0.3.1
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 +1 -1
- package/README.zh_CN.md +1 -1
- package/dist/index.mjs +6 -5
- package/package.json +21 -19
- package/template-config/.stylelintrc.cjs +1 -1
- package/template-electron-react/package.json +6 -6
- package/template-electron-vue/package.json +7 -7
- package/template-node/README.zh_CN.md +1 -1
- package/template-node/_lintstagedrc.examples.cjs +6 -0
- package/template-node/{jest.config.js → jest.config.electron.cjs} +1 -0
- package/template-node/package.json +28 -23
- package/template-node/src/index.ts +2 -13
- package/template-node/tsconfig.json +1 -6
- package/template-node/tsconfig.test.json +4 -0
- package/template-react/README.md +1 -1
- package/template-react/package.json +5 -5
- package/template-vue/README.md +1 -1
- package/template-vue/package.json +6 -6
- package/template-node-electron/.eslintrc.cjs +0 -7
- package/template-node-electron/LICENSE +0 -21
- package/template-node-electron/README.md +0 -27
- package/template-node-electron/README.zh_CN.md +0 -27
- package/template-node-electron/_lintstagedrc.cjs +0 -4
- package/template-node-electron/package.json +0 -77
- package/template-node-electron/test/simple.test.ts +0 -10
- package/template-node-electron/tsconfig.json +0 -9
- package/template-node-electron/tsup.config.ts +0 -12
- /package/{template-node-electron/jest.config.js → template-node/jest.config.cjs} +0 -0
- /package/{template-node-electron/src/index.ts → template-node/scripts/info.ts} +0 -0
package/README.md
CHANGED
|
@@ -51,6 +51,7 @@ pnpm create @tomjs/app --template vue
|
|
|
51
51
|
Parameters:
|
|
52
52
|
|
|
53
53
|
- `-t --template` : specify the template
|
|
54
|
+
- `--git`:git repository setting
|
|
54
55
|
|
|
55
56
|
Support templates:
|
|
56
57
|
|
|
@@ -59,7 +60,6 @@ Support templates:
|
|
|
59
60
|
- electron-vue
|
|
60
61
|
- electron-react
|
|
61
62
|
- node
|
|
62
|
-
- node-electron
|
|
63
63
|
|
|
64
64
|
## Reference project
|
|
65
65
|
|
package/README.zh_CN.md
CHANGED
|
@@ -52,6 +52,7 @@ pnpm create @tomjs/app my-app --template vue
|
|
|
52
52
|
参数说明:
|
|
53
53
|
|
|
54
54
|
- `-t --template`:指定模板
|
|
55
|
+
- `--git`:git 仓库配置
|
|
55
56
|
|
|
56
57
|
支持模板:
|
|
57
58
|
|
|
@@ -60,7 +61,6 @@ pnpm create @tomjs/app my-app --template vue
|
|
|
60
61
|
- electron-vue
|
|
61
62
|
- electron-react
|
|
62
63
|
- node
|
|
63
|
-
- node-electron
|
|
64
64
|
|
|
65
65
|
## 参考项目
|
|
66
66
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
3
|
-
|
|
2
|
+
import a,{renameSync as Ce}from"fs";import Oe from"os";import i from"path";import{fileURLToPath as Fe}from"url";import{blue as B,cyan as De,green as Te,red as fe,reset as w,yellow as Z}from"kolorist";import{camelCase as Ge}from"lodash-es";import Ue from"minimist";import _e from"prompts";import b from"shelljs";import pe from"os";import me from"path";import{blue as Pe,red as N,reset as C}from"kolorist";import Ae from"minimist";import L from"prompts";import p from"fs";import J from"path";function A(e){return[["t","template"],["g","git"]].forEach(([n,c])=>{e[c]=e[c]??e[n]}),e}function oe(e){let n=p.readdirSync(e);return n.length===0||n.length===1&&n[0]===".git"}function M(e){return e?.trim().replace(/\/+$/g,"")}function Re(e,n){p.mkdirSync(n,{recursive:!0});for(let c of p.readdirSync(e)){let h=J.resolve(e,c),u=J.resolve(n,c);z(h,u)}}function z(e,n){p.statSync(e).isDirectory()?Re(e,n):p.copyFileSync(e,n)}function re(e){if(p.existsSync(e))for(let n of p.readdirSync(e))n!==".git"&&p.rmSync(J.resolve(e,n),{recursive:!0,force:!0})}function V(e){return/^(?:@[a-z\d\-*~][a-z\d\-*._~]*\/)?[a-z\d\-~][a-z\d\-._~]*$/.test(e)}function ie(e){return e.trim().toLowerCase().replace(/\s+/g,"-").replace(/^[._]/,"").replace(/[^a-z\d\-~]+/g,"-")}function se(e){if(!e)return;let c=e.split(" ")[0].split("/");return{name:c[0],version:c[1]}}function v(e){if(p.existsSync(e))try{return JSON.parse(p.readFileSync(e,"utf8"))}catch(n){console.error(n)}}function x(e,n){p.writeFileSync(e,JSON.stringify(n,null,2)+`
|
|
3
|
+
`)}function $(e){p.existsSync(e)&&p.rmSync(e,{recursive:!0,force:!0})}function ce(e){p.existsSync(e)||p.mkdirSync(e,{recursive:!0})}var $e=A(Ae(process.argv.slice(2),{string:["_"]})),ae={repo:"https://github.com",owner:pe.userInfo().username};function K(e){let{repo:n,owner:c}=e;return`${n}${n.endsWith("/")?"":"/"}${c}`}async function le(e){let n=await L([{type:"text",name:"repo",message:C("Git repository url:"),initial:e?.repo||ae.repo},{type:"text",name:"owner",message:C("Git repository owner:"),initial:e?.owner||ae.owner}],{onCancel:()=>{throw console.log(N("\u2716")+" Operation cancelled"),new Error}});return{id:e?.id||Date.now().toString(),repo:n.repo,owner:n.owner}}var ue=me.join(pe.homedir(),".tomjs","create-app"),ge=me.join(ue,"config.json");function O(){return ce(ue),Object.assign({gitRepos:[]},v(ge))}function Ne(e){let n=O();n.createTime?n.updateTime=Date.now():n.createTime=Date.now(),x(ge,Object.assign(n,e))}function Y(e){Ne({gitRepos:e})}async function q(){let{gitRepos:e}=O();(e.length===0||$e.git)&&(e.length===0&&console.log(`You need to set the ${Pe("git remote repository")} for the first time.`),await n());async function n(){let c=e.map(g=>({title:K(g),value:g.id})).concat([{title:"Add",value:"add"},{title:N("Exit"),value:"exit"}]),h=await L({type:"select",name:"repoId",message:e.length===0?"You choose to add or exit:":"You can choose the repository to be operated, or choose to add or exit:",choices:c},{onCancel:()=>{throw console.log(N("\u2716")+" Operation cancelled"),new Error}}),{repoId:u}=h;if(u==="exit")return;if(u==="add"){let g=await le();return e.push(g),Y(e),n()}let S=e.findIndex(g=>g.id===u),R=await L([{type:"select",name:"action",message:C("Select an action?"),choices:[{title:"Edit",value:"edit"},{title:"Remove",value:"remove"},{title:"Exit",value:"exit"}]},{type:g=>g==="remove"&&"toggle",name:"confirmRemove",message:C("Where confirm to remove?"),initial:!0,active:"Yes",inactive:"No"}],{onCancel:()=>{throw console.log(N("\u2716")+" Operation cancelled"),new Error}}),{action:P,confirmRemove:F}=R;if(P==="exit")return q();if(P==="remove")return F&&(e.splice(S,1),Y(e)),n();let D=await le(e[S]);return e[S]=D,Y(e),n()}}var H=A(Ue(process.argv.slice(2),{string:["_"]})),Q=process.cwd(),ve=[{name:"vue",display:"Vue",color:Te,variants:[{name:"vue",display:"Web",color:B},{name:"electron-vue",display:"Electron",color:Z}]},{name:"react",display:"React",color:De,variants:[{name:"react",display:"Web",color:B},{name:"electron-react",display:"Electron",color:Z}]},{name:"node",display:"Node",color:B,options:[{id:"test",name:"Test"},{id:"publish",name:"Git Repository + NPM"},{id:"vite",name:"Vite Plugin"},{id:"electron",name:"Electron"},{id:"examples",name:"Examples"}]}],de=ve.map(e=>e.variants&&e.variants.map(n=>n.name)||[e.name]).reduce((e,n)=>e.concat(n),[]),X="my-app";function ye(e){let n=b.exec(`git config --get ${e}`,{silent:!0});if(n.code===0)return n.stdout.trim()}function he(e){return e.length>1?e.substring(e.indexOf("/")+1):e}async function Ie(){let e=M(H._[0]),n=H.template||H.t,c=e||X,h=()=>c==="."?i.basename(i.resolve()):c,u=he(c),{gitRepos:S}=O(),R=await _e([{type:e?null:"text",name:"projectName",message:w("Project name:"),initial:X,onState:t=>{c=M(t.value)||X,u=he(c)}},{type:()=>!a.existsSync(u)||oe(u)?null:"toggle",name:"overwrite",message:()=>(u==="."?"Current directory":`Target directory "${u}"`)+" is not empty. Remove existing files and continue?",initial:!1,active:"Yes",inactive:"No"},{type:(t,{overwrite:o})=>{if(o===!1)throw console.log(fe("\u2716")+" Operation cancelled"),new Error;return null},name:"overwriteChecker"},{type:()=>V(h())?null:"text",name:"packageName",message:w("Package name:"),initial:()=>ie(h()),validate:t=>V(t)||"Invalid package.json name"},{type:n&&de.includes(n)?null:"select",name:"framework",message:typeof n=="string"&&!de.includes(n)?w(`"${n}" isn't a valid template. Please choose from below: `):w("Select a framework:"),initial:0,choices:ve.map(t=>{let o=t.color;return{title:o(t.display||t.name),value:t}})},{type:t=>t&&t.variants?"select":null,name:"variant",message:w("Select a variant:"),choices:t=>t?.variants?.map(o=>{let r=o.color;return{title:r(o.display||o.name),value:o.name}})},{type:(t,o)=>{let{framework:r}=o;return r&&Array.isArray(r.options)&&r.options.length?"multiselect":null},name:"options",message:w("Select optional options:"),instructions:!1,choices:(t,o)=>{let{framework:r}=o;return r?.options?.map(l=>({title:l.name,value:l.id}))}},{type:(t,o)=>S.length&&Array.isArray(o.options)&&o.options.includes("publish")?"select":null,name:"gitUserUrl",message:w("Which git repository to publish to?"),choices:S.map(t=>{let o=K(t);return{title:o,value:o}})}],{onCancel:()=>{throw console.log(fe("\u2716")+" Operation cancelled"),new Error}}),{framework:P,overwrite:F,packageName:D,variant:g,gitUserUrl:xe}=R,f=R.options||[],s=i.join(Q,u);F?re(s):a.existsSync(s)||a.mkdirSync(s,{recursive:!0}),console.log(`
|
|
4
|
+
Scaffolding project in ${s}...`);let T=g||P?.name||n||"",G=t=>i.join(Fe(import.meta.url),"../..",`template-${t}`),we=G(T),U=T.includes("node");[we,G("config")].forEach(t=>{let o=a.readdirSync(t);for(let r of o){let l=r.startsWith("_")?r.replace("_","."):r;if(U&&!f.includes("examples")&&r.includes("stylelint"))continue;let m=i.join(s,l);z(i.join(t,r),m)}});let d=D||h(),Se=`template-${T}`,j={name:"UserName",email:"name@github.com"};function ee(){let t=d.startsWith("@")?d.split("/")[0].substring(1):Ge(j.name);return`${xe||`https://github.com/${t}`}/${d.substring(d.indexOf("/")+1)}.git`}ke(),U&&(je(),Ee(),be());let te=se(process.env.npm_config_user_agent),_=te?te.name:"npm";b.which("git")&&(b.exec(`cd ${s} && git init`),f.includes("publish")&&b.exec(`cd ${s} && git remote add origin ${ee()}`));let I=i.relative(Q,s);switch(console.log(`
|
|
4
5
|
Done. Now run:
|
|
5
|
-
`),
|
|
6
|
-
`,{encoding:"utf-8"});return}if(!
|
|
7
|
-
|
|
6
|
+
`),s!==Q&&console.log(` cd ${I.includes(" ")?`"${I}"`:I}`),_){case"yarn":console.log(" yarn"),console.log(" yarn dev");break;default:console.log(` ${_} install`),console.log(` ${_} run dev`);break}function je(){["LICENSE","README.md","README.zh_CN.md"].forEach(t=>{let o=i.join(s,t);if(!f.includes("publish")&&a.existsSync(o)){a.rmSync(o),t==="README.md"&&a.writeFileSync(o,`# ${d}
|
|
7
|
+
`,{encoding:"utf-8"});return}if(!a.existsSync(o))return;let r=a.readFileSync(o,"utf-8").replace(new RegExp(Se,"g"),d).replace(new RegExp("{{user.name}}","g"),j.name).replace(new RegExp("{{user.email}}","g"),j.email);if(t.startsWith("README")){let l=d.replace("@","%40"),m=d.replace("@","%40").replace(new RegExp("/","g"),"%2F");r=r.replace("{{badges}}",[``,``,``].join(" "))}a.writeFileSync(o,r)})}function k(t,...o){["dependencies","devDependencies"].forEach(r=>{Object.keys(t[r]||{}).forEach(l=>{o.find(m=>l.includes(m))&&delete t[r][l]})})}function ke(){let t=v(i.join(s,"package.json"));t.name=d,f.includes("publish")?(b.which("git")&&(j.name=ye("user.name")||Oe.userInfo().username,j.email=ye("user.email")||"",t.author=Object.assign(t.author,j)),t.repository.url=`git+${ee()}`):(delete t.author,delete t.publishConfig,delete t.repository,delete t.scripts.prepublishOnly,delete t.devDependencies.np),f.includes("electron")||(k(t,"electron"),t.scripts["lint:eslint"]=t.scripts["lint:eslint"].replace(",electron","")),U&&!f.includes("vite")&&k(t,"vite"),x(i.join(s,"package.json"),t)}function W(t,o){let r=t.lastIndexOf("."),l=t.substring(0,r)+"."+o+t.substring(r),m=i.join(s,t),y=i.join(s,l);f.includes(o)?($(m),a.existsSync(y)&&Ce(y,m)):$(y)}function Ee(){if(W("tsconfig.json","test"),W("jest.config.cjs","electron"),f.includes("test"))return;a.readdirSync(s).filter(r=>r.startsWith("jest.config")||["test"].includes(r)).forEach(r=>{$(i.join(s,r))});let t=i.join(s,"package.json"),o=v(t);delete o.scripts.test,o.scripts["lint:eslint"]=o.scripts["lint:eslint"].replace(",test",""),k(o,"jest"),x(t,o)}function be(){if(W(".lintstagedrc.cjs","examples"),!f.includes("examples")){let r=v(i.join(s,"package.json"));r.scripts.lint=r.scripts.lint.replace(" lint:stylelint",""),r.scripts["lint:eslint"]=r.scripts["lint:eslint"].replace(",examples",""),delete r.scripts["lint:stylelint"],k(r,"stylelint"),x(i.join(s,"package.json"),r);return}let t=i.join(s,"examples");a.mkdirSync(t);let o=f.includes("electron");["vue","react"].forEach(r=>{let l=G(o?`electron-${r}`:r),m=i.join(t,r);if(!a.existsSync(l)){console.log(`${Z(l)} template is not exist`);return}a.cpSync(l,m,{recursive:!0});let y=v(i.join(m,"package.json"));Object.keys(y.scripts).forEach(E=>{(E.startsWith("lint")||["prepare"].includes(E))&&delete y.scripts[E]}),k(y,"eslint","prettier","stylelint","commitlint","husky","lint-staged","tsconfig","lint-staged"),x(i.join(m,"package.json"),y),["_lintstagedrc.cjs"].forEach(E=>{let ne=i.join(m,E);a.existsSync(ne)&&a.rmSync(ne,{recursive:!0})})}),a.writeFileSync(i.join(s,"pnpm-workspace.yaml"),`packages:
|
|
8
|
+
- 'examples/*'`,{encoding:"utf-8"})}}q().then(async()=>Ie().catch(e=>{e.message&&console.error(e)})).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.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "create tomjs web app",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"tomjs",
|
|
@@ -23,27 +23,26 @@
|
|
|
23
23
|
"email": "tom@tomgao.cc"
|
|
24
24
|
},
|
|
25
25
|
"license": "MIT",
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
},
|
|
30
|
-
"publishConfig": {
|
|
31
|
-
"access": "public",
|
|
32
|
-
"registry": "https://registry.npmjs.org"
|
|
26
|
+
"main": "dist/index.mjs",
|
|
27
|
+
"bin": {
|
|
28
|
+
"create-app": "dist/index.mjs"
|
|
33
29
|
},
|
|
34
30
|
"files": [
|
|
35
31
|
"dist",
|
|
36
32
|
"template-*/**"
|
|
37
33
|
],
|
|
38
|
-
"main": "dist/index.mjs",
|
|
39
|
-
"bin": {
|
|
40
|
-
"create-app": "dist/index.mjs"
|
|
41
|
-
},
|
|
42
34
|
"engines": {
|
|
43
35
|
"node": ">=18"
|
|
44
36
|
},
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "git+https://github.com/tomgao365/create-app.git"
|
|
40
|
+
},
|
|
41
|
+
"publishConfig": {
|
|
42
|
+
"access": "public",
|
|
43
|
+
"registry": "https://registry.npmjs.org"
|
|
44
|
+
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"json5": "^2.2.3",
|
|
47
46
|
"kolorist": "^1.8.0",
|
|
48
47
|
"lodash-es": "^4.17.21",
|
|
49
48
|
"minimist": "^1.2.8",
|
|
@@ -53,28 +52,31 @@
|
|
|
53
52
|
"devDependencies": {
|
|
54
53
|
"@commitlint/cli": "^18.4.3",
|
|
55
54
|
"@tomjs/commitlint": "^2.0.5",
|
|
56
|
-
"@tomjs/eslint": "^1.1.
|
|
55
|
+
"@tomjs/eslint": "^1.1.1",
|
|
57
56
|
"@tomjs/prettier": "^1.0.6",
|
|
57
|
+
"@tomjs/stylelint": "^1.1.0",
|
|
58
58
|
"@tomjs/tsconfig": "^1.0.8",
|
|
59
59
|
"@types/lodash-es": "^4.17.12",
|
|
60
60
|
"@types/minimist": "^1.2.5",
|
|
61
|
-
"@types/node": "^18.19.
|
|
61
|
+
"@types/node": "^18.19.3",
|
|
62
62
|
"@types/prompts": "^2.4.9",
|
|
63
63
|
"@types/shelljs": "^0.8.15",
|
|
64
64
|
"eslint": "^8.55.0",
|
|
65
65
|
"husky": "^8.0.3",
|
|
66
66
|
"lint-staged": "^15.2.0",
|
|
67
|
-
"np": "^9.
|
|
67
|
+
"np": "^9.1.0",
|
|
68
68
|
"npm-run-all": "^4.1.5",
|
|
69
69
|
"prettier": "^3.1.0",
|
|
70
|
+
"stylelint": "^15.11.0",
|
|
70
71
|
"tsup": "^8.0.1",
|
|
71
72
|
"typescript": "~5.2.2"
|
|
72
73
|
},
|
|
73
74
|
"scripts": {
|
|
74
75
|
"dev": "tsup --watch",
|
|
75
76
|
"build": "tsup --minify",
|
|
76
|
-
"lint": "run-s lint:eslint lint:prettier",
|
|
77
|
-
"lint:eslint": "eslint \"src/**/*.{js,cjs,ts}\" *.{js,cjs,ts} --fix --cache",
|
|
78
|
-
"lint:
|
|
77
|
+
"lint": "run-s lint:eslint lint:stylelint lint:prettier",
|
|
78
|
+
"lint:eslint": "eslint \"{src,template-*}/**/*.{js,cjs,ts}\" *.{js,cjs,ts} --fix --cache",
|
|
79
|
+
"lint:stylelint": "stylelint \"template-*/**/*.{css,scss,less,vue,html}\" --fix --cache",
|
|
80
|
+
"lint:prettier": "prettier --write \"{src,template-*}/**/*.{js,cjs,ts,json,md}\" *.{js,cjs,ts,json,md}"
|
|
79
81
|
}
|
|
80
82
|
}
|
|
@@ -29,16 +29,16 @@
|
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@commitlint/cli": "^18.4.3",
|
|
31
31
|
"@tomjs/commitlint": "^2.0.5",
|
|
32
|
-
"@tomjs/eslint": "^1.1.
|
|
32
|
+
"@tomjs/eslint": "^1.1.1",
|
|
33
33
|
"@tomjs/prettier": "^1.0.6",
|
|
34
|
-
"@tomjs/stylelint": "^1.0
|
|
34
|
+
"@tomjs/stylelint": "^1.1.0",
|
|
35
35
|
"@tomjs/tsconfig": "^1.0.8",
|
|
36
|
-
"@types/node": "^18.19.
|
|
37
|
-
"@types/react": "^18.2.
|
|
36
|
+
"@types/node": "^18.19.3",
|
|
37
|
+
"@types/react": "^18.2.42",
|
|
38
38
|
"@types/react-dom": "^18.2.17",
|
|
39
39
|
"@types/shelljs": "^0.8.15",
|
|
40
40
|
"@vitejs/plugin-react-swc": "^3.5.0",
|
|
41
|
-
"electron": "^
|
|
41
|
+
"electron": "^28.0.0",
|
|
42
42
|
"electron-builder": "^24.9.1",
|
|
43
43
|
"eslint": "^8.55.0",
|
|
44
44
|
"husky": "^8.0.3",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"tree-kill": "^1.2.2",
|
|
52
52
|
"tsx": "^4.6.2",
|
|
53
53
|
"typescript": "~5.2.2",
|
|
54
|
-
"vite": "^5.0.
|
|
54
|
+
"vite": "^5.0.6",
|
|
55
55
|
"vite-plugin-electron": "^0.15.4",
|
|
56
56
|
"vite-plugin-electron-renderer": "^0.14.5"
|
|
57
57
|
}
|
|
@@ -22,19 +22,19 @@
|
|
|
22
22
|
"prepare": "husky install"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"vue": "^3.3.
|
|
25
|
+
"vue": "^3.3.10"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@commitlint/cli": "^18.4.3",
|
|
29
29
|
"@tomjs/commitlint": "^2.0.5",
|
|
30
|
-
"@tomjs/eslint": "^1.1.
|
|
30
|
+
"@tomjs/eslint": "^1.1.1",
|
|
31
31
|
"@tomjs/prettier": "^1.0.6",
|
|
32
|
-
"@tomjs/stylelint": "^1.0
|
|
32
|
+
"@tomjs/stylelint": "^1.1.0",
|
|
33
33
|
"@tomjs/tsconfig": "^1.0.8",
|
|
34
|
-
"@types/node": "^18.19.
|
|
34
|
+
"@types/node": "^18.19.3",
|
|
35
35
|
"@types/shelljs": "^0.8.15",
|
|
36
36
|
"@vitejs/plugin-vue": "^4.5.1",
|
|
37
|
-
"electron": "^
|
|
37
|
+
"electron": "^28.0.0",
|
|
38
38
|
"electron-builder": "^24.9.1",
|
|
39
39
|
"eslint": "^8.55.0",
|
|
40
40
|
"husky": "^8.0.3",
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
"tree-kill": "^1.2.2",
|
|
48
48
|
"tsx": "^4.6.2",
|
|
49
49
|
"typescript": "~5.2.2",
|
|
50
|
-
"vite": "^5.0.
|
|
50
|
+
"vite": "^5.0.6",
|
|
51
51
|
"vite-plugin-electron": "^0.15.4",
|
|
52
52
|
"vite-plugin-electron-renderer": "^0.14.5",
|
|
53
|
-
"vue-tsc": "^1.8.
|
|
53
|
+
"vue-tsc": "^1.8.25"
|
|
54
54
|
}
|
|
55
55
|
}
|
|
@@ -10,12 +10,22 @@
|
|
|
10
10
|
"email": "name@github.com"
|
|
11
11
|
},
|
|
12
12
|
"license": "MIT",
|
|
13
|
-
"
|
|
14
|
-
|
|
13
|
+
"main": "./dist/index.js",
|
|
14
|
+
"module": "./dist/index.mjs",
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"require": "./dist/index.js",
|
|
19
|
+
"import": "./dist/index.mjs",
|
|
20
|
+
"types": "./dist/index.d.ts"
|
|
21
|
+
}
|
|
15
22
|
},
|
|
16
23
|
"files": [
|
|
17
24
|
"dist"
|
|
18
25
|
],
|
|
26
|
+
"engines": {
|
|
27
|
+
"node": ">=16"
|
|
28
|
+
},
|
|
19
29
|
"publishConfig": {
|
|
20
30
|
"access": "public",
|
|
21
31
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -24,52 +34,47 @@
|
|
|
24
34
|
"type": "git",
|
|
25
35
|
"url": "git+https://github.com/xxx/template-node.git"
|
|
26
36
|
},
|
|
27
|
-
"main": "./dist/index.js",
|
|
28
|
-
"module": "./dist/index.mjs",
|
|
29
|
-
"types": "./dist/index.d.ts",
|
|
30
|
-
"exports": {
|
|
31
|
-
".": {
|
|
32
|
-
"require": "./dist/index.js",
|
|
33
|
-
"import": "./dist/index.mjs",
|
|
34
|
-
"types": "./dist/index.d.ts"
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"dev": "tsup --watch",
|
|
39
|
-
"start": "tsx ./
|
|
39
|
+
"start": "tsx ./scripts/info.ts",
|
|
40
40
|
"build": "tsup",
|
|
41
41
|
"test": "jest",
|
|
42
|
-
"lint": "run-s lint:eslint lint:prettier",
|
|
43
|
-
"lint:eslint": "eslint \"{src,test}/**/*.ts\" *.{js,cjs,ts} --fix --cache",
|
|
42
|
+
"lint": "run-s lint:eslint lint:stylelint lint:prettier",
|
|
43
|
+
"lint:eslint": "eslint \"{src,scripts,test,examples}/**/*.ts\" *.{js,cjs,ts} --fix --cache",
|
|
44
|
+
"lint:stylelint": "stylelint \"examples/**/*.{css,scss,less,vue,html}\" --fix --cache",
|
|
44
45
|
"lint:prettier": "prettier --write .",
|
|
45
46
|
"prepare": "husky install",
|
|
46
47
|
"prepublishOnly": "npm run build && np --any-branch --no-yarn --yolo --no-publish --message \"chore: release v%s\""
|
|
47
48
|
},
|
|
48
49
|
"dependencies": {
|
|
49
|
-
"kolorist": "^1.8.0"
|
|
50
|
+
"kolorist": "^1.8.0",
|
|
51
|
+
"shelljs": "^0.8.5"
|
|
50
52
|
},
|
|
51
53
|
"devDependencies": {
|
|
52
54
|
"@commitlint/cli": "^18.4.3",
|
|
53
55
|
"@jest/globals": "^29.7.0",
|
|
56
|
+
"@kayahr/jest-electron-runner": "^29.10.0",
|
|
54
57
|
"@tomjs/commitlint": "^2.0.5",
|
|
55
|
-
"@tomjs/eslint": "^1.1.
|
|
58
|
+
"@tomjs/eslint": "^1.1.1",
|
|
56
59
|
"@tomjs/prettier": "^1.0.6",
|
|
60
|
+
"@tomjs/stylelint": "^1.1.0",
|
|
57
61
|
"@tomjs/tsconfig": "^1.0.8",
|
|
58
|
-
"@types/jest": "^29.5.
|
|
59
|
-
"@types/node": "^18.19.
|
|
60
|
-
"
|
|
62
|
+
"@types/jest": "^29.5.11",
|
|
63
|
+
"@types/node": "^18.19.3",
|
|
64
|
+
"electron": "^28.0.0",
|
|
61
65
|
"eslint": "^8.55.0",
|
|
62
66
|
"husky": "^8.0.3",
|
|
63
67
|
"jest": "^29.7.0",
|
|
64
68
|
"lint-staged": "^15.2.0",
|
|
65
|
-
"np": "^9.
|
|
69
|
+
"np": "^9.1.0",
|
|
66
70
|
"npm-run-all": "^4.1.5",
|
|
67
71
|
"prettier": "^3.1.0",
|
|
68
72
|
"rimraf": "^5.0.5",
|
|
69
|
-
"
|
|
73
|
+
"stylelint": "^15.11.0",
|
|
70
74
|
"ts-jest": "^29.1.1",
|
|
71
75
|
"tsup": "^8.0.1",
|
|
72
76
|
"tsx": "^4.6.2",
|
|
73
|
-
"typescript": "~5.2.2"
|
|
77
|
+
"typescript": "~5.2.2",
|
|
78
|
+
"vite": "^5.0.6"
|
|
74
79
|
}
|
|
75
80
|
}
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
import { blue } from 'kolorist';
|
|
1
|
+
export function fun() {}
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
console.log(blue('Hello World!'));
|
|
6
|
-
console.log(
|
|
7
|
-
`system: ${os.platform()} ${os.arch()} v${os.release()} ${os.cpus().length} cores ${Math.ceil(
|
|
8
|
-
os.totalmem() / 1024 / 1024 / 1024,
|
|
9
|
-
)}GB`,
|
|
10
|
-
);
|
|
11
|
-
console.log(`node: ${process.version} ${process.arch}`);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
run();
|
|
3
|
+
export default fun();
|
package/template-react/README.md
CHANGED
|
@@ -23,12 +23,12 @@
|
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@commitlint/cli": "^18.4.3",
|
|
25
25
|
"@tomjs/commitlint": "^2.0.5",
|
|
26
|
-
"@tomjs/eslint": "^1.1.
|
|
26
|
+
"@tomjs/eslint": "^1.1.1",
|
|
27
27
|
"@tomjs/prettier": "^1.0.6",
|
|
28
|
-
"@tomjs/stylelint": "^1.0
|
|
28
|
+
"@tomjs/stylelint": "^1.1.0",
|
|
29
29
|
"@tomjs/tsconfig": "^1.0.8",
|
|
30
|
-
"@types/node": "^18.19.
|
|
31
|
-
"@types/react": "^18.2.
|
|
30
|
+
"@types/node": "^18.19.3",
|
|
31
|
+
"@types/react": "^18.2.42",
|
|
32
32
|
"@types/react-dom": "^18.2.17",
|
|
33
33
|
"@vitejs/plugin-react-swc": "^3.5.0",
|
|
34
34
|
"eslint": "^8.55.0",
|
|
@@ -38,6 +38,6 @@
|
|
|
38
38
|
"prettier": "^3.1.0",
|
|
39
39
|
"stylelint": "^15.11.0",
|
|
40
40
|
"typescript": "~5.2.2",
|
|
41
|
-
"vite": "^5.0.
|
|
41
|
+
"vite": "^5.0.6"
|
|
42
42
|
}
|
|
43
43
|
}
|
package/template-vue/README.md
CHANGED
|
@@ -17,16 +17,16 @@
|
|
|
17
17
|
"prepare": "husky install"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"vue": "^3.3.
|
|
20
|
+
"vue": "^3.3.10"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@commitlint/cli": "^18.4.3",
|
|
24
24
|
"@tomjs/commitlint": "^2.0.5",
|
|
25
|
-
"@tomjs/eslint": "^1.1.
|
|
25
|
+
"@tomjs/eslint": "^1.1.1",
|
|
26
26
|
"@tomjs/prettier": "^1.0.6",
|
|
27
|
-
"@tomjs/stylelint": "^1.0
|
|
27
|
+
"@tomjs/stylelint": "^1.1.0",
|
|
28
28
|
"@tomjs/tsconfig": "^1.0.8",
|
|
29
|
-
"@types/node": "^18.19.
|
|
29
|
+
"@types/node": "^18.19.3",
|
|
30
30
|
"@vitejs/plugin-vue": "^4.5.1",
|
|
31
31
|
"eslint": "^8.55.0",
|
|
32
32
|
"husky": "^8.0.3",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"prettier": "^3.1.0",
|
|
36
36
|
"stylelint": "^15.11.0",
|
|
37
37
|
"typescript": "~5.2.2",
|
|
38
|
-
"vite": "^5.0.
|
|
39
|
-
"vue-tsc": "^1.8.
|
|
38
|
+
"vite": "^5.0.6",
|
|
39
|
+
"vue-tsc": "^1.8.25"
|
|
40
40
|
}
|
|
41
41
|
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2023-PRESENT {{user.name}}<{{user.email}}>
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
# template-node-electron
|
|
2
|
-
|
|
3
|
-
{{badges}}
|
|
4
|
-
|
|
5
|
-
> Basic Electron template
|
|
6
|
-
|
|
7
|
-
**English** | [中文](./README.zh_CN.md)
|
|
8
|
-
|
|
9
|
-
## Install
|
|
10
|
-
|
|
11
|
-
With `pnpm`
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
pnpm add template-node-electron
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
With `yarn`
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
yarn add template-node-electron
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
With `npm`
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
npm i template-node-electron
|
|
27
|
-
```
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
# template-node-electron
|
|
2
|
-
|
|
3
|
-
{{badges}}
|
|
4
|
-
|
|
5
|
-
> 基础 Electron 模板
|
|
6
|
-
|
|
7
|
-
[English](./README.md) | **中文**
|
|
8
|
-
|
|
9
|
-
## 安装
|
|
10
|
-
|
|
11
|
-
使用 `pnpm`
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
pnpm add template-node-electron
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
使用 `yarn`
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
yarn add template-node-electron
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
使用 `npm`
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
npm i template-node-electron
|
|
27
|
-
```
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "template-node-electron",
|
|
3
|
-
"version": "0.0.0",
|
|
4
|
-
"description": "Basic Electron template",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"electron"
|
|
7
|
-
],
|
|
8
|
-
"author": {
|
|
9
|
-
"name": "name",
|
|
10
|
-
"email": "name@github.com"
|
|
11
|
-
},
|
|
12
|
-
"license": "MIT",
|
|
13
|
-
"engines": {
|
|
14
|
-
"node": ">=16"
|
|
15
|
-
},
|
|
16
|
-
"files": [
|
|
17
|
-
"dist"
|
|
18
|
-
],
|
|
19
|
-
"publishConfig": {
|
|
20
|
-
"access": "public",
|
|
21
|
-
"registry": "https://registry.npmjs.org/"
|
|
22
|
-
},
|
|
23
|
-
"repository": {
|
|
24
|
-
"type": "git",
|
|
25
|
-
"url": "git+https://github.com/xxx/template-node-electron.git"
|
|
26
|
-
},
|
|
27
|
-
"main": "./dist/index.js",
|
|
28
|
-
"module": "./dist/index.mjs",
|
|
29
|
-
"types": "./dist/index.d.ts",
|
|
30
|
-
"exports": {
|
|
31
|
-
".": {
|
|
32
|
-
"require": "./dist/index.js",
|
|
33
|
-
"import": "./dist/index.mjs",
|
|
34
|
-
"types": "./dist/index.d.ts"
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
"scripts": {
|
|
38
|
-
"dev": "tsup --watch",
|
|
39
|
-
"start": "tsx ./src/index.ts",
|
|
40
|
-
"build": "tsup",
|
|
41
|
-
"test": "jest",
|
|
42
|
-
"lint": "run-s lint:eslint lint:prettier",
|
|
43
|
-
"lint:eslint": "eslint \"{src,test}/**/*.ts\" *.{js,cjs,ts} --fix --cache",
|
|
44
|
-
"lint:prettier": "prettier --write .",
|
|
45
|
-
"prepare": "husky install",
|
|
46
|
-
"prepublishOnly": "npm run build && np --any-branch --no-yarn --yolo --no-publish --message \"chore: release v%s\""
|
|
47
|
-
},
|
|
48
|
-
"dependencies": {
|
|
49
|
-
"kolorist": "^1.8.0"
|
|
50
|
-
},
|
|
51
|
-
"devDependencies": {
|
|
52
|
-
"@commitlint/cli": "^18.4.3",
|
|
53
|
-
"@jest/globals": "^29.7.0",
|
|
54
|
-
"@kayahr/jest-electron-runner": "^29.10.0",
|
|
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/jest": "^29.5.10",
|
|
60
|
-
"@types/node": "^18.19.2",
|
|
61
|
-
"@types/shelljs": "^0.8.15",
|
|
62
|
-
"electron": "^27.1.3",
|
|
63
|
-
"eslint": "^8.55.0",
|
|
64
|
-
"husky": "^8.0.3",
|
|
65
|
-
"jest": "^29.7.0",
|
|
66
|
-
"lint-staged": "^15.2.0",
|
|
67
|
-
"np": "^9.0.0",
|
|
68
|
-
"npm-run-all": "^4.1.5",
|
|
69
|
-
"prettier": "^3.1.0",
|
|
70
|
-
"rimraf": "^5.0.5",
|
|
71
|
-
"shelljs": "^0.8.5",
|
|
72
|
-
"ts-jest": "^29.1.1",
|
|
73
|
-
"tsup": "^8.0.1",
|
|
74
|
-
"tsx": "^4.6.2",
|
|
75
|
-
"typescript": "~5.2.2"
|
|
76
|
-
}
|
|
77
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from 'tsup';
|
|
2
|
-
import pkg from './package.json';
|
|
3
|
-
|
|
4
|
-
export default defineConfig({
|
|
5
|
-
entry: ['src/index.ts'],
|
|
6
|
-
format: ['esm', 'cjs'],
|
|
7
|
-
target: ['es2021', 'node16'],
|
|
8
|
-
external: ['electron'].concat(Object.keys(pkg.dependencies)),
|
|
9
|
-
clean: true,
|
|
10
|
-
dts: true,
|
|
11
|
-
splitting: true,
|
|
12
|
-
});
|
|
File without changes
|
|
File without changes
|