@mxfb/cli 0.0.35 → 0.0.36
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.
- package/cli/assets/version.txt +1 -1
- package/make-template/index.js +2 -98
- package/package.json +3 -3
package/cli/assets/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.0.
|
|
1
|
+
0.0.36
|
package/make-template/index.js
CHANGED
|
@@ -1,99 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
`)).join(`
|
|
5
|
-
`)}});var hi=u((Ql,oi)=>{"use strict";oi.exports=(i,t,e)=>{e=e||t;let s=Math.min(t-e,i-Math.floor(e/2));s<0&&(s=0);let r=Math.min(s+e,t);return{startIndex:s,endIndex:r}}});var w=u((tu,li)=>{"use strict";li.exports={action:Ge(),clear:Xe(),style:ei(),strip:at(),figures:It(),lines:si(),wrap:ni(),entriesToDisplay:hi()}});var _=u((eu,ci)=>{"use strict";var ui=ut("readline"),Xn=w(),Qn=Xn.action,to=ut("events"),ai=m(),eo=ai.beep,io=ai.cursor,so=f(),Ct=class extends to{constructor(t={}){super(),this.firstRender=!0,this.in=t.stdin||process.stdin,this.out=t.stdout||process.stdout,this.onRender=(t.onRender||(()=>{})).bind(this);let e=ui.createInterface({input:this.in,escapeCodeTimeout:50});ui.emitKeypressEvents(this.in,e),this.in.isTTY&&this.in.setRawMode(!0);let s=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,r=(o,n)=>{let h=Qn(n,s);h===!1?this._&&this._(o,n):typeof this[h]=="function"?this[h](n):this.bell()};this.close=()=>{this.out.write(io.show),this.in.removeListener("keypress",r),this.in.isTTY&&this.in.setRawMode(!1),e.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",r)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(eo)}render(){this.onRender(so),this.firstRender&&(this.firstRender=!1)}};ci.exports=Ct});var gi=u((iu,mi)=>{"use strict";function di(i,t,e,s,r,o,n){try{var h=i[o](n),l=h.value}catch(a){e(a);return}h.done?t(l):Promise.resolve(l).then(s,r)}function fi(i){return function(){var t=this,e=arguments;return new Promise(function(s,r){var o=i.apply(t,e);function n(l){di(o,s,r,n,h,"next",l)}function h(l){di(o,s,r,n,h,"throw",l)}n(void 0)})}}var ct=f(),ro=_(),pi=m(),no=pi.erase,X=pi.cursor,dt=w(),jt=dt.style,Et=dt.clear,oo=dt.lines,ho=dt.figures,At=class extends ro{constructor(t={}){super(t),this.transform=jt.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=Et("",this.out.columns),this.render()}set value(t){!t&&this.initial?(this.placeholder=!0,this.rendered=ct.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(`
|
|
6
|
-
`),this.close()}validate(){var t=this;return fi(function*(){let e=yield t.validator(t.value);typeof e=="string"&&(t.errorMsg=e,e=!1),t.error=!e})()}submit(){var t=this;return fi(function*(){if(t.value=t.value||t.initial,t.cursorOffset=0,t.cursor=t.rendered.length,yield t.validate(),t.error){t.red=!0,t.fire(),t.render();return}t.done=!0,t.aborted=!1,t.fire(),t.render(),t.out.write(`
|
|
7
|
-
`),t.close()})()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(t){this.placeholder||(this.cursor=this.cursor+t,this.cursorOffset+=t)}_(t,e){let s=this.value.slice(0,this.cursor),r=this.value.slice(this.cursor);this.value=`${s}${t}${r}`,this.red=!1,this.cursor=this.placeholder?0:s.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let t=this.value.slice(0,this.cursor-1),e=this.value.slice(this.cursor);this.value=`${t}${e}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let t=this.value.slice(0,this.cursor),e=this.value.slice(this.cursor+1);this.value=`${t}${e}`,this.red=!1,this.isCursorAtEnd()?this.cursorOffset=0:this.cursorOffset++,this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(X.down(oo(this.outputError,this.out.columns)-1)+Et(this.outputError,this.out.columns)),this.out.write(Et(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[jt.symbol(this.done,this.aborted),ct.bold(this.msg),jt.delimiter(this.done),this.red?ct.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
8
|
-
`).reduce((t,e,s)=>t+`
|
|
9
|
-
${s?" ":ho.pointerSmall} ${ct.red().italic(e)}`,"")),this.out.write(no.line+X.to(0)+this.outputText+X.save+this.outputError+X.restore+X.move(this.cursorOffset,0)))}};mi.exports=At});var yi=u((su,wi)=>{"use strict";var I=f(),lo=_(),Q=w(),bi=Q.style,vi=Q.clear,ft=Q.figures,uo=Q.wrap,ao=Q.entriesToDisplay,co=m(),fo=co.cursor,Rt=class extends lo{constructor(t={}){super(t),this.msg=t.message,this.hint=t.hint||"- Use arrow-keys. Return to submit.",this.warn=t.warn||"- This option is disabled",this.cursor=t.initial||0,this.choices=t.choices.map((e,s)=>(typeof e=="string"&&(e={title:e,value:s}),{title:e&&(e.title||e.value||e),value:e&&(e.value===void 0?s:e.value),description:e&&e.description,selected:e&&e.selected,disabled:e&&e.disabled})),this.optionsPerPage=t.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=vi("",this.out.columns),this.render()}moveCursor(t){this.cursor=t,this.value=this.choices[t].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
10
|
-
`),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
11
|
-
`),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(t,e){if(t===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(fo.hide):this.out.write(vi(this.outputText,this.out.columns)),super.render();let t=ao(this.cursor,this.choices.length,this.optionsPerPage),e=t.startIndex,s=t.endIndex;if(this.outputText=[bi.symbol(this.done,this.aborted),I.bold(this.msg),bi.delimiter(!1),this.done?this.selection.title:this.selection.disabled?I.yellow(this.warn):I.gray(this.hint)].join(" "),!this.done){this.outputText+=`
|
|
12
|
-
`;for(let r=e;r<s;r++){let o,n,h="",l=this.choices[r];r===e&&e>0?n=ft.arrowUp:r===s-1&&s<this.choices.length?n=ft.arrowDown:n=" ",l.disabled?(o=this.cursor===r?I.gray().underline(l.title):I.strikethrough().gray(l.title),n=(this.cursor===r?I.bold().gray(ft.pointer)+" ":" ")+n):(o=this.cursor===r?I.cyan().underline(l.title):l.title,n=(this.cursor===r?I.cyan(ft.pointer)+" ":" ")+n,l.description&&this.cursor===r&&(h=` - ${l.description}`,(n.length+o.length+h.length>=this.out.columns||l.description.split(/\r?\n/).length>1)&&(h=`
|
|
13
|
-
`+uo(l.description,{margin:3,width:this.out.columns})))),this.outputText+=`${n} ${o}${I.gray(h)}
|
|
14
|
-
`}}this.out.write(this.outputText)}};wi.exports=Rt});var Ti=u((ru,Mi)=>{"use strict";var pt=f(),po=_(),qi=w(),xi=qi.style,mo=qi.clear,Oi=m(),Si=Oi.cursor,go=Oi.erase,kt=class extends po{constructor(t={}){super(t),this.msg=t.message,this.value=!!t.initial,this.active=t.active||"on",this.inactive=t.inactive||"off",this.initialValue=this.value,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(`
|
|
15
|
-
`),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
16
|
-
`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(t,e){if(t===" ")this.value=!this.value;else if(t==="1")this.value=!0;else if(t==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(Si.hide):this.out.write(mo(this.outputText,this.out.columns)),super.render(),this.outputText=[xi.symbol(this.done,this.aborted),pt.bold(this.msg),xi.delimiter(this.done),this.value?this.inactive:pt.cyan().underline(this.inactive),pt.gray("/"),this.value?pt.cyan().underline(this.active):this.active].join(" "),this.out.write(go.line+Si.to(0)+this.outputText))}};Mi.exports=kt});var S=u((nu,$i)=>{"use strict";var Ft=class i{constructor({token:t,date:e,parts:s,locales:r}){this.token=t,this.date=e||new Date,this.parts=s||[this],this.locales=r||{}}up(){}down(){}next(){let t=this.parts.indexOf(this);return this.parts.find((e,s)=>s>t&&e instanceof i)}setTo(t){}prev(){let t=[].concat(this.parts).reverse(),e=t.indexOf(this);return t.find((s,r)=>r>e&&s instanceof i)}toString(){return String(this.date)}};$i.exports=Ft});var _i=u((ou,Pi)=>{"use strict";var bo=S(),Ht=class extends bo{constructor(t={}){super(t)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let t=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?t.toUpperCase():t}};Pi.exports=Ht});var Di=u((hu,Ii)=>{"use strict";var vo=S(),wo=i=>(i=i%10,i===1?"st":i===2?"nd":i===3?"rd":"th"),Yt=class extends vo{constructor(t={}){super(t)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(t){this.date.setDate(parseInt(t.substr(-2)))}toString(){let t=this.date.getDate(),e=this.date.getDay();return this.token==="DD"?String(t).padStart(2,"0"):this.token==="Do"?t+wo(t):this.token==="d"?e+1:this.token==="ddd"?this.locales.weekdaysShort[e]:this.token==="dddd"?this.locales.weekdays[e]:t}};Ii.exports=Yt});var ji=u((lu,Ci)=>{"use strict";var yo=S(),Vt=class extends yo{constructor(t={}){super(t)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(t){this.date.setHours(parseInt(t.substr(-2)))}toString(){let t=this.date.getHours();return/h/.test(this.token)&&(t=t%12||12),this.token.length>1?String(t).padStart(2,"0"):t}};Ci.exports=Vt});var Ai=u((uu,Ei)=>{"use strict";var xo=S(),Lt=class extends xo{constructor(t={}){super(t)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(t){this.date.setMilliseconds(parseInt(t.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}};Ei.exports=Lt});var ki=u((au,Ri)=>{"use strict";var So=S(),Nt=class extends So{constructor(t={}){super(t)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(t){this.date.setMinutes(parseInt(t.substr(-2)))}toString(){let t=this.date.getMinutes();return this.token.length>1?String(t).padStart(2,"0"):t}};Ri.exports=Nt});var Hi=u((cu,Fi)=>{"use strict";var qo=S(),Ut=class extends qo{constructor(t={}){super(t)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(t){t=parseInt(t.substr(-2))-1,this.date.setMonth(t<0?0:t)}toString(){let t=this.date.getMonth(),e=this.token.length;return e===2?String(t+1).padStart(2,"0"):e===3?this.locales.monthsShort[t]:e===4?this.locales.months[t]:String(t+1)}};Fi.exports=Ut});var Vi=u((du,Yi)=>{"use strict";var Oo=S(),Gt=class extends Oo{constructor(t={}){super(t)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(t){this.date.setSeconds(parseInt(t.substr(-2)))}toString(){let t=this.date.getSeconds();return this.token.length>1?String(t).padStart(2,"0"):t}};Yi.exports=Gt});var Ni=u((fu,Li)=>{"use strict";var Mo=S(),Jt=class extends Mo{constructor(t={}){super(t)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(t){this.date.setFullYear(t.substr(-4))}toString(){let t=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?t.substr(-2):t}};Li.exports=Jt});var Gi=u((pu,Ui)=>{"use strict";Ui.exports={DatePart:S(),Meridiem:_i(),Day:Di(),Hours:ji(),Milliseconds:Ai(),Minutes:ki(),Month:Hi(),Seconds:Vi(),Year:Ni()}});var es=u((mu,ts)=>{"use strict";function Ji(i,t,e,s,r,o,n){try{var h=i[o](n),l=h.value}catch(a){e(a);return}h.done?t(l):Promise.resolve(l).then(s,r)}function Bi(i){return function(){var t=this,e=arguments;return new Promise(function(s,r){var o=i.apply(t,e);function n(l){Ji(o,s,r,n,h,"next",l)}function h(l){Ji(o,s,r,n,h,"throw",l)}n(void 0)})}}var Bt=f(),To=_(),Wt=w(),zi=Wt.style,Wi=Wt.clear,$o=Wt.figures,Qi=m(),Po=Qi.erase,Zi=Qi.cursor,D=Gi(),Ki=D.DatePart,_o=D.Meridiem,Io=D.Day,Do=D.Hours,Co=D.Milliseconds,jo=D.Minutes,Eo=D.Month,Ao=D.Seconds,Ro=D.Year,ko=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,Xi={1:({token:i})=>i.replace(/\\(.)/g,"$1"),2:i=>new Io(i),3:i=>new Eo(i),4:i=>new Ro(i),5:i=>new _o(i),6:i=>new Do(i),7:i=>new jo(i),8:i=>new Ao(i),9:i=>new Co(i)},Fo={months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),monthsShort:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),weekdaysShort:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")},zt=class extends To{constructor(t={}){super(t),this.msg=t.message,this.cursor=0,this.typed="",this.locales=Object.assign(Fo,t.locales),this._date=t.initial||new Date,this.errorMsg=t.error||"Please Enter A Valid Value",this.validator=t.validate||(()=>!0),this.mask=t.mask||"YYYY-MM-DD HH:mm:ss",this.clear=Wi("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(t){t&&this._date.setTime(t.getTime())}set mask(t){let e;for(this.parts=[];e=ko.exec(t);){let r=e.shift(),o=e.findIndex(n=>n!=null);this.parts.push(o in Xi?Xi[o]({token:e[o]||r,date:this.date,parts:this.parts,locales:this.locales}):e[o]||r)}let s=this.parts.reduce((r,o)=>(typeof o=="string"&&typeof r[r.length-1]=="string"?r[r.length-1]+=o:r.push(o),r),[]);this.parts.splice(0),this.parts.push(...s),this.reset()}moveCursor(t){this.typed="",this.cursor=t,this.fire()}reset(){this.moveCursor(this.parts.findIndex(t=>t instanceof Ki)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
17
|
-
`),this.close()}validate(){var t=this;return Bi(function*(){let e=yield t.validator(t.value);typeof e=="string"&&(t.errorMsg=e,e=!1),t.error=!e})()}submit(){var t=this;return Bi(function*(){if(yield t.validate(),t.error){t.color="red",t.fire(),t.render();return}t.done=!0,t.aborted=!1,t.fire(),t.render(),t.out.write(`
|
|
18
|
-
`),t.close()})()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let t=this.parts[this.cursor].prev();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t)),this.render()}right(){let t=this.parts[this.cursor].next();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t)),this.render()}next(){let t=this.parts[this.cursor].next();this.moveCursor(t?this.parts.indexOf(t):this.parts.findIndex(e=>e instanceof Ki)),this.render()}_(t){/\d/.test(t)&&(this.typed+=t,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(Zi.hide):this.out.write(Wi(this.outputText,this.out.columns)),super.render(),this.outputText=[zi.symbol(this.done,this.aborted),Bt.bold(this.msg),zi.delimiter(!1),this.parts.reduce((t,e,s)=>t.concat(s===this.cursor&&!this.done?Bt.cyan().underline(e.toString()):e),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
|
|
19
|
-
`).reduce((t,e,s)=>t+`
|
|
20
|
-
${s?" ":$o.pointerSmall} ${Bt.red().italic(e)}`,"")),this.out.write(Po.line+Zi.to(0)+this.outputText))}};ts.exports=zt});var ls=u((gu,hs)=>{"use strict";function is(i,t,e,s,r,o,n){try{var h=i[o](n),l=h.value}catch(a){e(a);return}h.done?t(l):Promise.resolve(l).then(s,r)}function ss(i){return function(){var t=this,e=arguments;return new Promise(function(s,r){var o=i.apply(t,e);function n(l){is(o,s,r,n,h,"next",l)}function h(l){is(o,s,r,n,h,"throw",l)}n(void 0)})}}var mt=f(),Ho=_(),os=m(),gt=os.cursor,Yo=os.erase,bt=w(),Zt=bt.style,Vo=bt.figures,rs=bt.clear,Lo=bt.lines,No=/[0-9]/,Kt=i=>i!==void 0,ns=(i,t)=>{let e=Math.pow(10,t);return Math.round(i*e)/e},Xt=class extends Ho{constructor(t={}){super(t),this.transform=Zt.render(t.style),this.msg=t.message,this.initial=Kt(t.initial)?t.initial:"",this.float=!!t.float,this.round=t.round||2,this.inc=t.increment||1,this.min=Kt(t.min)?t.min:-1/0,this.max=Kt(t.max)?t.max:1/0,this.errorMsg=t.error||"Please Enter A Valid Value",this.validator=t.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(t){!t&&t!==0?(this.placeholder=!0,this.rendered=mt.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${ns(t,this.round)}`),this._value=ns(t,this.round)),this.fire()}get value(){return this._value}parse(t){return this.float?parseFloat(t):parseInt(t)}valid(t){return t==="-"||t==="."&&this.float||No.test(t)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let t=this.value;this.value=t!==""?t:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
21
|
-
`),this.close()}validate(){var t=this;return ss(function*(){let e=yield t.validator(t.value);typeof e=="string"&&(t.errorMsg=e,e=!1),t.error=!e})()}submit(){var t=this;return ss(function*(){if(yield t.validate(),t.error){t.color="red",t.fire(),t.render();return}let e=t.value;t.value=e!==""?e:t.initial,t.done=!0,t.aborted=!1,t.error=!1,t.fire(),t.render(),t.out.write(`
|
|
22
|
-
`),t.close()})()}up(){if(this.typed="",this.value===""&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value===""&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let t=this.value.toString();if(t.length===0)return this.bell();this.value=this.parse(t=t.slice(0,-1))||"",this.value!==""&&this.value<this.min&&(this.value=this.min),this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(t,e){if(!this.valid(t))return this.bell();let s=Date.now();if(s-this.lastHit>1e3&&(this.typed=""),this.typed+=t,this.lastHit=s,this.color="cyan",t===".")return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(gt.down(Lo(this.outputError,this.out.columns)-1)+rs(this.outputError,this.out.columns)),this.out.write(rs(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[Zt.symbol(this.done,this.aborted),mt.bold(this.msg),Zt.delimiter(this.done),!this.done||!this.done&&!this.placeholder?mt[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
23
|
-
`).reduce((t,e,s)=>t+`
|
|
24
|
-
${s?" ":Vo.pointerSmall} ${mt.red().italic(e)}`,"")),this.out.write(Yo.line+gt.to(0)+this.outputText+gt.save+this.outputError+gt.restore))}};hs.exports=Xt});var te=u((bu,cs)=>{"use strict";var q=f(),Uo=m(),Go=Uo.cursor,Jo=_(),tt=w(),us=tt.clear,k=tt.figures,as=tt.style,Bo=tt.wrap,zo=tt.entriesToDisplay,Qt=class extends Jo{constructor(t={}){super(t),this.msg=t.message,this.cursor=t.cursor||0,this.scrollIndex=t.cursor||0,this.hint=t.hint||"",this.warn=t.warn||"- This option is disabled -",this.minSelected=t.min,this.showMinError=!1,this.maxChoices=t.max,this.instructions=t.instructions,this.optionsPerPage=t.optionsPerPage||10,this.value=t.choices.map((e,s)=>(typeof e=="string"&&(e={title:e,value:s}),{title:e&&(e.title||e.value||e),description:e&&e.description,value:e&&(e.value===void 0?s:e.value),selected:e&&e.selected,disabled:e&&e.disabled})),this.clear=us("",this.out.columns),t.overrideRender||this.render()}reset(){this.value.map(t=>!t.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(t=>t.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
25
|
-
`),this.close()}submit(){let t=this.value.filter(e=>e.selected);this.minSelected&&t.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
26
|
-
`),this.close())}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.value.length,this.render()}up(){this.cursor===0?this.cursor=this.value.length-1:this.cursor--,this.render()}down(){this.cursor===this.value.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(t=>t.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){let t=this.value[this.cursor];if(t.selected)t.selected=!1,this.render();else{if(t.disabled||this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();t.selected=!0,this.render()}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();let t=!this.value[this.cursor].selected;this.value.filter(e=>!e.disabled).forEach(e=>e.selected=t),this.render()}_(t,e){if(t===" ")this.handleSpaceToggle();else if(t==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
27
|
-
Instructions:
|
|
28
|
-
${k.arrowUp}/${k.arrowDown}: Highlight option
|
|
29
|
-
${k.arrowLeft}/${k.arrowRight}/[space]: Toggle selection
|
|
30
|
-
`+(this.maxChoices===void 0?` a: Toggle all
|
|
31
|
-
`:"")+" enter/return: Complete answer":""}renderOption(t,e,s,r){let o=(e.selected?q.green(k.radioOn):k.radioOff)+" "+r+" ",n,h;return e.disabled?n=t===s?q.gray().underline(e.title):q.strikethrough().gray(e.title):(n=t===s?q.cyan().underline(e.title):e.title,t===s&&e.description&&(h=` - ${e.description}`,(o.length+n.length+h.length>=this.out.columns||e.description.split(/\r?\n/).length>1)&&(h=`
|
|
32
|
-
`+Bo(e.description,{margin:o.length,width:this.out.columns})))),o+n+q.gray(h||"")}paginateOptions(t){if(t.length===0)return q.red("No matches for this query.");let e=zo(this.cursor,t.length,this.optionsPerPage),s=e.startIndex,r=e.endIndex,o,n=[];for(let h=s;h<r;h++)h===s&&s>0?o=k.arrowUp:h===r-1&&r<t.length?o=k.arrowDown:o=" ",n.push(this.renderOption(this.cursor,t[h],h,o));return`
|
|
33
|
-
`+n.join(`
|
|
34
|
-
`)}renderOptions(t){return this.done?"":this.paginateOptions(t)}renderDoneOrInstructions(){if(this.done)return this.value.filter(e=>e.selected).map(e=>e.title).join(", ");let t=[q.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&t.push(q.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Go.hide),super.render();let t=[as.symbol(this.done,this.aborted),q.bold(this.msg),as.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=q.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),t+=this.renderOptions(this.value),this.out.write(this.clear+t),this.clear=us(t,this.out.columns)}};cs.exports=Qt});var vs=u((vu,bs)=>{"use strict";function ds(i,t,e,s,r,o,n){try{var h=i[o](n),l=h.value}catch(a){e(a);return}h.done?t(l):Promise.resolve(l).then(s,r)}function Wo(i){return function(){var t=this,e=arguments;return new Promise(function(s,r){var o=i.apply(t,e);function n(l){ds(o,s,r,n,h,"next",l)}function h(l){ds(o,s,r,n,h,"throw",l)}n(void 0)})}}var et=f(),Zo=_(),gs=m(),Ko=gs.erase,fs=gs.cursor,it=w(),ee=it.style,ps=it.clear,ie=it.figures,Xo=it.wrap,Qo=it.entriesToDisplay,ms=(i,t)=>i[t]&&(i[t].value||i[t].title||i[t]),th=(i,t)=>i[t]&&(i[t].title||i[t].value||i[t]),eh=(i,t)=>{let e=i.findIndex(s=>s.value===t||s.title===t);return e>-1?e:void 0},se=class extends Zo{constructor(t={}){super(t),this.msg=t.message,this.suggest=t.suggest,this.choices=t.choices,this.initial=typeof t.initial=="number"?t.initial:eh(t.choices,t.initial),this.select=this.initial||t.cursor||0,this.i18n={noMatches:t.noMatches||"no matches found"},this.fallback=t.fallback||this.initial,this.clearFirst=t.clearFirst||!1,this.suggestions=[],this.input="",this.limit=t.limit||10,this.cursor=0,this.transform=ee.render(t.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=ps("",this.out.columns),this.complete(this.render),this.render()}set fallback(t){this._fb=Number.isSafeInteger(parseInt(t))?parseInt(t):t}get fallback(){let t;return typeof this._fb=="number"?t=this.choices[this._fb]:typeof this._fb=="string"&&(t={title:this._fb}),t||this._fb||{title:this.i18n.noMatches}}moveSelect(t){this.select=t,this.suggestions.length>0?this.value=ms(this.suggestions,t):this.value=this.fallback.value,this.fire()}complete(t){var e=this;return Wo(function*(){let s=e.completing=e.suggest(e.input,e.choices),r=yield s;if(e.completing!==s)return;e.suggestions=r.map((n,h,l)=>({title:th(l,h),value:ms(l,h),description:n.description})),e.completing=!1;let o=Math.max(r.length-1,0);e.moveSelect(Math.min(o,e.select)),t&&t()})()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
35
|
-
`),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
36
|
-
`),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
37
|
-
`),this.close()}_(t,e){let s=this.input.slice(0,this.cursor),r=this.input.slice(this.cursor);this.input=`${s}${t}${r}`,this.cursor=s.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),e=this.input.slice(this.cursor);this.input=`${t}${e}`,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),e=this.input.slice(this.cursor+1);this.input=`${t}${e}`,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,e,s,r){let o,n=s?ie.arrowUp:r?ie.arrowDown:" ",h=e?et.cyan().underline(t.title):t.title;return n=(e?et.cyan(ie.pointer)+" ":" ")+n,t.description&&(o=` - ${t.description}`,(n.length+h.length+o.length>=this.out.columns||t.description.split(/\r?\n/).length>1)&&(o=`
|
|
38
|
-
`+Xo(t.description,{margin:3,width:this.out.columns}))),n+" "+h+et.gray(o||"")}render(){if(this.closed)return;this.firstRender?this.out.write(fs.hide):this.out.write(ps(this.outputText,this.out.columns)),super.render();let t=Qo(this.select,this.choices.length,this.limit),e=t.startIndex,s=t.endIndex;if(this.outputText=[ee.symbol(this.done,this.aborted,this.exited),et.bold(this.msg),ee.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){let r=this.suggestions.slice(e,s).map((o,n)=>this.renderOption(o,this.select===n+e,n===0&&e>0,n+e===s-1&&s<this.choices.length)).join(`
|
|
39
|
-
`);this.outputText+=`
|
|
40
|
-
`+(r||et.gray(this.fallback.title))}this.out.write(Ko.line+fs.to(0)+this.outputText)}};bs.exports=se});var Ss=u((wu,xs)=>{"use strict";var C=f(),ih=m(),sh=ih.cursor,rh=te(),ne=w(),ws=ne.clear,ys=ne.style,U=ne.figures,re=class extends rh{constructor(t={}){t.overrideRender=!0,super(t),this.inputValue="",this.clear=ws("",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(){let t=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(s=>this.inputValue?!!(typeof s.title=="string"&&s.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof s.value=="string"&&s.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);let e=this.filteredOptions.findIndex(s=>s===t);this.cursor=e<0?0:e,this.render()}handleSpaceToggle(){let t=this.filteredOptions[this.cursor];if(t.selected)t.selected=!1,this.render();else{if(t.disabled||this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();t.selected=!0,this.render()}}handleInputChange(t){this.inputValue=this.inputValue+t,this.updateFilteredOptions()}_(t,e){t===" "?this.handleSpaceToggle():this.handleInputChange(t)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
41
|
-
Instructions:
|
|
42
|
-
${U.arrowUp}/${U.arrowDown}: Highlight option
|
|
43
|
-
${U.arrowLeft}/${U.arrowRight}/[space]: Toggle selection
|
|
44
|
-
[a,b,c]/delete: Filter choices
|
|
45
|
-
enter/return: Complete answer
|
|
46
|
-
`:""}renderCurrentInput(){return`
|
|
47
|
-
Filtered results for: ${this.inputValue?this.inputValue:C.gray("Enter something to filter")}
|
|
48
|
-
`}renderOption(t,e,s){let r;return e.disabled?r=t===s?C.gray().underline(e.title):C.strikethrough().gray(e.title):r=t===s?C.cyan().underline(e.title):e.title,(e.selected?C.green(U.radioOn):U.radioOff)+" "+r}renderDoneOrInstructions(){if(this.done)return this.value.filter(e=>e.selected).map(e=>e.title).join(", ");let t=[C.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&t.push(C.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(sh.hide),super.render();let t=[ys.symbol(this.done,this.aborted),C.bold(this.msg),ys.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=C.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=ws(t,this.out.columns)}};xs.exports=re});var _s=u((yu,Ps)=>{"use strict";var qs=f(),nh=_(),Ts=w(),Os=Ts.style,oh=Ts.clear,$s=m(),hh=$s.erase,Ms=$s.cursor,oe=class extends nh{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(`
|
|
49
|
-
`),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
50
|
-
`),this.close()}_(t,e){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(Ms.hide):this.out.write(oh(this.outputText,this.out.columns)),super.render(),this.outputText=[Os.symbol(this.done,this.aborted),qs.bold(this.msg),Os.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:qs.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(hh.line+Ms.to(0)+this.outputText))}};Ps.exports=oe});var Ds=u((xu,Is)=>{"use strict";Is.exports={TextPrompt:gi(),SelectPrompt:yi(),TogglePrompt:Ti(),DatePrompt:es(),NumberPrompt:ls(),MultiselectPrompt:te(),AutocompletePrompt:vs(),AutocompleteMultiselectPrompt:Ss(),ConfirmPrompt:_s()}});var js=u(Cs=>{"use strict";var b=Cs,lh=Ds(),vt=i=>i;function O(i,t,e={}){return new Promise((s,r)=>{let o=new lh[i](t),n=e.onAbort||vt,h=e.onSubmit||vt,l=e.onExit||vt;o.on("state",t.onState||vt),o.on("submit",a=>s(h(a))),o.on("exit",a=>s(l(a))),o.on("abort",a=>r(n(a)))})}b.text=i=>O("TextPrompt",i);b.password=i=>(i.style="password",b.text(i));b.invisible=i=>(i.style="invisible",b.text(i));b.number=i=>O("NumberPrompt",i);b.date=i=>O("DatePrompt",i);b.confirm=i=>O("ConfirmPrompt",i);b.list=i=>{let t=i.separator||",";return O("TextPrompt",i,{onSubmit:e=>e.split(t).map(s=>s.trim())})};b.toggle=i=>O("TogglePrompt",i);b.select=i=>O("SelectPrompt",i);b.multiselect=i=>{i.choices=[].concat(i.choices||[]);let t=e=>e.filter(s=>s.selected).map(s=>s.value);return O("MultiselectPrompt",i,{onAbort:t,onSubmit:t})};b.autocompleteMultiselect=i=>{i.choices=[].concat(i.choices||[]);let t=e=>e.filter(s=>s.selected).map(s=>s.value);return O("AutocompleteMultiselectPrompt",i,{onAbort:t,onSubmit:t})};var uh=(i,t)=>Promise.resolve(t.filter(e=>e.title.slice(0,i.length).toLowerCase()===i.toLowerCase()));b.autocomplete=i=>(i.suggest=i.suggest||uh,i.choices=[].concat(i.choices||[]),O("AutocompletePrompt",i))});var Vs=u((qu,Ys)=>{"use strict";function Es(i,t){var e=Object.keys(i);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);t&&(s=s.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),e.push.apply(e,s)}return e}function As(i){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?Es(Object(e),!0).forEach(function(s){ah(i,s,e[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(e)):Es(Object(e)).forEach(function(s){Object.defineProperty(i,s,Object.getOwnPropertyDescriptor(e,s))})}return i}function ah(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function ch(i,t){var e=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!e){if(Array.isArray(i)||(e=dh(i))||t&&i&&typeof i.length=="number"){e&&(i=e);var s=0,r=function(){};return{s:r,n:function(){return s>=i.length?{done:!0}:{done:!1,value:i[s++]}},e:function(a){throw a},f:r}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
51
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,n=!1,h;return{s:function(){e=e.call(i)},n:function(){var a=e.next();return o=a.done,a},e:function(a){n=!0,h=a},f:function(){try{!o&&e.return!=null&&e.return()}finally{if(n)throw h}}}}function dh(i,t){if(i){if(typeof i=="string")return Rs(i,t);var e=Object.prototype.toString.call(i).slice(8,-1);if(e==="Object"&&i.constructor&&(e=i.constructor.name),e==="Map"||e==="Set")return Array.from(i);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return Rs(i,t)}}function Rs(i,t){(t==null||t>i.length)&&(t=i.length);for(var e=0,s=new Array(t);e<t;e++)s[e]=i[e];return s}function ks(i,t,e,s,r,o,n){try{var h=i[o](n),l=h.value}catch(a){e(a);return}h.done?t(l):Promise.resolve(l).then(s,r)}function Fs(i){return function(){var t=this,e=arguments;return new Promise(function(s,r){var o=i.apply(t,e);function n(l){ks(o,s,r,n,h,"next",l)}function h(l){ks(o,s,r,n,h,"throw",l)}n(void 0)})}}var he=js(),fh=["suggest","format","onState","validate","onRender","type"],Hs=()=>{};function F(){return le.apply(this,arguments)}function le(){return le=Fs(function*(i=[],{onSubmit:t=Hs,onCancel:e=Hs}={}){let s={},r=F._override||{};i=[].concat(i);let o,n,h,l,a,z,W=function(){var R=Fs(function*(P,lt,Ye=!1){if(!(!Ye&&P.validate&&P.validate(lt)!==!0))return P.format?yield P.format(lt,s):lt});return function(lt,Ye){return R.apply(this,arguments)}}();var g=ch(i),x;try{for(g.s();!(x=g.n()).done;){n=x.value;var ht=n;if(l=ht.name,a=ht.type,typeof a=="function"&&(a=yield a(o,As({},s),n),n.type=a),!!a){for(let R in n){if(fh.includes(R))continue;let P=n[R];n[R]=typeof P=="function"?yield P(o,As({},s),z):P}if(z=n,typeof n.message!="string")throw new Error("prompt message is required");var He=n;if(l=He.name,a=He.type,he[a]===void 0)throw new Error(`prompt type (${a}) is not defined`);if(r[n.name]!==void 0&&(o=yield W(n,r[n.name]),o!==void 0)){s[l]=o;continue}try{o=F._injected?ph(F._injected,n.initial):yield he[a](n),s[l]=o=yield W(n,o,!0),h=yield t(n,o,s)}catch{h=!(yield e(n,s))}if(h)return s}}}catch(R){g.e(R)}finally{g.f()}return s}),le.apply(this,arguments)}function ph(i,t){let e=i.shift();if(e instanceof Error)throw e;return e===void 0?t:e}function mh(i){F._injected=(F._injected||[]).concat(i)}function gh(i){F._override=Object.assign({},i)}Ys.exports=Object.assign(F,{prompt:F,prompts:he,inject:mh,override:gh})});var Ns=u((Ou,Ls)=>{"use strict";Ls.exports=(i,t)=>{if(!(i.meta&&i.name!=="escape")){if(i.ctrl){if(i.name==="a")return"first";if(i.name==="c"||i.name==="d")return"abort";if(i.name==="e")return"last";if(i.name==="g")return"reset"}if(t){if(i.name==="j")return"down";if(i.name==="k")return"up"}return i.name==="return"||i.name==="enter"?"submit":i.name==="backspace"?"delete":i.name==="delete"?"deleteForward":i.name==="abort"?"abort":i.name==="escape"?"exit":i.name==="tab"?"next":i.name==="pagedown"?"nextPage":i.name==="pageup"?"prevPage":i.name==="home"?"home":i.name==="end"?"end":i.name==="up"?"up":i.name==="down"?"down":i.name==="right"?"right":i.name==="left"?"left":!1}}});var wt=u((Mu,Us)=>{"use strict";Us.exports=i=>{let 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("|"),e=new RegExp(t,"g");return typeof i=="string"?i.replace(e,""):i}});var Bs=u((Tu,Js)=>{"use strict";var bh=wt(),{erase:Gs,cursor:vh}=m(),wh=i=>[...bh(i)].length;Js.exports=function(i,t){if(!t)return Gs.line+vh.to(0);let e=0,s=i.split(/\r?\n/);for(let r of s)e+=1+Math.floor(Math.max(wh(r)-1,0)/t);return Gs.lines(e)}});var ue=u(($u,zs)=>{"use strict";var st={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},yh={arrowUp:st.arrowUp,arrowDown:st.arrowDown,arrowLeft:st.arrowLeft,arrowRight:st.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},xh=process.platform==="win32"?yh:st;zs.exports=xh});var Zs=u((Pu,Ws)=>{"use strict";var G=f(),L=ue(),ae=Object.freeze({password:{scale:1,render:i=>"*".repeat(i.length)},emoji:{scale:2,render:i=>"\u{1F603}".repeat(i.length)},invisible:{scale:0,render:i=>""},default:{scale:1,render:i=>`${i}`}}),Sh=i=>ae[i]||ae.default,rt=Object.freeze({aborted:G.red(L.cross),done:G.green(L.tick),exited:G.yellow(L.cross),default:G.cyan("?")}),qh=(i,t,e)=>t?rt.aborted:e?rt.exited:i?rt.done:rt.default,Oh=i=>G.gray(i?L.ellipsis:L.pointerSmall),Mh=(i,t)=>G.gray(i?t?L.pointerSmall:"+":L.line);Ws.exports={styles:ae,render:Sh,symbols:rt,symbol:qh,delimiter:Oh,item:Mh}});var Xs=u((_u,Ks)=>{"use strict";var Th=wt();Ks.exports=function(i,t){let e=String(Th(i)||"").split(/\r?\n/);return t?e.map(s=>Math.ceil(s.length/t)).reduce((s,r)=>s+r):e.length}});var tr=u((Iu,Qs)=>{"use strict";Qs.exports=(i,t={})=>{let e=Number.isSafeInteger(parseInt(t.margin))?new Array(parseInt(t.margin)).fill(" ").join(""):t.margin||"",s=t.width;return(i||"").split(/\r?\n/g).map(r=>r.split(/\s+/g).reduce((o,n)=>(n.length+e.length>=s||o[o.length-1].length+n.length+1<s?o[o.length-1]+=` ${n}`:o.push(`${e}${n}`),o),[e]).join(`
|
|
52
|
-
`)).join(`
|
|
53
|
-
`)}});var ir=u((Du,er)=>{"use strict";er.exports=(i,t,e)=>{e=e||t;let s=Math.min(t-e,i-Math.floor(e/2));s<0&&(s=0);let r=Math.min(s+e,t);return{startIndex:s,endIndex:r}}});var y=u((Cu,sr)=>{"use strict";sr.exports={action:Ns(),clear:Bs(),style:Zs(),strip:wt(),figures:ue(),lines:Xs(),wrap:tr(),entriesToDisplay:ir()}});var j=u((ju,nr)=>{"use strict";var rr=ut("readline"),{action:$h}=y(),Ph=ut("events"),{beep:_h,cursor:Ih}=m(),Dh=f(),ce=class extends Ph{constructor(t={}){super(),this.firstRender=!0,this.in=t.stdin||process.stdin,this.out=t.stdout||process.stdout,this.onRender=(t.onRender||(()=>{})).bind(this);let e=rr.createInterface({input:this.in,escapeCodeTimeout:50});rr.emitKeypressEvents(this.in,e),this.in.isTTY&&this.in.setRawMode(!0);let s=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,r=(o,n)=>{let h=$h(n,s);h===!1?this._&&this._(o,n):typeof this[h]=="function"?this[h](n):this.bell()};this.close=()=>{this.out.write(Ih.show),this.in.removeListener("keypress",r),this.in.isTTY&&this.in.setRawMode(!1),e.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",r)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(_h)}render(){this.onRender(Dh),this.firstRender&&(this.firstRender=!1)}};nr.exports=ce});var hr=u((Eu,or)=>{var yt=f(),Ch=j(),{erase:jh,cursor:nt}=m(),{style:de,clear:fe,lines:Eh,figures:Ah}=y(),pe=class extends Ch{constructor(t={}){super(t),this.transform=de.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=fe("",this.out.columns),this.render()}set value(t){!t&&this.initial?(this.placeholder=!0,this.rendered=yt.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(`
|
|
54
|
-
`),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(`
|
|
55
|
-
`),this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(t){this.placeholder||(this.cursor=this.cursor+t,this.cursorOffset+=t)}_(t,e){let s=this.value.slice(0,this.cursor),r=this.value.slice(this.cursor);this.value=`${s}${t}${r}`,this.red=!1,this.cursor=this.placeholder?0:s.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let t=this.value.slice(0,this.cursor-1),e=this.value.slice(this.cursor);this.value=`${t}${e}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let t=this.value.slice(0,this.cursor),e=this.value.slice(this.cursor+1);this.value=`${t}${e}`,this.red=!1,this.isCursorAtEnd()?this.cursorOffset=0:this.cursorOffset++,this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(nt.down(Eh(this.outputError,this.out.columns)-1)+fe(this.outputError,this.out.columns)),this.out.write(fe(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[de.symbol(this.done,this.aborted),yt.bold(this.msg),de.delimiter(this.done),this.red?yt.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
56
|
-
`).reduce((t,e,s)=>t+`
|
|
57
|
-
${s?" ":Ah.pointerSmall} ${yt.red().italic(e)}`,"")),this.out.write(jh.line+nt.to(0)+this.outputText+nt.save+this.outputError+nt.restore+nt.move(this.cursorOffset,0)))}};or.exports=pe});var cr=u((Au,ar)=>{"use strict";var E=f(),Rh=j(),{style:lr,clear:ur,figures:xt,wrap:kh,entriesToDisplay:Fh}=y(),{cursor:Hh}=m(),me=class extends Rh{constructor(t={}){super(t),this.msg=t.message,this.hint=t.hint||"- Use arrow-keys. Return to submit.",this.warn=t.warn||"- This option is disabled",this.cursor=t.initial||0,this.choices=t.choices.map((e,s)=>(typeof e=="string"&&(e={title:e,value:s}),{title:e&&(e.title||e.value||e),value:e&&(e.value===void 0?s:e.value),description:e&&e.description,selected:e&&e.selected,disabled:e&&e.disabled})),this.optionsPerPage=t.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=ur("",this.out.columns),this.render()}moveCursor(t){this.cursor=t,this.value=this.choices[t].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
58
|
-
`),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
59
|
-
`),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(t,e){if(t===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(Hh.hide):this.out.write(ur(this.outputText,this.out.columns)),super.render();let{startIndex:t,endIndex:e}=Fh(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[lr.symbol(this.done,this.aborted),E.bold(this.msg),lr.delimiter(!1),this.done?this.selection.title:this.selection.disabled?E.yellow(this.warn):E.gray(this.hint)].join(" "),!this.done){this.outputText+=`
|
|
60
|
-
`;for(let s=t;s<e;s++){let r,o,n="",h=this.choices[s];s===t&&t>0?o=xt.arrowUp:s===e-1&&e<this.choices.length?o=xt.arrowDown:o=" ",h.disabled?(r=this.cursor===s?E.gray().underline(h.title):E.strikethrough().gray(h.title),o=(this.cursor===s?E.bold().gray(xt.pointer)+" ":" ")+o):(r=this.cursor===s?E.cyan().underline(h.title):h.title,o=(this.cursor===s?E.cyan(xt.pointer)+" ":" ")+o,h.description&&this.cursor===s&&(n=` - ${h.description}`,(o.length+r.length+n.length>=this.out.columns||h.description.split(/\r?\n/).length>1)&&(n=`
|
|
61
|
-
`+kh(h.description,{margin:3,width:this.out.columns})))),this.outputText+=`${o} ${r}${E.gray(n)}
|
|
62
|
-
`}}this.out.write(this.outputText)}};ar.exports=me});var mr=u((Ru,pr)=>{var St=f(),Yh=j(),{style:dr,clear:Vh}=y(),{cursor:fr,erase:Lh}=m(),ge=class extends Yh{constructor(t={}){super(t),this.msg=t.message,this.value=!!t.initial,this.active=t.active||"on",this.inactive=t.inactive||"off",this.initialValue=this.value,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(`
|
|
63
|
-
`),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
64
|
-
`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(t,e){if(t===" ")this.value=!this.value;else if(t==="1")this.value=!0;else if(t==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(fr.hide):this.out.write(Vh(this.outputText,this.out.columns)),super.render(),this.outputText=[dr.symbol(this.done,this.aborted),St.bold(this.msg),dr.delimiter(this.done),this.value?this.inactive:St.cyan().underline(this.inactive),St.gray("/"),this.value?St.cyan().underline(this.active):this.active].join(" "),this.out.write(Lh.line+fr.to(0)+this.outputText))}};pr.exports=ge});var M=u((ku,gr)=>{"use strict";var be=class i{constructor({token:t,date:e,parts:s,locales:r}){this.token=t,this.date=e||new Date,this.parts=s||[this],this.locales=r||{}}up(){}down(){}next(){let t=this.parts.indexOf(this);return this.parts.find((e,s)=>s>t&&e instanceof i)}setTo(t){}prev(){let t=[].concat(this.parts).reverse(),e=t.indexOf(this);return t.find((s,r)=>r>e&&s instanceof i)}toString(){return String(this.date)}};gr.exports=be});var vr=u((Fu,br)=>{"use strict";var Nh=M(),ve=class extends Nh{constructor(t={}){super(t)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let t=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?t.toUpperCase():t}};br.exports=ve});var yr=u((Hu,wr)=>{"use strict";var Uh=M(),Gh=i=>(i=i%10,i===1?"st":i===2?"nd":i===3?"rd":"th"),we=class extends Uh{constructor(t={}){super(t)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(t){this.date.setDate(parseInt(t.substr(-2)))}toString(){let t=this.date.getDate(),e=this.date.getDay();return this.token==="DD"?String(t).padStart(2,"0"):this.token==="Do"?t+Gh(t):this.token==="d"?e+1:this.token==="ddd"?this.locales.weekdaysShort[e]:this.token==="dddd"?this.locales.weekdays[e]:t}};wr.exports=we});var Sr=u((Yu,xr)=>{"use strict";var Jh=M(),ye=class extends Jh{constructor(t={}){super(t)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(t){this.date.setHours(parseInt(t.substr(-2)))}toString(){let t=this.date.getHours();return/h/.test(this.token)&&(t=t%12||12),this.token.length>1?String(t).padStart(2,"0"):t}};xr.exports=ye});var Or=u((Vu,qr)=>{"use strict";var Bh=M(),xe=class extends Bh{constructor(t={}){super(t)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(t){this.date.setMilliseconds(parseInt(t.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}};qr.exports=xe});var Tr=u((Lu,Mr)=>{"use strict";var zh=M(),Se=class extends zh{constructor(t={}){super(t)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(t){this.date.setMinutes(parseInt(t.substr(-2)))}toString(){let t=this.date.getMinutes();return this.token.length>1?String(t).padStart(2,"0"):t}};Mr.exports=Se});var Pr=u((Nu,$r)=>{"use strict";var Wh=M(),qe=class extends Wh{constructor(t={}){super(t)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(t){t=parseInt(t.substr(-2))-1,this.date.setMonth(t<0?0:t)}toString(){let t=this.date.getMonth(),e=this.token.length;return e===2?String(t+1).padStart(2,"0"):e===3?this.locales.monthsShort[t]:e===4?this.locales.months[t]:String(t+1)}};$r.exports=qe});var Ir=u((Uu,_r)=>{"use strict";var Zh=M(),Oe=class extends Zh{constructor(t={}){super(t)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(t){this.date.setSeconds(parseInt(t.substr(-2)))}toString(){let t=this.date.getSeconds();return this.token.length>1?String(t).padStart(2,"0"):t}};_r.exports=Oe});var Cr=u((Gu,Dr)=>{"use strict";var Kh=M(),Me=class extends Kh{constructor(t={}){super(t)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(t){this.date.setFullYear(t.substr(-4))}toString(){let t=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?t.substr(-2):t}};Dr.exports=Me});var Er=u((Ju,jr)=>{"use strict";jr.exports={DatePart:M(),Meridiem:vr(),Day:yr(),Hours:Sr(),Milliseconds:Or(),Minutes:Tr(),Month:Pr(),Seconds:Ir(),Year:Cr()}});var Vr=u((Bu,Yr)=>{"use strict";var Te=f(),Xh=j(),{style:Ar,clear:Rr,figures:Qh}=y(),{erase:tl,cursor:kr}=m(),{DatePart:Fr,Meridiem:el,Day:il,Hours:sl,Milliseconds:rl,Minutes:nl,Month:ol,Seconds:hl,Year:ll}=Er(),ul=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,Hr={1:({token:i})=>i.replace(/\\(.)/g,"$1"),2:i=>new il(i),3:i=>new ol(i),4:i=>new ll(i),5:i=>new el(i),6:i=>new sl(i),7:i=>new nl(i),8:i=>new hl(i),9:i=>new rl(i)},al={months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),monthsShort:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),weekdaysShort:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")},$e=class extends Xh{constructor(t={}){super(t),this.msg=t.message,this.cursor=0,this.typed="",this.locales=Object.assign(al,t.locales),this._date=t.initial||new Date,this.errorMsg=t.error||"Please Enter A Valid Value",this.validator=t.validate||(()=>!0),this.mask=t.mask||"YYYY-MM-DD HH:mm:ss",this.clear=Rr("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(t){t&&this._date.setTime(t.getTime())}set mask(t){let e;for(this.parts=[];e=ul.exec(t);){let r=e.shift(),o=e.findIndex(n=>n!=null);this.parts.push(o in Hr?Hr[o]({token:e[o]||r,date:this.date,parts:this.parts,locales:this.locales}):e[o]||r)}let s=this.parts.reduce((r,o)=>(typeof o=="string"&&typeof r[r.length-1]=="string"?r[r.length-1]+=o:r.push(o),r),[]);this.parts.splice(0),this.parts.push(...s),this.reset()}moveCursor(t){this.typed="",this.cursor=t,this.fire()}reset(){this.moveCursor(this.parts.findIndex(t=>t instanceof Fr)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
65
|
-
`),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(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
66
|
-
`),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let t=this.parts[this.cursor].prev();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t)),this.render()}right(){let t=this.parts[this.cursor].next();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t)),this.render()}next(){let t=this.parts[this.cursor].next();this.moveCursor(t?this.parts.indexOf(t):this.parts.findIndex(e=>e instanceof Fr)),this.render()}_(t){/\d/.test(t)&&(this.typed+=t,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(kr.hide):this.out.write(Rr(this.outputText,this.out.columns)),super.render(),this.outputText=[Ar.symbol(this.done,this.aborted),Te.bold(this.msg),Ar.delimiter(!1),this.parts.reduce((t,e,s)=>t.concat(s===this.cursor&&!this.done?Te.cyan().underline(e.toString()):e),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
|
|
67
|
-
`).reduce((t,e,s)=>t+`
|
|
68
|
-
${s?" ":Qh.pointerSmall} ${Te.red().italic(e)}`,"")),this.out.write(tl.line+kr.to(0)+this.outputText))}};Yr.exports=$e});var Gr=u((zu,Ur)=>{var qt=f(),cl=j(),{cursor:Ot,erase:dl}=m(),{style:Pe,figures:fl,clear:Lr,lines:pl}=y(),ml=/[0-9]/,_e=i=>i!==void 0,Nr=(i,t)=>{let e=Math.pow(10,t);return Math.round(i*e)/e},Ie=class extends cl{constructor(t={}){super(t),this.transform=Pe.render(t.style),this.msg=t.message,this.initial=_e(t.initial)?t.initial:"",this.float=!!t.float,this.round=t.round||2,this.inc=t.increment||1,this.min=_e(t.min)?t.min:-1/0,this.max=_e(t.max)?t.max:1/0,this.errorMsg=t.error||"Please Enter A Valid Value",this.validator=t.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(t){!t&&t!==0?(this.placeholder=!0,this.rendered=qt.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${Nr(t,this.round)}`),this._value=Nr(t,this.round)),this.fire()}get value(){return this._value}parse(t){return this.float?parseFloat(t):parseInt(t)}valid(t){return t==="-"||t==="."&&this.float||ml.test(t)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let t=this.value;this.value=t!==""?t:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
69
|
-
`),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(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}let t=this.value;this.value=t!==""?t:this.initial,this.done=!0,this.aborted=!1,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
70
|
-
`),this.close()}up(){if(this.typed="",this.value===""&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value===""&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let t=this.value.toString();if(t.length===0)return this.bell();this.value=this.parse(t=t.slice(0,-1))||"",this.value!==""&&this.value<this.min&&(this.value=this.min),this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(t,e){if(!this.valid(t))return this.bell();let s=Date.now();if(s-this.lastHit>1e3&&(this.typed=""),this.typed+=t,this.lastHit=s,this.color="cyan",t===".")return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(Ot.down(pl(this.outputError,this.out.columns)-1)+Lr(this.outputError,this.out.columns)),this.out.write(Lr(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[Pe.symbol(this.done,this.aborted),qt.bold(this.msg),Pe.delimiter(this.done),!this.done||!this.done&&!this.placeholder?qt[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
71
|
-
`).reduce((t,e,s)=>t+`
|
|
72
|
-
${s?" ":fl.pointerSmall} ${qt.red().italic(e)}`,"")),this.out.write(dl.line+Ot.to(0)+this.outputText+Ot.save+this.outputError+Ot.restore))}};Ur.exports=Ie});var Ce=u((Wu,zr)=>{"use strict";var T=f(),{cursor:gl}=m(),bl=j(),{clear:Jr,figures:H,style:Br,wrap:vl,entriesToDisplay:wl}=y(),De=class extends bl{constructor(t={}){super(t),this.msg=t.message,this.cursor=t.cursor||0,this.scrollIndex=t.cursor||0,this.hint=t.hint||"",this.warn=t.warn||"- This option is disabled -",this.minSelected=t.min,this.showMinError=!1,this.maxChoices=t.max,this.instructions=t.instructions,this.optionsPerPage=t.optionsPerPage||10,this.value=t.choices.map((e,s)=>(typeof e=="string"&&(e={title:e,value:s}),{title:e&&(e.title||e.value||e),description:e&&e.description,value:e&&(e.value===void 0?s:e.value),selected:e&&e.selected,disabled:e&&e.disabled})),this.clear=Jr("",this.out.columns),t.overrideRender||this.render()}reset(){this.value.map(t=>!t.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(t=>t.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
73
|
-
`),this.close()}submit(){let t=this.value.filter(e=>e.selected);this.minSelected&&t.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
74
|
-
`),this.close())}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.value.length,this.render()}up(){this.cursor===0?this.cursor=this.value.length-1:this.cursor--,this.render()}down(){this.cursor===this.value.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(t=>t.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){let t=this.value[this.cursor];if(t.selected)t.selected=!1,this.render();else{if(t.disabled||this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();t.selected=!0,this.render()}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();let t=!this.value[this.cursor].selected;this.value.filter(e=>!e.disabled).forEach(e=>e.selected=t),this.render()}_(t,e){if(t===" ")this.handleSpaceToggle();else if(t==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
75
|
-
Instructions:
|
|
76
|
-
${H.arrowUp}/${H.arrowDown}: Highlight option
|
|
77
|
-
${H.arrowLeft}/${H.arrowRight}/[space]: Toggle selection
|
|
78
|
-
`+(this.maxChoices===void 0?` a: Toggle all
|
|
79
|
-
`:"")+" enter/return: Complete answer":""}renderOption(t,e,s,r){let o=(e.selected?T.green(H.radioOn):H.radioOff)+" "+r+" ",n,h;return e.disabled?n=t===s?T.gray().underline(e.title):T.strikethrough().gray(e.title):(n=t===s?T.cyan().underline(e.title):e.title,t===s&&e.description&&(h=` - ${e.description}`,(o.length+n.length+h.length>=this.out.columns||e.description.split(/\r?\n/).length>1)&&(h=`
|
|
80
|
-
`+vl(e.description,{margin:o.length,width:this.out.columns})))),o+n+T.gray(h||"")}paginateOptions(t){if(t.length===0)return T.red("No matches for this query.");let{startIndex:e,endIndex:s}=wl(this.cursor,t.length,this.optionsPerPage),r,o=[];for(let n=e;n<s;n++)n===e&&e>0?r=H.arrowUp:n===s-1&&s<t.length?r=H.arrowDown:r=" ",o.push(this.renderOption(this.cursor,t[n],n,r));return`
|
|
81
|
-
`+o.join(`
|
|
82
|
-
`)}renderOptions(t){return this.done?"":this.paginateOptions(t)}renderDoneOrInstructions(){if(this.done)return this.value.filter(e=>e.selected).map(e=>e.title).join(", ");let t=[T.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&t.push(T.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(gl.hide),super.render();let t=[Br.symbol(this.done,this.aborted),T.bold(this.msg),Br.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=T.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),t+=this.renderOptions(this.value),this.out.write(this.clear+t),this.clear=Jr(t,this.out.columns)}};zr.exports=De});var Qr=u((Zu,Xr)=>{"use strict";var ot=f(),yl=j(),{erase:xl,cursor:Wr}=m(),{style:je,clear:Zr,figures:Ee,wrap:Sl,entriesToDisplay:ql}=y(),Kr=(i,t)=>i[t]&&(i[t].value||i[t].title||i[t]),Ol=(i,t)=>i[t]&&(i[t].title||i[t].value||i[t]),Ml=(i,t)=>{let e=i.findIndex(s=>s.value===t||s.title===t);return e>-1?e:void 0},Ae=class extends yl{constructor(t={}){super(t),this.msg=t.message,this.suggest=t.suggest,this.choices=t.choices,this.initial=typeof t.initial=="number"?t.initial:Ml(t.choices,t.initial),this.select=this.initial||t.cursor||0,this.i18n={noMatches:t.noMatches||"no matches found"},this.fallback=t.fallback||this.initial,this.clearFirst=t.clearFirst||!1,this.suggestions=[],this.input="",this.limit=t.limit||10,this.cursor=0,this.transform=je.render(t.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=Zr("",this.out.columns),this.complete(this.render),this.render()}set fallback(t){this._fb=Number.isSafeInteger(parseInt(t))?parseInt(t):t}get fallback(){let t;return typeof this._fb=="number"?t=this.choices[this._fb]:typeof this._fb=="string"&&(t={title:this._fb}),t||this._fb||{title:this.i18n.noMatches}}moveSelect(t){this.select=t,this.suggestions.length>0?this.value=Kr(this.suggestions,t):this.value=this.fallback.value,this.fire()}async complete(t){let e=this.completing=this.suggest(this.input,this.choices),s=await e;if(this.completing!==e)return;this.suggestions=s.map((o,n,h)=>({title:Ol(h,n),value:Kr(h,n),description:o.description})),this.completing=!1;let r=Math.max(s.length-1,0);this.moveSelect(Math.min(r,this.select)),t&&t()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
83
|
-
`),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
84
|
-
`),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
85
|
-
`),this.close()}_(t,e){let s=this.input.slice(0,this.cursor),r=this.input.slice(this.cursor);this.input=`${s}${t}${r}`,this.cursor=s.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),e=this.input.slice(this.cursor);this.input=`${t}${e}`,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),e=this.input.slice(this.cursor+1);this.input=`${t}${e}`,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,e,s,r){let o,n=s?Ee.arrowUp:r?Ee.arrowDown:" ",h=e?ot.cyan().underline(t.title):t.title;return n=(e?ot.cyan(Ee.pointer)+" ":" ")+n,t.description&&(o=` - ${t.description}`,(n.length+h.length+o.length>=this.out.columns||t.description.split(/\r?\n/).length>1)&&(o=`
|
|
86
|
-
`+Sl(t.description,{margin:3,width:this.out.columns}))),n+" "+h+ot.gray(o||"")}render(){if(this.closed)return;this.firstRender?this.out.write(Wr.hide):this.out.write(Zr(this.outputText,this.out.columns)),super.render();let{startIndex:t,endIndex:e}=ql(this.select,this.choices.length,this.limit);if(this.outputText=[je.symbol(this.done,this.aborted,this.exited),ot.bold(this.msg),je.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){let s=this.suggestions.slice(t,e).map((r,o)=>this.renderOption(r,this.select===o+t,o===0&&t>0,o+t===e-1&&e<this.choices.length)).join(`
|
|
87
|
-
`);this.outputText+=`
|
|
88
|
-
`+(s||ot.gray(this.fallback.title))}this.out.write(xl.line+Wr.to(0)+this.outputText)}};Xr.exports=Ae});var rn=u((Ku,sn)=>{"use strict";var A=f(),{cursor:Tl}=m(),$l=Ce(),{clear:tn,style:en,figures:J}=y(),Re=class extends $l{constructor(t={}){t.overrideRender=!0,super(t),this.inputValue="",this.clear=tn("",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(){let t=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(s=>this.inputValue?!!(typeof s.title=="string"&&s.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof s.value=="string"&&s.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);let e=this.filteredOptions.findIndex(s=>s===t);this.cursor=e<0?0:e,this.render()}handleSpaceToggle(){let t=this.filteredOptions[this.cursor];if(t.selected)t.selected=!1,this.render();else{if(t.disabled||this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();t.selected=!0,this.render()}}handleInputChange(t){this.inputValue=this.inputValue+t,this.updateFilteredOptions()}_(t,e){t===" "?this.handleSpaceToggle():this.handleInputChange(t)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
89
|
-
Instructions:
|
|
90
|
-
${J.arrowUp}/${J.arrowDown}: Highlight option
|
|
91
|
-
${J.arrowLeft}/${J.arrowRight}/[space]: Toggle selection
|
|
92
|
-
[a,b,c]/delete: Filter choices
|
|
93
|
-
enter/return: Complete answer
|
|
94
|
-
`:""}renderCurrentInput(){return`
|
|
95
|
-
Filtered results for: ${this.inputValue?this.inputValue:A.gray("Enter something to filter")}
|
|
96
|
-
`}renderOption(t,e,s){let r;return e.disabled?r=t===s?A.gray().underline(e.title):A.strikethrough().gray(e.title):r=t===s?A.cyan().underline(e.title):e.title,(e.selected?A.green(J.radioOn):J.radioOff)+" "+r}renderDoneOrInstructions(){if(this.done)return this.value.filter(e=>e.selected).map(e=>e.title).join(", ");let t=[A.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&t.push(A.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Tl.hide),super.render();let t=[en.symbol(this.done,this.aborted),A.bold(this.msg),en.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=A.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=tn(t,this.out.columns)}};sn.exports=Re});var un=u((Xu,ln)=>{var nn=f(),Pl=j(),{style:on,clear:_l}=y(),{erase:Il,cursor:hn}=m(),ke=class extends Pl{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(`
|
|
97
|
-
`),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
98
|
-
`),this.close()}_(t,e){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(hn.hide):this.out.write(_l(this.outputText,this.out.columns)),super.render(),this.outputText=[on.symbol(this.done,this.aborted),nn.bold(this.msg),on.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:nn.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(Il.line+hn.to(0)+this.outputText))}};ln.exports=ke});var cn=u((Qu,an)=>{"use strict";an.exports={TextPrompt:hr(),SelectPrompt:cr(),TogglePrompt:mr(),DatePrompt:Vr(),NumberPrompt:Gr(),MultiselectPrompt:Ce(),AutocompletePrompt:Qr(),AutocompleteMultiselectPrompt:rn(),ConfirmPrompt:un()}});var fn=u(dn=>{"use strict";var v=dn,Dl=cn(),Mt=i=>i;function $(i,t,e={}){return new Promise((s,r)=>{let o=new Dl[i](t),n=e.onAbort||Mt,h=e.onSubmit||Mt,l=e.onExit||Mt;o.on("state",t.onState||Mt),o.on("submit",a=>s(h(a))),o.on("exit",a=>s(l(a))),o.on("abort",a=>r(n(a)))})}v.text=i=>$("TextPrompt",i);v.password=i=>(i.style="password",v.text(i));v.invisible=i=>(i.style="invisible",v.text(i));v.number=i=>$("NumberPrompt",i);v.date=i=>$("DatePrompt",i);v.confirm=i=>$("ConfirmPrompt",i);v.list=i=>{let t=i.separator||",";return $("TextPrompt",i,{onSubmit:e=>e.split(t).map(s=>s.trim())})};v.toggle=i=>$("TogglePrompt",i);v.select=i=>$("SelectPrompt",i);v.multiselect=i=>{i.choices=[].concat(i.choices||[]);let t=e=>e.filter(s=>s.selected).map(s=>s.value);return $("MultiselectPrompt",i,{onAbort:t,onSubmit:t})};v.autocompleteMultiselect=i=>{i.choices=[].concat(i.choices||[]);let t=e=>e.filter(s=>s.selected).map(s=>s.value);return $("AutocompleteMultiselectPrompt",i,{onAbort:t,onSubmit:t})};var Cl=(i,t)=>Promise.resolve(t.filter(e=>e.title.slice(0,i.length).toLowerCase()===i.toLowerCase()));v.autocomplete=i=>(i.suggest=i.suggest||Cl,i.choices=[].concat(i.choices||[]),$("AutocompletePrompt",i))});var gn=u((ea,mn)=>{"use strict";var Fe=fn(),jl=["suggest","format","onState","validate","onRender","type"],pn=()=>{};async function Y(i=[],{onSubmit:t=pn,onCancel:e=pn}={}){let s={},r=Y._override||{};i=[].concat(i);let o,n,h,l,a,z,W=async(g,x,ht=!1)=>{if(!(!ht&&g.validate&&g.validate(x)!==!0))return g.format?await g.format(x,s):x};for(n of i)if({name:l,type:a}=n,typeof a=="function"&&(a=await a(o,{...s},n),n.type=a),!!a){for(let g in n){if(jl.includes(g))continue;let x=n[g];n[g]=typeof x=="function"?await x(o,{...s},z):x}if(z=n,typeof n.message!="string")throw new Error("prompt message is required");if({name:l,type:a}=n,Fe[a]===void 0)throw new Error(`prompt type (${a}) is not defined`);if(r[n.name]!==void 0&&(o=await W(n,r[n.name]),o!==void 0)){s[l]=o;continue}try{o=Y._injected?El(Y._injected,n.initial):await Fe[a](n),s[l]=o=await W(n,o,!0),h=await t(n,o,s)}catch{h=!await e(n,s)}if(h)return s}return s}function El(i,t){let e=i.shift();if(e instanceof Error)throw e;return e===void 0?t:e}function Al(i){Y._injected=(Y._injected||[]).concat(i)}function Rl(i){Y._override=Object.assign({},i)}mn.exports=Object.assign(Y,{prompt:Y,prompts:Fe,inject:Al,override:Rl})});var vn=u((ia,bn)=>{function kl(i){i=(Array.isArray(i)?i:i.split(".")).map(Number);let t=0,e=process.versions.node.split(".").map(Number);for(;t<i.length;t++){if(e[t]>i[t])return!1;if(i[t]>e[t])return!0}return!1}bn.exports=kl("8.6.0")?Vs():gn()});var qn=Cn(vn(),1);import Tt from"node:process";import{promises as xn,existsSync as Sn}from"node:fs";import Fl from"node:url";import B from"node:path";import{program as $t}from"commander";import{promises as wn}from"node:fs";async function yn(i,t,...e){let[s,r]=e,o=await wn.readFile(i,s),n=t(o),h=e.length===2?r:s;return await wn.writeFile(i,n,h),n}import{execSync as Hl}from"node:child_process";var Yl=Fl.fileURLToPath(import.meta.url),On=B.dirname(Yl);$t.name("@mxfb-cli/make-template").description("Generate in cwd a project template");$t.command("html").description("simple html project structure").action(Vl);$t.command("react").description("react + typescript project structure").action(Ll);$t.parse(Tt.argv);var Mn=Tt.cwd();async function Vl(){let i=B.join(On,"assets/html");if(!Sn(i))return console.error(`Could not find the template to copy at ${i}`),Tt.exit(1);let t=B.join(Mn,"html-template");await xn.cp(i,t,{recursive:!0})}async function Ll(){let i=B.join(On,"assets/react");if(!Sn(i))return console.error(`Could not find the template to copy at ${i}`),Tt.exit(1);let t=B.join(Mn,"react-template");await xn.cp(i,t,{recursive:!0});let{projectName:e}=await(0,qn.default)({name:"projectName",message:"Project name ? (for package.json name field)",type:"text"}),s=B.join(t,"package.json");await yn(s,r=>{let o=typeof r=="string"?r:r.toString(),n=JSON.parse(o);delete n.name;let h={name:e,...n};return`${JSON.stringify(h,null,2)}
|
|
99
|
-
`},{encoding:"utf-8"}),Hl(`cd ${t} && npm i`)}
|
|
2
|
+
import c from"node:process";import{promises as d,existsSync as u}from"node:fs";import j from"node:url";import r from"node:path";import{execSync as y}from"node:child_process";import{program as m}from"commander";import w from"prompts";import{promises as l}from"node:fs";async function f(t,e,...n){let[i,o]=n,s=await l.readFile(t,i),a=e(s),p=n.length===2?o:i;return await l.writeFile(t,a,p),a}var x=j.fileURLToPath(import.meta.url),h=r.dirname(x);m.name("@mxfb-cli/make-template").description("Generate in cwd a project template");m.command("html").description("simple html project structure").action(P);m.command("react").description("react + typescript project structure").action(k);m.parse(c.argv);var g=c.cwd();async function P(){let t=r.join(h,"assets/html");if(!u(t))return console.error(`Could not find the template to copy at ${t}`),c.exit(1);let e=r.join(g,"html-template");await d.cp(t,e,{recursive:!0})}async function k(){let t=r.join(h,"assets/react");if(!u(t))return console.error(`Could not find the template to copy at ${t}`),c.exit(1);let e=r.join(g,"react-template");await d.cp(t,e,{recursive:!0});let{projectName:n}=await w({name:"projectName",message:"Project name ? (for package.json name field)",type:"text"}),i=r.join(e,"package.json");await f(i,o=>{let s=typeof o=="string"?o:o.toString(),a=JSON.parse(s);delete a.name;let p={name:n,...a};return`${JSON.stringify(p,null,2)}
|
|
3
|
+
`},{encoding:"utf-8"}),y(`cd ${e} && npm i`)}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mxfb/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.36",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "Maxime Fabas",
|
|
6
6
|
"license": "ISC",
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
"make-template": "./make-template/index.js"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"commander": "^12.0.0"
|
|
19
|
+
"commander": "^12.0.0",
|
|
20
|
+
"prompts": "^2.4.2"
|
|
20
21
|
},
|
|
21
22
|
"devDependencies": {
|
|
22
23
|
"@commander-js/extra-typings": "^12.0.1",
|
|
@@ -25,7 +26,6 @@
|
|
|
25
26
|
"@types/prompts": "^2.4.9",
|
|
26
27
|
"@types/semver": "^7.5.8",
|
|
27
28
|
"esbuild": "^0.20.2",
|
|
28
|
-
"prompts": "^2.4.2",
|
|
29
29
|
"semver": "^7.6.0",
|
|
30
30
|
"simple-git": "^3.23.0",
|
|
31
31
|
"typescript": "^5.4.3"
|