create-young-proj 2.0.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +39 -0
- package/README.md +7 -1
- package/dist/index.mjs +6 -6
- package/package.json +1 -1
- package/src/index.ts +6 -1
- package/template-electron-win7/.vscode/extensions.json +5 -0
- package/template-electron-win7/.vscode/settings.json +49 -0
- package/template-electron-win7/README.md +65 -0
- package/template-electron-win7/RELEASE_NOTES.md +11 -0
- package/template-electron-win7/_gitignore +27 -0
- package/template-electron-win7/dev-app-update.yml +2 -0
- package/template-electron-win7/electron/config/0.local.config.ts +13 -0
- package/template-electron-win7/electron/config/1.dev.config.ts +13 -0
- package/template-electron-win7/electron/config/2.test.config.ts +13 -0
- package/template-electron-win7/electron/config/3.wtest.config.ts +13 -0
- package/template-electron-win7/electron/config/4.online.config.ts +13 -0
- package/template-electron-win7/electron/config.ts +13 -0
- package/template-electron-win7/electron/electron-env.d.ts +58 -0
- package/template-electron-win7/electron/main.ts +318 -0
- package/template-electron-win7/electron/preload.ts +23 -0
- package/template-electron-win7/electron/update.ts +78 -0
- package/template-electron-win7/electron-builder.yaml +67 -0
- package/template-electron-win7/env/.env +1 -0
- package/template-electron-win7/env/.env.development +9 -0
- package/template-electron-win7/env/.env.production +9 -0
- package/template-electron-win7/eslint.config.mjs +33 -0
- package/template-electron-win7/index.html +16 -0
- package/template-electron-win7/package.json +71 -0
- package/template-electron-win7/public/icon.ico +0 -0
- package/template-electron-win7/scripts/afterPack.mjs +36 -0
- package/template-electron-win7/scripts/build.mjs +55 -0
- package/template-electron-win7/src/App.vue +23 -0
- package/template-electron-win7/src/auto-imports.d.ts +305 -0
- package/template-electron-win7/src/components/UpdateDialog.vue +166 -0
- package/template-electron-win7/src/components.d.ts +18 -0
- package/template-electron-win7/src/layouts/blank.vue +11 -0
- package/template-electron-win7/src/layouts/default.vue +13 -0
- package/template-electron-win7/src/main.ts +36 -0
- package/template-electron-win7/src/modules/1-router.ts +72 -0
- package/template-electron-win7/src/modules/2-pinia.ts +13 -0
- package/template-electron-win7/src/styles/variables.scss +8 -0
- package/template-electron-win7/src/types/global.d.ts +0 -0
- package/template-electron-win7/src/utils/env.ts +4 -0
- package/template-electron-win7/src/utils/ls.ts +118 -0
- package/template-electron-win7/src/views/[...all_404].vue +539 -0
- package/template-electron-win7/src/views/index.vue +34 -0
- package/template-electron-win7/src/vite-env.d.ts +27 -0
- package/template-electron-win7/tsconfig.json +29 -0
- package/template-electron-win7/tsconfig.node.json +11 -0
- package/template-electron-win7/uno.config.ts +32 -0
- package/template-electron-win7/vite.config.ts +78 -0
- package/template-electron-win7/yarn.lock +5964 -0
- package/template-nuxt-admin/error.vue +3 -3
- package/template-nuxt-admin/nuxt.config.ts +20 -7
- package/template-nuxt-admin/package.json +5 -3
- package/template-nuxt-admin/yarn.lock +3438 -2586
- package/template-nuxt-website/app.vue +45 -1
- package/template-nuxt-website/layouts/default.vue +18 -16
- package/template-nuxt-website/layouts/home.vue +14 -12
- package/template-nuxt-website/layouts/tabbar.vue +18 -16
- package/template-nuxt-website/nuxt.config.ts +20 -5
- package/template-nuxt-website/package.json +2 -1
- package/template-nuxt-website/yarn.lock +4677 -3598
package/CHANGELOG.md
CHANGED
@@ -1,6 +1,45 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
3
|
|
4
|
+
## v2.2.0
|
5
|
+
|
6
|
+
[compare changes](https://github.com/BluesYoung-web/create-young-proj/compare/v2.1.0...v2.2.0)
|
7
|
+
|
8
|
+
### 🚀 Enhancements
|
9
|
+
|
10
|
+
- 🚀 add electron template ([7024b66](https://github.com/BluesYoung-web/create-young-proj/commit/7024b66))
|
11
|
+
- 🚀 change script to add electron option ([8537119](https://github.com/BluesYoung-web/create-young-proj/commit/8537119))
|
12
|
+
|
13
|
+
### 📖 Documentation
|
14
|
+
|
15
|
+
- 📖 update readme ([25c1c6d](https://github.com/BluesYoung-web/create-young-proj/commit/25c1c6d))
|
16
|
+
|
17
|
+
### ❤️ Contributors
|
18
|
+
|
19
|
+
- 张扬 <bluesyoung_web@163.com>
|
20
|
+
|
21
|
+
## v2.1.0
|
22
|
+
|
23
|
+
[compare changes](https://github.com/BluesYoung-web/create-young-proj/compare/v2.0.0...v2.1.0)
|
24
|
+
|
25
|
+
### 🚀 Enhancements
|
26
|
+
|
27
|
+
- ⚠️ 🚀 website 依赖升级 & 兼容性增强 ([23d672a](https://github.com/BluesYoung-web/create-young-proj/commit/23d672a))
|
28
|
+
- ⚠️ 🚀 后台依赖升级 & 增强兼容性 ([0fcd91e](https://github.com/BluesYoung-web/create-young-proj/commit/0fcd91e))
|
29
|
+
|
30
|
+
### 🏡 Chore
|
31
|
+
|
32
|
+
- 🏡 后台依赖升级 ([15d9d4e](https://github.com/BluesYoung-web/create-young-proj/commit/15d9d4e))
|
33
|
+
|
34
|
+
#### ⚠️ Breaking Changes
|
35
|
+
|
36
|
+
- ⚠️ 🚀 website 依赖升级 & 兼容性增强 ([23d672a](https://github.com/BluesYoung-web/create-young-proj/commit/23d672a))
|
37
|
+
- ⚠️ 🚀 后台依赖升级 & 增强兼容性 ([0fcd91e](https://github.com/BluesYoung-web/create-young-proj/commit/0fcd91e))
|
38
|
+
|
39
|
+
### ❤️ Contributors
|
40
|
+
|
41
|
+
- 张扬 <bluesyoung_web@163.com>
|
42
|
+
|
4
43
|
## v2.0.0
|
5
44
|
|
6
45
|
[compare changes](https://github.com/BluesYoung-web/create-young-proj/compare/v1.9.1...v2.0.0)
|
package/README.md
CHANGED
@@ -25,6 +25,8 @@ pnpm create young-proj
|
|
25
25
|
- [x] template-nuxt3-website
|
26
26
|
- [x] template-vitepress
|
27
27
|
- [x] template-big-screen
|
28
|
+
- [x] template-electron-win7
|
29
|
+
|
28
30
|
|
29
31
|
## template-nuxt-admin
|
30
32
|
|
@@ -74,4 +76,8 @@ pnpm create young-proj
|
|
74
76
|
|
75
77
|
## template-big-screen
|
76
78
|
|
77
|
-
大屏模板,[详见](./template-big-screen/README.md)
|
79
|
+
大屏模板,[详见](./template-big-screen/README.md)
|
80
|
+
|
81
|
+
## template-electron-win7
|
82
|
+
|
83
|
+
基于 `electron` 开发,[详见](./template-electron-win7/README.md)
|
package/dist/index.mjs
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import S from"node:fs";import T from"node:path";import{fileURLToPath as Le}from"node:url";import Ve from"child_process";import at from"path";import ut from"fs";import Ye from"readline";import He from"events";var Be=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ct(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var W={exports:{}},dt,Ht;function ke(){if(Ht)return dt;Ht=1,dt=i,i.sync=n;var e=ut;function t(o,r){var l=r.pathExt!==void 0?r.pathExt:process.env.PATHEXT;if(!l||(l=l.split(";"),l.indexOf("")!==-1))return!0;for(var f=0;f<l.length;f++){var h=l[f].toLowerCase();if(h&&o.substr(-h.length).toLowerCase()===h)return!0}return!1}function s(o,r,l){return!o.isSymbolicLink()&&!o.isFile()?!1:t(r,l)}function i(o,r,l){e.stat(o,function(f,h){l(f,f?!1:s(h,o,r))})}function n(o,r){return s(e.statSync(o),o,r)}return dt}var ft,Bt;function We(){if(Bt)return ft;Bt=1,ft=t,t.sync=s;var e=ut;function t(o,r,l){e.stat(o,function(f,h){l(f,f?!1:i(h,r))})}function s(o,r){return i(e.statSync(o),r)}function i(o,r){return o.isFile()&&n(o,r)}function n(o,r){var l=o.mode,f=o.uid,h=o.gid,$=r.uid!==void 0?r.uid:process.getuid&&process.getuid(),p=r.gid!==void 0?r.gid:process.getgid&&process.getgid(),a=parseInt("100",8),d=parseInt("010",8),m=parseInt("001",8),x=a|d,P=l&m||l&d&&h===p||l&a&&f===$||l&x&&$===0;return P}return ft}var st;process.platform==="win32"||Be.TESTING_WINDOWS?st=ke():st=We();var ze=pt;pt.sync=Ge;function pt(e,t,s){if(typeof t=="function"&&(s=t,t={}),!s){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(i,n){pt(e,t||{},function(o,r){o?n(o):i(r)})})}st(e,t||{},function(i,n){i&&(i.code==="EACCES"||t&&t.ignoreErrors)&&(i=null,n=!1),s(i,n)})}function Ge(e,t){try{return st.sync(e,t||{})}catch(s){if(t&&t.ignoreErrors||s.code==="EACCES")return!1;throw s}}const z=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",kt=at,Ue=z?";":":",Wt=ze,zt=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),Gt=(e,t)=>{const s=t.colon||Ue,i=e.match(/\//)||z&&e.match(/\\/)?[""]:[...z?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(s)],n=z?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=z?n.split(s):[""];return z&&e.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:i,pathExt:o,pathExtExe:n}},Ut=(e,t,s)=>{typeof t=="function"&&(s=t,t={}),t||(t={});const{pathEnv:i,pathExt:n,pathExtExe:o}=Gt(e,t),r=[],l=h=>new Promise(($,p)=>{if(h===i.length)return t.all&&r.length?$(r):p(zt(e));const a=i[h],d=/^".*"$/.test(a)?a.slice(1,-1):a,m=kt.join(d,e),x=!d&&/^\.[\\\/]/.test(e)?e.slice(0,2)+m:m;$(f(x,h,0))}),f=(h,$,p)=>new Promise((a,d)=>{if(p===n.length)return a(l($+1));const m=n[p];Wt(h+m,{pathExt:o},(x,P)=>{if(!x&&P)if(t.all)r.push(h+m);else return a(h+m);return a(f(h,$,p+1))})});return s?l(0).then(h=>s(null,h),s):l(0)},Ke=(e,t)=>{t=t||{};const{pathEnv:s,pathExt:i,pathExtExe:n}=Gt(e,t),o=[];for(let r=0;r<s.length;r++){const l=s[r],f=/^".*"$/.test(l)?l.slice(1,-1):l,h=kt.join(f,e),$=!f&&/^\.[\\\/]/.test(e)?e.slice(0,2)+h:h;for(let p=0;p<i.length;p++){const a=$+i[p];try{if(Wt.sync(a,{pathExt:n}))if(t.all)o.push(a);else return a}catch{}}}if(t.all&&o.length)return o;if(t.nothrow)return null;throw zt(e)};var Je=Ut;Ut.sync=Ke;var mt={exports:{}};const Kt=(e={})=>{const t=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(i=>i.toUpperCase()==="PATH")||"Path"};mt.exports=Kt,mt.exports.default=Kt;var qe=mt.exports;const Jt=at,Ze=Je,Xe=qe;function qt(e,t){const s=e.options.env||process.env,i=process.cwd(),n=e.options.cwd!=null,o=n&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(e.options.cwd)}catch{}let r;try{r=Ze.sync(e.command,{path:s[Xe({env:s})],pathExt:t?Jt.delimiter:void 0})}catch{}finally{o&&process.chdir(i)}return r&&(r=Jt.resolve(n?e.options.cwd:"",r)),r}function Qe(e){return qt(e)||qt(e,!0)}var ts=Qe,gt={};const vt=/([()\][%!^"`<>&|;, *?])/g;function es(e){return e=e.replace(vt,"^$1"),e}function ss(e,t){return e=`${e}`,e=e.replace(/(\\*)"/g,'$1$1\\"'),e=e.replace(/(\\*)$/,"$1$1"),e=`"${e}"`,e=e.replace(vt,"^$1"),t&&(e=e.replace(vt,"^$1")),e}gt.command=es,gt.argument=ss;var is=/^#!(.*)/;const rs=is;var ns=(e="")=>{const t=e.match(rs);if(!t)return null;const[s,i]=t[0].replace(/#! ?/,"").split(" "),n=s.split("/").pop();return n==="env"?i:i?`${n} ${i}`:n};const bt=ut,os=ns;function ls(e){const s=Buffer.alloc(150);let i;try{i=bt.openSync(e,"r"),bt.readSync(i,s,0,150,0),bt.closeSync(i)}catch{}return os(s.toString())}var hs=ls;const as=at,Zt=ts,Xt=gt,us=hs,cs=process.platform==="win32",ds=/\.(?:com|exe)$/i,fs=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function ps(e){e.file=Zt(e);const t=e.file&&us(e.file);return t?(e.args.unshift(e.file),e.command=t,Zt(e)):e.file}function ms(e){if(!cs)return e;const t=ps(e),s=!ds.test(t);if(e.options.forceShell||s){const i=fs.test(t);e.command=as.normalize(e.command),e.command=Xt.command(e.command),e.args=e.args.map(o=>Xt.argument(o,i));const n=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${n}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}function gs(e,t,s){t&&!Array.isArray(t)&&(s=t,t=null),t=t?t.slice(0):[],s=Object.assign({},s);const i={command:e,args:t,options:s,file:void 0,original:{command:e,args:t}};return s.shell?i:ms(i)}var vs=gs;const wt=process.platform==="win32";function yt(e,t){return Object.assign(new Error(`${t} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function bs(e,t){if(!wt)return;const s=e.emit;e.emit=function(i,n){if(i==="exit"){const o=Qt(n,t);if(o)return s.call(e,"error",o)}return s.apply(e,arguments)}}function Qt(e,t){return wt&&e===1&&!t.file?yt(t.original,"spawn"):null}function ws(e,t){return wt&&e===1&&!t.file?yt(t.original,"spawnSync"):null}var ys={hookChildProcess:bs,verifyENOENT:Qt,verifyENOENTSync:ws,notFoundError:yt};const te=Ve,$t=vs,xt=ys;function ee(e,t,s){const i=$t(e,t,s),n=te.spawn(i.command,i.args,i.options);return xt.hookChildProcess(n,i),n}function $s(e,t,s){const i=$t(e,t,s),n=te.spawnSync(i.command,i.args,i.options);return n.error=n.error||xt.verifyENOENTSync(n.status,i),n}W.exports=ee,W.exports.spawn=ee,W.exports.sync=$s,W.exports._parse=$t,W.exports._enoent=xt;var xs=W.exports;const Ss=ct(xs);function Es(e,t){var s=e;t.slice(0,-1).forEach(function(n){s=s[n]||{}});var i=t[t.length-1];return i in s}function se(e){return typeof e=="number"||/^0x[0-9a-f]+$/i.test(e)?!0:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(e)}function ie(e,t){return t==="constructor"&&typeof e[t]=="function"||t==="__proto__"}var Os=function(e,t){t||(t={});var s={bools:{},strings:{},unknownFn:null};typeof t.unknown=="function"&&(s.unknownFn=t.unknown),typeof t.boolean=="boolean"&&t.boolean?s.allBools=!0:[].concat(t.boolean).filter(Boolean).forEach(function(u){s.bools[u]=!0});var i={};function n(u){return i[u].some(function(b){return s.bools[b]})}Object.keys(t.alias||{}).forEach(function(u){i[u]=[].concat(t.alias[u]),i[u].forEach(function(b){i[b]=[u].concat(i[u].filter(function(O){return b!==O}))})}),[].concat(t.string).filter(Boolean).forEach(function(u){s.strings[u]=!0,i[u]&&[].concat(i[u]).forEach(function(b){s.strings[b]=!0})});var o=t.default||{},r={_:[]};function l(u,b){return s.allBools&&/^--[^=]+$/.test(b)||s.strings[u]||s.bools[u]||i[u]}function f(u,b,O){for(var v=u,q=0;q<b.length-1;q++){var _=b[q];if(ie(v,_))return;v[_]===void 0&&(v[_]={}),(v[_]===Object.prototype||v[_]===Number.prototype||v[_]===String.prototype)&&(v[_]={}),v[_]===Array.prototype&&(v[_]=[]),v=v[_]}var R=b[b.length-1];ie(v,R)||((v===Object.prototype||v===Number.prototype||v===String.prototype)&&(v={}),v===Array.prototype&&(v=[]),v[R]===void 0||s.bools[R]||typeof v[R]=="boolean"?v[R]=O:Array.isArray(v[R])?v[R].push(O):v[R]=[v[R],O])}function h(u,b,O){if(!(O&&s.unknownFn&&!l(u,O)&&s.unknownFn(O)===!1)){var v=!s.strings[u]&&se(b)?Number(b):b;f(r,u.split("."),v),(i[u]||[]).forEach(function(q){f(r,q.split("."),v)})}}Object.keys(s.bools).forEach(function(u){h(u,o[u]===void 0?!1:o[u])});var $=[];e.indexOf("--")!==-1&&($=e.slice(e.indexOf("--")+1),e=e.slice(0,e.indexOf("--")));for(var p=0;p<e.length;p++){var a=e[p],d,m;if(/^--.+=/.test(a)){var x=a.match(/^--([^=]+)=([\s\S]*)$/);d=x[1];var P=x[2];s.bools[d]&&(P=P!=="false"),h(d,P,a)}else if(/^--no-.+/.test(a))d=a.match(/^--no-(.+)/)[1],h(d,!1,a);else if(/^--.+/.test(a))d=a.match(/^--(.+)/)[1],m=e[p+1],m!==void 0&&!/^(-|--)[^-]/.test(m)&&!s.bools[d]&&!s.allBools&&(!i[d]||!n(d))?(h(d,m,a),p+=1):/^(true|false)$/.test(m)?(h(d,m==="true",a),p+=1):h(d,s.strings[d]?"":!0,a);else if(/^-[^-]+/.test(a)){for(var E=a.slice(1,-1).split(""),H=!1,c=0;c<E.length;c++){if(m=a.slice(c+2),m==="-"){h(E[c],m,a);continue}if(/[A-Za-z]/.test(E[c])&&m[0]==="="){h(E[c],m.slice(1),a),H=!0;break}if(/[A-Za-z]/.test(E[c])&&/-?\d+(\.\d*)?(e-?\d+)?$/.test(m)){h(E[c],m,a),H=!0;break}if(E[c+1]&&E[c+1].match(/\W/)){h(E[c],a.slice(c+2),a),H=!0;break}else h(E[c],s.strings[E[c]]?"":!0,a)}d=a.slice(-1)[0],!H&&d!=="-"&&(e[p+1]&&!/^(-|--)[^-]/.test(e[p+1])&&!s.bools[d]&&(!i[d]||!n(d))?(h(d,e[p+1],a),p+=1):e[p+1]&&/^(true|false)$/.test(e[p+1])?(h(d,e[p+1]==="true",a),p+=1):h(d,s.strings[d]?"":!0,a))}else if((!s.unknownFn||s.unknownFn(a)!==!1)&&r._.push(s.strings._||!se(a)?a:Number(a)),t.stopEarly){r._.push.apply(r._,e.slice(p+1));break}}return Object.keys(o).forEach(function(u){Es(r,u.split("."))||(f(r,u.split("."),o[u]),(i[u]||[]).forEach(function(b){f(r,b.split("."),o[u])}))}),t["--"]?r["--"]=$.slice():$.forEach(function(u){r._.push(u)}),r};const Ts=ct(Os);var re={};const{FORCE_COLOR:Cs,NODE_DISABLE_COLORS:Ms,TERM:Ps}=process.env,g={enabled:!Ms&&Ps!=="dumb"&&Cs!=="0",reset:w(0,0),bold:w(1,22),dim:w(2,22),italic:w(3,23),underline:w(4,24),inverse:w(7,27),hidden:w(8,28),strikethrough:w(9,29),black:w(30,39),red:w(31,39),green:w(32,39),yellow:w(33,39),blue:w(34,39),magenta:w(35,39),cyan:w(36,39),white:w(37,39),gray:w(90,39),grey:w(90,39),bgBlack:w(40,49),bgRed:w(41,49),bgGreen:w(42,49),bgYellow:w(43,49),bgBlue:w(44,49),bgMagenta:w(45,49),bgCyan:w(46,49),bgWhite:w(47,49)};function ne(e,t){let s=0,i,n="",o="";for(;s<e.length;s++)i=e[s],n+=i.open,o+=i.close,t.includes(i.close)&&(t=t.replace(i.rgx,i.close+i.open));return n+t+o}function _s(e,t){let s={has:e,keys:t};return s.reset=g.reset.bind(s),s.bold=g.bold.bind(s),s.dim=g.dim.bind(s),s.italic=g.italic.bind(s),s.underline=g.underline.bind(s),s.inverse=g.inverse.bind(s),s.hidden=g.hidden.bind(s),s.strikethrough=g.strikethrough.bind(s),s.black=g.black.bind(s),s.red=g.red.bind(s),s.green=g.green.bind(s),s.yellow=g.yellow.bind(s),s.blue=g.blue.bind(s),s.magenta=g.magenta.bind(s),s.cyan=g.cyan.bind(s),s.white=g.white.bind(s),s.gray=g.gray.bind(s),s.grey=g.grey.bind(s),s.bgBlack=g.bgBlack.bind(s),s.bgRed=g.bgRed.bind(s),s.bgGreen=g.bgGreen.bind(s),s.bgYellow=g.bgYellow.bind(s),s.bgBlue=g.bgBlue.bind(s),s.bgMagenta=g.bgMagenta.bind(s),s.bgCyan=g.bgCyan.bind(s),s.bgWhite=g.bgWhite.bind(s),s}function w(e,t){let s={open:`\x1B[${e}m`,close:`\x1B[${t}m`,rgx:new RegExp(`\\x1b\\[${t}m`,"g")};return function(i){return this!==void 0&&this.has!==void 0?(this.has.includes(e)||(this.has.push(e),this.keys.push(s)),i===void 0?this:g.enabled?ne(this.keys,i+""):i+""):i===void 0?_s([e],[s]):g.enabled?ne([s],i+""):i+""}}var C=g,Ds=(e,t)=>{if(!(e.meta&&e.name!=="escape")){if(e.ctrl){if(e.name==="a")return"first";if(e.name==="c"||e.name==="d")return"abort";if(e.name==="e")return"last";if(e.name==="g")return"reset"}if(t){if(e.name==="j")return"down";if(e.name==="k")return"up"}return e.name==="return"||e.name==="enter"?"submit":e.name==="backspace"?"delete":e.name==="delete"?"deleteForward":e.name==="abort"?"abort":e.name==="escape"?"exit":e.name==="tab"?"next":e.name==="pagedown"?"nextPage":e.name==="pageup"?"prevPage":e.name==="home"?"home":e.name==="end"?"end":e.name==="up"?"up":e.name==="down"?"down":e.name==="right"?"right":e.name==="left"?"left":!1}},St=e=>{const t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),s=new RegExp(t,"g");return typeof e=="string"?e.replace(s,""):e};const Et="\x1B",y=`${Et}[`,Is="\x07",Ot={to(e,t){return t?`${y}${t+1};${e+1}H`:`${y}${e+1}G`},move(e,t){let s="";return e<0?s+=`${y}${-e}D`:e>0&&(s+=`${y}${e}C`),t<0?s+=`${y}${-t}A`:t>0&&(s+=`${y}${t}B`),s},up:(e=1)=>`${y}${e}A`,down:(e=1)=>`${y}${e}B`,forward:(e=1)=>`${y}${e}C`,backward:(e=1)=>`${y}${e}D`,nextLine:(e=1)=>`${y}E`.repeat(e),prevLine:(e=1)=>`${y}F`.repeat(e),left:`${y}G`,hide:`${y}?25l`,show:`${y}?25h`,save:`${Et}7`,restore:`${Et}8`},Rs={up:(e=1)=>`${y}S`.repeat(e),down:(e=1)=>`${y}T`.repeat(e)},As={screen:`${y}2J`,up:(e=1)=>`${y}1J`.repeat(e),down:(e=1)=>`${y}J`.repeat(e),line:`${y}2K`,lineEnd:`${y}K`,lineStart:`${y}1K`,lines(e){let t="";for(let s=0;s<e;s++)t+=this.line+(s<e-1?Ot.up():"");return e&&(t+=Ot.left),t}};var M={cursor:Ot,scroll:Rs,erase:As,beep:Is};const Ns=St,{erase:oe,cursor:js}=M,Fs=e=>[...Ns(e)].length;var Ls=function(e,t){if(!t)return oe.line+js.to(0);let s=0;const i=e.split(/\r?\n/);for(let n of i)s+=1+Math.floor(Math.max(Fs(n)-1,0)/t);return oe.lines(s)};const Z={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},Vs={arrowUp:Z.arrowUp,arrowDown:Z.arrowDown,arrowLeft:Z.arrowLeft,arrowRight:Z.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},Ys=process.platform==="win32"?Vs:Z;var le=Ys;const G=C,B=le,Tt=Object.freeze({password:{scale:1,render:e=>"*".repeat(e.length)},emoji:{scale:2,render:e=>"\u{1F603}".repeat(e.length)},invisible:{scale:0,render:e=>""},default:{scale:1,render:e=>`${e}`}}),Hs=e=>Tt[e]||Tt.default,X=Object.freeze({aborted:G.red(B.cross),done:G.green(B.tick),exited:G.yellow(B.cross),default:G.cyan("?")}),Bs=(e,t,s)=>t?X.aborted:s?X.exited:e?X.done:X.default,ks=e=>G.gray(e?B.ellipsis:B.pointerSmall),Ws=(e,t)=>G.gray(e?t?B.pointerSmall:"+":B.line);var zs={styles:Tt,render:Hs,symbols:X,symbol:Bs,delimiter:ks,item:Ws};const Gs=St;var Us=function(e,t){let s=String(Gs(e)||"").split(/\r?\n/);return t?s.map(i=>Math.ceil(i.length/t)).reduce((i,n)=>i+n):s.length},Ks=(e,t={})=>{const s=Number.isSafeInteger(parseInt(t.margin))?new Array(parseInt(t.margin)).fill(" ").join(""):t.margin||"",i=t.width;return(e||"").split(/\r?\n/g).map(n=>n.split(/\s+/g).reduce((o,r)=>(r.length+s.length>=i||o[o.length-1].length+r.length+1<i?o[o.length-1]+=` ${r}`:o.push(`${s}${r}`),o),[s]).join(`
|
1
|
+
import S from"node:fs";import T from"node:path";import{fileURLToPath as Le}from"node:url";import Ve from"child_process";import at from"path";import ut from"fs";import Ye from"readline";import He from"events";var Be=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ct(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var z={exports:{}},dt,Ht;function ke(){if(Ht)return dt;Ht=1,dt=i,i.sync=n;var e=ut;function t(o,r){var l=r.pathExt!==void 0?r.pathExt:process.env.PATHEXT;if(!l||(l=l.split(";"),l.indexOf("")!==-1))return!0;for(var f=0;f<l.length;f++){var h=l[f].toLowerCase();if(h&&o.substr(-h.length).toLowerCase()===h)return!0}return!1}function s(o,r,l){return!o.isSymbolicLink()&&!o.isFile()?!1:t(r,l)}function i(o,r,l){e.stat(o,function(f,h){l(f,f?!1:s(h,o,r))})}function n(o,r){return s(e.statSync(o),o,r)}return dt}var ft,Bt;function We(){if(Bt)return ft;Bt=1,ft=t,t.sync=s;var e=ut;function t(o,r,l){e.stat(o,function(f,h){l(f,f?!1:i(h,r))})}function s(o,r){return i(e.statSync(o),r)}function i(o,r){return o.isFile()&&n(o,r)}function n(o,r){var l=o.mode,f=o.uid,h=o.gid,$=r.uid!==void 0?r.uid:process.getuid&&process.getuid(),p=r.gid!==void 0?r.gid:process.getgid&&process.getgid(),a=parseInt("100",8),d=parseInt("010",8),m=parseInt("001",8),x=a|d,P=l&m||l&d&&h===p||l&a&&f===$||l&x&&$===0;return P}return ft}var st;process.platform==="win32"||Be.TESTING_WINDOWS?st=ke():st=We();var ze=pt;pt.sync=Ge;function pt(e,t,s){if(typeof t=="function"&&(s=t,t={}),!s){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(i,n){pt(e,t||{},function(o,r){o?n(o):i(r)})})}st(e,t||{},function(i,n){i&&(i.code==="EACCES"||t&&t.ignoreErrors)&&(i=null,n=!1),s(i,n)})}function Ge(e,t){try{return st.sync(e,t||{})}catch(s){if(t&&t.ignoreErrors||s.code==="EACCES")return!1;throw s}}const G=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",kt=at,Ue=G?";":":",Wt=ze,zt=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),Gt=(e,t)=>{const s=t.colon||Ue,i=e.match(/\//)||G&&e.match(/\\/)?[""]:[...G?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(s)],n=G?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=G?n.split(s):[""];return G&&e.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:i,pathExt:o,pathExtExe:n}},Ut=(e,t,s)=>{typeof t=="function"&&(s=t,t={}),t||(t={});const{pathEnv:i,pathExt:n,pathExtExe:o}=Gt(e,t),r=[],l=h=>new Promise(($,p)=>{if(h===i.length)return t.all&&r.length?$(r):p(zt(e));const a=i[h],d=/^".*"$/.test(a)?a.slice(1,-1):a,m=kt.join(d,e),x=!d&&/^\.[\\\/]/.test(e)?e.slice(0,2)+m:m;$(f(x,h,0))}),f=(h,$,p)=>new Promise((a,d)=>{if(p===n.length)return a(l($+1));const m=n[p];Wt(h+m,{pathExt:o},(x,P)=>{if(!x&&P)if(t.all)r.push(h+m);else return a(h+m);return a(f(h,$,p+1))})});return s?l(0).then(h=>s(null,h),s):l(0)},Ke=(e,t)=>{t=t||{};const{pathEnv:s,pathExt:i,pathExtExe:n}=Gt(e,t),o=[];for(let r=0;r<s.length;r++){const l=s[r],f=/^".*"$/.test(l)?l.slice(1,-1):l,h=kt.join(f,e),$=!f&&/^\.[\\\/]/.test(e)?e.slice(0,2)+h:h;for(let p=0;p<i.length;p++){const a=$+i[p];try{if(Wt.sync(a,{pathExt:n}))if(t.all)o.push(a);else return a}catch{}}}if(t.all&&o.length)return o;if(t.nothrow)return null;throw zt(e)};var Je=Ut;Ut.sync=Ke;var mt={exports:{}};const Kt=(e={})=>{const t=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(i=>i.toUpperCase()==="PATH")||"Path"};mt.exports=Kt,mt.exports.default=Kt;var qe=mt.exports;const Jt=at,Ze=Je,Xe=qe;function qt(e,t){const s=e.options.env||process.env,i=process.cwd(),n=e.options.cwd!=null,o=n&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(e.options.cwd)}catch{}let r;try{r=Ze.sync(e.command,{path:s[Xe({env:s})],pathExt:t?Jt.delimiter:void 0})}catch{}finally{o&&process.chdir(i)}return r&&(r=Jt.resolve(n?e.options.cwd:"",r)),r}function Qe(e){return qt(e)||qt(e,!0)}var ts=Qe,gt={};const vt=/([()\][%!^"`<>&|;, *?])/g;function es(e){return e=e.replace(vt,"^$1"),e}function ss(e,t){return e=`${e}`,e=e.replace(/(\\*)"/g,'$1$1\\"'),e=e.replace(/(\\*)$/,"$1$1"),e=`"${e}"`,e=e.replace(vt,"^$1"),t&&(e=e.replace(vt,"^$1")),e}gt.command=es,gt.argument=ss;var is=/^#!(.*)/;const rs=is;var ns=(e="")=>{const t=e.match(rs);if(!t)return null;const[s,i]=t[0].replace(/#! ?/,"").split(" "),n=s.split("/").pop();return n==="env"?i:i?`${n} ${i}`:n};const bt=ut,os=ns;function ls(e){const s=Buffer.alloc(150);let i;try{i=bt.openSync(e,"r"),bt.readSync(i,s,0,150,0),bt.closeSync(i)}catch{}return os(s.toString())}var hs=ls;const as=at,Zt=ts,Xt=gt,us=hs,cs=process.platform==="win32",ds=/\.(?:com|exe)$/i,fs=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function ps(e){e.file=Zt(e);const t=e.file&&us(e.file);return t?(e.args.unshift(e.file),e.command=t,Zt(e)):e.file}function ms(e){if(!cs)return e;const t=ps(e),s=!ds.test(t);if(e.options.forceShell||s){const i=fs.test(t);e.command=as.normalize(e.command),e.command=Xt.command(e.command),e.args=e.args.map(o=>Xt.argument(o,i));const n=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${n}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}function gs(e,t,s){t&&!Array.isArray(t)&&(s=t,t=null),t=t?t.slice(0):[],s=Object.assign({},s);const i={command:e,args:t,options:s,file:void 0,original:{command:e,args:t}};return s.shell?i:ms(i)}var vs=gs;const wt=process.platform==="win32";function yt(e,t){return Object.assign(new Error(`${t} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function bs(e,t){if(!wt)return;const s=e.emit;e.emit=function(i,n){if(i==="exit"){const o=Qt(n,t);if(o)return s.call(e,"error",o)}return s.apply(e,arguments)}}function Qt(e,t){return wt&&e===1&&!t.file?yt(t.original,"spawn"):null}function ws(e,t){return wt&&e===1&&!t.file?yt(t.original,"spawnSync"):null}var ys={hookChildProcess:bs,verifyENOENT:Qt,verifyENOENTSync:ws,notFoundError:yt};const te=Ve,$t=vs,xt=ys;function ee(e,t,s){const i=$t(e,t,s),n=te.spawn(i.command,i.args,i.options);return xt.hookChildProcess(n,i),n}function $s(e,t,s){const i=$t(e,t,s),n=te.spawnSync(i.command,i.args,i.options);return n.error=n.error||xt.verifyENOENTSync(n.status,i),n}z.exports=ee,z.exports.spawn=ee,z.exports.sync=$s,z.exports._parse=$t,z.exports._enoent=xt;var xs=z.exports;const Ss=ct(xs);function Es(e,t){var s=e;t.slice(0,-1).forEach(function(n){s=s[n]||{}});var i=t[t.length-1];return i in s}function se(e){return typeof e=="number"||/^0x[0-9a-f]+$/i.test(e)?!0:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(e)}function ie(e,t){return t==="constructor"&&typeof e[t]=="function"||t==="__proto__"}var Os=function(e,t){t||(t={});var s={bools:{},strings:{},unknownFn:null};typeof t.unknown=="function"&&(s.unknownFn=t.unknown),typeof t.boolean=="boolean"&&t.boolean?s.allBools=!0:[].concat(t.boolean).filter(Boolean).forEach(function(u){s.bools[u]=!0});var i={};function n(u){return i[u].some(function(b){return s.bools[b]})}Object.keys(t.alias||{}).forEach(function(u){i[u]=[].concat(t.alias[u]),i[u].forEach(function(b){i[b]=[u].concat(i[u].filter(function(O){return b!==O}))})}),[].concat(t.string).filter(Boolean).forEach(function(u){s.strings[u]=!0,i[u]&&[].concat(i[u]).forEach(function(b){s.strings[b]=!0})});var o=t.default||{},r={_:[]};function l(u,b){return s.allBools&&/^--[^=]+$/.test(b)||s.strings[u]||s.bools[u]||i[u]}function f(u,b,O){for(var v=u,q=0;q<b.length-1;q++){var _=b[q];if(ie(v,_))return;v[_]===void 0&&(v[_]={}),(v[_]===Object.prototype||v[_]===Number.prototype||v[_]===String.prototype)&&(v[_]={}),v[_]===Array.prototype&&(v[_]=[]),v=v[_]}var R=b[b.length-1];ie(v,R)||((v===Object.prototype||v===Number.prototype||v===String.prototype)&&(v={}),v===Array.prototype&&(v=[]),v[R]===void 0||s.bools[R]||typeof v[R]=="boolean"?v[R]=O:Array.isArray(v[R])?v[R].push(O):v[R]=[v[R],O])}function h(u,b,O){if(!(O&&s.unknownFn&&!l(u,O)&&s.unknownFn(O)===!1)){var v=!s.strings[u]&&se(b)?Number(b):b;f(r,u.split("."),v),(i[u]||[]).forEach(function(q){f(r,q.split("."),v)})}}Object.keys(s.bools).forEach(function(u){h(u,o[u]===void 0?!1:o[u])});var $=[];e.indexOf("--")!==-1&&($=e.slice(e.indexOf("--")+1),e=e.slice(0,e.indexOf("--")));for(var p=0;p<e.length;p++){var a=e[p],d,m;if(/^--.+=/.test(a)){var x=a.match(/^--([^=]+)=([\s\S]*)$/);d=x[1];var P=x[2];s.bools[d]&&(P=P!=="false"),h(d,P,a)}else if(/^--no-.+/.test(a))d=a.match(/^--no-(.+)/)[1],h(d,!1,a);else if(/^--.+/.test(a))d=a.match(/^--(.+)/)[1],m=e[p+1],m!==void 0&&!/^(-|--)[^-]/.test(m)&&!s.bools[d]&&!s.allBools&&(!i[d]||!n(d))?(h(d,m,a),p+=1):/^(true|false)$/.test(m)?(h(d,m==="true",a),p+=1):h(d,s.strings[d]?"":!0,a);else if(/^-[^-]+/.test(a)){for(var E=a.slice(1,-1).split(""),H=!1,c=0;c<E.length;c++){if(m=a.slice(c+2),m==="-"){h(E[c],m,a);continue}if(/[A-Za-z]/.test(E[c])&&m[0]==="="){h(E[c],m.slice(1),a),H=!0;break}if(/[A-Za-z]/.test(E[c])&&/-?\d+(\.\d*)?(e-?\d+)?$/.test(m)){h(E[c],m,a),H=!0;break}if(E[c+1]&&E[c+1].match(/\W/)){h(E[c],a.slice(c+2),a),H=!0;break}else h(E[c],s.strings[E[c]]?"":!0,a)}d=a.slice(-1)[0],!H&&d!=="-"&&(e[p+1]&&!/^(-|--)[^-]/.test(e[p+1])&&!s.bools[d]&&(!i[d]||!n(d))?(h(d,e[p+1],a),p+=1):e[p+1]&&/^(true|false)$/.test(e[p+1])?(h(d,e[p+1]==="true",a),p+=1):h(d,s.strings[d]?"":!0,a))}else if((!s.unknownFn||s.unknownFn(a)!==!1)&&r._.push(s.strings._||!se(a)?a:Number(a)),t.stopEarly){r._.push.apply(r._,e.slice(p+1));break}}return Object.keys(o).forEach(function(u){Es(r,u.split("."))||(f(r,u.split("."),o[u]),(i[u]||[]).forEach(function(b){f(r,b.split("."),o[u])}))}),t["--"]?r["--"]=$.slice():$.forEach(function(u){r._.push(u)}),r};const Ts=ct(Os);var re={};const{FORCE_COLOR:Cs,NODE_DISABLE_COLORS:Ms,TERM:Ps}=process.env,g={enabled:!Ms&&Ps!=="dumb"&&Cs!=="0",reset:w(0,0),bold:w(1,22),dim:w(2,22),italic:w(3,23),underline:w(4,24),inverse:w(7,27),hidden:w(8,28),strikethrough:w(9,29),black:w(30,39),red:w(31,39),green:w(32,39),yellow:w(33,39),blue:w(34,39),magenta:w(35,39),cyan:w(36,39),white:w(37,39),gray:w(90,39),grey:w(90,39),bgBlack:w(40,49),bgRed:w(41,49),bgGreen:w(42,49),bgYellow:w(43,49),bgBlue:w(44,49),bgMagenta:w(45,49),bgCyan:w(46,49),bgWhite:w(47,49)};function ne(e,t){let s=0,i,n="",o="";for(;s<e.length;s++)i=e[s],n+=i.open,o+=i.close,t.includes(i.close)&&(t=t.replace(i.rgx,i.close+i.open));return n+t+o}function _s(e,t){let s={has:e,keys:t};return s.reset=g.reset.bind(s),s.bold=g.bold.bind(s),s.dim=g.dim.bind(s),s.italic=g.italic.bind(s),s.underline=g.underline.bind(s),s.inverse=g.inverse.bind(s),s.hidden=g.hidden.bind(s),s.strikethrough=g.strikethrough.bind(s),s.black=g.black.bind(s),s.red=g.red.bind(s),s.green=g.green.bind(s),s.yellow=g.yellow.bind(s),s.blue=g.blue.bind(s),s.magenta=g.magenta.bind(s),s.cyan=g.cyan.bind(s),s.white=g.white.bind(s),s.gray=g.gray.bind(s),s.grey=g.grey.bind(s),s.bgBlack=g.bgBlack.bind(s),s.bgRed=g.bgRed.bind(s),s.bgGreen=g.bgGreen.bind(s),s.bgYellow=g.bgYellow.bind(s),s.bgBlue=g.bgBlue.bind(s),s.bgMagenta=g.bgMagenta.bind(s),s.bgCyan=g.bgCyan.bind(s),s.bgWhite=g.bgWhite.bind(s),s}function w(e,t){let s={open:`\x1B[${e}m`,close:`\x1B[${t}m`,rgx:new RegExp(`\\x1b\\[${t}m`,"g")};return function(i){return this!==void 0&&this.has!==void 0?(this.has.includes(e)||(this.has.push(e),this.keys.push(s)),i===void 0?this:g.enabled?ne(this.keys,i+""):i+""):i===void 0?_s([e],[s]):g.enabled?ne([s],i+""):i+""}}var C=g,Ds=(e,t)=>{if(!(e.meta&&e.name!=="escape")){if(e.ctrl){if(e.name==="a")return"first";if(e.name==="c"||e.name==="d")return"abort";if(e.name==="e")return"last";if(e.name==="g")return"reset"}if(t){if(e.name==="j")return"down";if(e.name==="k")return"up"}return e.name==="return"||e.name==="enter"?"submit":e.name==="backspace"?"delete":e.name==="delete"?"deleteForward":e.name==="abort"?"abort":e.name==="escape"?"exit":e.name==="tab"?"next":e.name==="pagedown"?"nextPage":e.name==="pageup"?"prevPage":e.name==="home"?"home":e.name==="end"?"end":e.name==="up"?"up":e.name==="down"?"down":e.name==="right"?"right":e.name==="left"?"left":!1}},St=e=>{const t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),s=new RegExp(t,"g");return typeof e=="string"?e.replace(s,""):e};const Et="\x1B",y=`${Et}[`,Is="\x07",Ot={to(e,t){return t?`${y}${t+1};${e+1}H`:`${y}${e+1}G`},move(e,t){let s="";return e<0?s+=`${y}${-e}D`:e>0&&(s+=`${y}${e}C`),t<0?s+=`${y}${-t}A`:t>0&&(s+=`${y}${t}B`),s},up:(e=1)=>`${y}${e}A`,down:(e=1)=>`${y}${e}B`,forward:(e=1)=>`${y}${e}C`,backward:(e=1)=>`${y}${e}D`,nextLine:(e=1)=>`${y}E`.repeat(e),prevLine:(e=1)=>`${y}F`.repeat(e),left:`${y}G`,hide:`${y}?25l`,show:`${y}?25h`,save:`${Et}7`,restore:`${Et}8`},Rs={up:(e=1)=>`${y}S`.repeat(e),down:(e=1)=>`${y}T`.repeat(e)},As={screen:`${y}2J`,up:(e=1)=>`${y}1J`.repeat(e),down:(e=1)=>`${y}J`.repeat(e),line:`${y}2K`,lineEnd:`${y}K`,lineStart:`${y}1K`,lines(e){let t="";for(let s=0;s<e;s++)t+=this.line+(s<e-1?Ot.up():"");return e&&(t+=Ot.left),t}};var M={cursor:Ot,scroll:Rs,erase:As,beep:Is};const Ns=St,{erase:oe,cursor:js}=M,Fs=e=>[...Ns(e)].length;var Ls=function(e,t){if(!t)return oe.line+js.to(0);let s=0;const i=e.split(/\r?\n/);for(let n of i)s+=1+Math.floor(Math.max(Fs(n)-1,0)/t);return oe.lines(s)};const Z={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},Vs={arrowUp:Z.arrowUp,arrowDown:Z.arrowDown,arrowLeft:Z.arrowLeft,arrowRight:Z.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},Ys=process.platform==="win32"?Vs:Z;var le=Ys;const U=C,B=le,Tt=Object.freeze({password:{scale:1,render:e=>"*".repeat(e.length)},emoji:{scale:2,render:e=>"\u{1F603}".repeat(e.length)},invisible:{scale:0,render:e=>""},default:{scale:1,render:e=>`${e}`}}),Hs=e=>Tt[e]||Tt.default,X=Object.freeze({aborted:U.red(B.cross),done:U.green(B.tick),exited:U.yellow(B.cross),default:U.cyan("?")}),Bs=(e,t,s)=>t?X.aborted:s?X.exited:e?X.done:X.default,ks=e=>U.gray(e?B.ellipsis:B.pointerSmall),Ws=(e,t)=>U.gray(e?t?B.pointerSmall:"+":B.line);var zs={styles:Tt,render:Hs,symbols:X,symbol:Bs,delimiter:ks,item:Ws};const Gs=St;var Us=function(e,t){let s=String(Gs(e)||"").split(/\r?\n/);return t?s.map(i=>Math.ceil(i.length/t)).reduce((i,n)=>i+n):s.length},Ks=(e,t={})=>{const s=Number.isSafeInteger(parseInt(t.margin))?new Array(parseInt(t.margin)).fill(" ").join(""):t.margin||"",i=t.width;return(e||"").split(/\r?\n/g).map(n=>n.split(/\s+/g).reduce((o,r)=>(r.length+s.length>=i||o[o.length-1].length+r.length+1<i?o[o.length-1]+=` ${r}`:o.push(`${s}${r}`),o),[s]).join(`
|
2
2
|
`)).join(`
|
3
3
|
`)},Js=(e,t,s)=>{s=s||t;let i=Math.min(t-s,e-Math.floor(s/2));i<0&&(i=0);let n=Math.min(i+s,t);return{startIndex:i,endIndex:n}},D={action:Ds,clear:Ls,style:zs,strip:St,figures:le,lines:Us,wrap:Ks,entriesToDisplay:Js};const he=Ye,{action:qs}=D,Zs=He,{beep:Xs,cursor:Qs}=M,ti=C;let ei=class extends Zs{constructor(t={}){super(),this.firstRender=!0,this.in=t.stdin||process.stdin,this.out=t.stdout||process.stdout,this.onRender=(t.onRender||(()=>{})).bind(this);const s=he.createInterface({input:this.in,escapeCodeTimeout:50});he.emitKeypressEvents(this.in,s),this.in.isTTY&&this.in.setRawMode(!0);const i=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,n=(o,r)=>{let l=qs(r,i);l===!1?this._&&this._(o,r):typeof this[l]=="function"?this[l](r):this.bell()};this.close=()=>{this.out.write(Qs.show),this.in.removeListener("keypress",n),this.in.isTTY&&this.in.setRawMode(!1),s.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",n)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(Xs)}render(){this.onRender(ti),this.firstRender&&(this.firstRender=!1)}};var L=ei;const it=C,si=L,{erase:ii,cursor:Q}=M,{style:Ct,clear:Mt,lines:ri,figures:ni}=D;class oi extends si{constructor(t={}){super(t),this.transform=Ct.render(t.style),this.scale=this.transform.scale,this.msg=t.message,this.initial=t.initial||"",this.validator=t.validate||(()=>!0),this.value="",this.errorMsg=t.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=Mt("",this.out.columns),this.render()}set value(t){!t&&this.initial?(this.placeholder=!0,this.rendered=it.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(t)),this._value=t,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=+!!this.initial,this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
|
4
4
|
`),this.close()}async validate(){let t=await this.validator(this.value);typeof t=="string"&&(this.errorMsg=t,t=!1),this.error=!t}async submit(){if(this.value=this.value||this.initial,this.cursorOffset=0,this.cursor=this.rendered.length,await this.validate(),this.error){this.red=!0,this.fire(),this.render();return}this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
@@ -35,17 +35,17 @@ Instructions:
|
|
35
35
|
`),this.close()}_(t,s){let i=this.input.slice(0,this.cursor),n=this.input.slice(this.cursor);this.input=`${i}${t}${n}`,this.cursor=i.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let t=this.input.slice(0,this.cursor-1),s=this.input.slice(this.cursor);this.input=`${t}${s}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let t=this.input.slice(0,this.cursor),s=this.input.slice(this.cursor+1);this.input=`${t}${s}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){this.select===0?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render()}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}next(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render()}renderOption(t,s,i,n){let o,r=i?Rt.arrowUp:n?Rt.arrowDown:" ",l=s?tt.cyan().underline(t.title):t.title;return r=(s?tt.cyan(Rt.pointer)+" ":" ")+r,t.description&&(o=` - ${t.description}`,(r.length+l.length+o.length>=this.out.columns||t.description.split(/\r?\n/).length>1)&&(o=`
|
36
36
|
`+$r(t.description,{margin:3,width:this.out.columns}))),r+" "+l+tt.gray(o||"")}render(){if(this.closed)return;this.firstRender?this.out.write(Se.hide):this.out.write(Ee(this.outputText,this.out.columns)),super.render();let{startIndex:t,endIndex:s}=xr(this.select,this.choices.length,this.limit);if(this.outputText=[It.symbol(this.done,this.aborted,this.exited),tt.bold(this.msg),It.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){const i=this.suggestions.slice(t,s).map((n,o)=>this.renderOption(n,this.select===o+t,o===0&&t>0,o+t===s-1&&s<this.choices.length)).join(`
|
37
37
|
`);this.outputText+=`
|
38
|
-
`+(i||tt.gray(this.fallback.title))}this.out.write(yr.line+Se.to(0)+this.outputText)}}var Tr=Or;const j=C,{cursor:Cr}=M,Mr=xe,{clear:Te,style:Ce,figures:
|
38
|
+
`+(i||tt.gray(this.fallback.title))}this.out.write(yr.line+Se.to(0)+this.outputText)}}var Tr=Or;const j=C,{cursor:Cr}=M,Mr=xe,{clear:Te,style:Ce,figures:K}=D;class Pr extends Mr{constructor(t={}){t.overrideRender=!0,super(t),this.inputValue="",this.clear=Te("",this.out.columns),this.filteredOptions=this.value,this.render()}last(){this.cursor=this.filteredOptions.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length,this.render()}up(){this.cursor===0?this.cursor=this.filteredOptions.length-1:this.cursor--,this.render()}down(){this.cursor===this.filteredOptions.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(t=>t.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions())}updateFilteredOptions(){const t=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(i=>this.inputValue?!!(typeof i.title=="string"&&i.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof i.value=="string"&&i.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);const s=this.filteredOptions.findIndex(i=>i===t);this.cursor=s<0?0:s,this.render()}handleSpaceToggle(){const t=this.filteredOptions[this.cursor];if(t.selected)t.selected=!1,this.render();else{if(t.disabled||this.value.filter(s=>s.selected).length>=this.maxChoices)return this.bell();t.selected=!0,this.render()}}handleInputChange(t){this.inputValue=this.inputValue+t,this.updateFilteredOptions()}_(t,s){t===" "?this.handleSpaceToggle():this.handleInputChange(t)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
39
39
|
Instructions:
|
40
|
-
${
|
41
|
-
${
|
40
|
+
${K.arrowUp}/${K.arrowDown}: Highlight option
|
41
|
+
${K.arrowLeft}/${K.arrowRight}/[space]: Toggle selection
|
42
42
|
[a,b,c]/delete: Filter choices
|
43
43
|
enter/return: Complete answer
|
44
44
|
`:""}renderCurrentInput(){return`
|
45
45
|
Filtered results for: ${this.inputValue?this.inputValue:j.gray("Enter something to filter")}
|
46
|
-
`}renderOption(t,s,i){let n;return s.disabled?n=t===i?j.gray().underline(s.title):j.strikethrough().gray(s.title):n=t===i?j.cyan().underline(s.title):s.title,(s.selected?j.green(
|
46
|
+
`}renderOption(t,s,i){let n;return s.disabled?n=t===i?j.gray().underline(s.title):j.strikethrough().gray(s.title):n=t===i?j.cyan().underline(s.title):s.title,(s.selected?j.green(K.radioOn):K.radioOff)+" "+n}renderDoneOrInstructions(){if(this.done)return this.value.filter(s=>s.selected).map(s=>s.title).join(", ");const t=[j.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&t.push(j.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Cr.hide),super.render();let t=[Ce.symbol(this.done,this.aborted),j.bold(this.msg),Ce.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=j.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),t+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+t),this.clear=Te(t,this.out.columns)}}var _r=Pr;const Me=C,Dr=L,{style:Pe,clear:Ir}=D,{erase:Rr,cursor:_e}=M;class Ar extends Dr{constructor(t={}){super(t),this.msg=t.message,this.value=t.initial,this.initialValue=!!t.initial,this.yesMsg=t.yes||"yes",this.yesOption=t.yesOption||"(Y/n)",this.noMsg=t.no||"no",this.noOption=t.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
47
47
|
`),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
48
|
-
`),this.close()}_(t,s){return t.toLowerCase()==="y"?(this.value=!0,this.submit()):t.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(_e.hide):this.out.write(Ir(this.outputText,this.out.columns)),super.render(),this.outputText=[Pe.symbol(this.done,this.aborted),Me.bold(this.msg),Pe.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:Me.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(Rr.line+_e.to(0)+this.outputText))}}var Nr=Ar,jr={TextPrompt:li,SelectPrompt:fi,TogglePrompt:bi,DatePrompt:or,NumberPrompt:fr,MultiselectPrompt:xe,AutocompletePrompt:Tr,AutocompleteMultiselectPrompt:_r,ConfirmPrompt:Nr};(function(e){const t=e,s=jr,i=r=>r;function n(r,l,f={}){return new Promise((h,$)=>{const p=new s[r](l),a=f.onAbort||i,d=f.onSubmit||i,m=f.onExit||i;p.on("state",l.onState||i),p.on("submit",x=>h(d(x))),p.on("exit",x=>h(m(x))),p.on("abort",x=>$(a(x)))})}t.text=r=>n("TextPrompt",r),t.password=r=>(r.style="password",t.text(r)),t.invisible=r=>(r.style="invisible",t.text(r)),t.number=r=>n("NumberPrompt",r),t.date=r=>n("DatePrompt",r),t.confirm=r=>n("ConfirmPrompt",r),t.list=r=>{const l=r.separator||",";return n("TextPrompt",r,{onSubmit:f=>f.split(l).map(h=>h.trim())})},t.toggle=r=>n("TogglePrompt",r),t.select=r=>n("SelectPrompt",r),t.multiselect=r=>{r.choices=[].concat(r.choices||[]);const l=f=>f.filter(h=>h.selected).map(h=>h.value);return n("MultiselectPrompt",r,{onAbort:l,onSubmit:l})},t.autocompleteMultiselect=r=>{r.choices=[].concat(r.choices||[]);const l=f=>f.filter(h=>h.selected).map(h=>h.value);return n("AutocompleteMultiselectPrompt",r,{onAbort:l,onSubmit:l})};const o=(r,l)=>Promise.resolve(l.filter(f=>f.title.slice(0,r.length).toLowerCase()===r.toLowerCase()));t.autocomplete=r=>(r.suggest=r.suggest||o,r.choices=[].concat(r.choices||[]),n("AutocompletePrompt",r))})(re);const At=re,Fr=["suggest","format","onState","validate","onRender","type"],De=()=>{};async function Y(e=[],{onSubmit:t=De,onCancel:s=De}={}){const i={},n=Y._override||{};e=[].concat(e);let o,r,l,f,h,$;const p=async(a,d,m=!1)=>{if(!(!m&&a.validate&&a.validate(d)!==!0))return a.format?await a.format(d,i):d};for(r of e)if({name:f,type:h}=r,typeof h=="function"&&(h=await h(o,{...i},r),r.type=h),!!h){for(let a in r){if(Fr.includes(a))continue;let d=r[a];r[a]=typeof d=="function"?await d(o,{...i},$):d}if($=r,typeof r.message!="string")throw new Error("prompt message is required");if({name:f,type:h}=r,At[h]===void 0)throw new Error(`prompt type (${h}) is not defined`);if(n[r.name]!==void 0&&(o=await p(r,n[r.name]),o!==void 0)){i[f]=o;continue}try{o=Y._injected?Lr(Y._injected,r.initial):await At[h](r),i[f]=o=await p(r,o,!0),l=await t(r,o,i)}catch{l=!await s(r,i)}if(l)return i}return i}function Lr(e,t){const s=e.shift();if(s instanceof Error)throw s;return s===void 0?t:s}function Vr(e){Y._injected=(Y._injected||[]).concat(e)}function Yr(e){Y._override=Object.assign({},e)}var Hr=Object.assign(Y,{prompt:Y,prompts:At,inject:Vr,override:Yr});const Br=ct(Hr);let k=!0;const
|
48
|
+
`),this.close()}_(t,s){return t.toLowerCase()==="y"?(this.value=!0,this.submit()):t.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(_e.hide):this.out.write(Ir(this.outputText,this.out.columns)),super.render(),this.outputText=[Pe.symbol(this.done,this.aborted),Me.bold(this.msg),Pe.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:Me.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(Rr.line+_e.to(0)+this.outputText))}}var Nr=Ar,jr={TextPrompt:li,SelectPrompt:fi,TogglePrompt:bi,DatePrompt:or,NumberPrompt:fr,MultiselectPrompt:xe,AutocompletePrompt:Tr,AutocompleteMultiselectPrompt:_r,ConfirmPrompt:Nr};(function(e){const t=e,s=jr,i=r=>r;function n(r,l,f={}){return new Promise((h,$)=>{const p=new s[r](l),a=f.onAbort||i,d=f.onSubmit||i,m=f.onExit||i;p.on("state",l.onState||i),p.on("submit",x=>h(d(x))),p.on("exit",x=>h(m(x))),p.on("abort",x=>$(a(x)))})}t.text=r=>n("TextPrompt",r),t.password=r=>(r.style="password",t.text(r)),t.invisible=r=>(r.style="invisible",t.text(r)),t.number=r=>n("NumberPrompt",r),t.date=r=>n("DatePrompt",r),t.confirm=r=>n("ConfirmPrompt",r),t.list=r=>{const l=r.separator||",";return n("TextPrompt",r,{onSubmit:f=>f.split(l).map(h=>h.trim())})},t.toggle=r=>n("TogglePrompt",r),t.select=r=>n("SelectPrompt",r),t.multiselect=r=>{r.choices=[].concat(r.choices||[]);const l=f=>f.filter(h=>h.selected).map(h=>h.value);return n("MultiselectPrompt",r,{onAbort:l,onSubmit:l})},t.autocompleteMultiselect=r=>{r.choices=[].concat(r.choices||[]);const l=f=>f.filter(h=>h.selected).map(h=>h.value);return n("AutocompleteMultiselectPrompt",r,{onAbort:l,onSubmit:l})};const o=(r,l)=>Promise.resolve(l.filter(f=>f.title.slice(0,r.length).toLowerCase()===r.toLowerCase()));t.autocomplete=r=>(r.suggest=r.suggest||o,r.choices=[].concat(r.choices||[]),n("AutocompletePrompt",r))})(re);const At=re,Fr=["suggest","format","onState","validate","onRender","type"],De=()=>{};async function Y(e=[],{onSubmit:t=De,onCancel:s=De}={}){const i={},n=Y._override||{};e=[].concat(e);let o,r,l,f,h,$;const p=async(a,d,m=!1)=>{if(!(!m&&a.validate&&a.validate(d)!==!0))return a.format?await a.format(d,i):d};for(r of e)if({name:f,type:h}=r,typeof h=="function"&&(h=await h(o,{...i},r),r.type=h),!!h){for(let a in r){if(Fr.includes(a))continue;let d=r[a];r[a]=typeof d=="function"?await d(o,{...i},$):d}if($=r,typeof r.message!="string")throw new Error("prompt message is required");if({name:f,type:h}=r,At[h]===void 0)throw new Error(`prompt type (${h}) is not defined`);if(n[r.name]!==void 0&&(o=await p(r,n[r.name]),o!==void 0)){i[f]=o;continue}try{o=Y._injected?Lr(Y._injected,r.initial):await At[h](r),i[f]=o=await p(r,o,!0),l=await t(r,o,i)}catch{l=!await s(r,i)}if(l)return i}return i}function Lr(e,t){const s=e.shift();if(s instanceof Error)throw s;return s===void 0?t:s}function Vr(e){Y._injected=(Y._injected||[]).concat(e)}function Yr(e){Y._override=Object.assign({},e)}var Hr=Object.assign(Y,{prompt:Y,prompts:At,inject:Vr,override:Yr});const Br=ct(Hr);let k=!0;const J=typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{};let et=0;if(J.process&&J.process.env&&J.process.stdout){const{FORCE_COLOR:e,NODE_DISABLE_COLORS:t,NO_COLOR:s,TERM:i,COLORTERM:n}=J.process.env;t||s||e==="0"?k=!1:e==="1"||e==="2"||e==="3"?k=!0:i==="dumb"?k=!1:"CI"in J.process.env&&["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(o=>o in J.process.env)?k=!0:k=process.stdout.isTTY,k&&(process.platform==="win32"||n&&(n==="truecolor"||n==="24bit")?et=3:i&&(i.endsWith("-256color")||i.endsWith("256"))?et=2:et=1)}let Ie={enabled:k,supportLevel:et};function ht(e,t,s=1){const i=`\x1B[${e}m`,n=`\x1B[${t}m`,o=new RegExp(`\\x1b\\[${t}m`,"g");return r=>Ie.enabled&&Ie.supportLevel>=s?i+(""+r).replace(o,i)+n:""+r}const F=ht(0,0),Re=ht(31,39),Nt=ht(32,39),W=ht(34,39),jt=Ts(process.argv.slice(2),{string:["_"]}),Ft=process.cwd(),Lt=[{name:"vue",display:"Young Designed Vue Template",color:Nt,variants:[{name:"nuxt-admin",display:"Nuxt3 Admin",color:W},{name:"nuxt-website",display:"Nuxt3 Website",color:W},{name:"electron-win7",display:"electron app support win7",color:W},{name:"vue-mobile",display:"Vue3 Mobile",color:W},{name:"uni-app",display:"Vue3 uni-app",color:W},{name:"big-screen",display:"Vue3 Big Screen",color:W},{name:"vitepress",display:"Vitepress docs template",color:W},{name:"vue-thin",display:"Vue3 mini demo",color:Nt},{name:"admin-server",display:"Node Server Based on Midwayjs",color:Nt}]},{name:"vite",display:"Vite Formal",color:F,variants:[{name:"create-vite",display:"create-vite",color:F,customCommand:"npm create vite@latest TARGET_DIR"}]},{name:"others",display:"Others",color:F,variants:[{name:"create-vite-extra",display:"create-vite-extra \u2197",color:F,customCommand:"npm create vite-extra@latest TARGET_DIR"}]}],Ae=Lt.map(e=>e.variants&&e.variants.map(t=>t.name)||[e.name]).reduce((e,t)=>e.concat(t),[]),kr={_gitignore:".gitignore",_npmrc:".npmrc",_nvmrc:".nvmrc"},Wr=/_env.*/,Vt="vite-project";async function zr(){const e=Ne(jt._[0]),t=jt.template||jt.t;let s=e||Vt;const i=()=>s==="."?T.basename(T.resolve()):s;let n;try{n=await Br([{type:e?null:"text",name:"projectName",message:F("Project name:"),initial:Vt,onState:c=>{s=Ne(c.value)||Vt}},{type:()=>!S.existsSync(s)||Kr(s)?null:"confirm",name:"overwrite",message:()=>`${s==="."?"Current directory":`Target directory "${s}"`} is not empty. Remove existing files and continue?`},{type:(c,{overwrite:u})=>{if(u===!1)throw new Error(`${Re("\u2716")} Operation cancelled`);return null},name:"overwriteChecker"},{type:()=>Fe(i())?null:"text",name:"packageName",message:F("Package name:"),initial:()=>Gr(i()),validate:c=>Fe(c)||"Invalid package.json name"},{type:t&&Ae.includes(t)?null:"select",name:"framework",message:typeof t=="string"&&!Ae.includes(t)?F(`"${t}" isn't a valid template. Please choose from below: `):F("Select a framework:"),initial:0,choices:Lt.map(c=>{const u=c.color;return{title:u(c.display||c.name),value:c}})},{type:c=>c&&c.variants?"select":null,name:"variant",message:F("Select a variant:"),choices:c=>c.variants.map(u=>{const b=u.color;return{title:b(u.display||u.name),value:u.name,disabled:u.wip||u.deprecated}})}],{onCancel:()=>{throw new Error(`${Re("\u2716")} Operation cancelled`)}})}catch(c){console.log(c.message);return}const{framework:o,overwrite:r,packageName:l,variant:f}=n,h=T.join(Ft,s);r?Jr(h):S.existsSync(h)||S.mkdirSync(h,{recursive:!0});const $=f||o?.name||t,p=qr(process.env.npm_config_user_agent),a=p?p.name:"npm",d=a==="yarn"&&p?.version.startsWith("1."),{customCommand:m}=Lt.flatMap(c=>c.variants).find(c=>c.name===$)??{};if(m){const c=m.replace("TARGET_DIR",s).replace(/^npm create/,`${a} create`).replace("@latest",()=>d?"":"@latest").replace(/^npm exec/,()=>a==="pnpm"?"pnpm dlx":a==="yarn"&&!d?"yarn dlx":"npm exec"),[u,...b]=c.split(" "),{status:O}=Ss.sync(u,b,{stdio:"inherit"});process.exit(O??0)}console.log(`
|
49
49
|
Scaffolding project in ${h}...`);const x=T.resolve(Le(import.meta.url),"../..",`template-${$}`),P=(c,u)=>{const b=T.join(h,kr[c]??Wr.test(c)?c.replace("_","."):c);u?S.writeFileSync(b,u):je(T.join(x,c),b)},E=S.readdirSync(x);for(const c of E.filter(u=>u!=="package.json"))P(c);const H=JSON.parse(S.readFileSync(T.join(x,"package.json"),"utf-8"));switch(H.name=l||i(),P("package.json",JSON.stringify(H,null,2)),console.log(`
|
50
50
|
Done. Now run:
|
51
51
|
`),h!==Ft&&console.log(` cd ${T.relative(Ft,h)}`),a){case"yarn":console.log(" yarn"),console.log(" yarn dev");break;default:console.log(` ${a} install`),console.log(` ${a} run dev`);break}console.log()}function Ne(e){return e?.trim().replace(/\/+$/g,"")}function je(e,t){S.statSync(e).isDirectory()?Ur(e,t):S.copyFileSync(e,t)}function Fe(e){return/^(?:@[a-z\d\-*~][a-z\d\-*._~]*\/)?[a-z\d\-~][a-z\d\-._~]*$/.test(e)}function Gr(e){return e.trim().toLowerCase().replace(/\s+/g,"-").replace(/^[._]/,"").replace(/[^a-z\d\-~]+/g,"-")}function Ur(e,t){S.mkdirSync(t,{recursive:!0});for(const s of S.readdirSync(e)){const i=T.resolve(e,s),n=T.resolve(t,s);je(i,n)}}function Kr(e){const t=S.readdirSync(e);return t.length===0||t.length===1&&t[0]===".git"}function Jr(e){if(S.existsSync(e))for(const t of S.readdirSync(e))t!==".git"&&S.rmSync(T.resolve(e,t),{recursive:!0,force:!0})}function qr(e){if(!e)return;const t=e.split(" ")[0].split("/");return{name:t[0],version:t[1]}}zr().catch(e=>{console.error(e)});
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
/*
|
2
2
|
* @Author: zhangyang
|
3
3
|
* @Date: 2022-12-03 15:14:08
|
4
|
-
* @LastEditTime: 2024-
|
4
|
+
* @LastEditTime: 2024-09-04 15:48:39
|
5
5
|
* @Description:
|
6
6
|
*/
|
7
7
|
import fs from 'node:fs'
|
@@ -58,6 +58,11 @@ const FRAMEWORKS: Framework[] = [
|
|
58
58
|
display: 'Nuxt3 Website',
|
59
59
|
color: blue,
|
60
60
|
},
|
61
|
+
{
|
62
|
+
name: 'electron-win7',
|
63
|
+
display: 'electron app support win7',
|
64
|
+
color: blue,
|
65
|
+
},
|
61
66
|
{
|
62
67
|
name: 'vue-mobile',
|
63
68
|
display: 'Vue3 Mobile',
|
@@ -0,0 +1,49 @@
|
|
1
|
+
{
|
2
|
+
"prettier.enable": false,
|
3
|
+
"editor.formatOnSave": false,
|
4
|
+
|
5
|
+
// Enable the ESlint flat config support
|
6
|
+
"eslint.experimental.useFlatConfig": true,
|
7
|
+
// Auto fix
|
8
|
+
"editor.codeActionsOnSave": {
|
9
|
+
"source.fixAll.eslint": "explicit",
|
10
|
+
"source.organizeImports": "never"
|
11
|
+
},
|
12
|
+
|
13
|
+
// Silent the stylistic rules in you IDE, but still auto fix them
|
14
|
+
"eslint.rules.customizations": [
|
15
|
+
{ "rule": "style/*", "severity": "off" },
|
16
|
+
{ "rule": "*-indent", "severity": "off" },
|
17
|
+
{ "rule": "*-spacing", "severity": "off" },
|
18
|
+
{ "rule": "*-spaces", "severity": "off" },
|
19
|
+
{ "rule": "*-order", "severity": "off" },
|
20
|
+
{ "rule": "*-dangle", "severity": "off" },
|
21
|
+
{ "rule": "*-newline", "severity": "off" },
|
22
|
+
{ "rule": "*quotes", "severity": "off" },
|
23
|
+
{ "rule": "*semi", "severity": "off" }
|
24
|
+
],
|
25
|
+
|
26
|
+
// Enable eslint for all supported languages
|
27
|
+
"eslint.validate": [
|
28
|
+
"javascript",
|
29
|
+
"javascriptreact",
|
30
|
+
"typescript",
|
31
|
+
"typescriptreact",
|
32
|
+
"vue",
|
33
|
+
"html",
|
34
|
+
"markdown",
|
35
|
+
"json",
|
36
|
+
"jsonc",
|
37
|
+
"yaml",
|
38
|
+
"toml",
|
39
|
+
"xml",
|
40
|
+
"gql",
|
41
|
+
"graphql",
|
42
|
+
"astro",
|
43
|
+
"css",
|
44
|
+
"less",
|
45
|
+
"scss",
|
46
|
+
"pcss",
|
47
|
+
"postcss"
|
48
|
+
]
|
49
|
+
}
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# Vue3 + TypeScript + Vite + Electron
|
2
|
+
|
3
|
+
[![](https://img.shields.io/badge/Author-BluesYoung--web-blue)](https://gitee.com/BluesYoung-web)
|
4
|
+
|
5
|
+
[![code style](https://antfu.me/badge-code-style.svg)](https://github.com/antfu/eslint-config)
|
6
|
+
|
7
|
+
## 注意
|
8
|
+
|
9
|
+
**图标至少为 `256x256` 的 `ico`**
|
10
|
+
|
11
|
+
**编译过程需要科学上网**
|
12
|
+
|
13
|
+
## 开始使用
|
14
|
+
|
15
|
+
1. 替换 [package.json](./package.json) 中的 `name`
|
16
|
+
|
17
|
+
2. 替换 [electron-builder.yaml](./electron-builder.yaml) 中的 `appId | productName | publish -> url`
|
18
|
+
|
19
|
+
3. 替换图标 [icon.ico](./public/icon.ico)
|
20
|
+
|
21
|
+
4. 替换 [dev-app-update.yml](./dev-app-update.yml) 中的 `url` 用于开发阶段的更新测试
|
22
|
+
|
23
|
+
5. 替换 [env/.env](./env/.env) 中的 `VITE_APP_TITLE`
|
24
|
+
|
25
|
+
6. 根据具体情况选择对应的操作:
|
26
|
+
- 一体化开发
|
27
|
+
- 注释 `electron/main.ts -> init 函数中的 await readConfig()`
|
28
|
+
- 按需修改 `env/.env.*`
|
29
|
+
- **`C:\Users\用户名\AppData\Roaming\修改后的应用名\config.json -> VITE_DEV_SERVER_URL` 的配置优先级最高,切换开发模式时注意清除**
|
30
|
+
- 嵌入外部网页(默认)
|
31
|
+
- 按需修改 `electron/config/*` 的内容
|
32
|
+
- **`electron/config.ts` 为打包脚本自动生成,不建议手动修改**
|
33
|
+
|
34
|
+
## 更新流程
|
35
|
+
|
36
|
+
1. 修改 [package.json](./package.json) 中的 `version`
|
37
|
+
|
38
|
+
2. 填写更新说明 [RELEASE_NOTES.md](./RELEASE_NOTES.md),不同版本之间使用 `------` 分隔
|
39
|
+
|
40
|
+
3. 打包
|
41
|
+
|
42
|
+
4. 将打包产物(`release/*`)上传至服务器(上面配置文件中的 `url`):
|
43
|
+
- `latest.yml`
|
44
|
+
- `新版安装包`
|
45
|
+
- `新版安装包.blockmap`
|
46
|
+
|
47
|
+
## 特性
|
48
|
+
|
49
|
+
### 一体化开发
|
50
|
+
|
51
|
+
- `Pinia` 状态管理
|
52
|
+
|
53
|
+
- `Unocss` 样式自动生成
|
54
|
+
|
55
|
+
- `API` 自动导入,组件自动导入
|
56
|
+
|
57
|
+
- 基于文件目录的自动路由
|
58
|
+
|
59
|
+
### 嵌入外部网页
|
60
|
+
|
61
|
+
- 支持动态切换不同环境
|
62
|
+
|
63
|
+
## Credits
|
64
|
+
|
65
|
+
[electron-vite-vue3-win7](https://github.com/nikinikinico/electron-vite-vue3-win7)
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# Logs
|
2
|
+
logs
|
3
|
+
*.log
|
4
|
+
npm-debug.log*
|
5
|
+
yarn-debug.log*
|
6
|
+
yarn-error.log*
|
7
|
+
pnpm-debug.log*
|
8
|
+
lerna-debug.log*
|
9
|
+
|
10
|
+
node_modules
|
11
|
+
dist
|
12
|
+
dist-ssr
|
13
|
+
dist-electron
|
14
|
+
release
|
15
|
+
*.local
|
16
|
+
|
17
|
+
# Editor directories and files
|
18
|
+
.vscode/*
|
19
|
+
!.vscode/extensions.json
|
20
|
+
!.vscode/settings.json
|
21
|
+
.idea
|
22
|
+
.DS_Store
|
23
|
+
*.suo
|
24
|
+
*.ntvs*
|
25
|
+
*.njsproj
|
26
|
+
*.sln
|
27
|
+
*.sw?
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/*
|
2
|
+
* @Author: zhangyang
|
3
|
+
* @Date: 2024-09-04 10:54:03
|
4
|
+
* @LastEditTime: 2024-09-04 11:39:28
|
5
|
+
* @Description:
|
6
|
+
* @LastEditors: zhangyang
|
7
|
+
* Copyright (c) 2024 to current by BluesYoung-web, All Rights Reserved.
|
8
|
+
*/
|
9
|
+
export default {
|
10
|
+
VITE_APP_MODE: 'local',
|
11
|
+
VITE_APP_LABEL: '本地',
|
12
|
+
VITE_APP_SERVER_URL: 'http://192.168.10.168:3000',
|
13
|
+
} as YoungAppConfig
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/*
|
2
|
+
* @Author: zhangyang
|
3
|
+
* @Date: 2024-09-04 10:46:10
|
4
|
+
* @LastEditTime: 2024-09-04 11:39:23
|
5
|
+
* @Description:
|
6
|
+
* @LastEditors: zhangyang
|
7
|
+
* Copyright (c) 2024 to current by BluesYoung-web, All Rights Reserved.
|
8
|
+
*/
|
9
|
+
export default {
|
10
|
+
VITE_APP_MODE: 'dev',
|
11
|
+
VITE_APP_LABEL: '开发服',
|
12
|
+
VITE_APP_SERVER_URL: 'https://xiaoai.mi.com',
|
13
|
+
} as YoungAppConfig
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/*
|
2
|
+
* @Author: zhangyang
|
3
|
+
* @Date: 2024-09-04 10:54:03
|
4
|
+
* @LastEditTime: 2024-09-04 11:39:42
|
5
|
+
* @Description:
|
6
|
+
* @LastEditors: zhangyang
|
7
|
+
* Copyright (c) 2024 to current by BluesYoung-web, All Rights Reserved.
|
8
|
+
*/
|
9
|
+
export default {
|
10
|
+
VITE_APP_MODE: 'test',
|
11
|
+
VITE_APP_LABEL: '测试服',
|
12
|
+
VITE_APP_SERVER_URL: 'https://www.mi.com',
|
13
|
+
} as YoungAppConfig
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/*
|
2
|
+
* @Author: zhangyang
|
3
|
+
* @Date: 2024-09-04 10:55:54
|
4
|
+
* @LastEditTime: 2024-09-04 11:39:52
|
5
|
+
* @Description:
|
6
|
+
* @LastEditors: zhangyang
|
7
|
+
* Copyright (c) 2024 to current by BluesYoung-web, All Rights Reserved.
|
8
|
+
*/
|
9
|
+
export default {
|
10
|
+
VITE_APP_MODE: 'wtest',
|
11
|
+
VITE_APP_LABEL: '外网测试服',
|
12
|
+
VITE_APP_SERVER_URL: 'https://shop.mi.com',
|
13
|
+
} as YoungAppConfig
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/*
|
2
|
+
* @Author: zhangyang
|
3
|
+
* @Date: 2024-09-04 10:57:42
|
4
|
+
* @LastEditTime: 2024-09-04 11:39:35
|
5
|
+
* @Description:
|
6
|
+
* @LastEditors: zhangyang
|
7
|
+
* Copyright (c) 2024 to current by BluesYoung-web, All Rights Reserved.
|
8
|
+
*/
|
9
|
+
export default {
|
10
|
+
VITE_APP_MODE: 'online',
|
11
|
+
VITE_APP_LABEL: '正式服',
|
12
|
+
VITE_APP_SERVER_URL: 'https://www.xiaomiev.com',
|
13
|
+
} as YoungAppConfig
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/*
|
2
|
+
* @Author: zhangyang
|
3
|
+
* @Date: 2024-09-04 10:57:42
|
4
|
+
* @LastEditTime: 2024-09-04 11:39:35
|
5
|
+
* @Description:
|
6
|
+
* @LastEditors: zhangyang
|
7
|
+
* Copyright (c) 2024 to current by BluesYoung-web, All Rights Reserved.
|
8
|
+
*/
|
9
|
+
export default {
|
10
|
+
VITE_APP_MODE: 'online',
|
11
|
+
VITE_APP_LABEL: '正式服',
|
12
|
+
VITE_APP_SERVER_URL: 'https://www.xiaomiev.com',
|
13
|
+
} as YoungAppConfig
|
@@ -0,0 +1,58 @@
|
|
1
|
+
/// <reference types="vite-plugin-electron/electron-env" />
|
2
|
+
|
3
|
+
declare namespace NodeJS {
|
4
|
+
interface ProcessEnv {
|
5
|
+
/**
|
6
|
+
* The built directory structure
|
7
|
+
*
|
8
|
+
* ```tree
|
9
|
+
* ├─┬─┬ dist
|
10
|
+
* │ │ └── index.html
|
11
|
+
* │ │
|
12
|
+
* │ ├─┬ dist-electron
|
13
|
+
* │ │ ├── main.js
|
14
|
+
* │ │ └── preload.js
|
15
|
+
* │
|
16
|
+
* ```
|
17
|
+
*/
|
18
|
+
DIST: string
|
19
|
+
/** /dist/ or /public/ */
|
20
|
+
VITE_PUBLIC: string
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
// Used in Renderer process, expose in `preload.ts`
|
25
|
+
interface Window {
|
26
|
+
ipcRenderer: import('electron').IpcRenderer
|
27
|
+
}
|
28
|
+
|
29
|
+
// IPCMAin,Render
|
30
|
+
type IPCOneWay =
|
31
|
+
| 'update-available'
|
32
|
+
| 'update-not-available'
|
33
|
+
| 'download-progress'
|
34
|
+
| 'update-downloaded'
|
35
|
+
| 'update-error'
|
36
|
+
| 'check-update'
|
37
|
+
| 'update-app'
|
38
|
+
|
39
|
+
interface SelectOptionItem {
|
40
|
+
label: string
|
41
|
+
value: any
|
42
|
+
}
|
43
|
+
|
44
|
+
interface YoungAppConfig {
|
45
|
+
/**
|
46
|
+
* 当前所处模式
|
47
|
+
*/
|
48
|
+
VITE_APP_MODE: 'local' | 'dev' | 'test' | 'wtest' | 'online'
|
49
|
+
/**
|
50
|
+
* 模式的中文描述
|
51
|
+
*/
|
52
|
+
VITE_APP_LABEL: string
|
53
|
+
|
54
|
+
/**
|
55
|
+
* 内嵌网页应用的地址
|
56
|
+
*/
|
57
|
+
VITE_APP_SERVER_URL: string
|
58
|
+
}
|