@tomjs/create-app 4.0.1 → 4.1.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 (46) hide show
  1. package/dist/index.mjs +2 -2
  2. package/package.json +2 -2
  3. package/templates/config/base/.vscode/settings.json +1 -1
  4. package/templates/config/base/package.json +4 -5
  5. package/templates/config/package.json +6 -6
  6. package/templates/electron-react/package.json +2 -2
  7. package/templates/electron-react/pnpm-workspace.yaml +1 -1
  8. package/templates/electron-react/tsconfig.app.json +15 -0
  9. package/templates/electron-react/tsconfig.json +3 -5
  10. package/templates/electron-react/tsconfig.node.json +6 -2
  11. package/templates/electron-vue/package.json +1 -1
  12. package/templates/electron-vue/pnpm-workspace.yaml +0 -1
  13. package/templates/electron-vue/tsconfig.app.json +16 -0
  14. package/templates/electron-vue/tsconfig.json +5 -3
  15. package/templates/electron-vue/tsconfig.node.json +6 -2
  16. package/templates/node-base/tsconfig.json +4 -1
  17. package/templates/node-cli/.vscode/settings.json +51 -15
  18. package/templates/node-cli/tsconfig.json +4 -1
  19. package/templates/node-vite/tsconfig.json +4 -1
  20. package/templates/vscode-base/.vscode/settings.json +1 -1
  21. package/templates/vscode-base/package.json +2 -2
  22. package/templates/vscode-base/tsconfig.json +5 -1
  23. package/templates/vscode-react/.vscode/settings.json +1 -1
  24. package/templates/vscode-react/package.json +1 -1
  25. package/templates/vscode-react/src/App.tsx +1 -1
  26. package/templates/vscode-react/src/utils/vscode.ts +1 -1
  27. package/templates/vscode-react/tsconfig.app.json +14 -0
  28. package/templates/vscode-react/tsconfig.json +5 -3
  29. package/templates/vscode-react/tsconfig.node.json +5 -2
  30. package/templates/vscode-vue/.vscode/settings.json +1 -1
  31. package/templates/vscode-vue/package.json +2 -2
  32. package/templates/vscode-vue/src/App.vue +4 -4
  33. package/templates/vscode-vue/src/utils/vscode.ts +1 -1
  34. package/templates/vscode-vue/tsconfig.app.json +15 -0
  35. package/templates/vscode-vue/tsconfig.json +5 -3
  36. package/templates/vscode-vue/tsconfig.node.json +5 -2
  37. package/templates/web-react/pnpm-workspace.yaml +5 -0
  38. package/templates/web-react/tsconfig.app.json +3 -23
  39. package/templates/web-react/tsconfig.node.json +2 -21
  40. package/templates/web-vue/package.json +0 -1
  41. package/templates/web-vue/pnpm-workspace.yaml +4 -0
  42. package/templates/web-vue/tsconfig.app.json +5 -1
  43. package/templates/web-vue/tsconfig.node.json +1 -1
  44. package/templates/electron-vue/electron/env.d.ts +0 -1
  45. package/templates/vscode-react/src/vite-env.d.ts +0 -2
  46. package/templates/vscode-vue/src/vite-env.d.ts +0 -2
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
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 L(e){re(e);let t=await R(e);t&&(await z(t),e.package&&await le(t),t.template===`node-vite`&&(await ce(t.targetDir),await X(t.targetDir,t.packageName)),e.package||await A(`git init`,{cwd:t.targetDir}))}async function R(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 G(`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||U(e)?void 0:P(`prompt.package.invalid`)});if(o.isCancel(f))return I();d=f;let p=B(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)&&!V(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`:H(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=K(d);let e=await o.text({message:P(`prompt.orgName.message`),defaultValue:s,placeholder:s,validate:e=>s&&!e||W(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 z(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 q(S,`base`,C),y.hasStyle&&await q(S,`style`,C),f&&!x&&await q(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 G(`user.name`)||r.userInfo().username,n=await G(`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`),Y(S)),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 B(e){return(e||``).trim().replace(/^@[^/]+\//,``)}function V(e){return t.readdirSync(e).length===0}function H(e){t.existsSync(e)&&m(e)}function U(e){return/^(?:@[a-z\d\-*~][a-z\d\-*._~]*\/)?[a-z\d\-~][a-z\d\-._~]*$/.test(e)}function W(e){return/^[a-z][a-z\d\-._]*$/.test(e)}async function G(e){return A(`git config --get ${e}`,{trim:!0})}function K(e){if(e.startsWith(`@`))return e.split(`/`)[0].substring(1)}async function q(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 J(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 se(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 Y(e){return e=J(e,ee),e.scripts&&=se(e.scripts,te,[`prepare`,`prepublishOnly`]),[`dependencies`,`devDependencies`,`peerDependencies`].forEach(t=>{e[t]&&(e[t]=J(e[t]))}),e}async function ce(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,Y(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 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(`
2
2
  Usage
3
3
  $ create-app [options] <package-name>
4
4
 
@@ -11,4 +11,4 @@ Options
11
11
  --verbose ${P(`options.verbose`)}
12
12
  --help, -h ${P(`options.help`)}
13
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:`,$),L(Object.assign({packageName:Q[0]},$)));export{};
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{};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tomjs/create-app",
3
3
  "type": "module",
4
- "version": "4.0.1",
4
+ "version": "4.1.0",
5
5
  "description": "Create a node/web/electron/vscode project based on tomjs",
6
6
  "author": {
7
7
  "name": "Tom Gao",
@@ -63,7 +63,7 @@
63
63
  "@tomjs/commitlint": "^5.0.0",
64
64
  "@tomjs/eslint": "^6.3.0",
65
65
  "@tomjs/stylelint": "^7.0.0",
66
- "@tomjs/tsconfig": "^2.2.0",
66
+ "@tomjs/tsconfig": "^3.0.1",
67
67
  "@tsconfig/node20": "^20.1.8",
68
68
  "@types/lodash-es": "^4.17.12",
69
69
  "@types/node": "^20.19.27",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  // Disable the default formatter, use eslint instead
3
3
  "prettier.enable": false,
4
- "editor.formatOnSave": false,
4
+ "editor.formatOnSave": true,
5
5
 
6
6
  // Auto fix
7
7
  "editor.codeActionsOnSave": {
@@ -1,18 +1,17 @@
1
1
  {
2
-
3
2
  "type": "module",
4
3
  "version": "0.0.0",
5
- "packageManager": "pnpm@10.26.2",
4
+ "packageManager": "pnpm@10.27.0",
6
5
  "scripts": {
7
6
  "lint": "eslint --fix",
8
7
  "prepare": "simple-git-hooks"
9
8
  },
10
9
  "devDependencies": {
11
10
  "@antfu/eslint-config": "^6.7.3",
12
- "@commitlint/cli": "^20.2.0",
11
+ "@commitlint/cli": "^20.3.0",
13
12
  "@tomjs/commitlint": "^5.0.0",
14
- "@tomjs/eslint": "^6.1.0",
15
- "@tomjs/tsconfig": "^2.2.0",
13
+ "@tomjs/eslint": "^6.3.0",
14
+ "@tomjs/tsconfig": "^3.0.1",
16
15
  "@types/node": "^20.19.27",
17
16
  "eslint": "^9.39.2",
18
17
  "lint-staged": "^16.2.7",
@@ -2,18 +2,18 @@
2
2
  "dependencies": {
3
3
  "@antfu/eslint-config": "^6.7.3",
4
4
  "@clack/prompts": "^0.11.0",
5
- "@commitlint/cli": "^20.2.0",
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.1.0",
8
+ "@tomjs/eslint": "^6.3.0",
9
9
  "@tomjs/logger": "^1.4.0",
10
10
  "@tomjs/node": "^2.2.3",
11
11
  "@tomjs/stylelint": "^7.0.0",
12
- "@tomjs/tsconfig": "^2.2.0",
13
- "@tomjs/vite-plugin-electron": "^2.1.0",
14
- "@tomjs/vite-plugin-vscode": "^6.0.1",
12
+ "@tomjs/tsconfig": "^3.0.1",
13
+ "@tomjs/vite-plugin-electron": "^2.2.0",
14
+ "@tomjs/vite-plugin-vscode": "^6.0.2",
15
15
  "@tomjs/vscode": "^2.5.0",
16
- "@tomjs/vscode-dev": "^3.0.2",
16
+ "@tomjs/vscode-dev": "^3.1.2",
17
17
  "@tomjs/vscode-webview": "^2.0.2",
18
18
  "@types/node": "^20.19.27",
19
19
  "@types/react": "^19.2.7",
@@ -19,8 +19,8 @@
19
19
  "react-dom": "^19.2.3"
20
20
  },
21
21
  "devDependencies": {
22
- "@eslint-react/eslint-plugin": "^2.4.0",
23
- "@tomjs/vite-plugin-electron": "^2.1.0",
22
+ "@eslint-react/eslint-plugin": "^2.5.0",
23
+ "@tomjs/vite-plugin-electron": "^2.2.0",
24
24
  "@types/node": "^20.19.27",
25
25
  "@types/react": "^19.2.7",
26
26
  "@types/react-dom": "^19.2.3",
@@ -1,6 +1,6 @@
1
1
  onlyBuiltDependencies:
2
+ - '@parcel/watcher'
2
3
  - '@swc/core'
3
4
  - electron
4
- - electron-winstaller
5
5
  - esbuild
6
6
  - simple-git-hooks
@@ -0,0 +1,15 @@
1
+ {
2
+ "extends": "@tomjs/tsconfig/react.json",
3
+ "compilerOptions": {
4
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
5
+ "types": [
6
+ "vite/client",
7
+ "node"
8
+ ]
9
+ },
10
+ "include": [
11
+ "src/**/*.ts",
12
+ "src/**/*.tsx",
13
+ "src/**/*.d.ts"
14
+ ]
15
+ }
@@ -1,9 +1,7 @@
1
1
  {
2
- "extends": "@tomjs/tsconfig/react-dom.json",
3
2
  "references": [
4
- {
5
- "path": "./tsconfig.node.json"
6
- }
3
+ { "path": "./tsconfig.app.json" },
4
+ { "path": "./tsconfig.node.json" }
7
5
  ],
8
- "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx"]
6
+ "files": []
9
7
  }
@@ -1,7 +1,11 @@
1
1
  {
2
2
  "extends": "@tomjs/tsconfig/node.json",
3
3
  "compilerOptions": {
4
- "composite": true
4
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo"
5
5
  },
6
- "include": ["electron", "vite.config.ts"]
6
+ "include": [
7
+ "@tomjs/vite-plugin-electron/env",
8
+ "electron",
9
+ "*.config.ts"
10
+ ]
7
11
  }
@@ -19,7 +19,7 @@
19
19
  "vue": "^3.5.26"
20
20
  },
21
21
  "devDependencies": {
22
- "@tomjs/vite-plugin-electron": "^2.1.0",
22
+ "@tomjs/vite-plugin-electron": "^2.2.0",
23
23
  "@types/node": "^20.19.27",
24
24
  "@vitejs/plugin-vue": "^6.0.3",
25
25
  "@vue/tsconfig": "^0.8.1",
@@ -1,6 +1,5 @@
1
1
  onlyBuiltDependencies:
2
2
  - '@parcel/watcher'
3
3
  - electron
4
- - electron-winstaller
5
4
  - esbuild
6
5
  - simple-git-hooks
@@ -0,0 +1,16 @@
1
+ {
2
+ "extends": "@tomjs/tsconfig/vue.json",
3
+ "compilerOptions": {
4
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
5
+ "types": [
6
+ "vite/client",
7
+ "node"
8
+ ]
9
+ },
10
+ "include": [
11
+ "src/**/*.ts",
12
+ "src/**/*.tsx",
13
+ "src/**/*.vue",
14
+ "src/**/*.d.ts"
15
+ ]
16
+ }
@@ -1,5 +1,7 @@
1
1
  {
2
- "extends": "@tomjs/tsconfig/vue-dom.json",
3
- "references": [{ "path": "./tsconfig.node.json" }],
4
- "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"]
2
+ "references": [
3
+ { "path": "./tsconfig.app.json" },
4
+ { "path": "./tsconfig.node.json" }
5
+ ],
6
+ "files": []
5
7
  }
@@ -1,7 +1,11 @@
1
1
  {
2
2
  "extends": "@tomjs/tsconfig/node.json",
3
3
  "compilerOptions": {
4
- "composite": true
4
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo"
5
5
  },
6
- "include": ["electron", "vite.config.ts"]
6
+ "include": [
7
+ "@tomjs/vite-plugin-electron/env",
8
+ "electron",
9
+ "*.config.ts"
10
+ ]
7
11
  }
@@ -1,4 +1,7 @@
1
1
  {
2
2
  "extends": "@tomjs/tsconfig/node.json",
3
- "include": ["src", "*.ts"]
3
+ "include": [
4
+ "src",
5
+ "*.ts"
6
+ ]
4
7
  }
@@ -4,31 +4,67 @@
4
4
  "i18n-ally.localesPaths": "./locales",
5
5
  "i18n-ally.displayLanguage": "zh-Hans",
6
6
  "i18n-ally.sourceLanguage": "zh-Hans",
7
-
8
7
  // Disable the default formatter, use eslint instead
9
8
  "prettier.enable": false,
10
- "editor.formatOnSave": false,
11
-
9
+ "editor.formatOnSave": true,
12
10
  // Auto fix
13
11
  "editor.codeActionsOnSave": {
14
12
  "source.fixAll.eslint": "explicit",
15
13
  "source.organizeImports": "never"
16
14
  },
17
-
18
15
  // Silent the stylistic rules in your IDE, but still auto fix them
19
16
  "eslint.rules.customizations": [
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 }
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
+ }
30
67
  ],
31
-
32
68
  // Enable eslint for all supported languages
33
69
  "eslint.validate": [
34
70
  "javascript",
@@ -1,4 +1,7 @@
1
1
  {
2
2
  "extends": "@tomjs/tsconfig/node.json",
3
- "include": ["src", "*.ts"]
3
+ "include": [
4
+ "src",
5
+ "*.ts"
6
+ ]
4
7
  }
@@ -1,4 +1,7 @@
1
1
  {
2
2
  "extends": "@tomjs/tsconfig/node.json",
3
- "include": ["src", "*.ts"]
3
+ "include": [
4
+ "src",
5
+ "*.ts"
6
+ ]
4
7
  }
@@ -10,7 +10,7 @@
10
10
 
11
11
  // Disable the default formatter, use eslint instead
12
12
  "prettier.enable": false,
13
- "editor.formatOnSave": false,
13
+ "editor.formatOnSave": true,
14
14
 
15
15
  // Auto fix
16
16
  "editor.codeActionsOnSave": {
@@ -42,8 +42,8 @@
42
42
  "@tomjs/vscode": "^2.5.0"
43
43
  },
44
44
  "devDependencies": {
45
- "@tomjs/vscode-dev": "^3.0.2",
45
+ "@tomjs/vscode-dev": "^3.1.2",
46
46
  "@types/vscode": "^1.56.0",
47
- "tsdown": "^0.18.3"
47
+ "tsdown": "^0.18.4"
48
48
  }
49
49
  }
@@ -1,5 +1,9 @@
1
1
  {
2
2
  "extends": "@tomjs/tsconfig/node.json",
3
3
  "compilerOptions": {},
4
- "include": ["src", "package.json", "*.config.ts"]
4
+ "include": [
5
+ "src",
6
+ "package.json",
7
+ "*.config.ts"
8
+ ]
5
9
  }
@@ -10,7 +10,7 @@
10
10
 
11
11
  // Disable the default formatter, use eslint instead
12
12
  "prettier.enable": false,
13
- "editor.formatOnSave": false,
13
+ "editor.formatOnSave": true,
14
14
 
15
15
  // Auto fix
16
16
  "editor.codeActionsOnSave": {
@@ -53,7 +53,7 @@
53
53
  },
54
54
  "devDependencies": {
55
55
  "@tomjs/vite-plugin-vscode": "^6.0.1",
56
- "@tomjs/vscode-dev": "^3.0.2",
56
+ "@tomjs/vscode-dev": "^3.1.2",
57
57
  "@types/react": "^19.2.7",
58
58
  "@types/react-dom": "^19.2.3",
59
59
  "@types/vscode": "^1.56.0",
@@ -1,6 +1,6 @@
1
1
  import { VSCodeButton, VSCodeTextField } from '@vscode/webview-ui-toolkit/react';
2
2
  import { useState } from 'react';
3
- import { vscode } from './utils/vscode';
3
+ import { vscode } from './utils';
4
4
 
5
5
  import './App.css';
6
6
 
@@ -1,4 +1,4 @@
1
1
  import { WebviewApi } from '@tomjs/vscode-webview';
2
2
 
3
3
  // Exports class singleton to prevent multiple invocations of acquireVsCodeApi.
4
- export const vscodeApi = new WebviewApi<string>();
4
+ export const vscode = new WebviewApi<string>();
@@ -0,0 +1,14 @@
1
+ {
2
+ "extends": "@tomjs/tsconfig/react-dom.json",
3
+ "compilerOptions": {
4
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
5
+ "types": [
6
+ "vite/client"
7
+ ]
8
+ },
9
+ "include": [
10
+ "src/**/*.ts",
11
+ "src/**/*.tsx",
12
+ "src/**/*.d.ts"
13
+ ]
14
+ }
@@ -1,5 +1,7 @@
1
1
  {
2
- "extends": "@tomjs/tsconfig/vue.json",
3
- "references": [{ "path": "./tsconfig.node.json" }],
4
- "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"]
2
+ "references": [
3
+ { "path": "./tsconfig.app.json" },
4
+ { "path": "./tsconfig.node.json" }
5
+ ],
6
+ "files": []
5
7
  }
@@ -1,7 +1,10 @@
1
1
  {
2
2
  "extends": "@tomjs/tsconfig/node.json",
3
3
  "compilerOptions": {
4
- "composite": true
4
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo"
5
5
  },
6
- "include": ["extension", "package.json", "*.config.ts"]
6
+ "include": [
7
+ "extension",
8
+ "vite.config.ts"
9
+ ]
7
10
  }
@@ -10,7 +10,7 @@
10
10
 
11
11
  // Disable the default formatter, use eslint instead
12
12
  "prettier.enable": false,
13
- "editor.formatOnSave": false,
13
+ "editor.formatOnSave": true,
14
14
 
15
15
  // Auto fix
16
16
  "editor.codeActionsOnSave": {
@@ -49,11 +49,11 @@
49
49
  "@tomjs/vscode-webview": "^2.0.2",
50
50
  "@vscode/webview-ui-toolkit": "^1.4.0",
51
51
  "vue": "^3.5.26",
52
- "vue-i18n": "^11.2.7"
52
+ "vue-i18n": "^11.2.8"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@tomjs/vite-plugin-vscode": "^6.0.1",
56
- "@tomjs/vscode-dev": "^3.0.2",
56
+ "@tomjs/vscode-dev": "^3.1.2",
57
57
  "@types/vscode": "^1.56.0",
58
58
  "@types/vscode-webview": "^1.57.5",
59
59
  "@vitejs/plugin-vue": "^6.0.3",
@@ -1,12 +1,12 @@
1
1
  <script setup lang="ts">
2
2
  import { allComponents, provideVSCodeDesignSystem } from '@vscode/webview-ui-toolkit';
3
3
  import { ref } from 'vue';
4
- import { vscodeApi } from './utils';
4
+ import { vscode } from './utils';
5
5
 
6
6
  provideVSCodeDesignSystem().register(allComponents);
7
7
 
8
8
  function onPostMessage() {
9
- vscodeApi.postMessage({
9
+ vscode.postMessage({
10
10
  command: 'hello',
11
11
  text: 'Hey there partner! 🤠',
12
12
  });
@@ -16,11 +16,11 @@ const message = ref('');
16
16
  const state = ref('');
17
17
 
18
18
  function onSetState() {
19
- vscodeApi.setState(state.value);
19
+ vscode.setState(state.value);
20
20
  }
21
21
 
22
22
  function onGetState() {
23
- state.value = vscodeApi.getState() as string;
23
+ state.value = vscode.getState() as string;
24
24
  }
25
25
  </script>
26
26
 
@@ -1,4 +1,4 @@
1
1
  import { WebviewApi } from '@tomjs/vscode-webview';
2
2
 
3
3
  // Exports class singleton to prevent multiple invocations of acquireVsCodeApi.
4
- export const vscodeApi = new WebviewApi<string>();
4
+ export const vscode = new WebviewApi<string>();
@@ -0,0 +1,15 @@
1
+ {
2
+ "extends": "@tomjs/tsconfig/vue-dom.json",
3
+ "compilerOptions": {
4
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
5
+ "types": [
6
+ "vite/client"
7
+ ]
8
+ },
9
+ "include": [
10
+ "src/**/*.ts",
11
+ "src/**/*.tsx",
12
+ "src/**/*.vue",
13
+ "src/**/*.d.ts"
14
+ ]
15
+ }
@@ -1,5 +1,7 @@
1
1
  {
2
- "extends": "@tomjs/tsconfig/vue.json",
3
- "references": [{ "path": "./tsconfig.node.json" }],
4
- "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"]
2
+ "references": [
3
+ { "path": "./tsconfig.app.json" },
4
+ { "path": "./tsconfig.node.json" }
5
+ ],
6
+ "files": []
5
7
  }
@@ -1,7 +1,10 @@
1
1
  {
2
2
  "extends": "@tomjs/tsconfig/node.json",
3
3
  "compilerOptions": {
4
- "composite": true
4
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo"
5
5
  },
6
- "include": ["extension", "package.json", "*.config.ts"]
6
+ "include": [
7
+ "extension",
8
+ "*.config.ts"
9
+ ]
7
10
  }
@@ -0,0 +1,5 @@
1
+ onlyBuiltDependencies:
2
+ - '@parcel/watcher'
3
+ - '@swc/core'
4
+ - esbuild
5
+ - simple-git-hooks
@@ -1,28 +1,8 @@
1
1
  {
2
+ "extends": "@tomjs/tsconfig/react-dom.json",
2
3
  "compilerOptions": {
3
4
  "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
4
- "target": "ES2022",
5
- "jsx": "react-jsx",
6
- "lib": ["ES2022", "DOM", "DOM.Iterable"],
7
- "moduleDetection": "force",
8
- "useDefineForClassFields": true,
9
- "module": "ESNext",
10
-
11
- /* Bundler mode */
12
- "moduleResolution": "bundler",
13
- "types": ["vite/client"],
14
- "allowImportingTsExtensions": true,
15
-
16
- /* Linting */
17
- "strict": true,
18
- "noFallthroughCasesInSwitch": true,
19
- "noUnusedLocals": true,
20
- "noUnusedParameters": true,
21
- "noEmit": true,
22
- "verbatimModuleSyntax": true,
23
- "erasableSyntaxOnly": true,
24
- "skipLibCheck": true,
25
- "noUncheckedSideEffectImports": true
5
+ "types": ["vite/client"]
26
6
  },
27
- "include": ["src"]
7
+ "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.d.ts"]
28
8
  }
@@ -1,26 +1,7 @@
1
1
  {
2
+ "extends": "@tomjs/tsconfig/node.json",
2
3
  "compilerOptions": {
3
- "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
4
- "target": "ES2023",
5
- "lib": ["ES2023"],
6
- "moduleDetection": "force",
7
- "module": "ESNext",
8
-
9
- /* Bundler mode */
10
- "moduleResolution": "bundler",
11
- "types": ["node"],
12
- "allowImportingTsExtensions": true,
13
-
14
- /* Linting */
15
- "strict": true,
16
- "noFallthroughCasesInSwitch": true,
17
- "noUnusedLocals": true,
18
- "noUnusedParameters": true,
19
- "noEmit": true,
20
- "verbatimModuleSyntax": true,
21
- "erasableSyntaxOnly": true,
22
- "skipLibCheck": true,
23
- "noUncheckedSideEffectImports": true
4
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo"
24
5
  },
25
6
  "include": ["vite.config.ts"]
26
7
  }
@@ -14,7 +14,6 @@
14
14
  "devDependencies": {
15
15
  "@types/node": "^22.19.3",
16
16
  "@vitejs/plugin-vue": "^6.0.3",
17
- "@vue/tsconfig": "^0.8.1",
18
17
  "typescript": "~5.9.3",
19
18
  "vite": "^7.3.0",
20
19
  "vue-tsc": "^3.2.1"
@@ -0,0 +1,4 @@
1
+ onlyBuiltDependencies:
2
+ - '@parcel/watcher'
3
+ - esbuild
4
+ - simple-git-hooks
@@ -1,4 +1,8 @@
1
1
  {
2
- "extends": "@tomjs/tsconfig/vue.json",
2
+ "extends": "@tomjs/tsconfig/vue-dom.json",
3
+ "compilerOptions": {
4
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
5
+ "types": ["vite/client"]
6
+ },
3
7
  "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"]
4
8
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "extends": "@tomjs/tsconfig/node.json",
3
3
  "compilerOptions": {
4
- "composite": true
4
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo"
5
5
  },
6
6
  "include": ["vite.config.ts"]
7
7
  }
@@ -1 +0,0 @@
1
- /// <reference types="@tomjs/vite-plugin-electron/env" />
@@ -1,2 +0,0 @@
1
- /// <reference types="vite/client" />
2
- /// <reference types="@tomjs/vite-plugin-vscode/env" />
@@ -1,2 +0,0 @@
1
- /// <reference types="vite/client" />
2
- /// <reference types="@tomjs/vite-plugin-vscode/env" />