@tomjs/create-app 0.7.0 → 0.8.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 +5 -5
- package/package.json +7 -7
- package/template-electron-react/package.json +7 -7
- package/template-electron-vue/package.json +8 -8
- package/template-node/package.json +5 -5
- package/template-react/package.json +5 -5
- package/template-vscode/.eslintrc.cjs +7 -0
- package/template-vscode/.vscode/launch.json +21 -0
- package/template-vscode/.vscode/tasks.json +36 -0
- package/template-vscode/README.md +64 -0
- package/template-vscode/_lintstagedrc.cjs +5 -0
- package/template-vscode/index.html +14 -0
- package/template-vscode/package.json +62 -0
- package/template-vscode/src/index.ts +13 -0
- package/template-vscode/tsconfig.json +5 -0
- package/template-vscode/tsup.config.ts +13 -0
- package/template-vscode-react/.vscode/launch.json +1 -1
- package/template-vscode-react/README.md +2 -2
- package/template-vscode-react/package.json +10 -10
- package/template-vscode-vue/.vscode/launch.json +1 -1
- package/template-vscode-vue/README.md +2 -2
- package/template-vscode-vue/package.json +9 -9
- package/template-vue/package.json +6 -6
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
**English** | [中文](./README.zh_CN.md)
|
|
6
6
|
|
|
7
|
-
> Create a web application based on [vite](https://github.com/vitejs/vite) + [tomjs](https://github.com/
|
|
7
|
+
> Create a web application based on [vite](https://github.com/vitejs/vite) + [tomjs](https://github.com/tomjs).
|
|
8
8
|
|
|
9
9
|
## Creating a Project
|
|
10
10
|
|
package/README.zh_CN.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
  
|
|
6
6
|
|
|
7
|
-
> 创建基于 [vite](https://github.com/vitejs/vite) + [tomjs](https://github.com/
|
|
7
|
+
> 创建基于 [vite](https://github.com/vitejs/vite) + [tomjs](https://github.com/tomjs) 的 web 应用。
|
|
8
8
|
|
|
9
9
|
## 创建项目
|
|
10
10
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import a,{renameSync as
|
|
3
|
-
`)}function C(e){l.existsSync(e)&&l.rmSync(e,{recursive:!0,force:!0})}function ce(e){l.existsSync(e)||l.mkdirSync(e,{recursive:!0})}var
|
|
4
|
-
Scaffolding project in ${s}...`);let Z=f||P?.name||n||"",U=t=>r.join(
|
|
2
|
+
import a,{renameSync as Ge}from"fs";import Ne from"os";import r from"path";import{fileURLToPath as Oe}from"url";import{lightBlue as O,lightCyan as Fe,lightGreen as F,lightYellow as fe,red as de,reset as w,yellow as Te}from"kolorist";import{camelCase as De}from"lodash-es";import Ue from"minimist";import _e from"prompts";import E from"shelljs";import pe from"os";import me from"path";import{blue as Pe,red as $,reset as G}from"kolorist";import Ae from"minimist";import B from"prompts";import l from"fs";import W from"path";function A(e){return[["t","template"],["g","git"]].forEach(([n,c])=>{e[c]=e[c]??e[n]}),e}function ie(e){return l.readdirSync(e).length===0}function M(e){return e?.trim().replace(/\/+$/g,"")}function Re(e,n){l.mkdirSync(n,{recursive:!0});for(let c of l.readdirSync(e)){let y=W.resolve(e,c),m=W.resolve(n,c);z(y,m)}}function z(e,n){l.statSync(e).isDirectory()?Re(e,n):l.copyFileSync(e,n)}function oe(e){if(l.existsSync(e))for(let n of l.readdirSync(e))l.rmSync(W.resolve(e,n),{recursive:!0,force:!0})}function Y(e){return/^(?:@[a-z\d\-*~][a-z\d\-*._~]*\/)?[a-z\d\-~][a-z\d\-._~]*$/.test(e)}function re(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(l.existsSync(e))try{return JSON.parse(l.readFileSync(e,"utf8"))}catch(n){console.error(n)}}function x(e,n){l.writeFileSync(e,JSON.stringify(n,null,2)+`
|
|
3
|
+
`)}function C(e){l.existsSync(e)&&l.rmSync(e,{recursive:!0,force:!0})}function ce(e){l.existsSync(e)||l.mkdirSync(e,{recursive:!0})}var Ce=A(Ae(process.argv.slice(2),{string:["_"]})),ae={repo:"https://github.com",owner:pe.userInfo().username};function H(e){let{repo:n,owner:c}=e;return`${n}${n.endsWith("/")?"":"/"}${c}`}async function le(e){let n=await B([{type:"text",name:"repo",message:G("Git repository url:"),initial:e?.repo||ae.repo},{type:"text",name:"owner",message:G("Git repository owner:"),initial:e?.owner||ae.owner}],{onCancel:()=>{throw console.log($("\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 N(){return ce(ue),Object.assign({gitRepos:[]},v(ge))}function $e(e){let n=N();n.createTime?n.updateTime=Date.now():n.createTime=Date.now(),x(ge,Object.assign(n,e))}function L(e){$e({gitRepos:e})}async function K(){let{gitRepos:e}=N();(e.length===0||Ce.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(f=>({title:H(f),value:f.id})).concat([{title:"Add",value:"add"},{title:$("Exit"),value:"exit"}]),y=await B({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($("\u2716")+" Operation cancelled"),new Error}}),{repoId:m}=y;if(m==="exit")return;if(m==="add"){let f=await le();return e.push(f),L(e),n()}let S=e.findIndex(f=>f.id===m),R=await B([{type:"select",name:"action",message:G("Select an action?"),choices:[{title:"Edit",value:"edit"},{title:"Remove",value:"remove"},{title:"Exit",value:"exit"}]},{type:f=>f==="remove"&&"toggle",name:"confirmRemove",message:G("Where confirm to remove?"),initial:!0,active:"Yes",inactive:"No"}],{onCancel:()=>{throw console.log($("\u2716")+" Operation cancelled"),new Error}}),{action:P,confirmRemove:T}=R;if(P==="exit")return K();if(P==="remove")return T&&(e.splice(S,1),L(e)),n();let D=await le(e[S]);return e[S]=D,L(e),n()}}var q=A(Ue(process.argv.slice(2),{string:["_"]})),Q=process.cwd(),xe=[{name:"web",display:"Web App",color:F,variants:[{name:"vue",display:"Vue",color:F},{name:"react",display:"React",color:O}]},{name:"electron",display:"Electron App",color:O,variants:[{name:"electron-vue",display:"Vue",color:F},{name:"electron-react",display:"React",color:O}]},{name:"vscode",display:"VSCode Extension",color:Fe,options:[{id:"publish",name:"Git Repository + NPM Publish"},{id:"ssh",name:"Git init by SSH"}],variants:[{name:"vscode",display:"Base",color:fe},{name:"vscode-vue",display:"Vue",color:F},{name:"vscode-react",display:"React",color:O}]},{name:"node",display:"Node",color:fe,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"}]}],ye=xe.map(e=>e.variants&&e.variants.map(n=>n.name)||[e.name]).reduce((e,n)=>e.concat(n),[]),X="my-app";function he(e){let n=E.exec(`git config --get ${e}`,{silent:!0});if(n.code===0)return n.stdout.trim()}function ve(e){return e.length>1?e.substring(e.indexOf("/")+1):e}async function Ie(){let e=M(q._[0]),n=q.template||q.t,c=e||X,y=()=>c==="."?r.basename(r.resolve()):c,m=ve(c),{gitRepos:S}=N(),R=await _e([{type:e?null:"text",name:"projectName",message:w("Project name:"),initial:X,onState:t=>{c=M(t.value)||X,m=ve(c)}},{type:()=>!a.existsSync(m)||ie(m)?null:"toggle",name:"overwrite",message:()=>(m==="."?"Current directory":`Target directory "${m}"`)+" is not empty. Remove existing files and continue?",initial:!1,active:"Yes",inactive:"No"},{type:(t,{overwrite:i})=>{if(i===!1)throw console.log(de("\u2716")+" Operation cancelled"),new Error;return null},name:"overwriteChecker"},{type:()=>Y(y())?null:"text",name:"packageName",message:w("Package name:"),initial:()=>re(y()),validate:t=>Y(t)||"Invalid package.json name"},{type:n&&ye.includes(n)?null:"select",name:"framework",message:typeof n=="string"&&!ye.includes(n)?w(`"${n}" isn't a valid template. Please choose from below: `):w("Select a framework:"),initial:0,choices:xe.map(t=>{let i=t.color;return{title:i(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(i=>{let o=i.color;return{title:o(i.display||i.name),value:i.name}})},{type:(t,i)=>{let{framework:o}=i;return o&&Array.isArray(o.options)&&o.options.length?"multiselect":null},name:"options",message:w("Select optional options:"),instructions:!1,choices:(t,i)=>{let{framework:o}=i;return o?.options?.map(p=>({title:p.name,value:p.id}))}},{type:(t,i)=>S.length&&Array.isArray(i.options)&&i.options.includes("publish")?"select":null,name:"gitUserUrl",message:w("Which git repository to publish to?"),choices:S.map(t=>{let i=H(t);return{title:i,value:i}})}],{onCancel:()=>{throw console.log(de("\u2716")+" Operation cancelled"),new Error}}),{framework:P,overwrite:T,packageName:D,variant:f,gitUserUrl:we}=R,u=R.options||[],s=r.join(Q,m);T?oe(s):a.existsSync(s)||a.mkdirSync(s,{recursive:!0}),console.log(`
|
|
4
|
+
Scaffolding project in ${s}...`);let Z=f||P?.name||n||"",U=t=>r.join(Oe(import.meta.url),"../..",`template-${t}`),Se=U(Z),_=Z.includes("node");[Se,U("config")].forEach(t=>{let i=a.readdirSync(t);for(let o of i){let p=o.startsWith("_")?o.replace("_","."):o;if(_&&!u.includes("examples")&&o.includes("stylelint"))continue;let g=r.join(s,p);z(r.join(t,o),g)}});let h=D||y(),j={name:"UserName",email:"name@github.com"};function ee(t=!1){let i=h.startsWith("@")?h.split("/")[0].substring(1):De(j.name),o=we||`https://github.com/${i}`;return t&&(o=o.replace(/http(s):\/\//g,"git@").replace(/\//,":")),`${o}/${h.substring(h.indexOf("/")+1)}.git`}ke(),_&&(je(),be(),Ee());let te=se(process.env.npm_config_user_agent),I=te?te.name:"npm";E.which("git")&&(E.exec(`cd ${s} && git init`),u.includes("publish")&&E.exec(`cd ${s} && git remote add origin ${ee(u.includes("ssh"))}`));let J=r.relative(Q,s);switch(console.log(`
|
|
5
5
|
Done. Now run:
|
|
6
|
-
`),s!==Q&&console.log(` cd ${J.includes(" ")?`"${J}"`:J}`),I){case"yarn":console.log(" yarn"),console.log(" yarn dev");break;default:console.log(` ${I} install`),console.log(` ${I} run dev`);break}function
|
|
7
|
-
`,{encoding:"utf-8"});return}if(!a.existsSync(i))return;let o=a.readFileSync(i,"utf-8").replace(new RegExp("{{pkg.name}}","g"),h).replace(new RegExp("{{user.name}}","g"),j.name).replace(new RegExp("{{user.email}}","g"),j.email);a.writeFileSync(i,o)})}function k(t,...i){["dependencies","devDependencies"].forEach(o=>{Object.keys(t[o]||{}).forEach(p=>{i.find(g=>p.includes(g))&&delete t[o][p]})})}function
|
|
6
|
+
`),s!==Q&&console.log(` cd ${J.includes(" ")?`"${J}"`:J}`),I){case"yarn":console.log(" yarn"),console.log(" yarn dev");break;default:console.log(` ${I} install`),console.log(` ${I} run dev`);break}function je(){["LICENSE","README.md","README.zh_CN.md"].forEach(t=>{let i=r.join(s,t);if(!u.includes("publish")&&a.existsSync(i)){a.rmSync(i),t==="README.md"&&a.writeFileSync(i,`# ${h}
|
|
7
|
+
`,{encoding:"utf-8"});return}if(!a.existsSync(i))return;let o=a.readFileSync(i,"utf-8").replace(new RegExp("{{pkg.name}}","g"),h).replace(new RegExp("{{user.name}}","g"),j.name).replace(new RegExp("{{user.email}}","g"),j.email);a.writeFileSync(i,o)})}function k(t,...i){["dependencies","devDependencies"].forEach(o=>{Object.keys(t[o]||{}).forEach(p=>{i.find(g=>p.includes(g))&&delete t[o][p]})})}function ke(){let t=v(r.join(s,"package.json"));t.name=h,u.includes("publish")?(E.which("git")&&(j.name=he("user.name")||Ne.userInfo().username,j.email=he("user.email")||"",t.author=Object.assign({},t.author,j)),t.publishConfig={access:"public",registry:"https://registry.npmjs.org/"},t.repository??={type:"git"},t.repository.url=`git+${ee()}`):(delete t.author,delete t.publishConfig,delete t.repository,delete t.scripts.prepublishOnly,delete t.devDependencies.np),_&&(u.includes("electron")||(k(t,"electron"),t.scripts["lint:eslint"]=t.scripts["lint:eslint"].replace(",electron","")),u.includes("vite")||k(t,"vite")),x(r.join(s,"package.json"),t)}function V(t,i){let o=t.lastIndexOf("."),p=t.substring(0,o)+"."+i+t.substring(o),g=r.join(s,t),d=r.join(s,p);u.includes(i)?(C(g),a.existsSync(d)&&Ge(d,g)):C(d)}function be(){if(V("tsconfig.json","test"),V("jest.config.cjs","electron"),u.includes("test"))return;a.readdirSync(s).filter(o=>o.startsWith("jest.config")||["test"].includes(o)).forEach(o=>{C(r.join(s,o))});let t=r.join(s,"package.json"),i=v(t);delete i.scripts.test,i.scripts["lint:eslint"]=i.scripts["lint:eslint"].replace(",test",""),k(i,"jest"),x(t,i)}function Ee(){if(V(".lintstagedrc.cjs","examples"),!u.includes("examples")){let o=v(r.join(s,"package.json"));o.scripts.lint=o.scripts.lint.replace(" lint:stylelint",""),o.scripts["lint:eslint"]=o.scripts["lint:eslint"].replace(",examples",""),delete o.scripts["lint:stylelint"],k(o,"stylelint"),x(r.join(s,"package.json"),o);return}let t=r.join(s,"examples");a.mkdirSync(t);let i=u.includes("electron");["vue","react"].forEach(o=>{let p=U(i?`electron-${o}`:o),g=r.join(t,o);if(!a.existsSync(p)){console.log(`${Te(p)} template is not exist`);return}a.cpSync(p,g,{recursive:!0});let d=v(r.join(g,"package.json"));Object.keys(d.scripts).forEach(b=>{(b.startsWith("lint")||["prepare"].includes(b))&&delete d.scripts[b]}),k(d,"eslint","prettier","stylelint","commitlint","husky","lint-staged","tsconfig","lint-staged","npm-run-all"),x(r.join(g,"package.json"),d),["_lintstagedrc.cjs"].forEach(b=>{let ne=r.join(g,b);a.existsSync(ne)&&a.rmSync(ne,{recursive:!0})})}),a.writeFileSync(r.join(s,"pnpm-workspace.yaml"),`packages:
|
|
8
8
|
- 'examples/*'`,{encoding:"utf-8"})}}K().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.8.1",
|
|
4
4
|
"description": "create tomjs web app",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"tomjs",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
},
|
|
37
37
|
"repository": {
|
|
38
38
|
"type": "git",
|
|
39
|
-
"url": "git+https://github.com/
|
|
39
|
+
"url": "git+https://github.com/tomjs/create-app.git"
|
|
40
40
|
},
|
|
41
41
|
"publishConfig": {
|
|
42
42
|
"access": "public",
|
|
@@ -51,11 +51,11 @@
|
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@commitlint/cli": "^18.4.3",
|
|
54
|
-
"@tomjs/commitlint": "^2.
|
|
55
|
-
"@tomjs/eslint": "^1.1
|
|
56
|
-
"@tomjs/prettier": "^1.
|
|
57
|
-
"@tomjs/stylelint": "^2.
|
|
58
|
-
"@tomjs/tsconfig": "^1.1
|
|
54
|
+
"@tomjs/commitlint": "^2.1.1",
|
|
55
|
+
"@tomjs/eslint": "^1.2.1",
|
|
56
|
+
"@tomjs/prettier": "^1.1.1",
|
|
57
|
+
"@tomjs/stylelint": "^2.1.1",
|
|
58
|
+
"@tomjs/tsconfig": "^1.2.1",
|
|
59
59
|
"@types/lodash-es": "^4.17.12",
|
|
60
60
|
"@types/minimist": "^1.2.5",
|
|
61
61
|
"@types/node": "^18.19.3",
|
|
@@ -20,18 +20,18 @@
|
|
|
20
20
|
"prepare": "husky install"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@tomjs/electron-devtools-installer": "^2.0.
|
|
23
|
+
"@tomjs/electron-devtools-installer": "^2.0.6",
|
|
24
24
|
"react": "^18.2.0",
|
|
25
25
|
"react-dom": "^18.2.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@commitlint/cli": "^18.4.3",
|
|
29
|
-
"@tomjs/commitlint": "^2.
|
|
30
|
-
"@tomjs/eslint": "^1.1
|
|
31
|
-
"@tomjs/prettier": "^1.
|
|
32
|
-
"@tomjs/stylelint": "^2.
|
|
33
|
-
"@tomjs/tsconfig": "^1.1
|
|
34
|
-
"@tomjs/vite-plugin-electron": "^1.
|
|
29
|
+
"@tomjs/commitlint": "^2.1.1",
|
|
30
|
+
"@tomjs/eslint": "^1.2.1",
|
|
31
|
+
"@tomjs/prettier": "^1.1.1",
|
|
32
|
+
"@tomjs/stylelint": "^2.1.1",
|
|
33
|
+
"@tomjs/tsconfig": "^1.2.1",
|
|
34
|
+
"@tomjs/vite-plugin-electron": "^1.8.0",
|
|
35
35
|
"@types/node": "^18.19.3",
|
|
36
36
|
"@types/react": "^18.2.45",
|
|
37
37
|
"@types/react-dom": "^18.2.18",
|
|
@@ -20,17 +20,17 @@
|
|
|
20
20
|
"prepare": "husky install"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@tomjs/electron-devtools-installer": "^2.0.
|
|
24
|
-
"vue": "^3.3.
|
|
23
|
+
"@tomjs/electron-devtools-installer": "^2.0.6",
|
|
24
|
+
"vue": "^3.3.13"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@commitlint/cli": "^18.4.3",
|
|
28
|
-
"@tomjs/commitlint": "^2.
|
|
29
|
-
"@tomjs/eslint": "^1.1
|
|
30
|
-
"@tomjs/prettier": "^1.
|
|
31
|
-
"@tomjs/stylelint": "^2.
|
|
32
|
-
"@tomjs/tsconfig": "^1.1
|
|
33
|
-
"@tomjs/vite-plugin-electron": "^1.
|
|
28
|
+
"@tomjs/commitlint": "^2.1.1",
|
|
29
|
+
"@tomjs/eslint": "^1.2.1",
|
|
30
|
+
"@tomjs/prettier": "^1.1.1",
|
|
31
|
+
"@tomjs/stylelint": "^2.1.1",
|
|
32
|
+
"@tomjs/tsconfig": "^1.2.1",
|
|
33
|
+
"@tomjs/vite-plugin-electron": "^1.8.0",
|
|
34
34
|
"@types/node": "^18.19.3",
|
|
35
35
|
"@vitejs/plugin-vue": "^4.5.2",
|
|
36
36
|
"cross-env": "^7.0.3",
|
|
@@ -53,11 +53,11 @@
|
|
|
53
53
|
"@commitlint/cli": "^18.4.3",
|
|
54
54
|
"@jest/globals": "^29.7.0",
|
|
55
55
|
"@kayahr/jest-electron-runner": "^29.10.0",
|
|
56
|
-
"@tomjs/commitlint": "^2.
|
|
57
|
-
"@tomjs/eslint": "^1.1
|
|
58
|
-
"@tomjs/prettier": "^1.
|
|
59
|
-
"@tomjs/stylelint": "^2.
|
|
60
|
-
"@tomjs/tsconfig": "^1.1
|
|
56
|
+
"@tomjs/commitlint": "^2.1.1",
|
|
57
|
+
"@tomjs/eslint": "^1.2.1",
|
|
58
|
+
"@tomjs/prettier": "^1.1.1",
|
|
59
|
+
"@tomjs/stylelint": "^2.1.1",
|
|
60
|
+
"@tomjs/tsconfig": "^1.2.1",
|
|
61
61
|
"@types/jest": "^29.5.11",
|
|
62
62
|
"@types/node": "^18.19.3",
|
|
63
63
|
"cross-env": "^7.0.3",
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@commitlint/cli": "^18.4.3",
|
|
25
|
-
"@tomjs/commitlint": "^2.
|
|
26
|
-
"@tomjs/eslint": "^1.1
|
|
27
|
-
"@tomjs/prettier": "^1.
|
|
28
|
-
"@tomjs/stylelint": "^2.
|
|
29
|
-
"@tomjs/tsconfig": "^1.1
|
|
25
|
+
"@tomjs/commitlint": "^2.1.1",
|
|
26
|
+
"@tomjs/eslint": "^1.2.1",
|
|
27
|
+
"@tomjs/prettier": "^1.1.1",
|
|
28
|
+
"@tomjs/stylelint": "^2.1.1",
|
|
29
|
+
"@tomjs/tsconfig": "^1.2.1",
|
|
30
30
|
"@types/node": "^18.19.3",
|
|
31
31
|
"@types/react": "^18.2.45",
|
|
32
32
|
"@types/react-dom": "^18.2.18",
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// A launch configuration that compiles the extension and then opens it inside a new window
|
|
2
|
+
// Use IntelliSense to learn about possible attributes.
|
|
3
|
+
// Hover to view descriptions of existing attributes.
|
|
4
|
+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
5
|
+
{
|
|
6
|
+
"version": "0.2.0",
|
|
7
|
+
"configurations": [
|
|
8
|
+
{
|
|
9
|
+
"name": "Debug Extension",
|
|
10
|
+
"type": "extensionHost",
|
|
11
|
+
"request": "launch",
|
|
12
|
+
"args": [
|
|
13
|
+
"--extensionDevelopmentPath=${workspaceFolder}"
|
|
14
|
+
],
|
|
15
|
+
"outFiles": [
|
|
16
|
+
"${workspaceFolder}/dist/*.js"
|
|
17
|
+
],
|
|
18
|
+
"preLaunchTask": "${defaultBuildTask}"
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
|
2
|
+
// for the documentation about the tasks.json format
|
|
3
|
+
{
|
|
4
|
+
"version": "2.0.0",
|
|
5
|
+
"tasks": [
|
|
6
|
+
{
|
|
7
|
+
"type": "npm",
|
|
8
|
+
"script": "dev",
|
|
9
|
+
"problemMatcher": {
|
|
10
|
+
"owner": "typescript",
|
|
11
|
+
"fileLocation": "relative",
|
|
12
|
+
"pattern": {
|
|
13
|
+
"regexp": "^([a-zA-Z]\\:\/?([\\w\\-]\/?)+\\.\\w+):(\\d+):(\\d+): (ERROR|WARNING)\\: (.*)$",
|
|
14
|
+
"file": 1,
|
|
15
|
+
"line": 3,
|
|
16
|
+
"column": 4,
|
|
17
|
+
"code": 5,
|
|
18
|
+
"message": 6
|
|
19
|
+
},
|
|
20
|
+
"background": {
|
|
21
|
+
"activeOnStart": true,
|
|
22
|
+
"beginsPattern": "^.*Build start*$",
|
|
23
|
+
"endsPattern": "^.*Build success.*$"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"isBackground": true,
|
|
27
|
+
"presentation": {
|
|
28
|
+
"reveal": "never"
|
|
29
|
+
},
|
|
30
|
+
"group": {
|
|
31
|
+
"kind": "build",
|
|
32
|
+
"isDefault": true
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# extension
|
|
2
|
+
|
|
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
|
+
```
|
|
@@ -0,0 +1,14 @@
|
|
|
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>
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "template-vscode",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "vscode extension template",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "name",
|
|
7
|
+
"email": "name@github.com"
|
|
8
|
+
},
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": ">=14",
|
|
12
|
+
"vscode": "^1.56.0"
|
|
13
|
+
},
|
|
14
|
+
"main": "dist/index.js",
|
|
15
|
+
"activationEvents": [
|
|
16
|
+
"onCommand:hello-world.showHelloWorld"
|
|
17
|
+
],
|
|
18
|
+
"contributes": {
|
|
19
|
+
"commands": [
|
|
20
|
+
{
|
|
21
|
+
"command": "hello-world.showHelloWorld",
|
|
22
|
+
"title": "Hello World: Show"
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public",
|
|
28
|
+
"registry": "https://registry.npmjs.org/"
|
|
29
|
+
},
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "git+https://github.com/xxx/template.git"
|
|
33
|
+
},
|
|
34
|
+
"scripts": {
|
|
35
|
+
"dev": "tsup --watch",
|
|
36
|
+
"build": "tsup --minify",
|
|
37
|
+
"lint": "run-s lint:eslint lint:prettier",
|
|
38
|
+
"lint:eslint": "eslint \"{src,scripts}/**/*.{js,cjs,ts}\" *.{js,cjs,ts} --fix --cache",
|
|
39
|
+
"lint:prettier": "prettier --write .",
|
|
40
|
+
"prepare": "husky install"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@commitlint/cli": "^18.4.3",
|
|
44
|
+
"@tomjs/commitlint": "^2.1.1",
|
|
45
|
+
"@tomjs/eslint": "^1.2.1",
|
|
46
|
+
"@tomjs/prettier": "^1.1.1",
|
|
47
|
+
"@tomjs/tsconfig": "^1.2.1",
|
|
48
|
+
"@types/node": "^18.19.3",
|
|
49
|
+
"@types/vscode": "^1.85.0",
|
|
50
|
+
"@vitejs/plugin-vue": "^4.5.2",
|
|
51
|
+
"cross-env": "^7.0.3",
|
|
52
|
+
"eslint": "^8.56.0",
|
|
53
|
+
"husky": "^8.0.3",
|
|
54
|
+
"lint-staged": "^15.2.0",
|
|
55
|
+
"npm-run-all": "^4.1.5",
|
|
56
|
+
"prettier": "^3.1.1",
|
|
57
|
+
"rimraf": "^5.0.5",
|
|
58
|
+
"tsup": "^8.0.1",
|
|
59
|
+
"tsx": "^4.7.0",
|
|
60
|
+
"typescript": "~5.3.3"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { commands, ExtensionContext, window } from 'vscode';
|
|
2
|
+
|
|
3
|
+
export function activate(context: ExtensionContext) {
|
|
4
|
+
// Create the show hello world command
|
|
5
|
+
const showHelloWorldCommand = commands.registerCommand('hello-world.showHelloWorld', async () => {
|
|
6
|
+
window.showInformationMessage('Hello World');
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
// Add command to the extension context
|
|
10
|
+
context.subscriptions.push(showHelloWorldCommand);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function deactivate() {}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineConfig } from 'tsup';
|
|
2
|
+
|
|
3
|
+
export default defineConfig(options => {
|
|
4
|
+
return {
|
|
5
|
+
entry: ['src/index.ts'],
|
|
6
|
+
format: ['cjs'],
|
|
7
|
+
target: ['es2020', 'node14'],
|
|
8
|
+
external: ['vscode'],
|
|
9
|
+
clean: true,
|
|
10
|
+
splitting: true,
|
|
11
|
+
sourcemap: !!options.watch,
|
|
12
|
+
};
|
|
13
|
+
});
|
|
@@ -27,7 +27,7 @@ vite + extension + vue
|
|
|
27
27
|
|
|
28
28
|
## Debug
|
|
29
29
|
|
|
30
|
-
Run `
|
|
30
|
+
Run `Debug Extension` through `vscode` to debug. For debugging tools, refer to [Official Documentation](https://code.visualstudio.com/docs/editor/debugging)
|
|
31
31
|
|
|
32
32
|
`launch.json` is configured as follows:
|
|
33
33
|
|
|
@@ -36,7 +36,7 @@ Run `Run Extension` through `vscode` to debug. For debugging tools, refer to [Of
|
|
|
36
36
|
"version": "0.2.0",
|
|
37
37
|
"configurations": [
|
|
38
38
|
{
|
|
39
|
-
"name": "
|
|
39
|
+
"name": "Debug Extension",
|
|
40
40
|
"type": "extensionHost",
|
|
41
41
|
"request": "launch",
|
|
42
42
|
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "vscode
|
|
2
|
+
"name": "template-vscode",
|
|
3
3
|
"version": "0.0.0",
|
|
4
|
-
"description": "vite + vscode +
|
|
4
|
+
"description": "vite + vscode + react",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=14",
|
|
7
7
|
"vscode": "^1.56.0"
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"repository": {
|
|
26
26
|
"type": "git",
|
|
27
|
-
"url": "git+https://github.com/xxx/
|
|
27
|
+
"url": "git+https://github.com/xxx/template.git"
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|
|
30
30
|
"dev": "vite",
|
|
@@ -43,13 +43,13 @@
|
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@commitlint/cli": "^18.4.3",
|
|
46
|
-
"@tomjs/commitlint": "^2.
|
|
47
|
-
"@tomjs/eslint": "^1.1
|
|
48
|
-
"@tomjs/prettier": "^1.
|
|
49
|
-
"@tomjs/stylelint": "^2.
|
|
50
|
-
"@tomjs/tsconfig": "^1.1
|
|
51
|
-
"@tomjs/vite-plugin-vscode": "^1.
|
|
52
|
-
"@tomjs/vscode-extension-webview": "^1.0
|
|
46
|
+
"@tomjs/commitlint": "^2.1.1",
|
|
47
|
+
"@tomjs/eslint": "^1.2.1",
|
|
48
|
+
"@tomjs/prettier": "^1.1.1",
|
|
49
|
+
"@tomjs/stylelint": "^2.1.1",
|
|
50
|
+
"@tomjs/tsconfig": "^1.2.1",
|
|
51
|
+
"@tomjs/vite-plugin-vscode": "^1.1.0",
|
|
52
|
+
"@tomjs/vscode-extension-webview": "^1.1.0",
|
|
53
53
|
"@types/node": "^18.19.3",
|
|
54
54
|
"@types/react": "^18.2.45",
|
|
55
55
|
"@types/react-dom": "^18.2.18",
|
|
@@ -27,7 +27,7 @@ vite + extension + vue
|
|
|
27
27
|
|
|
28
28
|
## Debug
|
|
29
29
|
|
|
30
|
-
Run `
|
|
30
|
+
Run `Debug Extension` through `vscode` to debug. For debugging tools, refer to [Official Documentation](https://code.visualstudio.com/docs/editor/debugging)
|
|
31
31
|
|
|
32
32
|
`launch.json` is configured as follows:
|
|
33
33
|
|
|
@@ -36,7 +36,7 @@ Run `Run Extension` through `vscode` to debug. For debugging tools, refer to [Of
|
|
|
36
36
|
"version": "0.2.0",
|
|
37
37
|
"configurations": [
|
|
38
38
|
{
|
|
39
|
-
"name": "
|
|
39
|
+
"name": "Debug Extension",
|
|
40
40
|
"type": "extensionHost",
|
|
41
41
|
"request": "launch",
|
|
42
42
|
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "vscode
|
|
2
|
+
"name": "template-vscode",
|
|
3
3
|
"version": "0.0.0",
|
|
4
4
|
"description": "vite + vscode + vue",
|
|
5
5
|
"engines": {
|
|
@@ -38,17 +38,17 @@
|
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@vscode/webview-ui-toolkit": "^1.4.0",
|
|
41
|
-
"vue": "^3.3.
|
|
41
|
+
"vue": "^3.3.13"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@commitlint/cli": "^18.4.3",
|
|
45
|
-
"@tomjs/commitlint": "^2.
|
|
46
|
-
"@tomjs/eslint": "^1.1
|
|
47
|
-
"@tomjs/prettier": "^1.
|
|
48
|
-
"@tomjs/stylelint": "^2.
|
|
49
|
-
"@tomjs/tsconfig": "^1.1
|
|
50
|
-
"@tomjs/vite-plugin-vscode": "^1.
|
|
51
|
-
"@tomjs/vscode-extension-webview": "^1.0
|
|
45
|
+
"@tomjs/commitlint": "^2.1.1",
|
|
46
|
+
"@tomjs/eslint": "^1.2.1",
|
|
47
|
+
"@tomjs/prettier": "^1.1.1",
|
|
48
|
+
"@tomjs/stylelint": "^2.1.1",
|
|
49
|
+
"@tomjs/tsconfig": "^1.2.1",
|
|
50
|
+
"@tomjs/vite-plugin-vscode": "^1.1.0",
|
|
51
|
+
"@tomjs/vscode-extension-webview": "^1.1.0",
|
|
52
52
|
"@types/node": "^18.19.3",
|
|
53
53
|
"@types/vscode": "^1.85.0",
|
|
54
54
|
"@types/vscode-webview": "^1.57.4",
|
|
@@ -17,15 +17,15 @@
|
|
|
17
17
|
"prepare": "husky install"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"vue": "^3.3.
|
|
20
|
+
"vue": "^3.3.13"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@commitlint/cli": "^18.4.3",
|
|
24
|
-
"@tomjs/commitlint": "^2.
|
|
25
|
-
"@tomjs/eslint": "^1.1
|
|
26
|
-
"@tomjs/prettier": "^1.
|
|
27
|
-
"@tomjs/stylelint": "^2.
|
|
28
|
-
"@tomjs/tsconfig": "^1.1
|
|
24
|
+
"@tomjs/commitlint": "^2.1.1",
|
|
25
|
+
"@tomjs/eslint": "^1.2.1",
|
|
26
|
+
"@tomjs/prettier": "^1.1.1",
|
|
27
|
+
"@tomjs/stylelint": "^2.1.1",
|
|
28
|
+
"@tomjs/tsconfig": "^1.2.1",
|
|
29
29
|
"@types/node": "^18.19.3",
|
|
30
30
|
"@vitejs/plugin-vue": "^4.5.2",
|
|
31
31
|
"cross-env": "^7.0.3",
|