create-web-kit 1.0.0 → 25.728.816

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 (37) hide show
  1. package/dist/assets/html/ie.html +256 -0
  2. package/dist/config/frameworks.js +167 -1
  3. package/dist/config/help.js +18 -1
  4. package/dist/generators/electron-react.d.ts +1 -0
  5. package/dist/generators/electron-react.js +8 -0
  6. package/dist/generators/electron-vue.d.ts +1 -0
  7. package/dist/generators/electron-vue.js +1 -0
  8. package/dist/generators/nextjs-csr.d.ts +1 -0
  9. package/dist/generators/nextjs-csr.js +72 -0
  10. package/dist/generators/nextjs-ssr.d.ts +1 -0
  11. package/dist/generators/nextjs-ssr.js +1 -0
  12. package/dist/generators/project.d.ts +2 -2
  13. package/dist/generators/project.js +62 -1
  14. package/dist/generators/template.js +1 -1
  15. package/dist/generators/vue3.d.ts +1 -0
  16. package/dist/generators/vue3.js +1 -0
  17. package/dist/index.js +1 -1
  18. package/dist/templates/electron-react/eslint.config.js +1 -0
  19. package/dist/templates/electron-vue/eslint.config.js +1 -0
  20. package/dist/templates/nextjs-csr/build-info.tsx +20 -0
  21. package/dist/templates/nextjs-csr/devcontainer.json +32 -0
  22. package/dist/templates/nextjs-csr/eslint.config.js +1 -0
  23. package/dist/templates/nextjs-csr/layout.tsx +46 -0
  24. package/dist/templates/nextjs-csr/next.config.js +1 -0
  25. package/dist/templates/nextjs-csr/not-found.tsx +16 -0
  26. package/dist/templates/nextjs-csr/prettier.config.json +21 -0
  27. package/dist/templates/nextjs-csr/query-provider.tsx +45 -0
  28. package/dist/templates/nextjs-csr/request.ts +204 -0
  29. package/dist/templates/nextjs-csr/show.tsx +12 -0
  30. package/dist/templates/nextjs-csr/theme-provider.tsx +17 -0
  31. package/dist/templates/vue3/vite.config.ts +12 -0
  32. package/dist/utils/file.js +1 -1
  33. package/dist/utils/package-manager.d.ts +1 -0
  34. package/dist/utils/package-manager.js +1 -1
  35. package/dist/utils/template.d.ts +8 -0
  36. package/dist/utils/template.js +1 -0
  37. package/package.json +58 -58
@@ -1 +1,62 @@
1
- (function(g,h){const q=b,i=g();while(!![]){try{const j=-parseInt(q(0x135))/0x1*(parseInt(q(0x140))/0x2)+parseInt(q(0x13f))/0x3+-parseInt(q(0x130))/0x4*(-parseInt(q(0x13e))/0x5)+-parseInt(q(0x132))/0x6+parseInt(q(0x136))/0x7+parseInt(q(0x145))/0x8+parseInt(q(0x13a))/0x9;if(j===h)break;else i['push'](i['shift']());}catch(k){i['push'](i['shift']());}}}(a,0x200e2));function a(){const y=['NEXTAUTH_URL=http://localhost:3000\x0aNEXTAUTH_SECRET=your-secret-key\x0aDATABASE_URL=\x22your-database-url\x22','error','12NoVkDm','1142414usdiqm','electron-react','.prettierrc','step','674145mvPZPz','module.exports\x20=\x20{\x0a\x20\x20extends:\x20[\x27electron\x27,\x20\x27@electron-toolkit/eslint-config-ts\x27,\x20\x27prettier\x27],\x0a\x20\x20rules:\x20{\x0a\x20\x20\x20\x20\x27@typescript-eslint/no-unused-vars\x27:\x20\x27error\x27,\x0a\x20\x20\x20\x20\x27@typescript-eslint/no-explicit-any\x27:\x20\x27warn\x27,\x0a\x20\x20},\x0a};','Failed\x20to\x20execute:\x20','nextjs-csr','2330RhqoyM','422856EguuMh','22786dMydPH','join','log','Error\x20executing\x20command:\x20','import\x20{\x20defineConfig\x20}\x20from\x20\x27vite\x27\x0aimport\x20vue\x20from\x20\x27@vitejs/plugin-vue\x27\x0aimport\x20{\x20resolve\x20}\x20from\x20\x27path\x27\x0a\x0aexport\x20default\x20defineConfig({\x0a\x20\x20plugins:\x20[vue()],\x0a\x20\x20resolve:\x20{\x0a\x20\x20\x20\x20alias:\x20{\x0a\x20\x20\x20\x20\x20\x20\x27@\x27:\x20resolve(__dirname,\x20\x27src\x27),\x0a\x20\x20\x20\x20},\x0a\x20\x20},\x0a})','168368vWJkiq','152gHrFSV','writeFileSync','898794oeRZQy'];a=function(){return y;};return a();}import c from'node:fs';function b(c,d){const e=a();return b=function(f,g){f=f-0x130;let h=e[f];return h;},b(c,d);}import d from'node:path';import e from'cross-spawn';import*as f from'@clack/prompts';export async function executeMultiStepCommands(g,h,i,cwd){const r=b;if(!g['multiStepCommands'])return;f['log']['step']('Setting\x20up\x20'+g['display']+'\x20project...');for(const j of g['multiStepCommands']){f['log'][r(0x139)](j['description']);const k=j['workingDir']==='target'?i:cwd,l=j['command']['replace'](/TARGET_DIR/g,h),[m,...n]=l['split']('\x20');try{const o=e['sync'](m,n,{'stdio':'inherit','cwd':k});o['status']!==0x0&&(f[r(0x142)]['error'](r(0x13c)+l),process['exit'](o['status']??0x1));}catch(p){f['log']['error'](r(0x143)+l),console[r(0x134)](p),process['exit'](0x1);}}}export function createProjectFiles(g,h){const s=b;g===s(0x13d)&&createNextjsCSRFiles(h),g==='nextjs-ssr'&&createNextjsSSRFiles(h),g==='vue3'&&createVue3Files(h),g===s(0x137)&&createElectronReactFiles(h),g==='electron-vue'&&createElectronVueFiles(h);}function createNextjsCSRFiles(g){const t=b,h={'semi':!![],'trailingComma':'es5','singleQuote':!![],'printWidth':0x50,'tabWidth':0x2,'useTabs':![]};c['writeFileSync'](d['join'](g,'.prettierrc'),JSON['stringify'](h,null,0x2));const i='module.exports\x20=\x20{\x0a\x20\x20extends:\x20[\x27next/core-web-vitals\x27,\x20\x27prettier\x27],\x0a\x20\x20rules:\x20{\x0a\x20\x20\x20\x20\x27@typescript-eslint/no-unused-vars\x27:\x20\x27error\x27,\x0a\x20\x20\x20\x20\x27@typescript-eslint/no-explicit-any\x27:\x20\x27warn\x27,\x0a\x20\x20},\x0a};';c[t(0x131)](d[t(0x141)](g,'.eslintrc.js'),i);}function createNextjsSSRFiles(g){const u=b,h={'semi':!![],'trailingComma':'es5','singleQuote':!![],'printWidth':0x50,'tabWidth':0x2,'useTabs':![]};c[u(0x131)](d['join'](g,'.prettierrc'),JSON['stringify'](h,null,0x2));const i='module.exports\x20=\x20{\x0a\x20\x20extends:\x20[\x27next/core-web-vitals\x27,\x20\x27prettier\x27],\x0a\x20\x20rules:\x20{\x0a\x20\x20\x20\x20\x27@typescript-eslint/no-unused-vars\x27:\x20\x27error\x27,\x0a\x20\x20\x20\x20\x27@typescript-eslint/no-explicit-any\x27:\x20\x27warn\x27,\x0a\x20\x20},\x0a};';c['writeFileSync'](d['join'](g,'.eslintrc.js'),i);const envLocal=u(0x133);c[u(0x131)](d[u(0x141)](g,'.env.local'),envLocal),c['writeFileSync'](d['join'](g,'.env.example'),envLocal);}function createVue3Files(g){const v=b,h={'semi':!![],'trailingComma':'es5','singleQuote':!![],'printWidth':0x50,'tabWidth':0x2,'useTabs':![]};c['writeFileSync'](d['join'](g,v(0x138)),JSON['stringify'](h,null,0x2));const i=v(0x144);c['writeFileSync'](d['join'](g,'vite.config.ts'),i);}function createElectronReactFiles(g){const w=b,h={'semi':!![],'trailingComma':'es5','singleQuote':!![],'printWidth':0x50,'tabWidth':0x2,'useTabs':![]};c['writeFileSync'](d['join'](g,'.prettierrc'),JSON['stringify'](h,null,0x2));const i='module.exports\x20=\x20{\x0a\x20\x20extends:\x20[\x27electron\x27,\x20\x27@electron-toolkit/eslint-config-ts\x27,\x20\x27prettier\x27],\x0a\x20\x20rules:\x20{\x0a\x20\x20\x20\x20\x27@typescript-eslint/no-unused-vars\x27:\x20\x27error\x27,\x0a\x20\x20\x20\x20\x27@typescript-eslint/no-explicit-any\x27:\x20\x27warn\x27,\x0a\x20\x20},\x0a};';c['writeFileSync'](d[w(0x141)](g,'.eslintrc.js'),i);}function createElectronVueFiles(g){const x=b,h={'semi':!![],'trailingComma':'es5','singleQuote':!![],'printWidth':0x50,'tabWidth':0x2,'useTabs':![]};c['writeFileSync'](d['join'](g,'.prettierrc'),JSON['stringify'](h,null,0x2));const i=x(0x13b);c['writeFileSync'](d['join'](g,'.eslintrc.js'),i);}export function generateSuccessMessage(g,h){return'🎉\x20Project\x20created\x20successfully!\x0a\x20\x20\x20\x20\x0aNext\x20steps:\x0a\x20\x20cd\x20'+g+'\x0a\x20\x20'+(h==='yarn'?'yarn\x20dev':h+'\x20run\x20dev');}
1
+ import spawn from "cross-spawn";
2
+ import * as prompts from "@clack/prompts";
3
+ import { replacePackageManagerInCommand } from "../utils/package-manager.js";
4
+ import { createNextjsCSRFiles } from "./nextjs-csr.js";
5
+ import { createNextjsSSRFiles } from "./nextjs-ssr.js";
6
+ import { createVue3Files } from "./vue3.js";
7
+ import { createElectronReactFiles } from "./electron-react.js";
8
+ import { createElectronVueFiles } from "./electron-vue.js";
9
+ export async function executeMultiStepCommands(variant, targetDir, root, cwd, pkgInfo) {
10
+ if (!variant.multiStepCommands)
11
+ return;
12
+ prompts.log.step(`Setting up ${variant.display} project...`);
13
+ for (const stepCommand of variant.multiStepCommands) {
14
+ prompts.log.step(stepCommand.description);
15
+ const workingDirectory = stepCommand.workingDir === "target" ? root : cwd;
16
+ let command = stepCommand.command.replace(/TARGET_DIR/g, targetDir);
17
+ // Replace package manager commands with user's preferred package manager
18
+ command = replacePackageManagerInCommand(command, pkgInfo);
19
+ // Parse the command and arguments
20
+ const [cmd, ...args] = command.split(" ");
21
+ try {
22
+ const result = spawn.sync(cmd, args, {
23
+ stdio: "inherit",
24
+ cwd: workingDirectory,
25
+ });
26
+ if (result.status !== 0) {
27
+ prompts.log.error(`Failed to execute: ${command}`);
28
+ process.exit(result.status ?? 1);
29
+ }
30
+ }
31
+ catch (error) {
32
+ prompts.log.error(`Error executing command: ${command}`);
33
+ console.error(error);
34
+ process.exit(1);
35
+ }
36
+ }
37
+ }
38
+ export function createProjectFiles(template, root) {
39
+ // Add configuration files for specific project types
40
+ if (template === "nextjs-csr") {
41
+ createNextjsCSRFiles(root);
42
+ }
43
+ if (template === "nextjs-ssr") {
44
+ createNextjsSSRFiles(root);
45
+ }
46
+ if (template === "vue3") {
47
+ createVue3Files(root);
48
+ }
49
+ if (template === "electron-react") {
50
+ createElectronReactFiles(root);
51
+ }
52
+ if (template === "electron-vue") {
53
+ createElectronVueFiles(root);
54
+ }
55
+ }
56
+ export function generateSuccessMessage(targetDir, pkgManager) {
57
+ return `🎉 Project created successfully!
58
+
59
+ Next steps:
60
+ cd ${targetDir}
61
+ ${pkgManager === "yarn" ? "yarn dev" : `${pkgManager} run dev`}`;
62
+ }
@@ -1 +1 @@
1
- (function(f,g){const s=b,h=f();while(!![]){try{const i=-parseInt(s(0x184))/0x1+parseInt(s(0x188))/0x2*(-parseInt(s(0x186))/0x3)+-parseInt(s(0x18b))/0x4+parseInt(s(0x18a))/0x5*(-parseInt(s(0x185))/0x6)+-parseInt(s(0x17f))/0x7*(parseInt(s(0x177))/0x8)+parseInt(s(0x175))/0x9*(parseInt(s(0x181))/0xa)+parseInt(s(0x17c))/0xb*(parseInt(s(0x18c))/0xc);if(i===g)break;else h['push'](h['shift']());}catch(j){h['push'](h['shift']());}}}(a,0xa9410));function a(){const v=['75aSocgY','stringify','47382Hlwmhh','\x0a\x20\x20','15XgzPlu','4963944lKOADE','1869444YKORhV','readFileSync','join','1723419KBPZBz','includes','1912056hgHSyn','package.json','Done.\x20Now\x20run:\x0a','log','\x20run\x20dev','253XXnuxS','relative','utf-8','7gjqfpg','\x0a\x20\x20cd\x20','30mbDjvX','url','step','1313976PgjFkA','156132MRRdJM'];a=function(){return v;};return a();}function b(c,d){const e=a();return b=function(f,g){f=f-0x173;let h=e[f];return h;},b(c,d);}import c from'node:fs';import d from'node:path';import{fileURLToPath}from'node:url';import*as e from'@clack/prompts';import{copy}from'../utils/file.js';import{renameFiles}from'../config/frameworks.js';export function generateTemplateProject(f,g,h,i,cwd){const t=b;c['mkdirSync'](g,{'recursive':!![]}),e[t(0x17a)][t(0x183)]('Scaffolding\x20project\x20in\x20'+g+'...');const j=d['resolve'](fileURLToPath(import.meta[t(0x182)]),'../../..','template-'+f),k=(p,q)=>{const u=t,r=d[u(0x174)](g,renameFiles[p]??p);q?c['writeFileSync'](r,q):copy(d['join'](j,p),r);},l=c['readdirSync'](j);for(const p of l['filter'](q=>q!=='package.json')){k(p);}const m=JSON['parse'](c[t(0x173)](d[t(0x174)](j,'package.json'),t(0x17e)));m['name']=h,k(t(0x178),JSON[t(0x187)](m,null,0x2)+'\x0a');let n='';const o=d[t(0x17d)](cwd,g);n+=t(0x179);g!==cwd&&(n+=t(0x180)+(o[t(0x176)]('\x20')?'\x22'+o+'\x22':o));switch(i){case'yarn':n+='\x0a\x20\x20yarn',n+='\x0a\x20\x20yarn\x20dev';break;default:n+='\x0a\x20\x20'+i+'\x20install',n+=t(0x189)+i+t(0x17b);break;}e['outro'](n);}
1
+ (function(f,g){const s=b,h=f();while(!![]){try{const i=-parseInt(s(0xf3))/0x1+-parseInt(s(0xef))/0x2*(-parseInt(s(0xfb))/0x3)+parseInt(s(0xee))/0x4+parseInt(s(0xf7))/0x5+-parseInt(s(0xfa))/0x6+parseInt(s(0xfc))/0x7+-parseInt(s(0xf1))/0x8*(parseInt(s(0xf5))/0x9);if(i===g)break;else h['push'](h['shift']());}catch(j){h['push'](h['shift']());}}}(a,0xedf18));function b(c,d){const e=a();return b=function(f,g){f=f-0xe9;let h=e[f];return h;},b(c,d);}import c from'node:fs';import d from'node:path';import{fileURLToPath}from'node:url';import*as e from'@clack/prompts';import{copy}from'../utils/file.js';function a(){const u=['utf-8','666803AsdYaC','step','31311YnWVSO','resolve','223115GdXBHK','outro','includes','357786RzNfUW','5198835bwCvcn','9853004VIjQqr','relative','\x20install','Scaffolding\x20project\x20in\x20','package.json','name','filter','3262116BrbzPu','2QfvjBs','\x0a\x20\x20','5288pqNsZi'];a=function(){return u;};return a();}import{renameFiles}from'../config/frameworks.js';export function generateTemplateProject(f,g,h,i,cwd){const t=b;c['mkdirSync'](g,{'recursive':!![]}),e['log'][t(0xf4)](t(0xea)+g+'...');const j=d[t(0xf6)](fileURLToPath(import.meta['url']),'../../..','template-'+f),k=(p,q)=>{const r=d['join'](g,renameFiles[p]??p);q?c['writeFileSync'](r,q):copy(d['join'](j,p),r);},l=c['readdirSync'](j);for(const p of l[t(0xed)](q=>q!=='package.json')){k(p);}const m=JSON['parse'](c['readFileSync'](d['join'](j,'package.json'),t(0xf2)));m[t(0xec)]=h,k(t(0xeb),JSON['stringify'](m,null,0x2)+'\x0a');let n='';const o=d[t(0xfd)](cwd,g);n+='Done.\x20Now\x20run:\x0a';g!==cwd&&(n+='\x0a\x20\x20cd\x20'+(o[t(0xf9)]('\x20')?'\x22'+o+'\x22':o));switch(i){case'yarn':n+='\x0a\x20\x20yarn',n+='\x0a\x20\x20yarn\x20dev';break;default:n+='\x0a\x20\x20'+i+t(0xe9),n+=t(0xf0)+i+'\x20run\x20dev';break;}e[t(0xf8)](n);}
@@ -0,0 +1 @@
1
+ export declare function createVue3Files(root: string): void;
@@ -0,0 +1 @@
1
+ (function(c,d){const h=b,e=c();while(!![]){try{const f=parseInt(h(0x65))/0x1*(parseInt(h(0x6e))/0x2)+parseInt(h(0x66))/0x3+-parseInt(h(0x69))/0x4+parseInt(h(0x6c))/0x5*(parseInt(h(0x68))/0x6)+-parseInt(h(0x6a))/0x7*(parseInt(h(0x67))/0x8)+-parseInt(h(0x6d))/0x9+-parseInt(h(0x6b))/0xa;if(f===d)break;else e['push'](e['shift']());}catch(g){e['push'](e['shift']());}}}(a,0x1e096));import{copyTemplateFiles}from'../utils/template.js';function b(c,d){const e=a();return b=function(f,g){f=f-0x65;let h=e[f];return h;},b(c,d);}const TEMPLATE_NAME='vue3',TEMPLATE_FILES=[{'source':'vite.config.ts','destination':'vite.config.ts'}];function a(){const i=['14sJDwVh','31567xCZlWB','252207oDRIKW','728408cWrtHA','6fenImA','45216iEKAxH','14NXGDVu','1157780WoxrLE','959695AuuuIE','582867EtngMw'];a=function(){return i;};return a();}export function createVue3Files(c){copyTemplateFiles(TEMPLATE_NAME,TEMPLATE_FILES,c);}
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- const J=b;(function(i,j){const I=b,k=i();while(!![]){try{const l=parseInt(I(0x110))/0x1+-parseInt(I(0x124))/0x2*(-parseInt(I(0x10d))/0x3)+parseInt(I(0x12b))/0x4+-parseInt(I(0x10e))/0x5*(-parseInt(I(0x127))/0x6)+-parseInt(I(0x12a))/0x7*(-parseInt(I(0x12d))/0x8)+-parseInt(I(0x11c))/0x9+parseInt(I(0x11b))/0xa*(-parseInt(I(0x117))/0xb);if(l===j)break;else k['push'](k['shift']());}catch(m){k['push'](k['shift']());}}}(a,0xe8680));import c from'node:fs';import d from'node:path';import e from'cross-spawn';import f from'mri';function b(c,d){const e=a();return b=function(f,g){f=f-0x10d;let h=e[f];return h;},b(c,d);}import*as g from'@clack/prompts';import h from'picocolors';import{helpMessage}from'./config/help.js';import{FRAMEWORKS,TEMPLATES,defaultTargetDir}from'./config/frameworks.js';import{formatTargetDir,isValidPackageName,toValidPackageName,isEmpty,emptyDir,pkgFromUserAgent}from'./utils/file.js';import{getFullCustomCommand}from'./utils/package-manager.js';import{executeMultiStepCommands,createProjectFiles,generateSuccessMessage}from'./generators/project.js';import{generateTemplateProject}from'./generators/template.js';const argv=f(process['argv']['slice'](0x2),{'alias':{'h':'help','t':'template'},'boolean':['help','overwrite'],'string':[J(0x113)]}),cwd=process['cwd']();function a(){const P=['462620bIXOsE','basename','16aaJlnI','flatMap','resolve','Operation\x20cancelled','existsSync','inherit','help','map','4350174FUFING','55ueYeAM','select','1660278BPmnNP','multiStepCommands','\x22\x20isn\x27t\x20a\x20valid\x20template.\x20Please\x20choose\x20from\x20below:\x20','template','join','variants','npm','44andPpE','name','Package\x20name:','Target\x20directory\x20\x22','9113930VYcsut','10804149IZIkIN','yes','isCancel','\x20is\x20not\x20empty.\x20Please\x20choose\x20how\x20to\x20proceed:','length','TARGET_DIR','Invalid\x20project\x20name','replace','2vzXijK','\x20commands','Invalid\x20package.json\x20name','566760ypadBX','npm_config_user_agent','color','5365213DxhXoQ'];a=function(){return P;};return a();}async function init(){const K=J,i=argv['_'][0x0]?formatTargetDir(String(argv['_'][0x0])):undefined,j=argv['template'],k=argv['overwrite'],l=argv[K(0x133)];if(l){console['log'](helpMessage);return;}const m=pkgFromUserAgent(process['env'][K(0x128)]),n=()=>g['cancel'](K(0x130));g['intro'](h['bgCyan'](h['black']('\x20create-web\x20')));let o=i;if(!o){const w=await g['text']({'message':'Project\x20name:','defaultValue':defaultTargetDir,'placeholder':defaultTargetDir,'validate':x=>{const L=K;return x['length']===0x0||formatTargetDir(x)[L(0x120)]>0x0?undefined:L(0x122);}});if(g['isCancel'](w))return n();o=formatTargetDir(w);}if(c[K(0x131)](o)&&!isEmpty(o)){const x=k?'yes':await g[K(0x10f)]({'message':(o==='.'?'Current\x20directory':K(0x11a)+o+'\x22')+K(0x11f),'options':[{'label':'Cancel\x20operation','value':'no'},{'label':'Remove\x20existing\x20files\x20and\x20continue','value':K(0x11d)},{'label':'Ignore\x20files\x20and\x20continue','value':'ignore'}]});if(g[K(0x11e)](x))return n();switch(x){case'yes':emptyDir(o);break;case'no':n();return;}}let p=d[K(0x12c)](d[K(0x12f)](o));if(!isValidPackageName(p)){const y=await g['text']({'message':K(0x119),'defaultValue':toValidPackageName(p),'placeholder':toValidPackageName(p),'validate'(z){const M=K;if(!isValidPackageName(z))return M(0x126);}});if(g[K(0x11e)](y))return n();p=y;}let q=j,r=![];j&&!TEMPLATES['includes'](j)&&(q=undefined,r=!![]);if(!q){const z=await g['select']({'message':r?'\x22'+j+K(0x112):'Select\x20a\x20framework:','options':FRAMEWORKS['map'](B=>{const N=K,C=B[N(0x129)];return{'label':C(B['display']||B[N(0x118)]),'value':B};})});if(g['isCancel'](z))return n();const A=await g['select']({'message':'Select\x20a\x20variant:','options':z[K(0x115)][K(0x134)](B=>{const O=K,C=B[O(0x129)],D=B['customCommand']?getFullCustomCommand(B['customCommand'],m)['replace'](/ TARGET_DIR$/,''):B['multiStepCommands']?'Multi-step\x20setup:\x20'+B[O(0x111)]['length']+O(0x125):undefined;return{'label':C(B['display']||B[O(0x118)]),'value':B['name'],'hint':D};})});if(g['isCancel'](A))return n();q=A;}const s=d[K(0x114)](cwd,o),t=m?m[K(0x118)]:K(0x116),u=FRAMEWORKS[K(0x12e)](B=>B[K(0x115)])['find'](B=>B['name']===q);if(u?.['multiStepCommands']){await executeMultiStepCommands(u,o,s,cwd),createProjectFiles(q,s);const B=generateSuccessMessage(o,t);g['outro'](B);return;}const {customCommand:v}=u??{};if(v){const C=getFullCustomCommand(v,m),[D,...E]=C['split']('\x20'),F=E['map'](H=>H[K(0x123)](K(0x121),()=>o)),{status:G}=e['sync'](D,F,{'stdio':K(0x132)});process['exit'](G??0x0);}generateTemplateProject(q,s,p,t,cwd);}init()['catch'](i=>{console['error'](i);});
2
+ const J=b;(function(i,j){const I=b,k=i();while(!![]){try{const l=-parseInt(I(0x213))/0x1+-parseInt(I(0x214))/0x2*(-parseInt(I(0x1f9))/0x3)+-parseInt(I(0x211))/0x4*(-parseInt(I(0x205))/0x5)+-parseInt(I(0x212))/0x6*(-parseInt(I(0x204))/0x7)+parseInt(I(0x20e))/0x8+parseInt(I(0x1fc))/0x9*(parseInt(I(0x219))/0xa)+parseInt(I(0x216))/0xb*(-parseInt(I(0x207))/0xc);if(l===j)break;else k['push'](k['shift']());}catch(m){k['push'](k['shift']());}}}(a,0xad34e));import c from'node:fs';function a(){const P=['Multi-step\x20setup:\x20','1409740TxWPsY','6btDGTE','537255rFdsKy','20AnwjbD','find','27406742TbQkzJ','length','Cancel\x20operation','840jDrHXu','Project\x20name:','black','variants','map','text','cancel','190383COVttR','replace','isCancel','130707RTNfRa','name','Package\x20name:','flatMap','select','color','Invalid\x20package.json\x20name','bgCyan','318038zjzMPr','15EFMwKp','help','12xKoVoy','\x20is\x20not\x20empty.\x20Please\x20choose\x20how\x20to\x20proceed:','Select\x20a\x20framework:','npm_config_user_agent','multiStepCommands','Remove\x20existing\x20files\x20and\x20continue','template','6247600aKXlDM','display'];a=function(){return P;};return a();}import d from'node:path';import e from'cross-spawn';import f from'mri';function b(c,d){const e=a();return b=function(f,g){f=f-0x1f3;let h=e[f];return h;},b(c,d);}import*as g from'@clack/prompts';import h from'picocolors';import{helpMessage}from'./config/help.js';import{FRAMEWORKS,TEMPLATES,defaultTargetDir}from'./config/frameworks.js';import{formatTargetDir,isValidPackageName,toValidPackageName,isEmpty,emptyDir,pkgFromUserAgent}from'./utils/file.js';import{getFullCustomCommand}from'./utils/package-manager.js';import{executeMultiStepCommands,createProjectFiles,generateSuccessMessage}from'./generators/project.js';import{generateTemplateProject}from'./generators/template.js';const argv=f(process['argv']['slice'](0x2),{'alias':{'h':J(0x206),'t':J(0x20d)},'boolean':['help','overwrite'],'string':[J(0x20d)]}),cwd=process['cwd']();async function init(){const K=J,i=argv['_'][0x0]?formatTargetDir(String(argv['_'][0x0])):undefined,j=argv[K(0x20d)],k=argv['overwrite'],l=argv['help'];if(l){console['log'](helpMessage);return;}const m=pkgFromUserAgent(process['env'][K(0x20a)]),n=()=>g[K(0x1f8)]('Operation\x20cancelled');g['intro'](h[K(0x203)](h[K(0x1f4)]('\x20create-web\x20')));let o=i;if(!o){const w=await g[K(0x1f7)]({'message':K(0x1f3),'defaultValue':defaultTargetDir,'placeholder':defaultTargetDir,'validate':x=>{const L=K;return x[L(0x217)]===0x0||formatTargetDir(x)[L(0x217)]>0x0?undefined:'Invalid\x20project\x20name';}});if(g['isCancel'](w))return n();o=formatTargetDir(w);}if(c['existsSync'](o)&&!isEmpty(o)){const x=k?'yes':await g[K(0x200)]({'message':(o==='.'?'Current\x20directory':'Target\x20directory\x20\x22'+o+'\x22')+K(0x208),'options':[{'label':K(0x218),'value':'no'},{'label':K(0x20c),'value':'yes'},{'label':'Ignore\x20files\x20and\x20continue','value':'ignore'}]});if(g['isCancel'](x))return n();switch(x){case'yes':emptyDir(o);break;case'no':n();return;}}let p=d['basename'](d['resolve'](o));if(!isValidPackageName(p)){const y=await g[K(0x1f7)]({'message':K(0x1fe),'defaultValue':toValidPackageName(p),'placeholder':toValidPackageName(p),'validate'(z){const M=K;if(!isValidPackageName(z))return M(0x202);}});if(g['isCancel'](y))return n();p=y;}let q=j,r=![];j&&!TEMPLATES['includes'](j)&&(q=undefined,r=!![]);if(!q){const z=await g[K(0x200)]({'message':r?'\x22'+j+'\x22\x20isn\x27t\x20a\x20valid\x20template.\x20Please\x20choose\x20from\x20below:\x20':K(0x209),'options':FRAMEWORKS['map'](B=>{const N=K,C=B['color'];return{'label':C(B['display']||B[N(0x1fd)]),'value':B};})});if(g['isCancel'](z))return n();const A=await g['select']({'message':'Select\x20a\x20variant:','options':z['variants']['map'](B=>{const O=K,C=B[O(0x201)],D=B['customCommand']?getFullCustomCommand(B['customCommand'],m)[O(0x1fa)](/ TARGET_DIR$/,''):B[O(0x20b)]?O(0x210)+B['multiStepCommands']['length']+'\x20commands':undefined;return{'label':C(B[O(0x20f)]||B[O(0x1fd)]),'value':B['name'],'hint':D};})});if(g[K(0x1fb)](A))return n();q=A;}const s=d['join'](cwd,o),t=m?m[K(0x1fd)]:'npm',u=FRAMEWORKS[K(0x1ff)](B=>B[K(0x1f5)])[K(0x215)](B=>B[K(0x1fd)]===q);if(u?.['multiStepCommands']){await executeMultiStepCommands(u,o,s,cwd,m),createProjectFiles(q,s);const B=generateSuccessMessage(o,t);g['outro'](B);return;}const {customCommand:v}=u??{};if(v){const C=getFullCustomCommand(v,m),[D,...E]=C['split']('\x20'),F=E[K(0x1f6)](H=>H['replace']('TARGET_DIR',()=>o)),{status:G}=e['sync'](D,F,{'stdio':'inherit'});process['exit'](G??0x0);}generateTemplateProject(q,s,p,t,cwd);}init()['catch'](i=>{console['error'](i);});
@@ -0,0 +1 @@
1
+ var i=b;function b(c,d){var e=a();return b=function(f,g){f=f-0xcf;var h=e[f];return h;},b(c,d);}(function(c,d){var h=b,e=c();while(!![]){try{var f=parseInt(h(0xd7))/0x1*(-parseInt(h(0xd1))/0x2)+-parseInt(h(0xda))/0x3*(parseInt(h(0xcf))/0x4)+parseInt(h(0xd5))/0x5+-parseInt(h(0xd4))/0x6+parseInt(h(0xd0))/0x7*(parseInt(h(0xd6))/0x8)+-parseInt(h(0xdb))/0x9+-parseInt(h(0xd3))/0xa*(-parseInt(h(0xd2))/0xb);if(f===d)break;else e['push'](e['shift']());}catch(g){e['push'](e['shift']());}}}(a,0x37d2f),module['exports']={'extends':['electron',i(0xd9),i(0xd8)],'rules':{'@typescript-eslint/no-unused-vars':'error','@typescript-eslint/no-explicit-any':'warn'}});function a(){var j=['129566yTbdXR','11ipaqDB','7405670WnFkBu','1985034eitbBo','2113645UYZDPr','8yOBcrf','5paSghR','prettier','@electron-toolkit/eslint-config-ts','3abXmVb','1231929BgiBbI','1349828SvRJQZ','1361157chQlwF'];a=function(){return j;};return a();}
@@ -0,0 +1 @@
1
+ var i=b;(function(c,d){var h=b,e=c();while(!![]){try{var f=parseInt(h(0x1ab))/0x1+-parseInt(h(0x1ac))/0x2*(parseInt(h(0x1b2))/0x3)+-parseInt(h(0x1b6))/0x4+parseInt(h(0x1b4))/0x5+-parseInt(h(0x1ad))/0x6*(-parseInt(h(0x1af))/0x7)+parseInt(h(0x1b1))/0x8*(-parseInt(h(0x1b3))/0x9)+parseInt(h(0x1b5))/0xa;if(f===d)break;else e['push'](e['shift']());}catch(g){e['push'](e['shift']());}}}(a,0x8d9ef),module['exports']={'extends':[i(0x1b7),i(0x1b0),i(0x1ae)],'rules':{'@typescript-eslint/no-unused-vars':'error','@typescript-eslint/no-explicit-any':'warn'}});function b(c,d){var e=a();return b=function(f,g){f=f-0x1ab;var h=e[f];return h;},b(c,d);}function a(){var j=['1818028TXoKgz','electron','329602HvRvND','2412FzPdOn','66xIARRB','prettier','694673aBaGoY','@electron-toolkit/eslint-config-ts','11720yMEiff','2367fSAMop','5247BqCODi','5756500wfoajN','2676840SLqPOP'];a=function(){return j;};return a();}
@@ -0,0 +1,20 @@
1
+ "use client";
2
+
3
+ import { useEffect } from "react";
4
+
5
+ import pkg from "../../package.json";
6
+
7
+ export default function BuildInfo() {
8
+ useEffect(() => {
9
+ const print = (key: string, value: string) =>
10
+ console.log(
11
+ `%c ${key} %c ${value} %c `,
12
+ "background:#20232a ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff",
13
+ "background:#61dafb ;padding: 1px; border-radius: 0 3px 3px 0; color: #20232a; font-weight: bold;",
14
+ "background:transparent"
15
+ );
16
+ print(pkg.name, pkg.version);
17
+ print("build time", `${process.env.NEXT_PUBLIC_BUILD_TIME}`);
18
+ }, []);
19
+ return null;
20
+ }
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "node:v22.9.0",
3
+ "image": "mcr.microsoft.com/devcontainers/typescript-node:1-22-bookworm",
4
+ "customizations": {
5
+ "vscode": {
6
+ "extensions": [
7
+ "bradlc.vscode-tailwindcss",
8
+ "esbenp.prettier-vscode",
9
+ "dbaeumer.vscode-eslint",
10
+ "ms-vscode.js-debug",
11
+ "yoavbls.pretty-ts-errors",
12
+ "github.vscode-github-actions"
13
+ ]
14
+ }
15
+ },
16
+ "remoteUser": "node",
17
+ "mounts": [
18
+ "source=${localEnv:HOME}/.ssh,target=/home/node/.ssh,type=bind,readonly",
19
+ "source=/etc/localtime,target=/etc/localtime,type=bind",
20
+ "source=/etc/timezone,target=/etc/timezone,type=bind"
21
+ ],
22
+ "remoteEnv": {
23
+ "SSH_AUTH_SOCK": "/ssh-agent",
24
+ "TZ": "Asia/Shanghai"
25
+ },
26
+ "initializeCommand": "mkdir -p ${localEnv:HOME}/.ssh",
27
+ "runArgs": [
28
+ "--volume=/run/host-services/ssh-auth.sock:/ssh-agent",
29
+ "--network=host",
30
+ "--privileged"
31
+ ]
32
+ }
@@ -0,0 +1 @@
1
+ (function(c,d){var h=b,e=c();while(!![]){try{var f=parseInt(h(0x1e0))/0x1+parseInt(h(0x1e7))/0x2+-parseInt(h(0x1e4))/0x3+parseInt(h(0x1e1))/0x4+parseInt(h(0x1e5))/0x5+-parseInt(h(0x1e3))/0x6+parseInt(h(0x1e2))/0x7*(-parseInt(h(0x1e6))/0x8);if(f===d)break;else e['push'](e['shift']());}catch(g){e['push'](e['shift']());}}}(a,0x21f26),module['exports']={'extends':['next/core-web-vitals','prettier']});function b(c,d){var e=a();return b=function(f,g){f=f-0x1e0;var h=e[f];return h;},b(c,d);}function a(){var i=['749124AAomPL','668088vtpXpQ','343480cjGWuI','1482664eBJVWg','259312dlpSkS','275707OpJDiN','791480xgAfhU','7KvnwpE'];a=function(){return i;};return a();}
@@ -0,0 +1,46 @@
1
+ import type { Metadata } from "next";
2
+ import { Inter } from "next/font/google";
3
+ import "./globals.css";
4
+
5
+ const inter = Inter({ subsets: ["latin"] });
6
+
7
+ export const metadata: Metadata = {
8
+ title: "Create Next App",
9
+ description: "Generated by create next app",
10
+ };
11
+
12
+ export default function RootLayout({
13
+ children,
14
+ }: {
15
+ children: React.ReactNode;
16
+ }) {
17
+ return (
18
+ <html lang="en" suppressHydrationWarning>
19
+ <head>
20
+ <meta httpEquiv="X-UA-Compatible" content="IE=edge,chrome=1" />
21
+ <meta name="renderer" content="webkit" />
22
+ <meta
23
+ name="viewport"
24
+ content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
25
+ />
26
+ {/* eslint-disable-next-line @next/next/no-before-interactive-script-outside-document */}
27
+ <script
28
+ dangerouslySetInnerHTML={{
29
+ __html: `
30
+ (function() {
31
+ var isIE = /MSIE|Trident/.test(navigator.userAgent);
32
+ var isOldIE = /MSIE [1-9]\\.|MSIE 10\\./.test(navigator.userAgent);
33
+ if (isOldIE) {
34
+ window.location.href = '/ie.html';
35
+ }
36
+ })();
37
+ `,
38
+ }}
39
+ />
40
+ </head>
41
+ <body className={inter.className} suppressHydrationWarning>
42
+ {children}
43
+ </body>
44
+ </html>
45
+ );
46
+ }
@@ -0,0 +1 @@
1
+ const i=b;(function(c,d){const h=b,e=c();while(!![]){try{const f=-parseInt(h(0x1a2))/0x1*(parseInt(h(0x19e))/0x2)+-parseInt(h(0x1ac))/0x3*(parseInt(h(0x1a0))/0x4)+parseInt(h(0x19f))/0x5+parseInt(h(0x1a4))/0x6*(-parseInt(h(0x1a6))/0x7)+parseInt(h(0x1a1))/0x8+-parseInt(h(0x1aa))/0x9*(parseInt(h(0x1a5))/0xa)+parseInt(h(0x1a9))/0xb*(parseInt(h(0x1a7))/0xc);if(f===d)break;else e['push'](e['shift']());}catch(g){e['push'](e['shift']());}}}(a,0x26000));import{format}from'date-fns';function b(c,d){const e=a();return b=function(f,g){f=f-0x19e;let h=e[f];return h;},b(c,d);}const nextConfig={},proxy=async()=>{return[{'source':'/api/:path*','destination':'http://localhost:8000/api/:path*'}];};switch(process['env'][i(0x1a3)]){case i(0x1ab):nextConfig['output']=i(0x1a8),nextConfig['images']={},nextConfig['images']['unoptimized']=!![],nextConfig['distDir']='dist';break;case'development':nextConfig['rewrites']=proxy;break;}process['env']['NEXT_PUBLIC_BUILD_TIME']=format(new Date(),'yyyy-MM-dd\x20HH:mm');function a(){const j=['production','6849hhaTED','14026XRxIqn','693435ROZuSR','536TWEUVB','1546624qJEkWP','15uPvVDs','NODE_ENV','224790JbCKbG','39970EbLmzr','14AbdlTM','32172PqjKqM','export','1287cqydKx','9LbxiTK'];a=function(){return j;};return a();}export default nextConfig;
@@ -0,0 +1,16 @@
1
+ import Link from "next/link";
2
+
3
+ export default function NotFound() {
4
+ return (
5
+ <div className="flex min-h-screen flex-col items-center justify-center">
6
+ <h2 className="text-2xl font-bold">页面未找到</h2>
7
+ <p className="mt-4 text-gray-600">抱歉,您访问的页面不存在。</p>
8
+ <Link
9
+ href="/"
10
+ className="mt-6 rounded bg-blue-500 px-4 py-2 text-white hover:bg-blue-600"
11
+ >
12
+ 返回首页
13
+ </Link>
14
+ </div>
15
+ );
16
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "semi": true,
3
+ "trailingComma": "all",
4
+ "singleQuote": true,
5
+ "printWidth": 80,
6
+ "tabWidth": 2,
7
+ "useTabs": false,
8
+ "importOrder": [
9
+ "^@core/(.*)$",
10
+ "^@server/(.*)$",
11
+ "^@ui/(.*)$",
12
+ "^[./]"
13
+ ],
14
+ "importOrderSeparation": true,
15
+ "importOrderSortSpecifiers": true,
16
+ "endOfLine": "auto",
17
+ "plugins": [
18
+ "prettier-plugin-tailwindcss",
19
+ "@trivago/prettier-plugin-sort-imports"
20
+ ]
21
+ }
@@ -0,0 +1,45 @@
1
+ "use client";
2
+
3
+ import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
4
+ import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
5
+ import { useState } from "react";
6
+
7
+ export function QueryProvider({ children }: { children: React.ReactNode }) {
8
+ const [queryClient] = useState(
9
+ () =>
10
+ new QueryClient({
11
+ defaultOptions: {
12
+ queries: {
13
+ // 数据缓存时间 (默认 5 分钟)
14
+ staleTime: 5 * 60 * 1000,
15
+ // 数据在内存中的缓存时间 (默认 5 分钟)
16
+ gcTime: 5 * 60 * 1000,
17
+ // 重试次数
18
+ retry: 3,
19
+ // 重试延迟
20
+ retryDelay: (attemptIndex) =>
21
+ Math.min(1000 * 2 ** attemptIndex, 30000),
22
+ // 窗口重新获得焦点时是否重新获取数据
23
+ refetchOnWindowFocus: false,
24
+ // 网络重新连接时是否重新获取数据
25
+ refetchOnReconnect: true,
26
+ },
27
+ mutations: {
28
+ // 重试次数
29
+ retry: 1,
30
+ // 重试延迟
31
+ retryDelay: 1000,
32
+ },
33
+ },
34
+ })
35
+ );
36
+
37
+ return (
38
+ <QueryClientProvider client={queryClient}>
39
+ {children}
40
+ {/* {process.env.NODE_ENV === 'development' && (
41
+ <ReactQueryDevtools initialIsOpen={false} />
42
+ )} */}
43
+ </QueryClientProvider>
44
+ );
45
+ }
@@ -0,0 +1,204 @@
1
+ /**
2
+ * HTTP 请求类封装(强类型,无 any)
3
+ * 配合 React Query 使用,简化超时和重试逻辑
4
+ */
5
+
6
+ import { toast } from "sonner";
7
+
8
+ interface RequestConfig {
9
+ baseURL?: string;
10
+ headers?: Record<string, string>;
11
+ }
12
+
13
+ interface RequestOptions extends RequestInit {
14
+ params?: Record<string, string | number | boolean>;
15
+ data?: unknown; // 用于传递请求体
16
+ }
17
+
18
+ interface ApiResponse<T> {
19
+ data: T;
20
+ status?: number;
21
+ ok?: boolean;
22
+ code?: number; // 后端业务状态码
23
+ msg?: string | null; // 后端消息
24
+ }
25
+
26
+ // 后端 API 响应结构
27
+ interface BackendResponse<T> {
28
+ code: number;
29
+ msg: string | null;
30
+ data: T;
31
+ }
32
+
33
+ export class HttpClient {
34
+ private baseURL: string;
35
+ private defaultHeaders: Record<string, string>;
36
+
37
+ constructor(config: RequestConfig = {}) {
38
+ this.baseURL = config.baseURL || "";
39
+ this.defaultHeaders = {
40
+ "Content-Type": "application/json",
41
+ ...config.headers,
42
+ };
43
+ }
44
+ updateToken(token: string) {
45
+ // this.defaultHeaders['Authorization'] = `Bearer ${token}`;
46
+ this.defaultHeaders["token"] = `${token}`;
47
+ }
48
+
49
+ private buildURL(url: string, params?: Record<string, unknown>): string {
50
+ let fullURL = url.startsWith("http") ? url : `${this.baseURL}${url}`;
51
+
52
+ if (params) {
53
+ const searchParams = new URLSearchParams();
54
+ Object.entries(params).forEach(([key, value]) => {
55
+ if (value !== null && value !== undefined) {
56
+ searchParams.append(key, String(value));
57
+ }
58
+ });
59
+ const paramString = searchParams.toString();
60
+ if (paramString) {
61
+ fullURL += `${fullURL.includes("?") ? "&" : "?"}${paramString}`;
62
+ }
63
+ }
64
+
65
+ return fullURL;
66
+ }
67
+
68
+ async request<T>(
69
+ url: string,
70
+ options: RequestOptions = {}
71
+ ): Promise<ApiResponse<T>> {
72
+ const { params, data, ...fetchOptions } = options;
73
+
74
+ const fullURL = this.buildURL(url, params);
75
+
76
+ const headers: HeadersInit = {
77
+ ...this.defaultHeaders,
78
+ ...(fetchOptions.headers || {}),
79
+ };
80
+
81
+ let body = fetchOptions.body;
82
+
83
+ // 如果提供了 data,优先使用
84
+ if (data !== undefined) {
85
+ if (data instanceof FormData) {
86
+ body = data;
87
+ Reflect.deleteProperty(headers, "Content-Type"); // FormData 不需要手动设置 Content-Type
88
+ } else {
89
+ body = JSON.stringify(data);
90
+ }
91
+ }
92
+ try {
93
+ const response = await fetch(fullURL, {
94
+ ...fetchOptions,
95
+ headers,
96
+ body,
97
+ });
98
+ const contentType = response.headers.get("content-type");
99
+ let responseData: T;
100
+ if (contentType?.includes("application/json")) {
101
+ const jsonResponse: BackendResponse<T> = await response.json();
102
+ if (jsonResponse.code == 401) {
103
+ // 清除本地存储
104
+ localStorage.clear();
105
+
106
+ // 退出用户状态
107
+ if (typeof window !== "undefined") {
108
+ // 动态导入store避免循环依赖
109
+ import("@/store")
110
+ .then(({ useStore }) => {
111
+ const { logout, openLoginDialog } = useStore.getState();
112
+ logout();
113
+ openLoginDialog();
114
+ })
115
+ .catch(console.error);
116
+ }
117
+
118
+ toast.error("登录信息已过期,请重新登录");
119
+ }
120
+ return jsonResponse;
121
+ } else if (contentType?.startsWith("text/")) {
122
+ responseData = (await response.text()) as T;
123
+ } else {
124
+ responseData = (await response.blob()) as T;
125
+ }
126
+
127
+ return {
128
+ data: responseData,
129
+ status: response.status,
130
+ ok: response.ok,
131
+ };
132
+ } catch (error: unknown) {
133
+ if (error instanceof Error) {
134
+ throw new Error(error.message);
135
+ }
136
+ throw new Error("网络请求失败");
137
+ }
138
+ }
139
+
140
+ // GET 请求
141
+ get<T>(
142
+ url: string,
143
+ params?: Record<string, string | number | boolean>,
144
+ options?: Omit<RequestOptions, "params">
145
+ ) {
146
+ return this.request<T>(url, { ...options, method: "GET", params });
147
+ }
148
+
149
+ // POST 请求
150
+ post<T = unknown, B = unknown>(
151
+ url: string,
152
+ data?: B,
153
+ options?: Omit<RequestOptions, "data">
154
+ ) {
155
+ return this.request<T>(url, { ...options, method: "POST", data });
156
+ }
157
+
158
+ // PUT 请求
159
+ put<T = unknown, B = unknown>(
160
+ url: string,
161
+ data?: B,
162
+ options?: Omit<RequestOptions, "data">
163
+ ) {
164
+ return this.request<T>(url, { ...options, method: "PUT", data });
165
+ }
166
+
167
+ // PATCH 请求
168
+ patch<T = unknown, B = unknown>(
169
+ url: string,
170
+ data?: B,
171
+ options?: Omit<RequestOptions, "data">
172
+ ) {
173
+ return this.request<T>(url, { ...options, method: "PATCH", data });
174
+ }
175
+
176
+ // DELETE 请求
177
+ delete<T = unknown>(url: string, options?: RequestOptions) {
178
+ return this.request<T>(url, { ...options, method: "DELETE" });
179
+ }
180
+
181
+ // 上传文件
182
+ upload<T = unknown>(
183
+ url: string,
184
+ formData: FormData,
185
+ options?: Omit<RequestOptions, "data" | "body">
186
+ ) {
187
+ return this.request<T>(url, { ...options, method: "POST", data: formData });
188
+ }
189
+ }
190
+
191
+ // 创建默认实例
192
+ export const http = new HttpClient({
193
+ baseURL: `${process.env.NEXT_PUBLIC_API_URL || "/api"}`,
194
+ });
195
+
196
+ // 快捷导出函数
197
+ export const get = http.get.bind(http);
198
+ export const post = http.post.bind(http);
199
+ export const put = http.put.bind(http);
200
+ export const patch = http.patch.bind(http);
201
+ export const del = http.delete.bind(http);
202
+ export const upload = http.upload.bind(http);
203
+
204
+ export default http;
@@ -0,0 +1,12 @@
1
+ interface ShowProps {
2
+ when: boolean;
3
+ fallback?: React.ReactNode;
4
+ }
5
+
6
+ export default function Show({
7
+ children,
8
+ when,
9
+ fallback = null,
10
+ }: React.PropsWithChildren<ShowProps>) {
11
+ return when ? children : fallback;
12
+ }
@@ -0,0 +1,17 @@
1
+ "use client";
2
+
3
+ import { ThemeProvider as NextThemesProvider } from "next-themes";
4
+ import * as React from "react";
5
+
6
+ export function ThemeProvider({ children }: React.PropsWithChildren) {
7
+ return (
8
+ <NextThemesProvider
9
+ attribute="class"
10
+ defaultTheme="system"
11
+ enableSystem
12
+ disableTransitionOnChange
13
+ >
14
+ {children}
15
+ </NextThemesProvider>
16
+ );
17
+ }
@@ -0,0 +1,12 @@
1
+ import { defineConfig } from "vite";
2
+ import vue from "@vitejs/plugin-vue";
3
+ import { resolve } from "path";
4
+
5
+ export default defineConfig({
6
+ plugins: [vue()],
7
+ resolve: {
8
+ alias: {
9
+ "@": resolve(__dirname, "src"),
10
+ },
11
+ },
12
+ });
@@ -1 +1 @@
1
- (function(e,f){const j=b,g=e();while(!![]){try{const h=-parseInt(j(0x1e7))/0x1+-parseInt(j(0x1e8))/0x2+-parseInt(j(0x1ef))/0x3+-parseInt(j(0x1ed))/0x4+parseInt(j(0x1e6))/0x5+parseInt(j(0x1e9))/0x6*(parseInt(j(0x1e4))/0x7)+parseInt(j(0x1ea))/0x8;if(h===f)break;else g['push'](g['shift']());}catch(i){g['push'](g['shift']());}}}(a,0xccc4e));import c from'node:fs';import d from'node:path';export function formatTargetDir(e){return e['trim']()['replace'](/\/+$/g,'');}function b(c,d){const e=a();return b=function(f,g){f=f-0x1e3;let h=e[f];return h;},b(c,d);}export function isValidPackageName(e){return/^(?:@[a-z\d\-*~][a-z\d\-*._~]*\/)?[a-z\d\-~][a-z\d\-._~]*$/['test'](e);}export function toValidPackageName(e){return e['trim']()['toLowerCase']()['replace'](/\s+/g,'-')['replace'](/^[._]/,'')['replace'](/[^a-z\d\-~]+/g,'-');}export function isEmpty(e){const k=b,f=c[k(0x1eb)](e);return f[k(0x1e5)]===0x0||f[k(0x1e5)]===0x1&&f[0x0]==='.git';}export function emptyDir(e){const l=b;if(!c['existsSync'](e))return;for(const f of c['readdirSync'](e)){if(f==='.git')continue;c['rmSync'](d[l(0x1ec)](e,f),{'recursive':!![],'force':!![]});}}export function pkgFromUserAgent(e){if(!e)return undefined;const f=e['split']('\x20')[0x0],g=f['split']('/');return{'name':g[0x0],'version':g[0x1]};}export function editFile(e,f){const m=b,g=c['readFileSync'](e,'utf-8');c['writeFileSync'](e,f(g),m(0x1ee));}function a(){const o=['mkdirSync','623YvhAwp','length','6015605FVtpPy','653181UQzQgp','2147990AsexhU','6114HlBznV','31204968xdiknn','readdirSync','resolve','4210604uOezHm','utf-8','4727616cboDLj'];a=function(){return o;};return a();}export function copy(e,f){const g=c['statSync'](e);g['isDirectory']()?copyDir(e,f):c['copyFileSync'](e,f);}export function copyDir(e,f){const n=b;c[n(0x1e3)](f,{'recursive':!![]});for(const g of c['readdirSync'](e)){const h=d[n(0x1ec)](e,g),i=d['resolve'](f,g);copy(h,i);}}
1
+ (function(e,f){const j=b,g=e();while(!![]){try{const h=-parseInt(j(0x7b))/0x1+parseInt(j(0x75))/0x2*(parseInt(j(0x74))/0x3)+parseInt(j(0x78))/0x4+parseInt(j(0x80))/0x5*(parseInt(j(0x82))/0x6)+parseInt(j(0x79))/0x7*(-parseInt(j(0x77))/0x8)+parseInt(j(0x83))/0x9*(-parseInt(j(0x81))/0xa)+parseInt(j(0x7f))/0xb*(parseInt(j(0x7d))/0xc);if(h===f)break;else g['push'](g['shift']());}catch(i){g['push'](g['shift']());}}}(a,0xdb57a));import c from'node:fs';import d from'node:path';export function formatTargetDir(e){const k=b;return e[k(0x7a)]()['replace'](/\/+$/g,'');}function b(c,d){const e=a();return b=function(f,g){f=f-0x74;let h=e[f];return h;},b(c,d);}export function isValidPackageName(e){return/^(?:@[a-z\d\-*~][a-z\d\-*._~]*\/)?[a-z\d\-~][a-z\d\-._~]*$/['test'](e);}export function toValidPackageName(e){return e['trim']()['toLowerCase']()['replace'](/\s+/g,'-')['replace'](/^[._]/,'')['replace'](/[^a-z\d\-~]+/g,'-');}export function isEmpty(e){const l=b,f=c[l(0x76)](e);return f['length']===0x0||f['length']===0x1&&f[0x0]==='.git';}export function emptyDir(e){const m=b;if(!c[m(0x7e)](e))return;for(const f of c['readdirSync'](e)){if(f==='.git')continue;c['rmSync'](d['resolve'](e,f),{'recursive':!![],'force':!![]});}}export function pkgFromUserAgent(e){if(!e)return undefined;const f=e['split']('\x20')[0x0],g=f['split']('/');return{'name':g[0x0],'version':g[0x1]};}export function editFile(e,f){const g=c['readFileSync'](e,'utf-8');c['writeFileSync'](e,f(g),'utf-8');}export function copy(e,f){const g=c['statSync'](e);g['isDirectory']()?copyDir(e,f):c['copyFileSync'](e,f);}export function copyDir(e,f){const n=b;c[n(0x7c)](f,{'recursive':!![]});for(const g of c['readdirSync'](e)){const h=d['resolve'](e,g),i=d['resolve'](f,g);copy(h,i);}}function a(){const o=['649LfTNlg','6946020OaFEKE','1340amMaFS','6iujxBN','57474bKZLlp','1269168ETJCoc','2FgYKPj','readdirSync','9193816sPBSOL','2510360XylbKC','7iRTvLe','trim','187066WldfgF','mkdirSync','132324TrBmfl','existsSync'];a=function(){return o;};return a();}
@@ -1,2 +1,3 @@
1
1
  import type { PkgInfo } from "../types/index.js";
2
2
  export declare function getFullCustomCommand(customCommand: string, pkgInfo?: PkgInfo): string;
3
+ export declare function replacePackageManagerInCommand(command: string, pkgInfo?: PkgInfo): string;
@@ -1 +1 @@
1
- function a(){const l=['1988760qSNaxm','116PuNdDh','yarn\x20dlx','63oepsQN','6445278MkfhCg','267530QiutjY','2267720ezjPwS','npm','replace','name','bun','yarn','2948408ONryov','@latest','10DKqUvZ','startsWith','9304UdVXOm','513066Ixqsom'];a=function(){return l;};return a();}function b(c,d){const e=a();return b=function(f,g){f=f-0x18a;let h=e[f];return h;},b(c,d);}(function(c,d){const h=b,e=c();while(!![]){try{const f=-parseInt(h(0x18e))/0x1*(parseInt(h(0x18b))/0x2)+parseInt(h(0x18d))/0x3+-parseInt(h(0x199))/0x4+-parseInt(h(0x19b))/0x5*(parseInt(h(0x18c))/0x6)+parseInt(h(0x191))/0x7+parseInt(h(0x193))/0x8+-parseInt(h(0x190))/0x9*(-parseInt(h(0x192))/0xa);if(f===d)break;else e['push'](e['shift']());}catch(g){e['push'](e['shift']());}}}(a,0x941be));export function getFullCustomCommand(c,d){const i=b,e=d?d[i(0x196)]:i(0x194),f=e===i(0x198)&&d?.['version'][i(0x18a)]('1.');return c[i(0x195)](/^npm create (?:-- )?/,()=>{const j=i;if(e===j(0x197))return'bun\x20x\x20create-';if(e==='pnpm')return'pnpm\x20create\x20';return c[j(0x18a)]('npm\x20create\x20--\x20')?e+'\x20create\x20--\x20':e+'\x20create\x20';})[i(0x195)](i(0x19a),()=>f?'':'@latest')['replace'](/^npm exec/,()=>{const k=i;if(e==='pnpm')return'pnpm\x20dlx';if(e==='yarn'&&!f)return k(0x18f);if(e==='bun')return'bun\x20x';return'npm\x20exec';});}
1
+ function b(c,d){const e=a();return b=function(f,g){f=f-0xc6;let h=e[f];return h;},b(c,d);}(function(c,d){const h=b,e=c();while(!![]){try{const f=-parseInt(h(0xc6))/0x1*(-parseInt(h(0xcc))/0x2)+parseInt(h(0xd1))/0x3*(parseInt(h(0xd2))/0x4)+-parseInt(h(0xd5))/0x5+parseInt(h(0xd6))/0x6+-parseInt(h(0xd0))/0x7+parseInt(h(0xcb))/0x8+-parseInt(h(0xd3))/0x9;if(f===d)break;else e['push'](e['shift']());}catch(g){e['push'](e['shift']());}}}(a,0x69e2d));export function getFullCustomCommand(c,d){const i=b,e=d?d['name']:i(0xcd),f=e===i(0xd9)&&d?.[i(0xc7)]['startsWith']('1.');return c['replace'](/^npm create (?:-- )?/,()=>{const j=i;if(e==='bun')return j(0xc9);if(e==='pnpm')return'pnpm\x20create\x20';return c['startsWith']('npm\x20create\x20--\x20')?e+'\x20create\x20--\x20':e+'\x20create\x20';})[i(0xcf)]('@latest',()=>f?'':'@latest')['replace'](/^npm exec/,()=>{const k=i;if(e==='pnpm')return'pnpm\x20dlx';if(e===k(0xd9)&&!f)return'yarn\x20dlx';if(e==='bun')return k(0xc8);return k(0xca);});}function a(){const q=['1589898Mxaeed','startsWith','npm\x20create\x20','yarn','191FdgiMK','version','bun\x20x','bun\x20x\x20create-','npm\x20exec','3240352CuILvm','8012zymjAb','npm','npx\x20','replace','2174956aokFId','6YdLSEx','96716MnXnlM','1047375NiPCzr','bunx\x20','3113695VifivS'];a=function(){return q;};return a();}export function replacePackageManagerInCommand(c,d){const l=b,e=d?d['name']:'npm',f=e==='yarn'&&d?.['version'][l(0xd7)]('1.');return c['replace'](/^pnpx\s/,()=>{const m=l;if(e===m(0xd9))return f?'npx\x20':'yarn\x20dlx\x20';if(e==='bun')return m(0xd4);if(e==='npm')return'npx\x20';return'pnpx\x20';})['replace'](/^pnpm dlx\s/,()=>{const n=l;if(e==='yarn')return f?n(0xce):'yarn\x20dlx\x20';if(e==='bun')return n(0xd4);if(e==='npm')return'npx\x20';return'pnpm\x20dlx\x20';})['replace'](/^pnpm add\s/,()=>{const o=l;if(e==='yarn')return'yarn\x20add\x20';if(e==='bun')return'bun\x20add\x20';if(e===o(0xcd))return'npm\x20install\x20';return'pnpm\x20add\x20';})['replace'](/^pnpm create\s/,()=>{const p=l;if(e==='yarn')return'yarn\x20create\x20';if(e==='bun')return'bun\x20create\x20';if(e===p(0xcd))return p(0xd8);return'pnpm\x20create\x20';});}
@@ -0,0 +1,8 @@
1
+ export interface TemplateFile {
2
+ source: string;
3
+ destination: string;
4
+ isJson?: boolean;
5
+ }
6
+ export declare function getTemplatePath(template: string): string;
7
+ export declare function readTemplateFile(templatePath: string, fileName: string): string;
8
+ export declare function copyTemplateFiles(templateName: string, files: TemplateFile[], targetRoot: string): void;
@@ -0,0 +1 @@
1
+ (function(e,f){const o=b,g=e();while(!![]){try{const h=-parseInt(o(0x10f))/0x1*(-parseInt(o(0x115))/0x2)+-parseInt(o(0x105))/0x3*(parseInt(o(0x10b))/0x4)+-parseInt(o(0x114))/0x5+-parseInt(o(0x113))/0x6+parseInt(o(0x116))/0x7+parseInt(o(0x108))/0x8+parseInt(o(0x111))/0x9;if(h===f)break;else g['push'](g['shift']());}catch(i){g['push'](g['shift']());}}}(a,0x2b4bf));import c from'node:fs';import d from'node:path';import{fileURLToPath}from'node:url';const __filename=fileURLToPath(import.meta['url']),__dirname=d['dirname'](__filename);function b(c,d){const e=a();return b=function(f,g){f=f-0x105;let h=e[f];return h;},b(c,d);}export function getTemplatePath(e){const p=b;return d[p(0x10c)](__dirname,p(0x10a),e);}export function readTemplateFile(e,f){const q=b,g=d[q(0x10c)](e,f);if(!c[q(0x10e)](g))throw new Error(q(0x106)+g);return c['readFileSync'](g,q(0x107));}function a(){const s=['657027IWiyMW','dirname','917118qWvRuJ','1504325GIEWhx','2Gesrmv','1373855AncFMB','4173mRLthH','Template\x20file\x20not\x20found:\x20','utf-8','144104VOlJyO','Error\x20copying\x20template\x20file\x20','../templates','20CumLdr','join','source','existsSync','350735lEZcvD','stringify'];a=function(){return s;};return a();}export function copyTemplateFiles(e,f,g){const r=b,h=getTemplatePath(e);for(const i of f){try{const j=readTemplateFile(h,i['source']),k=d[r(0x10c)](g,i['destination']),l=d[r(0x112)](k);!c[r(0x10e)](l)&&c['mkdirSync'](l,{'recursive':!![]});if(i['isJson']){const m=JSON['parse'](j);c['writeFileSync'](k,JSON[r(0x110)](m,null,0x2));}else c['writeFileSync'](k,j);}catch(n){console['error'](r(0x109)+i[r(0x10d)]+':',n);throw n;}}}