@tomjs/create-app 4.1.1 → 5.0.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 (86) hide show
  1. package/dist/index.mjs +10 -9
  2. package/locales/en-US.json +1 -0
  3. package/locales/zh-CN.json +1 -0
  4. package/package.json +3 -3
  5. package/templates/config/base/.vscode/settings.json +1 -1
  6. package/templates/config/base/package.json +1 -0
  7. package/templates/config/electron/package.json +13 -0
  8. package/templates/config/npm/LICENSE +21 -0
  9. package/templates/config/npm/package.json +10 -0
  10. package/templates/config/package.json +2 -2
  11. package/templates/config/public/package.json +1 -8
  12. package/templates/{web-react → config/react}/_eslint.config.mjs +0 -1
  13. package/templates/config/react/package.json +15 -0
  14. package/templates/config/style/lint-staged.config.mjs +1 -1
  15. package/templates/{vscode-vue → config/vscode}/.vscode/settings.json +1 -1
  16. package/templates/config/vscode/package.json +49 -0
  17. package/templates/config/vue/package.json +11 -0
  18. package/templates/electron-react/package.json +3 -25
  19. package/templates/electron-react/pnpm-workspace.yaml +1 -0
  20. package/templates/electron-vue/package.json +3 -19
  21. package/templates/electron-vue/pnpm-workspace.yaml +1 -0
  22. package/templates/electron-vue/tsconfig.node.json +1 -1
  23. package/templates/node-cli/.vscode/settings.json +15 -51
  24. package/templates/node-vite/examples/react/package.json +1 -1
  25. package/templates/node-vite/examples/react/vite.config.ts +2 -2
  26. package/templates/node-vite/examples/vue/package.json +1 -1
  27. package/templates/node-vite/examples/vue/vite.config.ts +2 -2
  28. package/templates/vscode-base/.vscode/launch.json +1 -0
  29. package/templates/vscode-base/.vscode/settings.json +1 -1
  30. package/templates/vscode-base/.vscode/tasks.json +1 -1
  31. package/templates/vscode-react/package.json +1 -54
  32. package/templates/vscode-react/tsconfig.app.json +2 -8
  33. package/templates/vscode-react/tsconfig.node.json +3 -5
  34. package/templates/vscode-vue/package.json +1 -50
  35. package/templates/vscode-vue/tsconfig.app.json +3 -9
  36. package/templates/vscode-vue/tsconfig.node.json +3 -5
  37. package/templates/web-react/package.json +0 -16
  38. package/templates/web-react/tsconfig.app.json +1 -0
  39. package/templates/web-vue/package.json +0 -10
  40. package/templates/web-vue/tsconfig.app.json +1 -0
  41. package/templates/electron-react/_eslint.config.mjs +0 -3
  42. package/templates/electron-react/electron/env.d.ts +0 -1
  43. package/templates/electron-react/electron/main/index.ts +0 -130
  44. package/templates/electron-vue/.vscode/launch.json +0 -48
  45. package/templates/electron-vue/.vscode/tasks.json +0 -67
  46. package/templates/electron-vue/_eslint.config.mjs +0 -3
  47. package/templates/electron-vue/electron/preload/index.ts +0 -4
  48. package/templates/vscode-react/.vscode/settings.json +0 -59
  49. package/templates/vscode-react/extension/env.d.ts +0 -1
  50. package/templates/vscode-vue/.vscode/extensions.json +0 -5
  51. package/templates/vscode-vue/.vscode/launch.json +0 -34
  52. package/templates/vscode-vue/.vscode/tasks.json +0 -45
  53. package/templates/vscode-vue/.vscodeignore +0 -73
  54. package/templates/vscode-vue/_.gitignore +0 -65
  55. package/templates/vscode-vue/extension/env.d.ts +0 -1
  56. package/templates/vscode-vue/extension/index.ts +0 -21
  57. package/templates/vscode-vue/extension/views/helper.ts +0 -29
  58. package/templates/vscode-vue/extension/views/panel.ts +0 -49
  59. package/templates/vscode-vue/locales/en.json +0 -6
  60. package/templates/vscode-vue/locales/zh-CN.json +0 -6
  61. package/templates/vscode-vue/resources/logo.png +0 -0
  62. package/templates/vscode-vue/resources/logo.svg +0 -1
  63. package/templates/web-vue/_eslint.config.mjs +0 -6
  64. package/templates/web-vue/public/vite.svg +0 -1
  65. /package/templates/config/base/{.editorconfig → _.editorconfig} +0 -0
  66. /package/templates/{electron-react → config/electron}/.vscode/launch.json +0 -0
  67. /package/templates/{electron-react → config/electron}/.vscode/tasks.json +0 -0
  68. /package/templates/{electron-vue → config/electron}/electron/main/index.ts +0 -0
  69. /package/templates/{electron-react → config/electron}/electron/preload/index.ts +0 -0
  70. /package/templates/{electron-react → config/electron}/public/vite.svg +0 -0
  71. /package/templates/config/{public → npm}/README.md +0 -0
  72. /package/templates/config/{public → npm}/README.zh_CN.md +0 -0
  73. /package/templates/{electron-vue → config/react}/public/vite.svg +0 -0
  74. /package/templates/{vscode-react → config/vscode}/.vscode/extensions.json +0 -0
  75. /package/templates/{vscode-react → config/vscode}/.vscode/launch.json +0 -0
  76. /package/templates/{vscode-react → config/vscode}/.vscode/tasks.json +0 -0
  77. /package/templates/{vscode-react → config/vscode}/.vscodeignore +0 -0
  78. /package/templates/{vscode-react → config/vscode}/_.gitignore +0 -0
  79. /package/templates/{vscode-react → config/vscode}/extension/index.ts +0 -0
  80. /package/templates/{vscode-react → config/vscode}/extension/views/helper.ts +0 -0
  81. /package/templates/{vscode-react → config/vscode}/extension/views/panel.ts +0 -0
  82. /package/templates/{vscode-react → config/vscode}/locales/en.json +0 -0
  83. /package/templates/{vscode-react → config/vscode}/locales/zh-CN.json +0 -0
  84. /package/templates/{vscode-react → config/vscode}/resources/logo.png +0 -0
  85. /package/templates/{vscode-react → config/vscode}/resources/logo.svg +0 -0
  86. /package/templates/{web-react → config/vue}/public/vite.svg +0 -0
package/dist/index.mjs CHANGED
@@ -1,14 +1,15 @@
1
- import e from"meow";import t from"node:fs";import n from"node:fs/promises";import r from"node:os";import i from"node:path";import{fileURLToPath as a}from"node:url";import*as o from"@clack/prompts";import{copy as s,mkdir as c,mkdirp as l,readFile as u,readJson as d,readJsonSync as f,rm as p,rmSync as m,writeFile as h,writeJson as g}from"@tomjs/node";import{camelCase as _,merge as v,upperFirst as y}from"lodash-es";import{glob as b}from"tinyglobby";import x from"chalk";import{$ as S}from"execa";import C from"@tomjs/logger";const w=a(new URL(`..`,import.meta.url)),T=[{name:`node`,display:`Node`,color:x.green,children:[{name:`node-base`,display:`Base`,color:x.green},{name:`node-cli`,display:`CLI`,color:x.green},{name:`node-vite`,display:`Vite Plugin`,value:`vite-plugin`,color:x.blue,hasStyle:!0}]},{name:`web`,display:`Web`,color:x.magenta,children:[{name:`web-vue`,display:`Vue`,color:x.green,hasStyle:!0,isPublic:!1},{name:`web-react`,display:`React`,color:x.blue,hasStyle:!0,isPublic:!1}]},{name:`vscode`,display:`VSCode`,color:x.blue,children:[{name:`vscode-base`,display:`Base`,color:x.yellow,isPublic:`public`},{name:`vscode-vue`,display:`Vue`,color:x.green,hasStyle:!0,isPublic:`public`},{name:`vscode-react`,display:`React`,color:x.blue,hasStyle:!0,isPublic:`public`}]},{name:`electron`,display:`Electron`,color:x.cyan,children:[{name:`electron-vue`,display:`Vue`,color:x.green,hasStyle:!0,isPublic:!1},{name:`electron-react`,display:`React`,color:x.blue,hasStyle:!0,isPublic:!1}]}],E=[{id:`github`,name:`Github`,url:`https://github.com`},{id:`gitcode`,name:`GitCode`,url:`https://gitcode.com`},{id:`gitee`,name:`码云`,url:`https://gitee.com`}],ee=`publisher.name.displayName.type.version.private.packageManager.description.author.contributors.license.funding.homepage.repository.publishConfig.bugs.keywords.categories.sideEffects.imports.exports.main.module.unpkg.jsdelivr.types.typesVersions.bin.icon.files.engines.activationEvents.contributes.scripts.peerDependencies.peerDependenciesMeta.dependencies.optionalDependencies.devDependencies.pnpm.overrides.resolutions.husky.simple-git-hooks.lint-staged.eslintConfig`.split(`.`),te=[`dev`,`dev:`,`debug`,`debug:`,`start`,`build`,`build:`,`preview`,`release`,`release:`,`clean`,`clean:`,`test`,`lint`,`lint:`],D=new C({directory:`create-app/logs`}),ne=process.platform===`win32`;let O={};function re(e){O=e}function k(){return O}async function A(e,t){let{trim:n,...r}=Object.assign({stdio:`pipe`,shell:!0},t);Array.isArray(e)&&(e=e.join(` `));let i=e=>{k().verbose?D.debug(e):D.write(e)};i(`$ ${e}`);try{let t=(await S(r)`${e}`).stdout;return i(t),n?t.trim().replace(/\n|\r/g,``):t.trim()}catch(e){let t=e.stderr||e.message;throw i(t),Error(t)}}function ie(e){if(e===`C`)return`en-US`;let t=``;try{t=Intl.getCanonicalLocales(e)[0]}catch(t){console.log(`${t.toString()}, invalid language tag: "${e}"\n`)}switch(t){case`zh-TW`:case`zh-HK`:case`zh-MO`:case`zh-CN`:case`zh-SG`:t=`zh-CN`;break;default:t=e}return t}function j(){return ie((process.env.LC_ALL||process.env.LC_MESSAGES||process.env.LANG||Intl.DateTimeFormat().resolvedOptions().locale||`en-US`).split(`.`)[0].replace(`_`,`-`))}async function M(e){return await t.promises.readFile(e,`utf-8`).then(e=>JSON.parse(e)||{})}async function ae(e){let n=j(),r=i.resolve(e,`${n}.json`),a=i.resolve(e,`en-US.json`);return t.existsSync(r)?await M(r):await M(a)}const N=await ae(i.join(w,`locales`));function P(...e){if(e.length===0||!N)return``;let[t,...n]=e,r=N[t]??``;if(n[0]===null||n[0]===void 0||n[0]===``)return r;let i=typeof n[0]==`object`?n[0]:n;return r.replace(/\{([^}]+)\}/g,(e,t)=>i[t]??e)}const oe=i.join(a(import.meta.url),`../../`),F=i.join(oe,`templates`),I=()=>o.cancel(P(`prompt.cancel`));async function se(e){re(e);let t=await L(e);t&&(await R(t),e.package&&await le(t),t.template===`node-vite`&&(await Y(t.targetDir),await X(t.targetDir,t.packageName)),e.package||await A(`git init`,{cwd:t.targetDir}))}async function L(e){let n=async function(){let e=await o.select({message:P(`prompt.templateType.message`),options:T.map(e=>({label:e.color(e.display||e.name),value:e.name}))});if(o.isCancel(e))return I();let t=T.find(t=>t.name===e),r=await o.select({message:P(`prompt.template.message`),options:t.children.map(e=>({label:e.color(e.display||e.name),value:e.name})).concat({label:P(`prompt.template.back`),value:`back`})});return o.isCancel(r)?I():r===`back`?await n():{template:r,templateOptions:t.children.find(e=>e.name===r)}},a=await n();if(!a)return;let s=``;await W(`user.email`)===`tom@tomgao.cc`&&(s=`tomjs`);let{template:c,templateOptions:l}=a,u=c.startsWith(`node-`),d=e.packageName;d||(d=l.value||c,s&&u&&(d=`@${s}/${d}`));let f=await o.text({message:P(`prompt.package.message`),initialValue:d,defaultValue:d,placeholder:d,validate:e=>e.length===0||H(e)?void 0:P(`prompt.package.invalid`)});if(o.isCancel(f))return I();d=f;let p=z(d),m=await o.text({message:P(`prompt.project.message`),defaultValue:p,initialValue:p,placeholder:p,validate:e=>e.length===0||e.length>0?void 0:P(`prompt.project.invalid`)});if(o.isCancel(m))return I();if(p=i.resolve(p===`~`&&!ne?r.homedir():process.cwd(),m),t.existsSync(p)&&!B(p)){let t=e.overwrite;if(!t){let e=await o.select({message:P(`prompt.exist.message`,p),options:[{label:P(`prompt.exist.option.no`),value:`no`},{label:P(`prompt.exist.option.yes`),value:`yes`},{label:P(`prompt.exist.option.ignore`),value:`ignore`}]});if(o.isCancel(e))return I();t=e}switch(t){case`yes`:V(p);break;case`no`:I();return}}let h;if(e.private!==!0&&l.isPublic!==`public`){let e=await o.confirm({message:P(`prompt.public.message`),active:P(`prompt.confirm.yes`),inactive:P(`prompt.confirm.no`),initialValue:l.isPublic??!0});if(o.isCancel(e))return I();h=e}else h=!e.private;let g;if(h){let e=await o.select({message:P(`prompt.gitUrl.message`),options:E.map(e=>({label:`${e.name} (${e.url})`,value:e.id}))});if(o.isCancel(e))return I();g=E.find(t=>t.id===e)?.url}let _;if(h){s=G(d)||s;let e=await o.text({message:P(`prompt.orgName.message`),defaultValue:s,placeholder:s,validate:e=>s&&!e||U(e)?void 0:P(`prompt.orgName.invalid`)});if(o.isCancel(e))return I();_=e}return delete l.color,{targetDir:p,orgName:_,packageName:d,template:c,templateOptions:l,isPublic:h,gitUrl:g}}async function R(e){D.debug(`projectOptions:`,e);let{targetDir:t,packageName:a,template:o,isPublic:f,gitUrl:m,orgName:_,templateOptions:y}=e;await c(t);let x=o.includes(`vscode`),S={},C=i.join(t,`.temp`);if(await l(C),await K(S,`base`,C),y.hasStyle&&await K(S,`style`,C),f&&!x&&await K(S,`public`,C),await s(C,t),await p(C),await s(i.join(F,o),t),v(S,await d(i.join(i.join(F,o),`package.json`))),S.name=a,f){delete S.private,S.name=a,S.license=`MIT`;let e=await W(`user.name`)||r.userInfo().username,n=await W(`user.email`);e&&n?S.author={name:e,email:n}:e&&(S.author=e);let o=`${m}/${_}/${i.basename(t)}`;x&&(S.publisher=_,S.homepage=`${o}/blob/main/README.md`,S.bugs={url:`${o}/issues`},delete S.publishConfig),S.repository={type:`git`,url:`${o}.git`,directory:k().package?`packages/${i.basename(t)}`:void 0}}else S.private=!0,delete S.publishConfig,S.devDependencies&&delete S.devDependencies.publint;if(await g(i.join(t,`package.json`),J(S)),await Y(t),f){let{author:e}=S,r=``;e&&(typeof e==`string`?r=e:typeof e==`object`&&(e.name&&e.email?r=`${e.name}<${e.email}>`:e.name?r=e.name:e.email&&(r=e.email)));let o={pkgName:a,dateYear:new Date().getFullYear(),gitUserName:r},s=(await n.readdir(t)).filter(e=>[`README.md`,`README.zh_CN.md`,`LICENSE`].includes(e));for(let e of s){let n=await u(i.join(t,e));Object.keys(o).forEach(e=>{n=n.replace(RegExp(`{{${e}}}`,`g`),o[e])}),await h(i.join(t,e),n)}}let w=await b(`**/_*`,{ignore:[`**/node_modules/**`,`**/.*`],cwd:t});for(let e of w){let r=e.split(`/`);r[r.length-1]=r[r.length-1].substring(1),await n.rename(i.join(t,e),i.join(t,r.join(`/`)))}}function z(e){return(e||``).trim().replace(/^@[^/]+\//,``)}function B(e){return t.readdirSync(e).length===0}function V(e){t.existsSync(e)&&m(e)}function H(e){return/^(?:@[a-z\d\-*~][a-z\d\-*._~]*\/)?[a-z\d\-~][a-z\d\-._~]*$/.test(e)}function U(e){return/^[a-z][a-z\d\-._]*$/.test(e)}async function W(e){return A(`git config --get ${e}`,{trim:!0})}function G(e){if(e.startsWith(`@`))return e.split(`/`)[0].substring(1)}async function K(e,t,r){let a=i.join(F,`config/${t}`),o=await n.readdir(a);for(let t of o)[`node_modules`,`.git`].includes(t)||(t===`package.json`?v(e,await d(i.join(a,`package.json`))):await s(i.join(a,t),i.join(r,t)))}function q(e,t){if(!e)return e;let n={};return Array.isArray(t)&&t.length>0?(t.filter(t=>t in e).forEach(t=>{n[t]=e[t]}),Object.keys(e).filter(e=>!t.includes(e)).sort().forEach(t=>{n[t]=e[t]})):Object.keys(e).sort().forEach(t=>{n[t]=e[t]}),n}function ce(e,t,n){let r={},i=Object.keys(e);{let e=i.filter(e=>e.includes(`:`));i=i.filter(e=>!e.includes(`:`)).sort().concat(e)}let a=s(t),o=s(n);return a.concat(i.filter(e=>!a.includes(e)&&!o.includes(e))).concat(o).forEach(t=>{r[t]=e[t]}),r;function s(e){let t=Array.isArray(e)?e:[];return t.length>0&&(t=t.reduce((e,t)=>{if(t.endsWith(`:`)){let n=i.filter(n=>!e.includes(n)&&n.startsWith(t));return e.concat(n)}return i.includes(t)?e.concat(t):e},[])),t}}function J(e){return e=q(e,ee),e.scripts&&=ce(e.scripts,te,[`prepare`,`prepublishOnly`]),[`dependencies`,`devDependencies`,`peerDependencies`].forEach(t=>{e[t]&&(e[t]=q(e[t]))}),e}async function Y(e){let t=f(i.join(F,`config/package.json`))?.dependencies||{},n=await b(`**/package.json`,{ignore:[`**/node_modules/**`,`**/.*`],cwd:e});for(let r of n){let n=i.join(e,r),a=await d(n);[`dependencies`,`devDependencies`].forEach(e=>{let n=a[e];n&&Object.keys(n).forEach(e=>{n[e]=t[e]||n[e]})}),g(n,J(a))}}async function le(e){let n=e.templateOptions.hasStyle,r=[`.editorconfig`,`.gitignore`,`.gitattributes`,`commitlint.config.mjs`,`simple-git-hooks.mjs`,`pnpm-workspace.yaml`];n||r.push(`lint-staged.config.mjs`),[`vscode`,`electron`].find(t=>e.template.startsWith(t))||r.push(`.vscode`),r.forEach(n=>{let r=i.join(e.targetDir,n);t.existsSync(r)&&m(r)});let a=await d(i.join(e.targetDir,`package.json`));if(a.scripts&&delete a.scripts.prepare,!n)delete a.devDependencies;else if(a.devDependencies){let e=await d(i.join(F,`config/style/package.json`)),t=Object.keys(e.devDependencies||{});Object.keys(a.devDependencies).forEach(e=>{t.includes(e)||delete a.devDependencies[e]})}await g(i.join(e.targetDir,`package.json`),a)}async function X(e,t){let n=await b([`examples/*/package.json`,`examples/*/vite.config.ts`],{ignore:[`**/node_modules/**`,`**/.*`],cwd:e});for(let r of n){let n=i.join(e,r);await h(n,(await u(n)).replaceAll(`@tomjs/vite-plugin-template`,t))}let r=_((t.split(`/`).pop()||``).replace(`vite-plugin-`,``));if(r){let t=await b([`src/**/*.ts`],{ignore:[`**/node_modules/**`,`**/.*`],cwd:e});for(let n of t){let t=i.join(e,n);await h(t,(await u(t)).replaceAll(`@tomjs:xxx`,`@tomjs/${r}`).replaceAll(`useXxxPlugin`,`use${y(r)}Plugin`).replaceAll(`XxxPluginOptions`,`${y(r)}PluginOptions`))}}}const Z=e(`
1
+ import e from"meow";import t from"node:fs";import n,{readdir as r}from"node:fs/promises";import i from"node:os";import a from"node:path";import{fileURLToPath as o}from"node:url";import*as s from"@clack/prompts";import{copy as c,mkdir as l,mkdirp as u,readFile as d,readJson as f,readJsonSync as p,rm as m,rmSync as h,writeFile as g,writeJson as _}from"@tomjs/node";import{camelCase as v,merge as y,upperFirst as b}from"lodash-es";import{glob as x}from"tinyglobby";import S from"chalk";import{$ as C}from"execa";import w from"@tomjs/logger";const T=o(new URL(`..`,import.meta.url)),ee=[`vue`,`react`],E=[{name:`node`,display:`Node`,color:S.green,children:[{name:`node-base`,display:`Base`,color:S.green,public:`npm`},{name:`node-cli`,display:`CLI`,color:S.green,public:`npm`},{name:`node-vite`,display:`Vite Plugin`,value:`vite-plugin-xxx`,color:S.blue,hasStyle:!0,public:`npm`}]},{name:`web`,display:`Web`,color:S.magenta,children:[{name:`web-vue`,display:`Vue`,color:S.green,hasStyle:!0},{name:`web-react`,display:`React`,color:S.blue,hasStyle:!0}]},{name:`vscode`,display:`VSCode`,color:S.blue,children:[{name:`vscode-base`,display:`Base`,color:S.yellow,public:`public`},{name:`vscode-vue`,display:`Vue`,color:S.green,commonTemplates:[`vscode`],hasStyle:!0,public:`public`},{name:`vscode-react`,display:`React`,color:S.blue,commonTemplates:[`vscode`],hasStyle:!0,public:`public`}]},{name:`electron`,display:`Electron`,color:S.cyan,children:[{name:`electron-vue`,display:`Vue`,color:S.green,commonTemplates:[`electron`],hasStyle:!0},{name:`electron-react`,display:`React`,color:S.blue,commonTemplates:[`electron`],hasStyle:!0}]}],D=[{id:`github`,name:`Github`,url:`https://github.com`},{id:`gitcode`,name:`GitCode`,url:`https://gitcode.com`},{id:`gitee`,name:`码云`,url:`https://gitee.com`}],O=`publisher.name.displayName.type.version.private.packageManager.description.author.contributors.license.funding.homepage.repository.publishConfig.bugs.keywords.categories.sideEffects.imports.exports.main.module.unpkg.jsdelivr.types.typesVersions.bin.icon.files.engines.activationEvents.contributes.scripts.peerDependencies.peerDependenciesMeta.dependencies.optionalDependencies.devDependencies.pnpm.overrides.resolutions.husky.simple-git-hooks.lint-staged.eslintConfig`.split(`.`),k=[`dev`,`dev:`,`debug`,`debug:`,`start`,`build`,`build:`,`preview`,`release`,`release:`,`clean`,`clean:`,`test`,`lint`,`lint:`],A=new w({directory:`create-app/logs`}),te=process.platform===`win32`;let j={};function ne(e){j=e}function M(){return j}async function N(e,t){let{trim:n,...r}=Object.assign({stdio:`pipe`,shell:!0},t);Array.isArray(e)&&(e=e.join(` `));let i=e=>{M().verbose?A.debug(e):A.write(e)};i(`$ ${e}`);try{let t=(await C(r)`${e}`).stdout;return i(t),n?t.trim().replace(/\n|\r/g,``):t.trim()}catch(e){let t=e.stderr||e.message;throw i(t),Error(t)}}function P(e){if(e===`C`)return`en-US`;let t=``;try{t=Intl.getCanonicalLocales(e)[0]}catch(t){console.log(`${t.toString()}, invalid language tag: "${e}"\n`)}switch(t){case`zh-TW`:case`zh-HK`:case`zh-MO`:case`zh-CN`:case`zh-SG`:t=`zh-CN`;break;default:t=e}return t}function F(){return P((process.env.LC_ALL||process.env.LC_MESSAGES||process.env.LANG||Intl.DateTimeFormat().resolvedOptions().locale||`en-US`).split(`.`)[0].replace(`_`,`-`))}async function I(e){return await t.promises.readFile(e,`utf-8`).then(e=>JSON.parse(e)||{})}async function L(e){let n=F(),r=a.resolve(e,`${n}.json`),i=a.resolve(e,`en-US.json`);return t.existsSync(r)?await I(r):await I(i)}const R=await L(a.join(T,`locales`));function z(...e){if(e.length===0||!R)return``;let[t,...n]=e,r=R[t]??``;if(n[0]===null||n[0]===void 0||n[0]===``)return r;let i=typeof n[0]==`object`?n[0]:n;return r.replace(/\{([^}]+)\}/g,(e,t)=>i[t]??e)}const B=a.join(o(import.meta.url),`../../`),V=a.join(B,`templates`),H=()=>s.cancel(z(`prompt.cancel`));async function U(e){ne(e);let t=await W(e);t&&(await G(t),e.package&&await ue(t),t.template===`node-vite`&&await de(t.targetDir,t.packageName),e.package||await N(`git init`,{cwd:t.targetDir}))}async function W(e){let n=async function(){let e=await s.select({message:z(`prompt.templateType.message`),options:E.map(e=>({label:e.color(e.display||e.name),value:e.name}))});if(s.isCancel(e))return H();let t=E.find(t=>t.name===e),r=await s.select({message:z(`prompt.template.message`),options:t.children.map(e=>({label:e.color(e.display||e.name),value:e.name})).concat({label:z(`prompt.template.back`),value:`back`})});return s.isCancel(r)?H():r===`back`?await n():{template:r,templateOptions:t.children.find(e=>e.name===r)}},r=await n();if(!r)return;let o=``;await q(`user.email`)===`tom@tomgao.cc`&&(o=`tomjs`);let{template:c,templateOptions:l}=r,u=c.startsWith(`node-`),d=e.packageName;d||(d=l.value||c,o&&u&&(d=`@${o}/${d}`));let f=await s.text({message:z(`prompt.package.message`),initialValue:d,defaultValue:d,placeholder:d,validate:e=>e.length===0||ae(e)?void 0:z(`prompt.package.invalid`)});if(s.isCancel(f))return H();d=f;let p=K(d),m=await s.text({message:z(`prompt.project.message`),defaultValue:p,initialValue:p,placeholder:p,validate:e=>e.length===0||e.length>0?void 0:z(`prompt.project.invalid`)});if(s.isCancel(m))return H();if(p=a.resolve(p===`~`&&!te?i.homedir():e.cwd||process.cwd(),m),t.existsSync(p)&&!re(p)){let t=e.overwrite;if(!t){let e=await s.select({message:z(`prompt.exist.message`,p),options:[{label:z(`prompt.exist.option.no`),value:`no`},{label:z(`prompt.exist.option.yes`),value:`yes`},{label:z(`prompt.exist.option.ignore`),value:`ignore`}]});if(s.isCancel(e))return H();t=e}switch(t){case`yes`:ie(p);break;case`no`:H();return}}let h;if(e.private!==!0&&l.public){let e=await s.confirm({message:z(`prompt.public.message`),active:z(`prompt.confirm.yes`),inactive:z(`prompt.confirm.no`),initialValue:!0});if(s.isCancel(e))return H();h=e}let g;if(h){let e=await s.select({message:z(`prompt.gitUrl.message`),options:D.map(e=>({label:`${e.name} (${e.url})`,value:e.id}))});if(s.isCancel(e))return H();g=D.find(t=>t.id===e)?.url}let _;if(h){o=se(d)||o;let e=await s.text({message:z(`prompt.orgName.message`),defaultValue:o,placeholder:o,validate:e=>o&&!e||oe(e)?void 0:z(`prompt.orgName.invalid`)});if(s.isCancel(e))return H();_=e}return delete l.color,{targetDir:p,orgName:_,packageName:d,template:c,templateOptions:l,isPublic:h,gitUrl:g}}async function G(e){A.debug(`projectOptions:`,e);let{targetDir:t,packageName:o,template:s,isPublic:p,gitUrl:h,orgName:v,templateOptions:b}=e;await l(t);let S=s.includes(`vscode`),C={},w=a.join(t,`.temp`);if(await u(w),await J(C,`base`,w),b.hasStyle&&(await J(C,`style`,w),!s.includes(`vue`))){function e(e){return e.replaceAll(`vue,`,``).replaceAll(`,vue`,``)}let t=await r(a.join(V,`config/style`));for(let n of t){if(n===`package.json`){C.scripts&&Object.keys(C.scripts).forEach(t=>{C.scripts[t].includes(`vue`)&&(C.scripts[t]=e(C.scripts[t]))});continue}let t=a.join(w,n),r=await d(t);r.includes(`vue`)&&g(t,e(r))}}p&&b.public&&await J(C,b.public,w);let T=ee.find(e=>s.includes(`-${e}`));T&&await J(C,T,w);let E=b.commonTemplates;if(Array.isArray(E)&&E.length>0)for(let e of E)await J(C,e,w);if(await c(w,t),await m(w),await c(a.join(V,s),t),y(C,await f(a.join(a.join(V,s),`package.json`))),C.name=o,p){delete C.private,C.name=o,C.license=`MIT`;let e=await q(`user.name`)||i.userInfo().username,n=await q(`user.email`);e&&n?C.author={name:e,email:n}:e&&(C.author=e);let r=`${h}/${v}/${a.basename(t)}`;S&&(C.publisher=v,C.homepage=`${r}/blob/main/README.md`,C.bugs={url:`${r}/issues`},delete C.publishConfig),C.repository={type:`git`,url:`${r}.git`,directory:M().package?`packages/${a.basename(t)}`:void 0}}else C.private=!0,delete C.publishConfig,C.devDependencies&&delete C.devDependencies.publint;if(await _(a.join(t,`package.json`),X(C)),await le(t),p){let{author:e}=C,r=``;e&&(typeof e==`string`?r=e:typeof e==`object`&&(e.name&&e.email?r=`${e.name}<${e.email}>`:e.name?r=e.name:e.email&&(r=e.email)));let i={pkgName:o,dateYear:new Date().getFullYear(),gitUserName:r},s=(await n.readdir(t)).filter(e=>[`README.md`,`README.zh_CN.md`,`LICENSE`].includes(e));for(let e of s){let n=await d(a.join(t,e));Object.keys(i).forEach(e=>{n=n.replace(RegExp(`{{${e}}}`,`g`),i[e])}),await g(a.join(t,e),n)}}let D=await x(`**/_*`,{ignore:[`**/node_modules/**`,`**/.*`],cwd:t});for(let e of D){let r=e.split(`/`);r[r.length-1]=r[r.length-1].substring(1),await n.rename(a.join(t,e),a.join(t,r.join(`/`)))}}function K(e){return(e||``).trim().replace(/^@[^/]+\//,``)}function re(e){return t.readdirSync(e).length===0}function ie(e){t.existsSync(e)&&h(e)}function ae(e){return/^(?:@[a-z\d\-*~][a-z\d\-*._~]*\/)?[a-z\d\-~][a-z\d\-._~]*$/.test(e)}function oe(e){return/^[a-z][a-z\d\-._]*$/.test(e)}async function q(e){return N(`git config --get ${e}`,{trim:!0})}function se(e){if(e.startsWith(`@`))return e.split(`/`)[0].substring(1)}async function J(e,r,i){let o=a.join(V,`config/${r}`);if(!t.existsSync(o))return;let s=await n.readdir(o);for(let t of s)[`node_modules`,`.git`].includes(t)||(t===`package.json`?y(e,await f(a.join(o,`package.json`))):await c(a.join(o,t),a.join(i,t)))}function Y(e,t){if(!e)return e;let n={};return Array.isArray(t)&&t.length>0?(t.filter(t=>t in e).forEach(t=>{n[t]=e[t]}),Object.keys(e).filter(e=>!t.includes(e)).sort().forEach(t=>{n[t]=e[t]})):Object.keys(e).sort().forEach(t=>{n[t]=e[t]}),n}function ce(e,t,n){let r={},i=Object.keys(e);{let e=i.filter(e=>e.includes(`:`));i=i.filter(e=>!e.includes(`:`)).sort().concat(e)}let a=s(t),o=s(n);return a.concat(i.filter(e=>!a.includes(e)&&!o.includes(e))).concat(o).forEach(t=>{r[t]=e[t]}),r;function s(e){let t=Array.isArray(e)?e:[];return t.length>0&&(t=t.reduce((e,t)=>{if(t.endsWith(`:`)){let n=i.filter(n=>!e.includes(n)&&n.startsWith(t));return e.concat(n)}return i.includes(t)?e.concat(t):e},[])),t}}function X(e){return e=Y(e,O),e.scripts&&=ce(e.scripts,k,[`prepare`,`prepublishOnly`]),[`dependencies`,`devDependencies`,`peerDependencies`].forEach(t=>{e[t]&&(e[t]=Y(e[t]))}),e}async function le(e){let t=p(a.join(V,`config/package.json`))?.dependencies||{},n=await x(`**/package.json`,{ignore:[`**/node_modules/**`,`**/.*`],cwd:e});for(let r of n){let n=a.join(e,r),i=await f(n);[`dependencies`,`devDependencies`].forEach(e=>{let n=i[e];n&&Object.keys(n).forEach(e=>{n[e]=t[e]||n[e]})}),_(n,X(i))}}async function ue(e){let n=e.templateOptions.hasStyle,r=[`.editorconfig`,`.gitignore`,`.gitattributes`,`commitlint.config.mjs`,`simple-git-hooks.mjs`,`pnpm-workspace.yaml`];n||r.push(`lint-staged.config.mjs`),[`vscode`,`electron`].find(t=>e.template.startsWith(t))||r.push(`.vscode`),r.forEach(n=>{let r=a.join(e.targetDir,n);t.existsSync(r)&&h(r)});let i=await f(a.join(e.targetDir,`package.json`));if(i.scripts&&delete i.scripts.prepare,!n)delete i.devDependencies;else if(i.devDependencies){let e=await f(a.join(V,`config/style/package.json`)),t=Object.keys(e.devDependencies||{});Object.keys(i.devDependencies).forEach(e=>{t.includes(e)||delete i.devDependencies[e]})}await _(a.join(e.targetDir,`package.json`),i)}async function de(e,t){let n=v((t.split(`/`).pop()||``).replace(`vite-plugin`,``)||`xxx`),r=await x([`src/**/*.ts`,`examples/*/vite.config.ts`,`examples/*/package.json`],{ignore:[`**/node_modules/**`,`**/.*`],cwd:e});for(let t of r){let r=a.join(e,t);await g(r,(await d(r)).replaceAll(`xxx`,n).replaceAll(`Xxx`,b(n)))}}const Z=e(`
2
2
  Usage
3
3
  $ create-app [options] <package-name>
4
4
 
5
- package-name ${P(`options.packageName`)}
5
+ package-name ${z(`options.packageName`)}
6
6
 
7
7
  Options
8
- --overwrite, -o ${P(`options.overwrite`)}
9
- --package, -p ${P(`options.package`)}
10
- --private ${P(`options.private`)}
11
- --verbose ${P(`options.verbose`)}
12
- --help, -h ${P(`options.help`)}
13
- --version, -v ${P(`options.version`)}
14
- `,{importMeta:import.meta,booleanDefault:void 0,helpIndent:0,description:P(`app.description`),flags:{overwrite:{type:`string`},private:{type:`boolean`},package:{type:`boolean`,shortFlag:`p`},verbose:{type:`boolean`,default:!1},help:{type:`boolean`,shortFlag:`h`},version:{type:`boolean`,shortFlag:`v`}}}),{input:Q,flags:$}=Z;$.help?Z.showHelp(0):$.version?Z.showVersion():(D.enableDebug($.verbose),D.debug(`package name:`,Q.join()),D.debug(`cli options:`,$),se(Object.assign({packageName:Q[0]},$)));export{};
8
+ --cwd ${z(`options.cwd`)}
9
+ --overwrite, -o ${z(`options.overwrite`)}
10
+ --package, -p ${z(`options.package`)}
11
+ --private ${z(`options.private`)}
12
+ --verbose ${z(`options.verbose`)}
13
+ --help, -h ${z(`options.help`)}
14
+ --version, -v ${z(`options.version`)}
15
+ `,{importMeta:import.meta,booleanDefault:void 0,helpIndent:0,description:z(`app.description`),flags:{cwd:{type:`string`},overwrite:{type:`string`},private:{type:`boolean`},package:{type:`boolean`,shortFlag:`p`},verbose:{type:`boolean`,default:!1},help:{type:`boolean`,shortFlag:`h`},version:{type:`boolean`,shortFlag:`v`}}}),{input:Q,flags:$}=Z;if($.help)Z.showHelp(0);else if($.version)Z.showVersion();else{A.enableDebug($.verbose),A.debug(`package name:`,Q.join()),A.debug(`cli options:`,$);let e=Object.assign({packageName:Q[0],cwd:process.env.CLI_CWD},$);A.debug(`merge options:`,e),U(e)}export{};
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "app.description": "Create a node/web/electron/vscode project based on tomjs",
3
+ "options.cwd": "Current working directory",
3
4
  "options.help": "Show help information",
4
5
  "options.interactive": "Force interactive",
5
6
  "options.overwrite": "Overwrite existing project",
@@ -2,6 +2,7 @@
2
2
  "app.description": "创建基于 tomjs 的 node/web/electron/vscode 项目",
3
3
  "options.help": "显示帮助信息",
4
4
  "options.interactive": "强制互动",
5
+ "options.cwd": "当前工作目录",
5
6
  "options.overwrite": "覆盖已存在的目录",
6
7
  "options.package": "为 workspace 项目创建包",
7
8
  "options.packageName": "包名称",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tomjs/create-app",
3
3
  "type": "module",
4
- "version": "4.1.1",
4
+ "version": "5.0.0",
5
5
  "description": "Create a node/web/electron/vscode project based on tomjs",
6
6
  "author": {
7
7
  "name": "Tom Gao",
@@ -59,9 +59,9 @@
59
59
  },
60
60
  "devDependencies": {
61
61
  "@antfu/eslint-config": "^6.7.3",
62
- "@commitlint/cli": "^20.2.0",
62
+ "@commitlint/cli": "^20.3.0",
63
63
  "@tomjs/commitlint": "^5.0.0",
64
- "@tomjs/eslint": "^6.3.0",
64
+ "@tomjs/eslint": "^6.4.0",
65
65
  "@tomjs/stylelint": "^7.0.0",
66
66
  "@tomjs/tsconfig": "^3.0.1",
67
67
  "@tsconfig/node20": "^20.1.8",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  // Disable the default formatter, use eslint instead
3
3
  "prettier.enable": false,
4
- "editor.formatOnSave": true,
4
+ "editor.formatOnSave": false,
5
5
 
6
6
  // Auto fix
7
7
  "editor.codeActionsOnSave": {
@@ -13,6 +13,7 @@
13
13
  "@tomjs/eslint": "^6.3.0",
14
14
  "@tomjs/tsconfig": "^3.0.1",
15
15
  "@types/node": "^20.19.27",
16
+ "cross-env": "^10.1.0",
16
17
  "eslint": "^9.39.2",
17
18
  "lint-staged": "^16.2.7",
18
19
  "npm-run-all2": "^8.0.4",
@@ -0,0 +1,13 @@
1
+ {
2
+ "scripts": {
3
+ "dev": "vite",
4
+ "debug": "cross-env VITE_ELECTRON_DEBUG=1 vite",
5
+ "build": "vite build"
6
+ },
7
+ "devDependencies": {
8
+ "@tomjs/vite-plugin-electron": "^2.2.0",
9
+ "electron": "^39.2.7",
10
+ "electron-builder": "^26.0.12",
11
+ "vite-plugin-electron-renderer": "^0.14.6"
12
+ }
13
+ }
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) {{dateYear}}-PRESENT {{gitUserName}}
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,10 @@
1
+ {
2
+ "license": "MIT",
3
+ "publishConfig": {
4
+ "access": "public",
5
+ "registry": "https://registry.npmjs.org"
6
+ },
7
+ "scripts": {
8
+ "prepublishOnly": "pnpm build"
9
+ }
10
+ }
@@ -5,13 +5,13 @@
5
5
  "@commitlint/cli": "^20.3.0",
6
6
  "@eslint-react/eslint-plugin": "^2.5.0",
7
7
  "@tomjs/commitlint": "^5.0.0",
8
- "@tomjs/eslint": "^6.3.0",
8
+ "@tomjs/eslint": "^6.4.0",
9
9
  "@tomjs/logger": "^1.4.0",
10
10
  "@tomjs/node": "^2.2.3",
11
11
  "@tomjs/stylelint": "^7.0.0",
12
12
  "@tomjs/tsconfig": "^3.0.1",
13
13
  "@tomjs/vite-plugin-electron": "^2.2.0",
14
- "@tomjs/vite-plugin-vscode": "^6.0.2",
14
+ "@tomjs/vite-plugin-vscode": "^6.1.0",
15
15
  "@tomjs/vscode": "^2.5.0",
16
16
  "@tomjs/vscode-dev": "^3.1.2",
17
17
  "@tomjs/vscode-webview": "^2.0.2",
@@ -1,10 +1,3 @@
1
1
  {
2
- "license": "MIT",
3
- "publishConfig": {
4
- "access": "public",
5
- "registry": "https://registry.npmjs.org"
6
- },
7
- "scripts": {
8
- "prepublishOnly": "pnpm build"
9
- }
2
+ "license": "MIT"
10
3
  }
@@ -2,5 +2,4 @@ import defineConfig from '@tomjs/eslint';
2
2
 
3
3
  export default defineConfig({
4
4
  react: true,
5
- typescript: true,
6
5
  });
@@ -0,0 +1,15 @@
1
+ {
2
+ "dependencies": {
3
+ "react": "^19.2.3",
4
+ "react-dom": "^19.2.3"
5
+ },
6
+ "devDependencies": {
7
+ "@eslint-react/eslint-plugin": "^2.5.0",
8
+ "@types/react": "^19.2.7",
9
+ "@types/react-dom": "^19.2.3",
10
+ "@vitejs/plugin-react-swc": "^4.2.2",
11
+ "eslint-plugin-react-hooks": "^7.0.1",
12
+ "eslint-plugin-react-refresh": "^0.4.26",
13
+ "vite": "^7.3.0"
14
+ }
15
+ }
@@ -1,5 +1,5 @@
1
1
  export default {
2
- '*.{vue,css,scss,html}': [
2
+ '*.{css,scss,vue,html}': [
3
3
  'stylelint --fix',
4
4
  'eslint --fix',
5
5
  ],
@@ -10,7 +10,7 @@
10
10
 
11
11
  // Disable the default formatter, use eslint instead
12
12
  "prettier.enable": false,
13
- "editor.formatOnSave": true,
13
+ "editor.formatOnSave": false,
14
14
 
15
15
  // Auto fix
16
16
  "editor.codeActionsOnSave": {
@@ -0,0 +1,49 @@
1
+ {
2
+ "keywords": [
3
+ "vscode"
4
+ ],
5
+ "categories": [
6
+ "Other"
7
+ ],
8
+ "icon": "resources/logo.png",
9
+ "engines": {
10
+ "node": ">=14.16.0",
11
+ "vscode": "^1.56.0"
12
+ },
13
+ "activationEvents": [],
14
+ "contributes": {
15
+ "commands": [
16
+ {
17
+ "command": "tomjs.xxx.showHello",
18
+ "title": "%tomjs.commands.hello%",
19
+ "category": "%displayName%"
20
+ },
21
+ {
22
+ "command": "tomjs.xxx.showPanel",
23
+ "title": "%tomjs.commands.panel%",
24
+ "category": "%displayName%"
25
+ }
26
+ ]
27
+ },
28
+ "scripts": {
29
+ "dev": "run-p dev:*",
30
+ "dev:vsd": "vscode-dev --watch",
31
+ "dev:dist": "vite"
32
+ },
33
+ "dependencies": {
34
+ "@tomjs/node": "^2.2.3",
35
+ "@tomjs/vscode": "^2.5.0",
36
+ "@tomjs/vscode-webview": "^2.0.2",
37
+ "@vscode/webview-ui-toolkit": "^1.4.0"
38
+ },
39
+ "devDependencies": {
40
+ "@tomjs/vite-plugin-vscode": "^6.1.0",
41
+ "@tomjs/vscode-dev": "^3.1.2",
42
+ "@types/vscode": "^1.56.0",
43
+ "@types/vscode-webview": "^1.57.5"
44
+ },
45
+ "vsce": {
46
+ "dependencies": false,
47
+ "yarn": false
48
+ }
49
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "dependencies": {
3
+ "vue": "^3.5.26"
4
+ },
5
+ "devDependencies": {
6
+ "@vitejs/plugin-vue": "^6.0.3",
7
+ "vite": "^7.3.0",
8
+ "vite-plugin-vue-devtools": "^8.0.5",
9
+ "vue-tsc": "^3.2.1"
10
+ }
11
+ }
@@ -3,34 +3,12 @@
3
3
  "version": "0.0.0",
4
4
  "private": true,
5
5
  "description": "vite + react",
6
- "main": "./dist/main/index.js",
6
+ "main": "./dist/main/index.mjs",
7
7
  "engines": {
8
8
  "node": ">=20"
9
9
  },
10
10
  "scripts": {
11
- "dev": "vite",
12
- "debug": "cross-env VITE_ELECTRON_DEBUG=1 vite",
13
- "build": "vite build",
14
- "build:pack": "cross-env VITE_ELECTRON_BUILDER=1 vite build",
15
- "preview": "vite preview"
16
- },
17
- "dependencies": {
18
- "react": "^19.2.3",
19
- "react-dom": "^19.2.3"
20
- },
21
- "devDependencies": {
22
- "@eslint-react/eslint-plugin": "^2.5.0",
23
- "@tomjs/vite-plugin-electron": "^2.2.0",
24
- "@types/node": "^20.19.27",
25
- "@types/react": "^19.2.7",
26
- "@types/react-dom": "^19.2.3",
27
- "@vitejs/plugin-react-swc": "^4.2.2",
28
- "cross-env": "^10.1.0",
29
- "electron": "^39.2.7",
30
- "eslint-plugin-react-hooks": "^7.0.1",
31
- "eslint-plugin-react-refresh": "^0.4.26",
32
- "typescript": "~5.9.3",
33
- "vite": "^7.3.0",
34
- "vite-plugin-electron-renderer": "^0.14.6"
11
+ "build": "tsc -b && vite build",
12
+ "release": "tsc -b --noEmit && cross-env VITE_ELECTRON_BUILDER=1 vite build"
35
13
  }
36
14
  }
@@ -2,5 +2,6 @@ onlyBuiltDependencies:
2
2
  - '@parcel/watcher'
3
3
  - '@swc/core'
4
4
  - electron
5
+ - electron-winstaller
5
6
  - esbuild
6
7
  - simple-git-hooks
@@ -9,27 +9,11 @@
9
9
  "node": ">=20"
10
10
  },
11
11
  "scripts": {
12
- "dev": "vite",
13
- "debug": "cross-env VITE_ELECTRON_DEBUG=1 vite",
14
12
  "build": "vue-tsc --noEmit && vite build",
15
- "build:pack": "cross-env VITE_ELECTRON_BUILDER=1 vite build",
16
- "preview": "vite preview"
17
- },
18
- "dependencies": {
19
- "vue": "^3.5.26"
13
+ "release": "vue-tsc --noEmit && cross-env VITE_ELECTRON_BUILDER=1 vite build"
20
14
  },
15
+ "dependencies": {},
21
16
  "devDependencies": {
22
- "@tomjs/vite-plugin-electron": "^2.2.0",
23
- "@types/node": "^20.19.27",
24
- "@vitejs/plugin-vue": "^6.0.3",
25
- "@vue/tsconfig": "^0.8.1",
26
- "cross-env": "^10.1.0",
27
- "electron": "^39.2.7",
28
- "electron-builder": "^26.0.12",
29
- "typescript": "~5.9.3",
30
- "vite": "^7.3.0",
31
- "vite-plugin-electron-renderer": "^0.14.6",
32
- "vite-plugin-vue-devtools": "^8.0.5",
33
- "vue-tsc": "^3.2.1"
17
+ "vite-plugin-electron-renderer": "^0.14.6"
34
18
  }
35
19
  }
@@ -1,5 +1,6 @@
1
1
  onlyBuiltDependencies:
2
2
  - '@parcel/watcher'
3
3
  - electron
4
+ - electron-winstaller
4
5
  - esbuild
5
6
  - simple-git-hooks
@@ -5,7 +5,7 @@
5
5
  },
6
6
  "include": [
7
7
  "@tomjs/vite-plugin-electron/env",
8
- "electron",
8
+ "../config/electron/electron",
9
9
  "*.config.ts"
10
10
  ]
11
11
  }
@@ -4,67 +4,31 @@
4
4
  "i18n-ally.localesPaths": "./locales",
5
5
  "i18n-ally.displayLanguage": "zh-Hans",
6
6
  "i18n-ally.sourceLanguage": "zh-Hans",
7
+
7
8
  // Disable the default formatter, use eslint instead
8
9
  "prettier.enable": false,
9
- "editor.formatOnSave": true,
10
+ "editor.formatOnSave": false,
11
+
10
12
  // Auto fix
11
13
  "editor.codeActionsOnSave": {
12
14
  "source.fixAll.eslint": "explicit",
13
15
  "source.organizeImports": "never"
14
16
  },
17
+
15
18
  // Silent the stylistic rules in your IDE, but still auto fix them
16
19
  "eslint.rules.customizations": [
17
- {
18
- "rule": "style/*",
19
- "severity": "off",
20
- "fixable": true
21
- },
22
- {
23
- "rule": "format/*",
24
- "severity": "off",
25
- "fixable": true
26
- },
27
- {
28
- "rule": "*-indent",
29
- "severity": "off",
30
- "fixable": true
31
- },
32
- {
33
- "rule": "*-spacing",
34
- "severity": "off",
35
- "fixable": true
36
- },
37
- {
38
- "rule": "*-spaces",
39
- "severity": "off",
40
- "fixable": true
41
- },
42
- {
43
- "rule": "*-order",
44
- "severity": "off",
45
- "fixable": true
46
- },
47
- {
48
- "rule": "*-dangle",
49
- "severity": "off",
50
- "fixable": true
51
- },
52
- {
53
- "rule": "*-newline",
54
- "severity": "off",
55
- "fixable": true
56
- },
57
- {
58
- "rule": "*quotes",
59
- "severity": "off",
60
- "fixable": true
61
- },
62
- {
63
- "rule": "*semi",
64
- "severity": "off",
65
- "fixable": true
66
- }
20
+ { "rule": "style/*", "severity": "off", "fixable": true },
21
+ { "rule": "format/*", "severity": "off", "fixable": true },
22
+ { "rule": "*-indent", "severity": "off", "fixable": true },
23
+ { "rule": "*-spacing", "severity": "off", "fixable": true },
24
+ { "rule": "*-spaces", "severity": "off", "fixable": true },
25
+ { "rule": "*-order", "severity": "off", "fixable": true },
26
+ { "rule": "*-dangle", "severity": "off", "fixable": true },
27
+ { "rule": "*-newline", "severity": "off", "fixable": true },
28
+ { "rule": "*quotes", "severity": "off", "fixable": true },
29
+ { "rule": "*semi", "severity": "off", "fixable": true }
67
30
  ],
31
+
68
32
  // Enable eslint for all supported languages
69
33
  "eslint.validate": [
70
34
  "javascript",
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "devDependencies": {
17
17
  "@eslint-react/eslint-plugin": "^2.3.9",
18
- "@tomjs/vite-plugin-template": "workspace:*",
18
+ "@tomjs/vite-plugin-xxx": "workspace:*",
19
19
  "@types/node": "^24.10.1",
20
20
  "@types/react": "^19.2.5",
21
21
  "@types/react-dom": "^19.2.3",
@@ -1,5 +1,5 @@
1
1
  import path from 'node:path';
2
- import usePlugin from '@tomjs/vite-plugin-template';
2
+ import xxx from '@tomjs/vite-plugin-template';
3
3
  import react from '@vitejs/plugin-react-swc';
4
4
  import { defineConfig } from 'vite';
5
5
 
@@ -11,5 +11,5 @@ export default defineConfig({
11
11
  react: path.resolve(process.cwd(), 'node_modules/react'),
12
12
  },
13
13
  },
14
- plugins: [react(), usePlugin()],
14
+ plugins: [react(), xxx()],
15
15
  });
@@ -12,7 +12,7 @@
12
12
  "vue": "^3.5.24"
13
13
  },
14
14
  "devDependencies": {
15
- "@tomjs/vite-plugin-template": "workspace:*",
15
+ "@tomjs/vite-plugin-xxx": "workspace:*",
16
16
  "@types/node": "^24.10.1",
17
17
  "@vitejs/plugin-vue": "^6.0.1",
18
18
  "@vue/tsconfig": "^0.8.1",
@@ -1,8 +1,8 @@
1
- import usePlugin from '@tomjs/vite-plugin-template';
1
+ import xxx from '@tomjs/vite-plugin-template';
2
2
  import vue from '@vitejs/plugin-vue';
3
3
  import { defineConfig } from 'vite';
4
4
 
5
5
  // https://vite.dev/config/
6
6
  export default defineConfig({
7
- plugins: [vue(), usePlugin()],
7
+ plugins: [vue(), xxx()],
8
8
  });
@@ -10,6 +10,7 @@
10
10
  "type": "extensionHost",
11
11
  "request": "launch",
12
12
  "args": [
13
+ "--disable-extensions",
13
14
  "--extensionDevelopmentPath=${workspaceFolder}"
14
15
  ],
15
16
  "outFiles": [
@@ -10,7 +10,7 @@
10
10
 
11
11
  // Disable the default formatter, use eslint instead
12
12
  "prettier.enable": false,
13
- "editor.formatOnSave": true,
13
+ "editor.formatOnSave": false,
14
14
 
15
15
  // Auto fix
16
16
  "editor.codeActionsOnSave": {
@@ -20,7 +20,7 @@
20
20
  "background": {
21
21
  "activeOnStart": true,
22
22
  "beginsPattern": "^.*Build start*$",
23
- "endsPattern": "^.*Build complete.*$"
23
+ "endsPattern": "^.*Rebuilt.*$"
24
24
  }
25
25
  },
26
26
  "isBackground": true,
@@ -5,61 +5,8 @@
5
5
  "type": "commonjs",
6
6
  "description": "%description%",
7
7
  "license": "MIT",
8
- "keywords": [
9
- "vscode"
10
- ],
11
- "categories": [
12
- "Other"
13
- ],
14
8
  "main": "dist/extension/index.js",
15
- "icon": "resources/logo.png",
16
- "engines": {
17
- "node": ">=14.16.0",
18
- "vscode": "^1.56.0"
19
- },
20
- "activationEvents": [],
21
- "contributes": {
22
- "commands": [
23
- {
24
- "command": "tomjs.xxx.showHello",
25
- "title": "%tomjs.commands.hello%",
26
- "category": "%displayName%"
27
- },
28
- {
29
- "command": "tomjs.xxx.showPanel",
30
- "title": "%tomjs.commands.panel%",
31
- "category": "%displayName%"
32
- }
33
- ]
34
- },
35
- "vsce": {
36
- "dependencies": false,
37
- "yarn": false
38
- },
39
9
  "scripts": {
40
- "dev": "run-p dev:*",
41
- "dev:vsd": "vscode-dev --watch",
42
- "dev:dist": "vite",
43
- "build": "vscode-dev && tsc -b && vite build",
44
- "preview": "vite preview"
45
- },
46
- "dependencies": {
47
- "@tomjs/node": "^2.2.3",
48
- "@tomjs/vscode": "^2.5.0",
49
- "@tomjs/vscode-webview": "^2.0.2",
50
- "@vscode/webview-ui-toolkit": "^1.4.0",
51
- "react": "^19.2.3",
52
- "react-dom": "^19.2.3"
53
- },
54
- "devDependencies": {
55
- "@tomjs/vite-plugin-vscode": "^6.0.1",
56
- "@tomjs/vscode-dev": "^3.1.2",
57
- "@types/react": "^19.2.7",
58
- "@types/react-dom": "^19.2.3",
59
- "@types/vscode": "^1.56.0",
60
- "@types/vscode-webview": "^1.57.5",
61
- "@vitejs/plugin-react": "^5.1.2",
62
- "@vitejs/plugin-react-swc": "^4.2.2",
63
- "vite": "^7.3.0"
10
+ "build": "tsc -b && vite build"
64
11
  }
65
12
  }