create-banana 2.2.3 → 2.3.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.
Files changed (45) hide show
  1. package/dist/index.js +14 -14
  2. package/dist/template/Eslint/TS/eslint.config.ts.ejs +68 -0
  3. package/dist/template/Eslint/TS/package.json +16 -0
  4. package/dist/template/Eslint/TS/prettierPkg.json +6 -0
  5. package/dist/template/Eslint/eslint.config.js.ejs +2 -2
  6. package/dist/template/Prettier/.prettierignore +43 -0
  7. package/dist/template/base/TS/ejs/App.vue.ejs +148 -0
  8. package/dist/template/base/{static/README.md → TS/ejs/README.md.ejs} +6 -2
  9. package/dist/template/base/TS/ejs/main.ts.ejs +18 -0
  10. package/dist/template/base/TS/static/_gitignore +38 -0
  11. package/dist/template/base/TS/static/env.d.ts +1 -0
  12. package/dist/template/base/TS/static/index.html +13 -0
  13. package/dist/template/base/TS/static/package.json +30 -0
  14. package/dist/template/base/TS/static/public/favicon.ico +0 -0
  15. package/dist/template/base/TS/static/src/assets/base.css +86 -0
  16. package/dist/template/base/TS/static/src/assets/logo.svg +1 -0
  17. package/dist/template/base/TS/static/src/assets/main.css +35 -0
  18. package/dist/template/base/TS/static/src/components/HelloWorld.vue +41 -0
  19. package/dist/template/base/TS/static/src/components/TheWelcome.vue +95 -0
  20. package/dist/template/base/TS/static/src/components/WelcomeItem.vue +87 -0
  21. package/dist/template/base/TS/static/src/components/icons/IconCommunity.vue +7 -0
  22. package/dist/template/base/TS/static/src/components/icons/IconDocumentation.vue +7 -0
  23. package/dist/template/base/TS/static/src/components/icons/IconEcosystem.vue +7 -0
  24. package/dist/template/base/TS/static/src/components/icons/IconSupport.vue +7 -0
  25. package/dist/template/base/TS/static/src/components/icons/IconTooling.vue +19 -0
  26. package/dist/template/base/TS/static/tsconfig.app.json +12 -0
  27. package/dist/template/base/TS/static/tsconfig.json +11 -0
  28. package/dist/template/base/TS/static/tsconfig.node.json +19 -0
  29. package/dist/template/base/TS/static/vite.config.ts +18 -0
  30. package/dist/template/base/ejs/README.md.ejs +38 -0
  31. package/dist/template/base/static/package.json +1 -1
  32. package/dist/template/pinia/TS/counter.ts +11 -0
  33. package/dist/template/pinia/TS/package.json +5 -0
  34. package/dist/template/pinia/TS/pinia-plugin-persistedstate/key.ts +11 -0
  35. package/dist/template/pinia/TS/pinia-plugin-persistedstate/package.json +5 -0
  36. package/dist/template/vue-router/TS/ejs/AboutView.vue.ejs +21 -0
  37. package/dist/template/vue-router/TS/ejs/router/index.ts.ejs +39 -0
  38. package/dist/template/vue-router/TS/package.json +5 -0
  39. package/dist/template/vue-router/TS/static/components/TitleText.vue +13 -0
  40. package/dist/template/vue-router/TS/static/views/HomeView.vue +7 -0
  41. package/dist/template/vue-router/TS/static/views/NotFound.vue +7 -0
  42. package/dist/template/vue-router/ejs/router/index.js.ejs +39 -0
  43. package/package.json +1 -1
  44. package/readme.md +12 -0
  45. package/dist/template/vue-router/static/router/index.js +0 -32
package/dist/index.js CHANGED
@@ -1,16 +1,16 @@
1
1
  #!/usr/bin/env node
2
- import wt from"path";import G from"fs-extra";import{select as ot}from"@inquirer/prompts";import it from"chalk";import nt from"ora";var st=async(t,e)=>{try{if(G.pathExistsSync(e))if(!await ot({message:`The target folder "${t}" is existing. ${it.yellow("Overwrite")}?`,choices:[{name:"Yes",value:!0},{name:"No",value:!1}]}))console.log("canceled!"),process.exit(0);else{let o=nt("Overwriting existing folder...").start();await G.remove(e),await G.mkdir(e),o.succeed("Existing folder overwritten.")}}catch(r){console.error(r),process.exit(1)}},J=st;import d from"fs-extra";import y from"path";import at from"ejs";var h=class{targetDir;pkg;fileMiddlewares;constructor(e){this.targetDir=e,this.pkg={},this.fileMiddlewares=[]}writePkg(e){this.pkg={...this.pkg,...e}}extendDepsPkg(e){this.pkg.dependencies={...this.pkg.dependencies,...e.dependencies}}extendDevDepsPkg(e){this.pkg.devDependencies={...this.pkg.devDependencies,...e.devDependencies}}extendScriptsPkg(e){this.pkg.scripts={...this.pkg.scripts,...e.scripts}}copy(e,r){this.fileMiddlewares.push(()=>{d.copySync(e,y.join(this.targetDir,r))})}rename(e,r){this.fileMiddlewares.push(()=>{d.renameSync(y.join(this.targetDir,e),y.join(this.targetDir,r))})}render(e,r,o){this.fileMiddlewares.push(()=>{d.outputFileSync(y.join(this.targetDir,r),at.render(d.readFileSync(e,"utf-8"),o))})}async generate(){this.fileMiddlewares.forEach(e=>e()),d.writeFileSync(y.join(this.targetDir,"package.json"),JSON.stringify(this.pkg,null,2))}};import j from"chalk";import{input as mt,checkbox as ct}from"@inquirer/prompts";import{select as pt}from"@inquirer/prompts";var m=async t=>await pt({message:t,choices:[{name:"Yes",value:!0},{name:"No",value:!1}]});var L=async()=>await mt({message:`Enter your ${j.yellow("project name")}:`,required:!0}),M=async()=>{let t=await ct({message:`Please select the ${j.yellow("features")} to include:`,choices:[{name:"Eslint",value:"eslint"},{name:"Prettier",value:"prettier"},{name:"Pinia",value:"pinia"},{name:"Vue-Router",value:"vue-router"},{name:"Commitizen",value:"commitizen"}]}),e=t.includes("eslint"),r=t.includes("prettier"),o=t.includes("pinia"),i=t.includes("vue-router"),n=t.includes("commitizen"),s=!1;o&&(s=await m(`Do you want to use ${j.yellow.bold("pinia-plugin-persistedstate")} for Pinia state persistence?`));let p=!1;(e||r)&&(p=await m(`Do you want to use ${j.yellow.bold("Husky")} for Git hooks?`));let A=!1;return p&&(A=await m(`Do you want to use ${j.yellow.bold("lint-staged")} to run linters on staged files?`)),{useEslint:e,usePrettier:r,usePinia:o,useVueRouter:i,usePiniaPluginPersistedstate:s,useHusky:p,useLintStaged:A,useCommitizen:n}};import ut from"figlet";var lt=async t=>{try{return await ut.text(t,{font:"Big Money-se",horizontalLayout:"default",verticalLayout:"default",width:80,whitespaceBreak:!0})}catch(e){console.log("Something went wrong..."),console.dir(e)}},E=lt;import gt from"chalk";function ft(t,e,r){e/=100,r/=100;let o=s=>(s+t/30)%12,i=e*Math.min(r,1-r),n=s=>r-i*Math.max(-1,Math.min(o(s)-3,Math.min(9-o(s),1)));return[Math.round(255*n(0)),Math.round(255*n(8)),Math.round(255*n(4))]}function dt(t){return t.split("").map((e,r)=>{let o=r/t.length*360,[i,n,s]=ft(o,100,50);return gt.rgb(i,n,s)(e)}).join("")}var T=dt;import f from"chalk";import C from"boxen";var k=console.log,P=[22,198,12],l,I=(t,{useEslint:e,usePrettier:r,useHusky:o})=>{l=e?"pnpm i && pnpm lint":r?"pnpm i && pnpm format":"pnpm i",l=o?`cd ${t} && git init && `+l:`cd ${t} && `+l,k(f.cyan(C(f.rgb(...P)(`
3
- ${l}
4
- `),{title:"commands",titleAlignment:"center"})))},S,R=(t,{useHusky:e,useCommitizen:r})=>{S=e?`cd ${t} && git add .`:`cd ${t} && git init && git add .`,S+=` && ${r?"pnpm commit":'git commit -m "Initial commit"'}`,k(f.cyan(C(f.rgb(...P)(`
5
- ${S}
6
- `),{title:"commands",titleAlignment:"center"})))},x,F=(t,{useCommitizen:e})=>{e&&(x=`cd ${t} && pnpm i -g commitizen && commitizen init cz-conventional-changelog --pnpm --save-dev --save-exact`,k(f.cyan(C(f.rgb(...P)(`
7
- ${x}
8
- `),{title:"commands",titleAlignment:"center"})),`
9
- `))},_=async()=>{k(T(await E("BANANA")))},v=async t=>{k(T(t))};import ht from"fs-extra";import{fileURLToPath as yt}from"url";var a=yt(new URL("../dist/template",import.meta.url));import g from"path";var B=(t,e)=>{let r=g.join(a,"base");t.writePkg(ht.readJSONSync(g.join(r,"static","package.json"))),t.copy(g.join(r,"static"),""),t.rename("_gitignore",".gitignore"),t.render(g.join(r,"ejs","App.vue.ejs"),g.join("src","App.vue"),{...e}),t.render(g.join(r,"ejs","main.js.ejs"),g.join("src","main.js"),{...e})};import V from"fs-extra";import c from"path";var H=(t,e)=>{let{usePinia:r,usePiniaPluginPersistedstate:o}=e;if(!r)return;let i=c.join(a,"pinia");if(t.extendDepsPkg(V.readJSONSync(c.join(i,"package.json"))),t.copy(c.join(i,"counter.js"),c.join("src","stores","counter.js")),!o)return;let n=c.join(i,"pinia-plugin-persistedstate");t.extendDepsPkg(V.readJSONSync(c.join(n,"package.json"))),t.copy(c.join(n,"key.js"),c.join("src","stores","key.js"))};import Y from"fs-extra";import b from"path";var U=(t,e)=>{let{useEslint:r,usePrettier:o}=e;if(!r)return;let i=b.join(a,"eslint"),n=Y.readJSONSync(b.join(i,"package.json"));t.extendDevDepsPkg(n),t.extendScriptsPkg(n),t.render(b.join(i,"eslint.config.js.ejs"),"eslint.config.js",{usePrettier:o}),o&&t.extendDevDepsPkg(Y.readJSONSync(b.join(i,"prettierPkg.json")))};import jt from"fs-extra";import O from"path";var q=(t,e)=>{let{usePrettier:r}=e;if(!r)return;let o=O.join(a,"prettier"),i=jt.readJSONSync(O.join(o,"package.json"));t.extendDevDepsPkg(i),t.extendScriptsPkg(i),t.copy(O.join(o,".prettierrc"),".prettierrc")};import St from"fs-extra";import w from"path";var K=(t,e)=>{let{useVueRouter:r,usePiniaPluginPersistedstate:o}=e;if(!r)return;let i=w.join(a,"vue-router");t.extendDepsPkg(St.readJSONSync(w.join(i,"package.json"))),t.copy(w.join(i,"static"),"src"),t.render(w.join(i,"ejs","AboutView.vue.ejs"),w.join("src","views","AboutView.vue"),{usePiniaPluginPersistedstate:o})};import kt from"fs-extra";import u from"path";var Q=(t,e)=>{let{useEslint:r,usePrettier:o,useHusky:i,useLintStaged:n}=e;if(!i)return;let s=u.join(a,"husky"),p=kt.readJSONSync(u.join(s,"package.json"));t.extendDevDepsPkg(p),t.extendScriptsPkg(p),t.copy(u.join(s,"_"),u.join(".husky","_")),t.rename(u.join(".husky","_","_gitignore"),u.join(".husky","_",".gitignore")),t.render(u.join(s,"pre-commit.ejs"),u.join(".husky","pre-commit"),{useEslint:r,usePrettier:o,useLintStaged:n})};import $ from"fs-extra";import D from"path";var W=(t,e)=>{let{useEslint:r,usePrettier:o,useLintStaged:i}=e;if(!i)return;let n=D.join(a,"lintStaged"),s=$.readJSONSync(D.join(n,"package.json"));t.extendDevDepsPkg(s),t.extendScriptsPkg(s);let p={};r?p=$.readJSONSync(D.join(n,"eslint.json")):o&&(p=$.readJSONSync(D.join(n,"prettier.json"))),t.writePkg(p)};import Pt from"fs-extra";import X from"path";var Z=(t,e)=>{let{useCommitizen:r}=e;if(!r)return;let o=X.join(a,"commitizen"),i=Pt.readJSONSync(X.join(o,"package.json"));t.extendScriptsPkg(i)};var tt=async t=>{let e=await M();return B(t,e),H(t,e),U(t,e),q(t,e),K(t,e),Q(t,e),W(t,e),Z(t,e),e};import{execa as z}from"execa";import N from"chalk";var et=async()=>{await m(`Do you want to ${N.yellow.bold("execute")} the above commands now?`)&&(await z({shell:!0,stdio:"inherit"})`${l}`,await m(`Do you want to ${N.yellow.bold("install the commitizen")} now?`)&&await z({shell:!0,stdio:"inherit"})`${x}`,await m(`Do you want to ${N.yellow.bold("execute the git")} commands now?`)&&await z({shell:!0,stdio:"inherit"})`${S}`,console.log(N.rgb(...P).bold(`
10
- All commands executed successfully!
11
- `)))};import xt from"ora";var rt=async()=>{await _();let t=await L(),e=wt.join(process.cwd(),t);await J(t,e);let r=new h(e),o=await tt(r),i=xt("Generating files...").start();await r.generate(),i.succeed("Files generated successfully."),v(`
12
- Project initialization complete. You may execute the following commands:
13
- `),I(t,o),v(`
2
+ import De from"path";import C from"fs-extra";import{select as ae}from"@inquirer/prompts";import pe from"chalk";import ce from"ora";var me=async(e,t)=>{try{if(C.pathExistsSync(t))if(!await ae({message:`The target folder "${e}" is existing. ${pe.yellow("Overwrite")}?`,choices:[{name:"Yes",value:!0},{name:"No",value:!1}]}))console.log("canceled!"),process.exit(0);else{let o=ce("Overwriting existing folder...").start();await C.remove(t),await C.mkdir(t),o.succeed("Existing folder overwritten.")}}catch(r){console.error(r),process.exit(1)}},R=me;import j from"fs-extra";import h from"path";import ue from"ejs";var S=class{projectName;targetDir;pkg;fileMiddlewares;constructor(t,r){this.projectName=t,this.targetDir=r,this.pkg={},this.fileMiddlewares=[]}writePkg(t){this.pkg={...this.pkg,...t}}extendDepsPkg(t){this.pkg.dependencies={...this.pkg.dependencies,...t.dependencies}}extendDevDepsPkg(t){this.pkg.devDependencies={...this.pkg.devDependencies,...t.devDependencies}}extendScriptsPkg(t){this.pkg.scripts={...this.pkg.scripts,...t.scripts}}copy(t,r){this.fileMiddlewares.push(()=>{j.copySync(t,h.join(this.targetDir,r))})}rename(t,r){this.fileMiddlewares.push(()=>{j.renameSync(h.join(this.targetDir,t),h.join(this.targetDir,r))})}render(t,r,o){this.fileMiddlewares.push(()=>{j.outputFileSync(h.join(this.targetDir,r),ue.render(j.readFileSync(t,"utf-8"),o))})}async generate(){this.fileMiddlewares.forEach(t=>t()),j.writeFileSync(h.join(this.targetDir,"package.json"),JSON.stringify(this.pkg,null,2))}};import d from"chalk";import{input as ge,checkbox as de,select as fe}from"@inquirer/prompts";import{select as le}from"@inquirer/prompts";var c=async e=>await le({message:e,choices:[{name:"Yes",value:!0},{name:"No",value:!1}]});var I=async()=>await ge({message:`Enter your ${d.yellow("project name")}:`,required:!0,validate:e=>/[\\/:*?"<>|]/.test(e)?'Project name cannot contain special characters like \\ / : * ? " < > |':!0}),H=async()=>{let e=await c(`Do you want to use ${d.yellow.bold("TypeScript")} in your project?`),t=await de({message:`Please select the ${d.yellow("features")} to include:`,choices:[{name:"Eslint",value:"eslint"},{name:"Prettier",value:"prettier"},{name:"Pinia",value:"pinia"},{name:"Vue-Router",value:"vue-router"},{name:"Commitizen",value:"commitizen"}]}),r=t.includes("eslint"),o=t.includes("prettier"),i=t.includes("pinia"),n=t.includes("vue-router"),s=t.includes("commitizen"),p=!1;i&&(p=await c(`Do you want to use ${d.yellow.bold("pinia-plugin-persistedstate")} for Pinia state persistence?`));let L=!1,z=!1;if(n){let E=await fe({message:`Select the ${d.yellow("Vue-Router mode")} to use:`,choices:[{name:"HTML5 Mode",value:"html5"},{name:"Hash Mode",value:"hash"}]});L=E.includes("html5"),z=E.includes("hash")}let N=!1;(r||o)&&(N=await c(`Do you want to use ${d.yellow.bold("Husky")} for Git hooks?`));let J=!1;return N&&(J=await c(`Do you want to use ${d.yellow.bold("lint-staged")} to run linters on staged files?`)),{useTypescript:e,useEslint:r,usePrettier:o,usePinia:i,useVueRouter:n,usePiniaPluginPersistedstate:p,useHusky:N,useLintStaged:J,useCommitizen:s,useHTML5Mode:L,useHashMode:z}};import ye from"figlet";var je=async e=>{try{return await ye.text(e,{font:"Big Money-se",horizontalLayout:"default",verticalLayout:"default",width:80,whitespaceBreak:!0})}catch(t){console.log("Something went wrong..."),console.dir(t)}},F=je;import he from"chalk";function Se(e,t,r){t/=100,r/=100;let o=s=>(s+e/30)%12,i=t*Math.min(r,1-r),n=s=>r-i*Math.max(-1,Math.min(o(s)-3,Math.min(9-o(s),1)));return[Math.round(255*n(0)),Math.round(255*n(8)),Math.round(255*n(4))]}function ke(e){return e.split("").map((t,r)=>{let o=r/e.length*360,[i,n,s]=Se(o,100,50);return he.rgb(i,n,s)(t)}).join("")}var G=ke;import y from"chalk";import M from"boxen";var w=console.log,P=[22,198,12],f,V=(e,{useEslint:t,usePrettier:r,useHusky:o})=>{f=t?"pnpm i && pnpm lint":r?"pnpm i && pnpm format":"pnpm i",f=o?`cd ${e} && git init && `+f:`cd ${e} && `+f,w(y.cyan(M(y.rgb(...P)(`
3
+ ${f}
4
+ `),{title:"commands",titleAlignment:"center"})))},k,_=(e,{useHusky:t,useCommitizen:r})=>{k=t?`cd ${e} && git add .`:`cd ${e} && git init && git add .`,k+=` && ${r?"pnpm commit":'git commit -m "Initial commit"'}`,w(y.cyan(M(y.rgb(...P)(`
5
+ ${k}
6
+ `),{title:"commands",titleAlignment:"center"})))},v,B=(e,{useCommitizen:t})=>{t&&(T(`
14
7
  To set up Commitizen, run the following command:
15
- `),F(t,o),v(`And initialize Git using the following commands:
16
- `),R(t,o),await et()};await rt();
8
+ `),v=`cd ${e} && pnpm i -g commitizen && commitizen init cz-conventional-changelog --pnpm --save-dev --save-exact`,w(y.cyan(M(y.rgb(...P)(`
9
+ ${v}
10
+ `),{title:"commands",titleAlignment:"center"}))))},Y=async()=>{w(G(await F("BANANA")))},T=async e=>{w(G(e))};import Pe from"fs-extra";import{fileURLToPath as we}from"url";var a=we(new URL("../dist/template",import.meta.url));import m from"path";var U=(e,t)=>{let r=t.useTypescript?m.join(a,"base","TS"):m.join(a,"base");e.writePkg(Pe.readJSONSync(m.join(r,"static","package.json"))),e.copy(m.join(r,"static"),""),e.rename("_gitignore",".gitignore"),e.render(m.join(r,"ejs","App.vue.ejs"),m.join("src","App.vue"),{...t}),e.render(m.join(r,"ejs",t.useTypescript?"main.ts.ejs":"main.js.ejs"),m.join("src",t.useTypescript?"main.ts":"main.js"),{...t}),e.render(m.join(r,"ejs","README.md.ejs"),"README.md",{projectName:e.projectName})};import q from"fs-extra";import u from"path";var K=(e,t)=>{let{usePinia:r,usePiniaPluginPersistedstate:o,useTypescript:i}=t;if(!r)return;let n=i?u.join(a,"pinia","TS"):u.join(a,"pinia");if(e.extendDepsPkg(q.readJSONSync(u.join(n,"package.json"))),e.copy(u.join(n,i?"counter.ts":"counter.js"),u.join("src","stores",i?"counter.ts":"counter.js")),!o)return;let s=u.join(n,"pinia-plugin-persistedstate");e.extendDepsPkg(q.readJSONSync(u.join(s,"package.json"))),e.copy(u.join(s,i?"key.ts":"key.js"),u.join("src","stores",i?"key.ts":"key.js"))};import Q from"fs-extra";import x from"path";var W=(e,t)=>{let{useEslint:r,usePrettier:o,useTypescript:i}=t;if(!r)return;let n=i?x.join(a,"eslint","TS"):x.join(a,"eslint"),s=Q.readJSONSync(x.join(n,"package.json"));e.extendDevDepsPkg(s),e.extendScriptsPkg(s),e.render(x.join(n,i?"eslint.config.ts.ejs":"eslint.config.js.ejs"),i?"eslint.config.ts":"eslint.config.js",{usePrettier:o}),o&&e.extendDevDepsPkg(Q.readJSONSync(x.join(n,"prettierPkg.json")))};import xe from"fs-extra";import b from"path";var X=(e,t)=>{let{usePrettier:r}=t;if(!r)return;let o=b.join(a,"prettier"),i=xe.readJSONSync(b.join(o,"package.json"));e.extendDevDepsPkg(i),e.extendScriptsPkg(i),e.copy(b.join(o,".prettierrc"),".prettierrc"),e.copy(b.join(o,".prettierignore"),".prettierignore")};import ve from"fs-extra";import l from"path";var Z=(e,t)=>{let{useVueRouter:r,usePiniaPluginPersistedstate:o,useTypescript:i,useHTML5Mode:n,useHashMode:s}=t;if(!r)return;let p=i?l.join(a,"vue-router","TS"):l.join(a,"vue-router");e.extendDepsPkg(ve.readJSONSync(l.join(p,"package.json"))),e.copy(l.join(p,"static"),"src"),e.render(l.join(p,"ejs","AboutView.vue.ejs"),l.join("src","views","AboutView.vue"),{usePiniaPluginPersistedstate:o}),e.render(l.join(p,"ejs","router",i?"index.ts.ejs":"index.js.ejs"),l.join("src","router",i?"index.ts":"index.js"),{useHTML5Mode:n,useHashMode:s})};import Te from"fs-extra";import g from"path";var ee=(e,t)=>{let{useEslint:r,usePrettier:o,useHusky:i,useLintStaged:n}=t;if(!i)return;let s=g.join(a,"husky"),p=Te.readJSONSync(g.join(s,"package.json"));e.extendDevDepsPkg(p),e.extendScriptsPkg(p),e.copy(g.join(s,"_"),g.join(".husky","_")),e.rename(g.join(".husky","_","_gitignore"),g.join(".husky","_",".gitignore")),e.render(g.join(s,"pre-commit.ejs"),g.join(".husky","pre-commit"),{useEslint:r,usePrettier:o,useLintStaged:n})};import $ from"fs-extra";import D from"path";var te=(e,t)=>{let{useEslint:r,usePrettier:o,useLintStaged:i}=t;if(!i)return;let n=D.join(a,"lintStaged"),s=$.readJSONSync(D.join(n,"package.json"));e.extendDevDepsPkg(s),e.extendScriptsPkg(s);let p={};r?p=$.readJSONSync(D.join(n,"eslint.json")):o&&(p=$.readJSONSync(D.join(n,"prettier.json"))),e.writePkg(p)};import be from"fs-extra";import re from"path";var oe=(e,t)=>{let{useCommitizen:r}=t;if(!r)return;let o=re.join(a,"commitizen"),i=be.readJSONSync(re.join(o,"package.json"));e.extendScriptsPkg(i)};var ie=async e=>{let t=await H();return U(e,t),K(e,t),W(e,t),X(e,t),Z(e,t),ee(e,t),te(e,t),oe(e,t),t};import{execa as O}from"execa";import A from"chalk";var ne=async e=>{await c(`Do you want to ${A.yellow.bold("execute")} the above commands now?`)&&(await O({shell:!0,stdio:"inherit"})`${f}`,e.useCommitizen&&await c(`Do you want to ${A.yellow.bold("install the commitizen")} now?`)&&await O({shell:!0,stdio:"inherit"})`${v}`,await c(`Do you want to ${A.yellow.bold("execute the git")} commands now?`)&&await O({shell:!0,stdio:"inherit"})`${k}`)};import Ne from"ora";import Ce from"chalk";var se=async()=>{await Y();let e=await I(),t=De.join(process.cwd(),e);await R(e,t);let r=new S(e,t),o=await ie(r),i=Ne("Generating files...").start();await r.generate(),i.succeed("Files generated successfully."),T(`
11
+ Project initialization complete. You may execute the following commands:
12
+ `),V(e,o),B(e,o),T(`
13
+ And initialize Git using the following commands:
14
+ `),_(e,o),await ne(o),console.log(Ce.rgb(...P).bold(`
15
+ All commands executed successfully!
16
+ `))};await se();
@@ -0,0 +1,68 @@
1
+ import js from "@eslint/js";
2
+ import globals from "globals";
3
+ import tseslint from "typescript-eslint";
4
+ import pluginVue from "eslint-plugin-vue";
5
+ import json from "@eslint/json";
6
+ import markdown from "@eslint/markdown";
7
+ import css from "@eslint/css";
8
+ import { defineConfig, globalIgnores } from "eslint/config";
9
+ <% if (usePrettier) { %>
10
+ import prettierPlugin from 'eslint-plugin-prettier'
11
+ import prettierConfig from "eslint-config-prettier";
12
+ <% } %>
13
+
14
+ export default defineConfig([
15
+ { files: ["**/*.{js,mjs,cjs,ts,mts,cts,vue}"], plugins: { js }, extends: ["js/recommended"], languageOptions: { globals: globals.browser } },
16
+ tseslint.configs.recommended,
17
+ {
18
+ files: ["**/*.vue"],
19
+ plugins: { vue: pluginVue },
20
+ extends: [pluginVue.configs["flat/essential"]],
21
+ },
22
+ { files: ["**/*.vue"], languageOptions: { parserOptions: { parser: tseslint.parser } } },
23
+ { files: ["**/*.json"], plugins: { json }, language: "json/json", extends: ["json/recommended"] },
24
+ { files: ["**/*.jsonc"], plugins: { json }, language: "json/jsonc", extends: ["json/recommended"] },
25
+ { files: ["**/*.json5"], plugins: { json }, language: "json/json5", extends: ["json/recommended"] },
26
+ { files: ["**/*.md"], plugins: { markdown }, language: "markdown/gfm", extends: ["markdown/recommended"] },
27
+ { files: ["**/*.css"], plugins: { css }, language: "css/css", extends: ["css/recommended"] },
28
+
29
+ <% if (usePrettier) { %>
30
+ // global Prettier configuration
31
+ {
32
+ plugins: { prettier: prettierPlugin },
33
+ extends: [prettierConfig],
34
+ rules: {
35
+ 'prettier/prettier': ['warn'], // When not in prettier style, display a warning
36
+ },
37
+ },
38
+ // prevent Prettier parsing markdown as JavaScript
39
+ {
40
+ files: ['**/*.md'],
41
+ rules: {
42
+ 'prettier/prettier': ['warn', { parser: 'markdown' }],
43
+ },
44
+ },
45
+ <% } %>
46
+
47
+ globalIgnores([
48
+ "node_modules/*",
49
+ "dist/*",
50
+ "build/*",
51
+ "out/*",
52
+ ".next/*",
53
+ ".nuxt/*",
54
+ "coverage/*",
55
+ "public/*",
56
+ "assets/*",
57
+ ".cache/*",
58
+ ".temp/*",
59
+ ".tmp/*",
60
+ "*.min.js",
61
+ "*.bundle.js",
62
+ "package-lock.json",
63
+ "yarn.lock",
64
+ "pnpm-lock.yaml",
65
+ ".env*",
66
+ "docs/.vitepress/dist/*",
67
+ ]),
68
+ ]);
@@ -0,0 +1,16 @@
1
+ {
2
+ "scripts": {
3
+ "lint": "eslint . --fix --cache"
4
+ },
5
+ "devDependencies": {
6
+ "@eslint/css": "^0.14.1",
7
+ "@eslint/js": "^9.39.2",
8
+ "@eslint/json": "^0.14.0",
9
+ "@eslint/markdown": "^7.5.1",
10
+ "eslint": "^9.39.2",
11
+ "eslint-plugin-vue": "^10.6.2",
12
+ "globals": "^17.0.0",
13
+ "jiti": "^2.6.1",
14
+ "typescript-eslint": "^8.53.0"
15
+ }
16
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "devDependencies": {
3
+ "eslint-config-prettier": "^10.1.8",
4
+ "eslint-plugin-prettier": "^5.5.4"
5
+ }
6
+ }
@@ -44,12 +44,12 @@ extends: ['markdown/recommended'],
44
44
  { files: ['**/*.css'], plugins: { css }, language: 'css/css', extends: ['css/recommended'] },
45
45
 
46
46
  <% if (usePrettier) { %>
47
- // 全局 Prettier 配置
47
+ // global Prettier configuration
48
48
  {
49
49
  plugins: { prettier: prettierPlugin },
50
50
  extends: [prettierConfig],
51
51
  rules: {
52
- 'prettier/prettier': ['warn'], // 不符合 prettier 风格时显示 warning
52
+ 'prettier/prettier': ['warn'], // When not in prettier style, display a warning
53
53
  },
54
54
  },
55
55
  <% } %>
@@ -0,0 +1,43 @@
1
+ # Dependency directories
2
+ node_modules/
3
+
4
+ # Build and output directories
5
+ dist/
6
+ build/
7
+ out/
8
+ .next/
9
+ .nuxt/
10
+ .cache/
11
+ .temp/
12
+ .tmp/
13
+ .vercel/
14
+ docs/.vitepress/dist/
15
+
16
+ # Test coverage
17
+ coverage/
18
+
19
+ # Static and generated assets
20
+ # Note: Keep 'public/' if you have handwritten HTML/CSS there you want formatted
21
+ public/
22
+ assets/
23
+ *.min.js
24
+ *.bundle.js
25
+
26
+ # Lock files (Prettier shouldn't touch these)
27
+ package-lock.json
28
+ yarn.lock
29
+ pnpm-lock.yaml
30
+ bun.lockb
31
+
32
+ # Environment and secrets
33
+ .env*
34
+ *.local
35
+
36
+ # Logs
37
+ *.log
38
+ npm-debug.log*
39
+ yarn-debug.log*
40
+ yarn-error.log*
41
+
42
+ # System files
43
+ .DS_Store
@@ -0,0 +1,148 @@
1
+ <script setup lang="ts">
2
+ import HelloWorld from './components/HelloWorld.vue'
3
+ <% if(!useVueRouter) { %>
4
+ import TheWelcome from './components/TheWelcome.vue'
5
+ <% } %>
6
+ <% if(usePinia) { %>
7
+ import {
8
+ useCounterStore
9
+ } from './stores/counter'
10
+ <% } %>
11
+ <% if(usePiniaPluginPersistedstate) { %>
12
+ import {
13
+ useKeyStore
14
+ } from './stores/key'
15
+ <% } %>
16
+ <% if(useVueRouter) { %>import {
17
+ useRoute
18
+ }
19
+ from 'vue-router'
20
+ <% } %>
21
+
22
+ <% if(usePinia) { %>
23
+ const counterStore = useCounterStore()
24
+ <% } %>
25
+ <% if(usePiniaPluginPersistedstate) { %>
26
+ const keyStore = useKeyStore()
27
+ <% } %>
28
+ <% if(useVueRouter) { %>
29
+ const route = useRoute()
30
+ <% } %>
31
+ </script>
32
+
33
+ <template>
34
+ <header>
35
+ <img alt="Vue logo" class="logo" src="./assets/logo.svg" width="125" height="125" />
36
+
37
+ <div class="wrapper">
38
+ <HelloWorld msg="You did it!" />
39
+ <% if(usePinia) { %><button class="piniaBtn" @click="counterStore.increment">Count is:
40
+ {{ counterStore.count }}</button><% } %>
41
+ <% if(usePiniaPluginPersistedstate) { %><input class="persistInp" v-model="keyStore.key" placeholder="Enter a key to persist" /><% } %>
42
+ <% if(useVueRouter) { %>
43
+ <!-- 按钮切换页面 -->
44
+ <div>
45
+ <button class="routerBtn">
46
+ <router-link to="/home">
47
+ <span :class="{ 'active-link': route.name === 'home' }">
48
+ Home
49
+ </span>
50
+ </router-link>
51
+ </button>
52
+ <span style="margin: 0 5px">|</span>
53
+ <button class="routerBtn">
54
+ <router-link to="/about">
55
+ <span :class="{ 'active-link': route.name === 'about' }">
56
+ About
57
+ </span>
58
+ </router-link>
59
+ </button>
60
+ </div><% } %>
61
+ </div>
62
+ </header>
63
+
64
+ <main>
65
+ <% if(useVueRouter) { %>
66
+ <router-view />
67
+ <% } %>
68
+ <% if(!useVueRouter) { %>
69
+ <TheWelcome />
70
+ <% } %>
71
+ </main>
72
+ </template>
73
+
74
+ <style scoped>
75
+ header {
76
+ line-height: 1.5;
77
+ }
78
+
79
+ .logo {
80
+ display: block;
81
+ margin: 0 auto 2rem;
82
+ }
83
+
84
+ <% if(usePinia) {
85
+ %>.piniaBtn {
86
+ margin-top: 1rem;
87
+ padding: 0.5rem 1rem;
88
+ font-size: 1rem;
89
+ border: none;
90
+ border-radius: 4px;
91
+ background-color: #42b983;
92
+ color: white;
93
+ cursor: pointer;
94
+ }
95
+
96
+ <%
97
+ }
98
+
99
+ %><% if(usePiniaPluginPersistedstate) {
100
+ %>.persistInp {
101
+ margin-top: 1rem;
102
+ padding: 0.5rem;
103
+ font-size: 1rem;
104
+ border: 1px solid #ccc;
105
+ border-radius: 4px;
106
+ width: 100%;
107
+ max-width: 300px;
108
+ }
109
+
110
+ <%
111
+ }
112
+
113
+ %><%if(useVueRouter) {
114
+ %>.routerBtn {
115
+ margin-top: 1rem;
116
+ padding: 0.5rem 1rem;
117
+ font-size: 1rem;
118
+ border: none;
119
+ background: none;
120
+ }
121
+
122
+ .active-link {
123
+ font-weight: bold;
124
+ color: hsla(160, 100%, 30%, 1);
125
+ border-bottom: 2px solid hsla(160, 100%, 37%, 1);
126
+ }
127
+
128
+ <%
129
+ }
130
+
131
+ %>@media (min-width: 1024px) {
132
+ header {
133
+ display: flex;
134
+ place-items: center;
135
+ padding-right: calc(var(--section-gap) / 2);
136
+ }
137
+
138
+ .logo {
139
+ margin: 0 2rem 0 0;
140
+ }
141
+
142
+ header .wrapper {
143
+ display: flex;
144
+ place-items: flex-start;
145
+ flex-wrap: wrap;
146
+ }
147
+ }
148
+ </style>
@@ -1,4 +1,4 @@
1
- # create-tm
1
+ # <%= projectName %>
2
2
 
3
3
  This template should help get you started developing with Vue 3 in Vite.
4
4
 
@@ -15,6 +15,10 @@ This template should help get you started developing with Vue 3 in Vite.
15
15
  - [Vue.js devtools](https://addons.mozilla.org/en-US/firefox/addon/vue-js-devtools/)
16
16
  - [Turn on Custom Object Formatter in Firefox DevTools](https://fxdx.dev/firefox-devtools-custom-object-formatters/)
17
17
 
18
+ ## Type Support for `.vue` Imports in TS
19
+
20
+ TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) to make the TypeScript language service aware of `.vue` types.
21
+
18
22
  ## Customize configuration
19
23
 
20
24
  See [Vite Configuration Reference](https://vite.dev/config/).
@@ -31,7 +35,7 @@ pnpm install
31
35
  pnpm dev
32
36
  ```
33
37
 
34
- ### Compile and Minify for Production
38
+ ### Type-Check, Compile and Minify for Production
35
39
 
36
40
  ```sh
37
41
  pnpm build
@@ -0,0 +1,18 @@
1
+ import './assets/main.css'
2
+ import { createApp } from 'vue'
3
+ import App from './App.vue'
4
+ <% if(usePinia) { %>import { createPinia } from 'pinia'<% } %>
5
+ <% if(usePiniaPluginPersistedstate) { %>import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'<% } %>
6
+ <% if(useVueRouter) { %>import router from './router/index.js';<% } %>
7
+
8
+ createApp(App)
9
+ <% if(usePinia) { %>
10
+ .use(createPinia()
11
+ <% if(usePiniaPluginPersistedstate) { %>
12
+ .use(piniaPluginPersistedstate)
13
+ <% } %>
14
+ )
15
+ <% } %>
16
+ <% if(useVueRouter) { %>
17
+ .use(router)
18
+ <% } %>.mount('#app')
@@ -0,0 +1,38 @@
1
+ # Logs
2
+ logs
3
+ *.log
4
+ npm-debug.log*
5
+ yarn-debug.log*
6
+ yarn-error.log*
7
+ pnpm-debug.log*
8
+ lerna-debug.log*
9
+
10
+ node_modules
11
+ .DS_Store
12
+ dist
13
+ dist-ssr
14
+ coverage
15
+ *.local
16
+
17
+ # Editor directories and files
18
+ .vscode/*
19
+ !.vscode/extensions.json
20
+ .idea
21
+ *.suo
22
+ *.ntvs*
23
+ *.njsproj
24
+ *.sln
25
+ *.sw?
26
+
27
+ *.tsbuildinfo
28
+
29
+ .eslintcache
30
+
31
+ .husky/
32
+
33
+ # Cypress
34
+ /cypress/videos/
35
+ /cypress/screenshots/
36
+
37
+ # Vitest
38
+ __screenshots__/
@@ -0,0 +1 @@
1
+ /// <reference types="vite/client" />
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html lang="">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <link rel="icon" href="/favicon.ico">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <title>Vite App</title>
8
+ </head>
9
+ <body>
10
+ <div id="app"></div>
11
+ <script type="module" src="/src/main.ts"></script>
12
+ </body>
13
+ </html>
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "base",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "engines": {
7
+ "node": "^20.19.0 || >=22.12.0"
8
+ },
9
+ "scripts": {
10
+ "dev": "vite",
11
+ "build": "run-p type-check \"build-only {@}\" --",
12
+ "preview": "vite preview",
13
+ "build-only": "vite build",
14
+ "type-check": "vue-tsc --build"
15
+ },
16
+ "dependencies": {
17
+ "vue": "^3.5.26"
18
+ },
19
+ "devDependencies": {
20
+ "@tsconfig/node24": "^24.0.3",
21
+ "@types/node": "^24.10.4",
22
+ "@vitejs/plugin-vue": "^6.0.3",
23
+ "@vue/tsconfig": "^0.8.1",
24
+ "npm-run-all2": "^8.0.4",
25
+ "typescript": "~5.9.3",
26
+ "vite": "^7.3.0",
27
+ "vite-plugin-vue-devtools": "^8.0.5",
28
+ "vue-tsc": "^3.2.2"
29
+ }
30
+ }
@@ -0,0 +1,86 @@
1
+ /* color palette from <https://github.com/vuejs/theme> */
2
+ :root {
3
+ --vt-c-white: #ffffff;
4
+ --vt-c-white-soft: #f8f8f8;
5
+ --vt-c-white-mute: #f2f2f2;
6
+
7
+ --vt-c-black: #181818;
8
+ --vt-c-black-soft: #222222;
9
+ --vt-c-black-mute: #282828;
10
+
11
+ --vt-c-indigo: #2c3e50;
12
+
13
+ --vt-c-divider-light-1: rgba(60, 60, 60, 0.29);
14
+ --vt-c-divider-light-2: rgba(60, 60, 60, 0.12);
15
+ --vt-c-divider-dark-1: rgba(84, 84, 84, 0.65);
16
+ --vt-c-divider-dark-2: rgba(84, 84, 84, 0.48);
17
+
18
+ --vt-c-text-light-1: var(--vt-c-indigo);
19
+ --vt-c-text-light-2: rgba(60, 60, 60, 0.66);
20
+ --vt-c-text-dark-1: var(--vt-c-white);
21
+ --vt-c-text-dark-2: rgba(235, 235, 235, 0.64);
22
+ }
23
+
24
+ /* semantic color variables for this project */
25
+ :root {
26
+ --color-background: var(--vt-c-white);
27
+ --color-background-soft: var(--vt-c-white-soft);
28
+ --color-background-mute: var(--vt-c-white-mute);
29
+
30
+ --color-border: var(--vt-c-divider-light-2);
31
+ --color-border-hover: var(--vt-c-divider-light-1);
32
+
33
+ --color-heading: var(--vt-c-text-light-1);
34
+ --color-text: var(--vt-c-text-light-1);
35
+
36
+ --section-gap: 160px;
37
+ }
38
+
39
+ @media (prefers-color-scheme: dark) {
40
+ :root {
41
+ --color-background: var(--vt-c-black);
42
+ --color-background-soft: var(--vt-c-black-soft);
43
+ --color-background-mute: var(--vt-c-black-mute);
44
+
45
+ --color-border: var(--vt-c-divider-dark-2);
46
+ --color-border-hover: var(--vt-c-divider-dark-1);
47
+
48
+ --color-heading: var(--vt-c-text-dark-1);
49
+ --color-text: var(--vt-c-text-dark-2);
50
+ }
51
+ }
52
+
53
+ *,
54
+ *::before,
55
+ *::after {
56
+ box-sizing: border-box;
57
+ margin: 0;
58
+ font-weight: normal;
59
+ }
60
+
61
+ body {
62
+ min-height: 100vh;
63
+ color: var(--color-text);
64
+ background: var(--color-background);
65
+ transition:
66
+ color 0.5s,
67
+ background-color 0.5s;
68
+ line-height: 1.6;
69
+ font-family:
70
+ Inter,
71
+ -apple-system,
72
+ BlinkMacSystemFont,
73
+ 'Segoe UI',
74
+ Roboto,
75
+ Oxygen,
76
+ Ubuntu,
77
+ Cantarell,
78
+ 'Fira Sans',
79
+ 'Droid Sans',
80
+ 'Helvetica Neue',
81
+ sans-serif;
82
+ font-size: 15px;
83
+ text-rendering: optimizeLegibility;
84
+ -webkit-font-smoothing: antialiased;
85
+ -moz-osx-font-smoothing: grayscale;
86
+ }
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 261.76 226.69"><path d="M161.096.001l-30.225 52.351L100.647.001H-.005l130.877 226.688L261.749.001z" fill="#41b883"/><path d="M161.096.001l-30.225 52.351L100.647.001H52.346l78.526 136.01L209.398.001z" fill="#34495e"/></svg>
@@ -0,0 +1,35 @@
1
+ @import './base.css';
2
+
3
+ #app {
4
+ max-width: 1280px;
5
+ margin: 0 auto;
6
+ padding: 2rem;
7
+ font-weight: normal;
8
+ }
9
+
10
+ a,
11
+ .green {
12
+ text-decoration: none;
13
+ color: hsla(160, 100%, 37%, 1);
14
+ transition: 0.4s;
15
+ padding: 3px;
16
+ }
17
+
18
+ @media (hover: hover) {
19
+ a:hover {
20
+ background-color: hsla(160, 100%, 37%, 0.2);
21
+ }
22
+ }
23
+
24
+ @media (min-width: 1024px) {
25
+ body {
26
+ display: flex;
27
+ place-items: center;
28
+ }
29
+
30
+ #app {
31
+ display: grid;
32
+ grid-template-columns: 1fr 1fr;
33
+ padding: 0 2rem;
34
+ }
35
+ }