@tomjs/create-app 0.10.3 → 0.11.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.mjs +7 -7
- package/package.json +2 -2
- package/template-electron-react/package.json +1 -1
- package/template-electron-vue/package.json +2 -2
- package/template-node/package.json +4 -4
- package/template-react/package.json +1 -1
- package/template-vscode/.vscodeignore +71 -0
- package/template-vscode/README.md +0 -61
- package/template-vscode/images/icon.png +0 -0
- package/template-vscode/package.json +12 -11
- package/template-vscode-react/.vscodeignore +72 -0
- package/template-vscode-react/README.md +2 -86
- package/template-vscode-react/images/icon.png +0 -0
- package/template-vscode-react/package.json +13 -7
- package/template-vscode-vue/.vscodeignore +72 -0
- package/template-vscode-vue/README.md +0 -84
- package/template-vscode-vue/images/icon.png +0 -0
- package/template-vscode-vue/package.json +13 -8
- package/template-vue/package.json +2 -2
- package/template-vscode/index.html +0 -14
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
3
|
-
`)}function
|
|
4
|
-
Scaffolding project in ${
|
|
2
|
+
import s,{renameSync as Ie}from"fs";import Ve from"os";import c from"path";import{fileURLToPath as Je}from"url";import{lightBlue as C,lightCyan as Me,lightGreen as D,lightYellow as xe,red as Se,reset as w,yellow as We}from"kolorist";import{camelCase as we}from"lodash-es";import ze from"minimist";import Le from"prompts";import G from"shelljs";import de from"os";import ye from"path";import{blue as Ne,red as $,reset as F}from"kolorist";import Te from"minimist";import H from"prompts";import p from"fs";import W from"path";function R(e){return[["t","template"],["g","git"]].forEach(([r,l])=>{e[l]=e[l]??e[r]}),e}function ce(e){return p.readdirSync(e).length===0}function z(e){return e?.trim().replace(/\/+$/g,"")}function Ge(e,r){p.mkdirSync(r,{recursive:!0});for(let l of p.readdirSync(e)){let x=W.resolve(e,l),f=W.resolve(r,l);L(x,f)}}function L(e,r){p.statSync(e).isDirectory()?Ge(e,r):p.copyFileSync(e,r)}function ae(e){if(p.existsSync(e))for(let r of p.readdirSync(e))p.rmSync(W.resolve(e,r),{recursive:!0,force:!0})}function Y(e){return/^(?:@[a-z\d\-*~][a-z\d\-*._~]*\/)?[a-z\d\-~][a-z\d\-._~]*$/.test(e)}function le(e){return e.trim().toLowerCase().replace(/\s+/g,"-").replace(/^[._]/,"").replace(/[^a-z\d\-~]+/g,"-")}function pe(e){if(!e)return;let l=e.split(" ")[0].split("/");return{name:l[0],version:l[1]}}function S(e){if(p.existsSync(e))try{return JSON.parse(p.readFileSync(e,"utf8"))}catch(r){console.error(r)}}function v(e,r){p.writeFileSync(e,JSON.stringify(r,null,2)+`
|
|
3
|
+
`)}function me(e){return p.existsSync(e)?p.readFileSync(e,"utf8"):""}function A(e){p.existsSync(e)&&p.rmSync(e,{recursive:!0,force:!0})}function ue(e){p.existsSync(e)||p.mkdirSync(e,{recursive:!0})}var _e=R(Te(process.argv.slice(2),{string:["_"]})),ge={repo:"https://github.com",owner:de.userInfo().username};function K(e){let{repo:r,owner:l}=e;return`${r}${r.endsWith("/")?"":"/"}${l}`}async function fe(e){let r=await H([{type:"text",name:"repo",message:F("Git repository url:"),initial:e?.repo||ge.repo},{type:"text",name:"owner",message:F("Git repository owner:"),initial:e?.owner||ge.owner}],{onCancel:()=>{throw console.log($("\u2716")+" Operation cancelled"),new Error}});return{id:e?.id||Date.now().toString(),repo:r.repo,owner:r.owner}}var he=ye.join(de.homedir(),".tomjs","create-app"),ve=ye.join(he,"config.json");function O(){return ue(he),Object.assign({gitRepos:[]},S(ve))}function Ue(e){let r=O();r.createTime?r.updateTime=Date.now():r.createTime=Date.now(),v(ve,Object.assign(r,e))}function B(e){Ue({gitRepos:e})}async function q(){let{gitRepos:e}=O();(e.length===0||_e.git)&&(e.length===0&&console.log(`You need to set the ${Ne("git remote repository")} for the first time.`),await r());async function r(){let l=e.map(y=>({title:K(y),value:y.id})).concat([{title:"Add",value:"add"},{title:$("Exit"),value:"exit"}]),x=await H({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:l},{onCancel:()=>{throw console.log($("\u2716")+" Operation cancelled"),new Error}}),{repoId:f}=x;if(f==="exit")return;if(f==="add"){let y=await fe();return e.push(y),B(e),r()}let j=e.findIndex(y=>y.id===f),b=await H([{type:"select",name:"action",message:F("Select an action?"),choices:[{title:"Edit",value:"edit"},{title:"Remove",value:"remove"},{title:"Exit",value:"exit"}]},{type:y=>y==="remove"&&"toggle",name:"confirmRemove",message:F("Where confirm to remove?"),initial:!0,active:"Yes",inactive:"No"}],{onCancel:()=>{throw console.log($("\u2716")+" Operation cancelled"),new Error}}),{action:E,confirmRemove:N}=b;if(E==="exit")return q();if(E==="remove")return N&&(e.splice(j,1),B(e)),r();let T=await fe(e[j]);return e[j]=T,B(e),r()}}var Q=R(ze(process.argv.slice(2),{string:["_"]})),X=process.cwd(),Ye=["test","vite","electron","examples"],Ee=[{name:"web",display:"Web App",color:D,variants:[{name:"vue",display:"Vue",color:D},{name:"react",display:"React",color:C}]},{name:"electron",display:"Electron App",color:C,variants:[{name:"electron-vue",display:"Vue",color:D},{name:"electron-react",display:"React",color:C}]},{name:"vscode",display:"VSCode Extension",color:Me,options:[{id:"publish",name:"Git Repository + NPM Publish"},{id:"ssh",name:"Git init by SSH"}],variants:[{name:"vscode",display:"Base",color:xe},{name:"vscode-vue",display:"Vue",color:D},{name:"vscode-react",display:"React",color:C}]},{name:"node",display:"Node",color:xe,options:[{id:"test",name:"Test"},{id:"publish",name:"Git Repository + NPM Publish"},{id:"ssh",name:"Git init by SSH"},{id:"vite",name:"Vite Plugin"},{id:"electron",name:"Electron"},{id:"examples",name:"Examples"}]}],je=Ee.map(e=>e.variants&&e.variants.map(r=>r.name)||[e.name]).reduce((e,r)=>e.concat(r),[]),Z="my-app";function ke(e){let r=G.exec(`git config --get ${e}`,{silent:!0});if(r.code===0)return r.stdout.trim()}function be(e){return e.length>1?e.substring(e.indexOf("/")+1):e}async function Be(){let e=z(Q._[0]),r=Q.template||Q.t,l=e||Z,x=()=>l==="."?c.basename(c.resolve()):l,f=be(l),{gitRepos:j}=O(),b=await Le([{type:e?null:"text",name:"projectName",message:w("Project name:"),initial:Z,onState:t=>{l=z(t.value)||Z,f=be(l)}},{type:()=>!s.existsSync(f)||ce(f)?null:"toggle",name:"overwrite",message:()=>(f==="."?"Current directory":`Target directory "${f}"`)+" is not empty. Remove existing files and continue?",initial:!1,active:"Yes",inactive:"No"},{type:(t,{overwrite:n})=>{if(n===!1)throw console.log(Se("\u2716")+" Operation cancelled"),new Error;return null},name:"overwriteChecker"},{type:()=>Y(x())?null:"text",name:"packageName",message:w("Package name:"),initial:()=>le(x()),validate:t=>Y(t)||"Invalid package.json name"},{type:r&&je.includes(r)?null:"select",name:"framework",message:typeof r=="string"&&!je.includes(r)?w(`"${r}" isn't a valid template. Please choose from below: `):w("Select a framework:"),initial:0,choices:Ee.map(t=>{let n=t.color;return{title:n(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(n=>{let i=n.color;return{title:i(n.display||n.name),value:n.name}})},{type:(t,n)=>{let{framework:i}=n;return i&&Array.isArray(i.options)&&i.options.length?"multiselect":null},name:"options",message:w("Select optional options:"),instructions:!1,choices:(t,n)=>{let{framework:i}=n;return i?.options?.map(o=>({title:o.name,value:o.id}))}},{type:(t,n)=>j.length&&Array.isArray(n.options)&&n.options.includes("publish")?"select":null,name:"gitUserUrl",message:w("Which git repository to publish to?"),choices:j.map(t=>{let n=K(t);return{title:n,value:n}})}],{onCancel:()=>{throw console.log(Se("\u2716")+" Operation cancelled"),new Error}}),{framework:E,overwrite:N,packageName:T,variant:y,gitUserUrl:ee}=b,g=b.options||[],a=c.join(X,f);N?ae(a):s.existsSync(a)||s.mkdirSync(a,{recursive:!0}),console.log(`
|
|
4
|
+
Scaffolding project in ${a}...`);let _=y||E?.name||r||"",U=t=>c.join(Je(import.meta.url),"../..",`template-${t}`),Pe=U(_),I=_.includes("node");[Pe,U("config")].forEach(t=>{let n=s.readdirSync(t);for(let i of n){let o=i.startsWith("_")?i.replace("_","."):i;if((I&&!g.includes("examples")||_==="vscode")&&i.includes("stylelint"))continue;let u=c.join(a,o);L(c.join(t,i),u)}});let m=T||x(),P={name:ke("user.name")||Ve.userInfo().username,email:ke("user.email")||""},V={"pkg.name":m,"git.name":P.name,"git.email":P.email,"git.url":Re(),"git.fullUrl":te()};function Re(){let t=m.startsWith("@")?m.split("/")[0].substring(1):we(P.name);return`${ee||`https://github.com/${t}`}/${m.substring(m.indexOf("/")+1)}`}function te(t=!1){let n=m.startsWith("@")?m.split("/")[0].substring(1):we(P.name),i=ee||`https://github.com/${n}`;return t&&(i=i.replace(/http(s):\/\//g,"git@").replace(/\//,":")),`${i}/${m.substring(m.indexOf("/")+1)}.git`}$e(),I&&(Ae(),Ce(),De());let ne=pe(process.env.npm_config_user_agent),J=ne?ne.name:"npm";G.which("git")&&(G.exec(`cd ${a} && git init`),g.includes("publish")&&G.exec(`cd ${a} && git remote add origin ${te(g.includes("ssh"))}`));let M=c.relative(X,a);switch(console.log(`
|
|
5
5
|
Done. Now run:
|
|
6
|
-
`),
|
|
7
|
-
`);["LICENSE","README.md","README.zh_CN.md"].forEach(
|
|
8
|
-
`,{encoding:"utf-8"});return}if(!
|
|
9
|
-
- 'examples/*'`,{encoding:"utf-8"})}}
|
|
6
|
+
`),a!==X&&console.log(` cd ${M.includes(" ")?`"${M}"`:M}`),J){case"yarn":console.log(" yarn"),console.log(" yarn dev");break;default:console.log(` ${J} install`),console.log(` ${J} run dev`);break}function Ae(){Oe(".lintstagedrc.cjs","jest.config.cjs","tsconfig.json","tsup.config.ts");let t=g.find(i=>["vite"].includes(i)),n=["#pnpm",`pnpm add ${m}${t?" -D":""}`,"","#yarn",`yarn add ${m}${t?" -D":""}`,"","#npm",`npm i ${m}${t?" --save-dev":""}`].join(`
|
|
7
|
+
`);["LICENSE","README.md","README.zh_CN.md"].forEach(i=>{let o=c.join(a,i);if(!g.includes("publish")&&s.existsSync(o)){s.rmSync(o),i==="README.md"&&s.writeFileSync(o,`# ${m}
|
|
8
|
+
`,{encoding:"utf-8"});return}if(!s.existsSync(o))return;let u=Object.assign({},V,{"pkg.install":n}),d=s.readFileSync(o,"utf-8");Object.keys(u).forEach(h=>{d=d.replace(new RegExp("{{"+h+"}}","g"),u[h])}),s.writeFileSync(o,d,"utf8")})}function k(t,...n){["dependencies","devDependencies"].forEach(i=>{Object.keys(t[i]||{}).forEach(o=>{n.find(u=>o.includes(u))&&delete t[i][o]})})}function ie(...t){!Array.isArray(t)||t.length===0||t.forEach(n=>{let i=c.join(a,n);s.existsSync(i)&&A(i)})}function $e(){let t=c.join(a,"package.json"),n=S(t);n.name=m,g.includes("publish")||(delete n.author,delete n.publishConfig,delete n.repository,delete n.scripts.prepublishOnly,delete n.devDependencies.np),I&&(g.includes("electron")||(k(n,"electron"),n.scripts["lint:eslint"]=n.scripts["lint:eslint"].replace(",electron","")),g.includes("vite")||k(n,"vite")),v(t,n);let i=me(t);Object.keys(V).forEach(o=>{i=i.replace(new RegExp("{{"+o+"}}","g"),V[o])}),s.writeFileSync(t,i)}function Fe(t,n){let i=t.lastIndexOf("."),o=t.substring(0,i)+"."+n+t.substring(i),u=c.join(a,t),d=c.join(a,o);s.existsSync(d)&&(g.includes(n)?(A(u),Ie(d,u)):A(d))}function Oe(...t){t.forEach(n=>{Ye.forEach(i=>{Fe(n,i)})})}function Ce(){let t=c.join(a,"package.json"),n=S(t);if(g.includes("test")){if(g.includes("electron")){k(n,"vitest"),v(t,n);let i=c.join(a,"test/simple.test.ts");if(s.existsSync(i)){let o=s.readFileSync(i,{encoding:"utf8"});s.writeFileSync(i,o.replace("import { describe, expect, it } from 'vitest';",""),{encoding:"utf8"})}}else ie("jest.config.cjs");return}delete n.scripts.test,n.scripts["lint:eslint"]=n.scripts["lint:eslint"].replace(",test",""),k(n,"jest","vitest"),ie(".lintstagedrc.cjs","jest.config.cjs","test"),v(t,n)}function De(){if(!g.includes("examples")){let i=S(c.join(a,"package.json"));i.scripts.lint=i.scripts.lint.replace(" lint:stylelint",""),i.scripts["lint:eslint"]=i.scripts["lint:eslint"].replace(",examples",""),delete i.scripts["lint:stylelint"],k(i,"stylelint"),v(c.join(a,"package.json"),i);return}let t=c.join(a,"examples");s.mkdirSync(t);let n=g.includes("electron");["vue","react"].forEach(i=>{let o=U(n?`electron-${i}`:i),u=c.join(t,i);if(!s.existsSync(o)){console.log(`${We(o)} template is not exist`);return}s.cpSync(o,u,{recursive:!0});let d=S(c.join(u,"package.json"));Object.keys(d.scripts).forEach(h=>{(h.startsWith("lint")||["prepare"].includes(h))&&delete d.scripts[h]}),k(d,"eslint","prettier","stylelint","commitlint","husky","lint-staged","tsconfig","lint-staged","npm-run-all"),v(c.join(u,"package.json"),d),["_lintstagedrc.cjs"].forEach(h=>{let re=c.join(u,h);s.existsSync(re)&&s.rmSync(re,{recursive:!0})})}),s.writeFileSync(c.join(a,"pnpm-workspace.yaml"),`packages:
|
|
9
|
+
- 'examples/*'`,{encoding:"utf-8"})}}q().then(async()=>Be().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.11.0",
|
|
4
4
|
"description": "create tomjs web app",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"tomjs",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"lint-staged": "^15.2.0",
|
|
68
68
|
"np": "^9.2.0",
|
|
69
69
|
"npm-run-all": "^4.1.5",
|
|
70
|
-
"prettier": "^3.2.
|
|
70
|
+
"prettier": "^3.2.2",
|
|
71
71
|
"stylelint": "^16.1.0",
|
|
72
72
|
"tsup": "^8.0.1",
|
|
73
73
|
"typescript": "~5.3.3"
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@tomjs/electron-devtools-installer": "^2.1.0",
|
|
24
|
-
"vue": "^3.4.
|
|
24
|
+
"vue": "^3.4.13"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@commitlint/cli": "^18.4.4",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"husky": "^8.0.3",
|
|
41
41
|
"lint-staged": "^15.2.0",
|
|
42
42
|
"npm-run-all": "^4.1.5",
|
|
43
|
-
"prettier": "^3.2.
|
|
43
|
+
"prettier": "^3.2.2",
|
|
44
44
|
"rimraf": "^5.0.5",
|
|
45
45
|
"stylelint": "^16.1.0",
|
|
46
46
|
"tsx": "^4.7.0",
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
"node"
|
|
7
7
|
],
|
|
8
8
|
"author": {
|
|
9
|
-
"name": "name",
|
|
10
|
-
"email": "
|
|
9
|
+
"name": "{{git.name}}",
|
|
10
|
+
"email": "{{git.email}}"
|
|
11
11
|
},
|
|
12
12
|
"license": "MIT",
|
|
13
13
|
"main": "./dist/index.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"repository": {
|
|
34
34
|
"type": "git",
|
|
35
|
-
"url": "git+
|
|
35
|
+
"url": "git+{{git.url}}.git"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"dev": "tsup --watch",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"lint-staged": "^15.2.0",
|
|
69
69
|
"np": "^9.2.0",
|
|
70
70
|
"npm-run-all": "^4.1.5",
|
|
71
|
-
"prettier": "^3.2.
|
|
71
|
+
"prettier": "^3.2.2",
|
|
72
72
|
"rimraf": "^5.0.5",
|
|
73
73
|
"stylelint": "^16.1.0",
|
|
74
74
|
"ts-jest": "^29.1.1",
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# logs
|
|
2
|
+
*.log
|
|
3
|
+
lerna-debug.log*
|
|
4
|
+
logs
|
|
5
|
+
npm-debug.log*
|
|
6
|
+
pnpm-debug.log*
|
|
7
|
+
yarn-debug.log*
|
|
8
|
+
yarn-error.log*
|
|
9
|
+
|
|
10
|
+
# diagnostic reports (https://nodejs.org/api/report.html)
|
|
11
|
+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
|
12
|
+
|
|
13
|
+
# runtime data
|
|
14
|
+
*.pid
|
|
15
|
+
*.pid.lock
|
|
16
|
+
*.seed
|
|
17
|
+
pids
|
|
18
|
+
|
|
19
|
+
# dependency directory
|
|
20
|
+
node_modules
|
|
21
|
+
|
|
22
|
+
# cache
|
|
23
|
+
.cache
|
|
24
|
+
.npm
|
|
25
|
+
.tmp
|
|
26
|
+
.temp
|
|
27
|
+
.eslintcache
|
|
28
|
+
.stylelintcache
|
|
29
|
+
tsconfig.tsbuildinfo
|
|
30
|
+
|
|
31
|
+
# environment
|
|
32
|
+
*.local
|
|
33
|
+
|
|
34
|
+
# macOS
|
|
35
|
+
.DS_Store
|
|
36
|
+
|
|
37
|
+
# package files
|
|
38
|
+
*.7z
|
|
39
|
+
*.gz
|
|
40
|
+
*.gzip
|
|
41
|
+
*.rar
|
|
42
|
+
*.tar
|
|
43
|
+
*.tar.*
|
|
44
|
+
*.tgz
|
|
45
|
+
*.zip
|
|
46
|
+
*.vsix
|
|
47
|
+
|
|
48
|
+
# IDEA
|
|
49
|
+
.idea
|
|
50
|
+
|
|
51
|
+
# vscode
|
|
52
|
+
.vscode
|
|
53
|
+
.history
|
|
54
|
+
|
|
55
|
+
# project
|
|
56
|
+
src
|
|
57
|
+
|
|
58
|
+
.husky
|
|
59
|
+
.commitlintrc*
|
|
60
|
+
.editorconfig
|
|
61
|
+
.eslintrc*
|
|
62
|
+
.eslintignore
|
|
63
|
+
.gitattributes
|
|
64
|
+
.gitignore
|
|
65
|
+
.lintstagedrc*
|
|
66
|
+
.prettierrc*
|
|
67
|
+
.prettierignore
|
|
68
|
+
pnpm-lock.yaml
|
|
69
|
+
tsconfig.json
|
|
70
|
+
tsconfig.*.json
|
|
71
|
+
*.config.ts
|
|
@@ -1,64 +1,3 @@
|
|
|
1
1
|
# extension
|
|
2
2
|
|
|
3
3
|
vscode extension
|
|
4
|
-
|
|
5
|
-
## Debug
|
|
6
|
-
|
|
7
|
-
Run `Debug Extension` through `vscode` to debug. For debugging tools, refer to [Official Documentation](https://code.visualstudio.com/docs/editor/debugging)
|
|
8
|
-
|
|
9
|
-
`launch.json` is configured as follows:
|
|
10
|
-
|
|
11
|
-
```json
|
|
12
|
-
{
|
|
13
|
-
"version": "0.2.0",
|
|
14
|
-
"configurations": [
|
|
15
|
-
{
|
|
16
|
-
"name": "Debug Extension",
|
|
17
|
-
"type": "extensionHost",
|
|
18
|
-
"request": "launch",
|
|
19
|
-
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
|
|
20
|
-
"outFiles": ["${workspaceFolder}/dist/*.js"],
|
|
21
|
-
"preLaunchTask": "${defaultBuildTask}"
|
|
22
|
-
}
|
|
23
|
-
]
|
|
24
|
-
}
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
`tasks.json` is configured as follows:
|
|
28
|
-
|
|
29
|
-
```json
|
|
30
|
-
{
|
|
31
|
-
"version": "2.0.0",
|
|
32
|
-
"tasks": [
|
|
33
|
-
{
|
|
34
|
-
"type": "npm",
|
|
35
|
-
"script": "dev",
|
|
36
|
-
"problemMatcher": {
|
|
37
|
-
"owner": "typescript",
|
|
38
|
-
"fileLocation": "relative",
|
|
39
|
-
"pattern": {
|
|
40
|
-
"regexp": "^([a-zA-Z]\\:/?([\\w\\-]/?)+\\.\\w+):(\\d+):(\\d+): (ERROR|WARNING)\\: (.*)$",
|
|
41
|
-
"file": 1,
|
|
42
|
-
"line": 3,
|
|
43
|
-
"column": 4,
|
|
44
|
-
"code": 5,
|
|
45
|
-
"message": 6
|
|
46
|
-
},
|
|
47
|
-
"background": {
|
|
48
|
-
"activeOnStart": true,
|
|
49
|
-
"beginsPattern": "^.*extension build start*$",
|
|
50
|
-
"endsPattern": "^.*extension (build|rebuild) success.*$"
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
"isBackground": true,
|
|
54
|
-
"presentation": {
|
|
55
|
-
"reveal": "never"
|
|
56
|
-
},
|
|
57
|
-
"group": {
|
|
58
|
-
"kind": "build",
|
|
59
|
-
"isDefault": true
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
]
|
|
63
|
-
}
|
|
64
|
-
```
|
|
Binary file
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "
|
|
2
|
+
"name": "{{pkg.name}}",
|
|
3
3
|
"version": "0.0.0",
|
|
4
4
|
"description": "vscode extension template",
|
|
5
|
-
"author": {
|
|
6
|
-
"name": "name",
|
|
7
|
-
"email": "name@github.com"
|
|
8
|
-
},
|
|
9
5
|
"license": "MIT",
|
|
10
6
|
"engines": {
|
|
11
7
|
"node": ">=14",
|
|
@@ -23,13 +19,18 @@
|
|
|
23
19
|
}
|
|
24
20
|
]
|
|
25
21
|
},
|
|
26
|
-
"publishConfig": {
|
|
27
|
-
"access": "public",
|
|
28
|
-
"registry": "https://registry.npmjs.org/"
|
|
29
|
-
},
|
|
30
22
|
"repository": {
|
|
31
23
|
"type": "git",
|
|
32
|
-
"url": "git+
|
|
24
|
+
"url": "git+{{git.url}}.git"
|
|
25
|
+
},
|
|
26
|
+
"bugs": {
|
|
27
|
+
"url": "git+{{git.url}}/issues"
|
|
28
|
+
},
|
|
29
|
+
"homepage": "{{git.url}}/blob/main/README.md",
|
|
30
|
+
"icon": "images/icon.png",
|
|
31
|
+
"vsce": {
|
|
32
|
+
"dependencies": false,
|
|
33
|
+
"yarn": false
|
|
33
34
|
},
|
|
34
35
|
"scripts": {
|
|
35
36
|
"dev": "tsup --watch",
|
|
@@ -53,7 +54,7 @@
|
|
|
53
54
|
"husky": "^8.0.3",
|
|
54
55
|
"lint-staged": "^15.2.0",
|
|
55
56
|
"npm-run-all": "^4.1.5",
|
|
56
|
-
"prettier": "^3.2.
|
|
57
|
+
"prettier": "^3.2.2",
|
|
57
58
|
"rimraf": "^5.0.5",
|
|
58
59
|
"tsup": "^8.0.1",
|
|
59
60
|
"tsx": "^4.7.0",
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# logs
|
|
2
|
+
*.log
|
|
3
|
+
lerna-debug.log*
|
|
4
|
+
logs
|
|
5
|
+
npm-debug.log*
|
|
6
|
+
pnpm-debug.log*
|
|
7
|
+
yarn-debug.log*
|
|
8
|
+
yarn-error.log*
|
|
9
|
+
|
|
10
|
+
# diagnostic reports (https://nodejs.org/api/report.html)
|
|
11
|
+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
|
12
|
+
|
|
13
|
+
# runtime data
|
|
14
|
+
*.pid
|
|
15
|
+
*.pid.lock
|
|
16
|
+
*.seed
|
|
17
|
+
pids
|
|
18
|
+
|
|
19
|
+
# dependency directory
|
|
20
|
+
node_modules
|
|
21
|
+
|
|
22
|
+
# cache
|
|
23
|
+
.cache
|
|
24
|
+
.npm
|
|
25
|
+
.tmp
|
|
26
|
+
.temp
|
|
27
|
+
.eslintcache
|
|
28
|
+
.stylelintcache
|
|
29
|
+
tsconfig.tsbuildinfo
|
|
30
|
+
|
|
31
|
+
# environment
|
|
32
|
+
*.local
|
|
33
|
+
|
|
34
|
+
# macOS
|
|
35
|
+
.DS_Store
|
|
36
|
+
|
|
37
|
+
# package files
|
|
38
|
+
*.7z
|
|
39
|
+
*.gz
|
|
40
|
+
*.gzip
|
|
41
|
+
*.rar
|
|
42
|
+
*.tar
|
|
43
|
+
*.tar.*
|
|
44
|
+
*.tgz
|
|
45
|
+
*.zip
|
|
46
|
+
*.vsix
|
|
47
|
+
|
|
48
|
+
# IDEA
|
|
49
|
+
.idea
|
|
50
|
+
|
|
51
|
+
# vscode
|
|
52
|
+
.vscode
|
|
53
|
+
.history
|
|
54
|
+
|
|
55
|
+
# project
|
|
56
|
+
src
|
|
57
|
+
extension
|
|
58
|
+
|
|
59
|
+
.husky
|
|
60
|
+
.commitlintrc*
|
|
61
|
+
.editorconfig
|
|
62
|
+
.eslintrc*
|
|
63
|
+
.eslintignore
|
|
64
|
+
.gitattributes
|
|
65
|
+
.gitignore
|
|
66
|
+
.lintstagedrc*
|
|
67
|
+
.prettierrc*
|
|
68
|
+
.prettierignore
|
|
69
|
+
pnpm-lock.yaml
|
|
70
|
+
tsconfig.json
|
|
71
|
+
tsconfig.*.json
|
|
72
|
+
*.config.ts
|
|
@@ -1,87 +1,3 @@
|
|
|
1
|
-
# extension-
|
|
1
|
+
# extension-react
|
|
2
2
|
|
|
3
|
-
vite + extension +
|
|
4
|
-
|
|
5
|
-
## Description
|
|
6
|
-
|
|
7
|
-
- Recommend `extension` and page `src` code directory structure
|
|
8
|
-
|
|
9
|
-
```
|
|
10
|
-
|--extension // extension code
|
|
11
|
-
| |--index.ts
|
|
12
|
-
|--src // front-end code
|
|
13
|
-
| |--App.vue
|
|
14
|
-
| |--main.ts
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
- Zero configuration, default dist output directory
|
|
18
|
-
|
|
19
|
-
```
|
|
20
|
-
|--dist
|
|
21
|
-
| |--extension
|
|
22
|
-
| | |--index.js
|
|
23
|
-
| | |--index.js.map
|
|
24
|
-
| |--webview
|
|
25
|
-
| | |--index.html
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## Debug
|
|
29
|
-
|
|
30
|
-
Run `Debug Extension` through `vscode` to debug. For debugging tools, refer to [Official Documentation](https://code.visualstudio.com/docs/editor/debugging)
|
|
31
|
-
|
|
32
|
-
`launch.json` is configured as follows:
|
|
33
|
-
|
|
34
|
-
```json
|
|
35
|
-
{
|
|
36
|
-
"version": "0.2.0",
|
|
37
|
-
"configurations": [
|
|
38
|
-
{
|
|
39
|
-
"name": "Debug Extension",
|
|
40
|
-
"type": "extensionHost",
|
|
41
|
-
"request": "launch",
|
|
42
|
-
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
|
|
43
|
-
"outFiles": ["${workspaceFolder}/dist/extension/*.js"],
|
|
44
|
-
"preLaunchTask": "${defaultBuildTask}"
|
|
45
|
-
}
|
|
46
|
-
]
|
|
47
|
-
}
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
`tasks.json` is configured as follows:
|
|
51
|
-
|
|
52
|
-
```json
|
|
53
|
-
{
|
|
54
|
-
"version": "2.0.0",
|
|
55
|
-
"tasks": [
|
|
56
|
-
{
|
|
57
|
-
"type": "npm",
|
|
58
|
-
"script": "dev",
|
|
59
|
-
"problemMatcher": {
|
|
60
|
-
"owner": "typescript",
|
|
61
|
-
"fileLocation": "relative",
|
|
62
|
-
"pattern": {
|
|
63
|
-
"regexp": "^([a-zA-Z]\\:/?([\\w\\-]/?)+\\.\\w+):(\\d+):(\\d+): (ERROR|WARNING)\\: (.*)$",
|
|
64
|
-
"file": 1,
|
|
65
|
-
"line": 3,
|
|
66
|
-
"column": 4,
|
|
67
|
-
"code": 5,
|
|
68
|
-
"message": 6
|
|
69
|
-
},
|
|
70
|
-
"background": {
|
|
71
|
-
"activeOnStart": true,
|
|
72
|
-
"beginsPattern": "^.*extension build start*$",
|
|
73
|
-
"endsPattern": "^.*extension (build|rebuild) success.*$"
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
"isBackground": true,
|
|
77
|
-
"presentation": {
|
|
78
|
-
"reveal": "never"
|
|
79
|
-
},
|
|
80
|
-
"group": {
|
|
81
|
-
"kind": "build",
|
|
82
|
-
"isDefault": true
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
]
|
|
86
|
-
}
|
|
87
|
-
```
|
|
3
|
+
vite + extension + react
|
|
Binary file
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "
|
|
2
|
+
"name": "{{pkg.name}}",
|
|
3
3
|
"version": "0.0.0",
|
|
4
4
|
"description": "vite + vscode + react",
|
|
5
|
+
"keywords": [],
|
|
5
6
|
"engines": {
|
|
6
7
|
"node": ">=14",
|
|
7
8
|
"vscode": "^1.56.0"
|
|
@@ -18,13 +19,18 @@
|
|
|
18
19
|
}
|
|
19
20
|
]
|
|
20
21
|
},
|
|
21
|
-
"publishConfig": {
|
|
22
|
-
"access": "public",
|
|
23
|
-
"registry": "https://registry.npmjs.org/"
|
|
24
|
-
},
|
|
25
22
|
"repository": {
|
|
26
23
|
"type": "git",
|
|
27
|
-
"url": "git+
|
|
24
|
+
"url": "git+{{git.url}}.git"
|
|
25
|
+
},
|
|
26
|
+
"bugs": {
|
|
27
|
+
"url": "git+{{git.url}}/issues"
|
|
28
|
+
},
|
|
29
|
+
"homepage": "{{git.url}}/blob/main/README.md",
|
|
30
|
+
"icon": "images/icon.png",
|
|
31
|
+
"vsce": {
|
|
32
|
+
"dependencies": false,
|
|
33
|
+
"yarn": false
|
|
28
34
|
},
|
|
29
35
|
"scripts": {
|
|
30
36
|
"dev": "vite",
|
|
@@ -61,7 +67,7 @@
|
|
|
61
67
|
"husky": "^8.0.3",
|
|
62
68
|
"lint-staged": "^15.2.0",
|
|
63
69
|
"npm-run-all": "^4.1.5",
|
|
64
|
-
"prettier": "^3.2.
|
|
70
|
+
"prettier": "^3.2.2",
|
|
65
71
|
"rimraf": "^5.0.5",
|
|
66
72
|
"stylelint": "^16.1.0",
|
|
67
73
|
"tsx": "^4.7.0",
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# logs
|
|
2
|
+
*.log
|
|
3
|
+
lerna-debug.log*
|
|
4
|
+
logs
|
|
5
|
+
npm-debug.log*
|
|
6
|
+
pnpm-debug.log*
|
|
7
|
+
yarn-debug.log*
|
|
8
|
+
yarn-error.log*
|
|
9
|
+
|
|
10
|
+
# diagnostic reports (https://nodejs.org/api/report.html)
|
|
11
|
+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
|
12
|
+
|
|
13
|
+
# runtime data
|
|
14
|
+
*.pid
|
|
15
|
+
*.pid.lock
|
|
16
|
+
*.seed
|
|
17
|
+
pids
|
|
18
|
+
|
|
19
|
+
# dependency directory
|
|
20
|
+
node_modules
|
|
21
|
+
|
|
22
|
+
# cache
|
|
23
|
+
.cache
|
|
24
|
+
.npm
|
|
25
|
+
.tmp
|
|
26
|
+
.temp
|
|
27
|
+
.eslintcache
|
|
28
|
+
.stylelintcache
|
|
29
|
+
tsconfig.tsbuildinfo
|
|
30
|
+
|
|
31
|
+
# environment
|
|
32
|
+
*.local
|
|
33
|
+
|
|
34
|
+
# macOS
|
|
35
|
+
.DS_Store
|
|
36
|
+
|
|
37
|
+
# package files
|
|
38
|
+
*.7z
|
|
39
|
+
*.gz
|
|
40
|
+
*.gzip
|
|
41
|
+
*.rar
|
|
42
|
+
*.tar
|
|
43
|
+
*.tar.*
|
|
44
|
+
*.tgz
|
|
45
|
+
*.zip
|
|
46
|
+
*.vsix
|
|
47
|
+
|
|
48
|
+
# IDEA
|
|
49
|
+
.idea
|
|
50
|
+
|
|
51
|
+
# vscode
|
|
52
|
+
.vscode
|
|
53
|
+
.history
|
|
54
|
+
|
|
55
|
+
# project
|
|
56
|
+
src
|
|
57
|
+
extension
|
|
58
|
+
|
|
59
|
+
.husky
|
|
60
|
+
.commitlintrc*
|
|
61
|
+
.editorconfig
|
|
62
|
+
.eslintrc*
|
|
63
|
+
.eslintignore
|
|
64
|
+
.gitattributes
|
|
65
|
+
.gitignore
|
|
66
|
+
.lintstagedrc*
|
|
67
|
+
.prettierrc*
|
|
68
|
+
.prettierignore
|
|
69
|
+
pnpm-lock.yaml
|
|
70
|
+
tsconfig.json
|
|
71
|
+
tsconfig.*.json
|
|
72
|
+
*.config.ts
|
|
@@ -1,87 +1,3 @@
|
|
|
1
1
|
# extension-vue
|
|
2
2
|
|
|
3
3
|
vite + extension + vue
|
|
4
|
-
|
|
5
|
-
## Description
|
|
6
|
-
|
|
7
|
-
- Recommend `extension` and page `src` code directory structure
|
|
8
|
-
|
|
9
|
-
```
|
|
10
|
-
|--extension // extension code
|
|
11
|
-
| |--index.ts
|
|
12
|
-
|--src // front-end code
|
|
13
|
-
| |--App.vue
|
|
14
|
-
| |--main.ts
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
- Zero configuration, default dist output directory
|
|
18
|
-
|
|
19
|
-
```
|
|
20
|
-
|--dist
|
|
21
|
-
| |--extension
|
|
22
|
-
| | |--index.js
|
|
23
|
-
| | |--index.js.map
|
|
24
|
-
| |--webview
|
|
25
|
-
| | |--index.html
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## Debug
|
|
29
|
-
|
|
30
|
-
Run `Debug Extension` through `vscode` to debug. For debugging tools, refer to [Official Documentation](https://code.visualstudio.com/docs/editor/debugging)
|
|
31
|
-
|
|
32
|
-
`launch.json` is configured as follows:
|
|
33
|
-
|
|
34
|
-
```json
|
|
35
|
-
{
|
|
36
|
-
"version": "0.2.0",
|
|
37
|
-
"configurations": [
|
|
38
|
-
{
|
|
39
|
-
"name": "Debug Extension",
|
|
40
|
-
"type": "extensionHost",
|
|
41
|
-
"request": "launch",
|
|
42
|
-
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
|
|
43
|
-
"outFiles": ["${workspaceFolder}/dist/extension/*.js"],
|
|
44
|
-
"preLaunchTask": "${defaultBuildTask}"
|
|
45
|
-
}
|
|
46
|
-
]
|
|
47
|
-
}
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
`tasks.json` is configured as follows:
|
|
51
|
-
|
|
52
|
-
```json
|
|
53
|
-
{
|
|
54
|
-
"version": "2.0.0",
|
|
55
|
-
"tasks": [
|
|
56
|
-
{
|
|
57
|
-
"type": "npm",
|
|
58
|
-
"script": "dev",
|
|
59
|
-
"problemMatcher": {
|
|
60
|
-
"owner": "typescript",
|
|
61
|
-
"fileLocation": "relative",
|
|
62
|
-
"pattern": {
|
|
63
|
-
"regexp": "^([a-zA-Z]\\:/?([\\w\\-]/?)+\\.\\w+):(\\d+):(\\d+): (ERROR|WARNING)\\: (.*)$",
|
|
64
|
-
"file": 1,
|
|
65
|
-
"line": 3,
|
|
66
|
-
"column": 4,
|
|
67
|
-
"code": 5,
|
|
68
|
-
"message": 6
|
|
69
|
-
},
|
|
70
|
-
"background": {
|
|
71
|
-
"activeOnStart": true,
|
|
72
|
-
"beginsPattern": "^.*extension build start*$",
|
|
73
|
-
"endsPattern": "^.*extension (build|rebuild) success.*$"
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
"isBackground": true,
|
|
77
|
-
"presentation": {
|
|
78
|
-
"reveal": "never"
|
|
79
|
-
},
|
|
80
|
-
"group": {
|
|
81
|
-
"kind": "build",
|
|
82
|
-
"isDefault": true
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
]
|
|
86
|
-
}
|
|
87
|
-
```
|
|
Binary file
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "
|
|
2
|
+
"name": "{{pkg.name}}",
|
|
3
3
|
"version": "0.0.0",
|
|
4
4
|
"description": "vite + vscode + vue",
|
|
5
5
|
"engines": {
|
|
@@ -18,13 +18,18 @@
|
|
|
18
18
|
}
|
|
19
19
|
]
|
|
20
20
|
},
|
|
21
|
-
"publishConfig": {
|
|
22
|
-
"access": "public",
|
|
23
|
-
"registry": "https://registry.npmjs.org/"
|
|
24
|
-
},
|
|
25
21
|
"repository": {
|
|
26
22
|
"type": "git",
|
|
27
|
-
"url": "git+
|
|
23
|
+
"url": "git+{{git.url}}.git"
|
|
24
|
+
},
|
|
25
|
+
"bugs": {
|
|
26
|
+
"url": "git+{{git.url}}/issues"
|
|
27
|
+
},
|
|
28
|
+
"homepage": "{{git.url}}/blob/main/README.md",
|
|
29
|
+
"icon": "images/icon.png",
|
|
30
|
+
"vsce": {
|
|
31
|
+
"dependencies": false,
|
|
32
|
+
"yarn": false
|
|
28
33
|
},
|
|
29
34
|
"scripts": {
|
|
30
35
|
"dev": "vite",
|
|
@@ -38,7 +43,7 @@
|
|
|
38
43
|
},
|
|
39
44
|
"dependencies": {
|
|
40
45
|
"@vscode/webview-ui-toolkit": "^1.4.0",
|
|
41
|
-
"vue": "^3.4.
|
|
46
|
+
"vue": "^3.4.13"
|
|
42
47
|
},
|
|
43
48
|
"devDependencies": {
|
|
44
49
|
"@commitlint/cli": "^18.4.4",
|
|
@@ -58,7 +63,7 @@
|
|
|
58
63
|
"husky": "^8.0.3",
|
|
59
64
|
"lint-staged": "^15.2.0",
|
|
60
65
|
"npm-run-all": "^4.1.5",
|
|
61
|
-
"prettier": "^3.2.
|
|
66
|
+
"prettier": "^3.2.2",
|
|
62
67
|
"rimraf": "^5.0.5",
|
|
63
68
|
"stylelint": "^16.1.0",
|
|
64
69
|
"tsx": "^4.7.0",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"prepare": "husky install"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"vue": "^3.4.
|
|
20
|
+
"vue": "^3.4.13"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@commitlint/cli": "^18.4.4",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"husky": "^8.0.3",
|
|
34
34
|
"lint-staged": "^15.2.0",
|
|
35
35
|
"npm-run-all": "^4.1.5",
|
|
36
|
-
"prettier": "^3.2.
|
|
36
|
+
"prettier": "^3.2.2",
|
|
37
37
|
"stylelint": "^16.1.0",
|
|
38
38
|
"typescript": "~5.3.3",
|
|
39
39
|
"vite": "^5.0.11",
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
-
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
|
|
7
|
-
<title>Vite + VSCode Extension + Vue</title>
|
|
8
|
-
</head>
|
|
9
|
-
|
|
10
|
-
<body>
|
|
11
|
-
<div id="app"></div>
|
|
12
|
-
<script type="module" src="/src/main.ts"></script>
|
|
13
|
-
</body>
|
|
14
|
-
</html>
|