create-enchilada 1.0.4 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +5 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Pt from"readline";import Ct from"events";import{fileURLToPath as ui}from"node:url";import
|
|
1
|
+
import Pt from"readline";import Ct from"events";import{fileURLToPath as ui}from"node:url";import Z from"node:path";import oe,{argv as ci}from"node:process";import di from"node:os";import Et from"node:tty";import{readFileSync as fi,writeFileSync as pi,existsSync as Dt,mkdirSync as mi}from"fs";import{readdirSync as gi,lstatSync as vi,mkdirSync as bi,copyFileSync as yi}from"node:fs";function _t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var le={},he,qt;function q(){if(qt)return he;qt=1;const{FORCE_COLOR:e,NODE_DISABLE_COLORS:r,TERM:n}=process.env,t={enabled:!r&&n!=="dumb"&&e!=="0",reset:i(0,0),bold:i(1,22),dim:i(2,22),italic:i(3,23),underline:i(4,24),inverse:i(7,27),hidden:i(8,28),strikethrough:i(9,29),black:i(30,39),red:i(31,39),green:i(32,39),yellow:i(33,39),blue:i(34,39),magenta:i(35,39),cyan:i(36,39),white:i(37,39),gray:i(90,39),grey:i(90,39),bgBlack:i(40,49),bgRed:i(41,49),bgGreen:i(42,49),bgYellow:i(43,49),bgBlue:i(44,49),bgMagenta:i(45,49),bgCyan:i(46,49),bgWhite:i(47,49)};function s(v,h){let u=0,o,m="",d="";for(;u<v.length;u++)o=v[u],m+=o.open,d+=o.close,h.includes(o.close)&&(h=h.replace(o.rgx,o.close+o.open));return m+h+d}function f(v,h){let u={has:v,keys:h};return u.reset=t.reset.bind(u),u.bold=t.bold.bind(u),u.dim=t.dim.bind(u),u.italic=t.italic.bind(u),u.underline=t.underline.bind(u),u.inverse=t.inverse.bind(u),u.hidden=t.hidden.bind(u),u.strikethrough=t.strikethrough.bind(u),u.black=t.black.bind(u),u.red=t.red.bind(u),u.green=t.green.bind(u),u.yellow=t.yellow.bind(u),u.blue=t.blue.bind(u),u.magenta=t.magenta.bind(u),u.cyan=t.cyan.bind(u),u.white=t.white.bind(u),u.gray=t.gray.bind(u),u.grey=t.grey.bind(u),u.bgBlack=t.bgBlack.bind(u),u.bgRed=t.bgRed.bind(u),u.bgGreen=t.bgGreen.bind(u),u.bgYellow=t.bgYellow.bind(u),u.bgBlue=t.bgBlue.bind(u),u.bgMagenta=t.bgMagenta.bind(u),u.bgCyan=t.bgCyan.bind(u),u.bgWhite=t.bgWhite.bind(u),u}function i(v,h){let u={open:`\x1B[${v}m`,close:`\x1B[${h}m`,rgx:new RegExp(`\\x1b\\[${h}m`,"g")};return function(o){return this!==void 0&&this.has!==void 0?(this.has.includes(v)||(this.has.push(v),this.keys.push(u)),o===void 0?this:t.enabled?s(this.keys,o+""):o+""):o===void 0?f([v],[u]):t.enabled?s([u],o+""):o+""}}return he=t,he}var ae,At;function wi(){return At||(At=1,ae=(e,r)=>{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(r){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}}),ae}var ue,It;function ce(){return It||(It=1,ue=e=>{const r=["[\\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("|"),n=new RegExp(r,"g");return typeof e=="string"?e.replace(n,""):e}),ue}var de,Ft;function A(){if(Ft)return de;Ft=1;const e="\x1B",r=`${e}[`,n="\x07",t={to(i,v){return v?`${r}${v+1};${i+1}H`:`${r}${i+1}G`},move(i,v){let h="";return i<0?h+=`${r}${-i}D`:i>0&&(h+=`${r}${i}C`),v<0?h+=`${r}${-v}A`:v>0&&(h+=`${r}${v}B`),h},up:(i=1)=>`${r}${i}A`,down:(i=1)=>`${r}${i}B`,forward:(i=1)=>`${r}${i}C`,backward:(i=1)=>`${r}${i}D`,nextLine:(i=1)=>`${r}E`.repeat(i),prevLine:(i=1)=>`${r}F`.repeat(i),left:`${r}G`,hide:`${r}?25l`,show:`${r}?25h`,save:`${e}7`,restore:`${e}8`},s={up:(i=1)=>`${r}S`.repeat(i),down:(i=1)=>`${r}T`.repeat(i)},f={screen:`${r}2J`,up:(i=1)=>`${r}1J`.repeat(i),down:(i=1)=>`${r}J`.repeat(i),line:`${r}2K`,lineEnd:`${r}K`,lineStart:`${r}1K`,lines(i){let v="";for(let h=0;h<i;h++)v+=this.line+(h<i-1?t.up():"");return i&&(v+=t.left),v}};return de={cursor:t,scroll:s,erase:f,beep:n},de}var fe,jt;function xi(){if(jt)return fe;jt=1;function e(h,u){var o=typeof Symbol<"u"&&h[Symbol.iterator]||h["@@iterator"];if(!o){if(Array.isArray(h)||(o=r(h))||u){o&&(h=o);var m=0,d=function(){};return{s:d,n:function(){return m>=h.length?{done:!0}:{done:!1,value:h[m++]}},e:function(c){throw c},f:d}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var l=!0,a=!1,b;return{s:function(){o=o.call(h)},n:function(){var c=o.next();return l=c.done,c},e:function(c){a=!0,b=c},f:function(){try{!l&&o.return!=null&&o.return()}finally{if(a)throw b}}}}function r(h,u){if(h){if(typeof h=="string")return n(h,u);var o=Object.prototype.toString.call(h).slice(8,-1);if(o==="Object"&&h.constructor&&(o=h.constructor.name),o==="Map"||o==="Set")return Array.from(h);if(o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return n(h,u)}}function n(h,u){(u==null||u>h.length)&&(u=h.length);for(var o=0,m=new Array(u);o<u;o++)m[o]=h[o];return m}const t=ce(),s=A(),f=s.erase,i=s.cursor,v=h=>[...t(h)].length;return fe=function(h,u){if(!u)return f.line+i.to(0);let o=0;const m=h.split(/\r?\n/);var d=e(m),l;try{for(d.s();!(l=d.n()).done;){let a=l.value;o+=1+Math.floor(Math.max(v(a)-1,0)/u)}}catch(a){d.e(a)}finally{d.f()}return f.lines(o)},fe}var pe,kt;function Nt(){if(kt)return pe;kt=1;const e={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},r={arrowUp:e.arrowUp,arrowDown:e.arrowDown,arrowLeft:e.arrowLeft,arrowRight:e.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"};return pe=process.platform==="win32"?r:e,pe}var me,Lt;function Si(){if(Lt)return me;Lt=1;const e=q(),r=Nt(),n=Object.freeze({password:{scale:1,render:h=>"*".repeat(h.length)},emoji:{scale:2,render:h=>"\u{1F603}".repeat(h.length)},invisible:{scale:0,render:h=>""},default:{scale:1,render:h=>`${h}`}}),t=h=>n[h]||n.default,s=Object.freeze({aborted:e.red(r.cross),done:e.green(r.tick),exited:e.yellow(r.cross),default:e.cyan("?")});return me={styles:n,render:t,symbols:s,symbol:(h,u,o)=>u?s.aborted:o?s.exited:h?s.done:s.default,delimiter:h=>e.gray(h?r.ellipsis:r.pointerSmall),item:(h,u)=>e.gray(h?u?r.pointerSmall:"+":r.line)},me}var ge,Vt;function $i(){if(Vt)return ge;Vt=1;const e=ce();return ge=function(r,n){let t=String(e(r)||"").split(/\r?\n/);return n?t.map(s=>Math.ceil(s.length/n)).reduce((s,f)=>s+f):t.length},ge}var ve,Yt;function Ti(){return Yt||(Yt=1,ve=(e,r={})=>{const n=Number.isSafeInteger(parseInt(r.margin))?new Array(parseInt(r.margin)).fill(" ").join(""):r.margin||"",t=r.width;return(e||"").split(/\r?\n/g).map(s=>s.split(/\s+/g).reduce((f,i)=>(i.length+n.length>=t||f[f.length-1].length+i.length+1<t?f[f.length-1]+=` ${i}`:f.push(`${n}${i}`),f),[n]).join(`
|
|
3
3
|
`)).join(`
|
|
4
4
|
`)}),ve}var be,Bt;function Mi(){return Bt||(Bt=1,be=(e,r,n)=>{n=n||r;let t=Math.min(r-n,e-Math.floor(n/2));t<0&&(t=0);let s=Math.min(t+n,r);return{startIndex:t,endIndex:s}}),be}var ye,Ht;function Y(){return Ht||(Ht=1,ye={action:wi(),clear:xi(),style:Si(),strip:ce(),figures:Nt(),lines:$i(),wrap:Ti(),entriesToDisplay:Mi()}),ye}var we,Jt;function z(){if(Jt)return we;Jt=1;const e=Pt,r=Y(),n=r.action,t=Ct,s=A(),f=s.beep,i=s.cursor,v=q();class h extends t{constructor(o={}){super(),this.firstRender=!0,this.in=o.stdin||process.stdin,this.out=o.stdout||process.stdout,this.onRender=(o.onRender||(()=>{})).bind(this);const m=e.createInterface({input:this.in,escapeCodeTimeout:50});e.emitKeypressEvents(this.in,m),this.in.isTTY&&this.in.setRawMode(!0);const d=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,l=(a,b)=>{let g=n(b,d);g===!1?this._&&this._(a,b):typeof this[g]=="function"?this[g](b):this.bell()};this.close=()=>{this.out.write(i.show),this.in.removeListener("keypress",l),this.in.isTTY&&this.in.setRawMode(!1),m.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",l)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(f)}render(){this.onRender(v),this.firstRender&&(this.firstRender=!1)}}return we=h,we}var xe,Ut;function Oi(){if(Ut)return xe;Ut=1;function e(l,a,b,g,c,p,y){try{var w=l[p](y),x=w.value}catch($){b($);return}w.done?a(x):Promise.resolve(x).then(g,c)}function r(l){return function(){var a=this,b=arguments;return new Promise(function(g,c){var p=l.apply(a,b);function y(x){e(p,g,c,y,w,"next",x)}function w(x){e(p,g,c,y,w,"throw",x)}y(void 0)})}}const n=q(),t=z(),s=A(),f=s.erase,i=s.cursor,v=Y(),h=v.style,u=v.clear,o=v.lines,m=v.figures;class d extends t{constructor(a={}){super(a),this.transform=h.render(a.style),this.scale=this.transform.scale,this.msg=a.message,this.initial=a.initial||"",this.validator=a.validate||(()=>!0),this.value="",this.errorMsg=a.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=u("",this.out.columns),this.render()}set value(a){!a&&this.initial?(this.placeholder=!0,this.rendered=n.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(a)),this._value=a,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(`
|
|
@@ -12,7 +12,7 @@ ${g?" ":m.pointerSmall} ${n.red().italic(b)}`,"")),this.out.write(f.line+i.to(0)
|
|
|
12
12
|
`+i(y.description,{margin:3,width:this.out.columns})))),this.outputText+=`${c} ${g}${e.gray(p)}
|
|
13
13
|
`}}this.out.write(this.outputText)}}return Se=o,Se}var $e,Wt;function Pi(){if(Wt)return $e;Wt=1;const e=q(),r=z(),n=Y(),t=n.style,s=n.clear,f=A(),i=f.cursor,v=f.erase;class h extends r{constructor(o={}){super(o),this.msg=o.message,this.value=!!o.initial,this.active=o.active||"on",this.inactive=o.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(`
|
|
14
14
|
`),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
15
|
-
`),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()}_(o,m){if(o===" ")this.value=!this.value;else if(o==="1")this.value=!0;else if(o==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(i.hide):this.out.write(s(this.outputText,this.out.columns)),super.render(),this.outputText=[t.symbol(this.done,this.aborted),e.bold(this.msg),t.delimiter(this.done),this.value?this.inactive:e.cyan().underline(this.inactive),e.gray("/"),this.value?e.cyan().underline(this.active):this.active].join(" "),this.out.write(v.line+i.to(0)+this.outputText))}}return $e=h,$e}var Te,zt;function J(){if(zt)return Te;zt=1;class e{constructor({token:n,date:t,parts:s,locales:f}){this.token=n,this.date=t||new Date,this.parts=s||[this],this.locales=f||{}}up(){}down(){}next(){const n=this.parts.indexOf(this);return this.parts.find((t,s)=>s>n&&t instanceof e)}setTo(n){}prev(){let n=[].concat(this.parts).reverse();const t=n.indexOf(this);return n.find((s,f)=>f>t&&s instanceof e)}toString(){return String(this.date)}}return Te=e,Te}var Me,Kt;function Ci(){if(Kt)return Me;Kt=1;const e=J();class r extends e{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}}return Me=r,Me}var Oe,Zt;function Ei(){if(Zt)return Oe;Zt=1;const e=J(),r=t=>(t=t%10,t===1?"st":t===2?"nd":t===3?"rd":"th");class n extends e{constructor(s={}){super(s)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(s){this.date.setDate(parseInt(s.substr(-2)))}toString(){let s=this.date.getDate(),f=this.date.getDay();return this.token==="DD"?String(s).padStart(2,"0"):this.token==="Do"?s+r(s):this.token==="d"?f+1:this.token==="ddd"?this.locales.weekdaysShort[f]:this.token==="dddd"?this.locales.weekdays[f]:s}}return Oe=n,Oe}var Re,Xt;function Di(){if(Xt)return Re;Xt=1;const e=J();class r extends e{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}}return Re=r,Re}var Pe,Qt;function _i(){if(Qt)return Pe;Qt=1;const e=J();class r extends e{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)}}return Pe=r,Pe}var Ce,er;function qi(){if(er)return Ce;er=1;const e=J();class r extends e{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}}return Ce=r,Ce}var Ee,tr;function Ai(){if(tr)return Ee;tr=1;const e=J();class r extends e{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(),s=this.token.length;return s===2?String(t+1).padStart(2,"0"):s===3?this.locales.monthsShort[t]:s===4?this.locales.months[t]:String(t+1)}}return Ee=r,Ee}var De,rr;function Ii(){if(rr)return De;rr=1;const e=J();class r extends e{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}}return De=r,De}var _e,ir;function Fi(){if(ir)return _e;ir=1;const e=J();class r extends e{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}}return _e=r,_e}var qe,sr;function ji(){return sr||(sr=1,qe={DatePart:J(),Meridiem:Ci(),Day:Ei(),Hours:Di(),Milliseconds:_i(),Minutes:qi(),Month:Ai(),Seconds:Ii(),Year:Fi()}),qe}var Ae,nr;function ki(){if(nr)return Ae;nr=1;function e(M,S,R,E,C,F,V){try{var k=M[F](V),j=k.value}catch(
|
|
15
|
+
`),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()}_(o,m){if(o===" ")this.value=!this.value;else if(o==="1")this.value=!0;else if(o==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(i.hide):this.out.write(s(this.outputText,this.out.columns)),super.render(),this.outputText=[t.symbol(this.done,this.aborted),e.bold(this.msg),t.delimiter(this.done),this.value?this.inactive:e.cyan().underline(this.inactive),e.gray("/"),this.value?e.cyan().underline(this.active):this.active].join(" "),this.out.write(v.line+i.to(0)+this.outputText))}}return $e=h,$e}var Te,zt;function J(){if(zt)return Te;zt=1;class e{constructor({token:n,date:t,parts:s,locales:f}){this.token=n,this.date=t||new Date,this.parts=s||[this],this.locales=f||{}}up(){}down(){}next(){const n=this.parts.indexOf(this);return this.parts.find((t,s)=>s>n&&t instanceof e)}setTo(n){}prev(){let n=[].concat(this.parts).reverse();const t=n.indexOf(this);return n.find((s,f)=>f>t&&s instanceof e)}toString(){return String(this.date)}}return Te=e,Te}var Me,Kt;function Ci(){if(Kt)return Me;Kt=1;const e=J();class r extends e{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}}return Me=r,Me}var Oe,Zt;function Ei(){if(Zt)return Oe;Zt=1;const e=J(),r=t=>(t=t%10,t===1?"st":t===2?"nd":t===3?"rd":"th");class n extends e{constructor(s={}){super(s)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(s){this.date.setDate(parseInt(s.substr(-2)))}toString(){let s=this.date.getDate(),f=this.date.getDay();return this.token==="DD"?String(s).padStart(2,"0"):this.token==="Do"?s+r(s):this.token==="d"?f+1:this.token==="ddd"?this.locales.weekdaysShort[f]:this.token==="dddd"?this.locales.weekdays[f]:s}}return Oe=n,Oe}var Re,Xt;function Di(){if(Xt)return Re;Xt=1;const e=J();class r extends e{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}}return Re=r,Re}var Pe,Qt;function _i(){if(Qt)return Pe;Qt=1;const e=J();class r extends e{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)}}return Pe=r,Pe}var Ce,er;function qi(){if(er)return Ce;er=1;const e=J();class r extends e{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}}return Ce=r,Ce}var Ee,tr;function Ai(){if(tr)return Ee;tr=1;const e=J();class r extends e{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(),s=this.token.length;return s===2?String(t+1).padStart(2,"0"):s===3?this.locales.monthsShort[t]:s===4?this.locales.months[t]:String(t+1)}}return Ee=r,Ee}var De,rr;function Ii(){if(rr)return De;rr=1;const e=J();class r extends e{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}}return De=r,De}var _e,ir;function Fi(){if(ir)return _e;ir=1;const e=J();class r extends e{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}}return _e=r,_e}var qe,sr;function ji(){return sr||(sr=1,qe={DatePart:J(),Meridiem:Ci(),Day:Ei(),Hours:Di(),Milliseconds:_i(),Minutes:qi(),Month:Ai(),Seconds:Ii(),Year:Fi()}),qe}var Ae,nr;function ki(){if(nr)return Ae;nr=1;function e(M,S,R,E,C,F,V){try{var k=M[F](V),j=k.value}catch(X){R(X);return}k.done?S(j):Promise.resolve(j).then(E,C)}function r(M){return function(){var S=this,R=arguments;return new Promise(function(E,C){var F=M.apply(S,R);function V(j){e(F,E,C,V,k,"next",j)}function k(j){e(F,E,C,V,k,"throw",j)}V(void 0)})}}const n=q(),t=z(),s=Y(),f=s.style,i=s.clear,v=s.figures,h=A(),u=h.erase,o=h.cursor,m=ji(),d=m.DatePart,l=m.Meridiem,a=m.Day,b=m.Hours,g=m.Milliseconds,c=m.Minutes,p=m.Month,y=m.Seconds,w=m.Year,x=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,$={1:({token:M})=>M.replace(/\\(.)/g,"$1"),2:M=>new a(M),3:M=>new p(M),4:M=>new w(M),5:M=>new l(M),6:M=>new b(M),7:M=>new c(M),8:M=>new y(M),9:M=>new g(M)},T={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(",")};class O extends t{constructor(S={}){super(S),this.msg=S.message,this.cursor=0,this.typed="",this.locales=Object.assign(T,S.locales),this._date=S.initial||new Date,this.errorMsg=S.error||"Please Enter A Valid Value",this.validator=S.validate||(()=>!0),this.mask=S.mask||"YYYY-MM-DD HH:mm:ss",this.clear=i("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(S){S&&this._date.setTime(S.getTime())}set mask(S){let R;for(this.parts=[];R=x.exec(S);){let C=R.shift(),F=R.findIndex(V=>V!=null);this.parts.push(F in $?$[F]({token:R[F]||C,date:this.date,parts:this.parts,locales:this.locales}):R[F]||C)}let E=this.parts.reduce((C,F)=>(typeof F=="string"&&typeof C[C.length-1]=="string"?C[C.length-1]+=F:C.push(F),C),[]);this.parts.splice(0),this.parts.push(...E),this.reset()}moveCursor(S){this.typed="",this.cursor=S,this.fire()}reset(){this.moveCursor(this.parts.findIndex(S=>S instanceof d)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
16
16
|
`),this.close()}validate(){var S=this;return r(function*(){let R=yield S.validator(S.value);typeof R=="string"&&(S.errorMsg=R,R=!1),S.error=!R})()}submit(){var S=this;return r(function*(){if(yield S.validate(),S.error){S.color="red",S.fire(),S.render();return}S.done=!0,S.aborted=!1,S.fire(),S.render(),S.out.write(`
|
|
17
17
|
`),S.close()})()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let S=this.parts[this.cursor].prev();if(S==null)return this.bell();this.moveCursor(this.parts.indexOf(S)),this.render()}right(){let S=this.parts[this.cursor].next();if(S==null)return this.bell();this.moveCursor(this.parts.indexOf(S)),this.render()}next(){let S=this.parts[this.cursor].next();this.moveCursor(S?this.parts.indexOf(S):this.parts.findIndex(R=>R instanceof d)),this.render()}_(S){/\d/.test(S)&&(this.typed+=S,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(o.hide):this.out.write(i(this.outputText,this.out.columns)),super.render(),this.outputText=[f.symbol(this.done,this.aborted),n.bold(this.msg),f.delimiter(!1),this.parts.reduce((S,R,E)=>S.concat(E===this.cursor&&!this.done?n.cyan().underline(R.toString()):R),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
|
|
18
18
|
`).reduce((S,R,E)=>S+`
|
|
@@ -47,7 +47,7 @@ Filtered results for: ${this.inputValue?this.inputValue:e.gray("Enter something
|
|
|
47
47
|
`}renderOption(o,m,d){let l;return m.disabled?l=o===d?e.gray().underline(m.title):e.strikethrough().gray(m.title):l=o===d?e.cyan().underline(m.title):m.title,(m.selected?e.green(v.radioOn):v.radioOff)+" "+l}renderDoneOrInstructions(){if(this.done)return this.value.filter(m=>m.selected).map(m=>m.title).join(", ");const o=[e.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&o.push(e.yellow(this.warn)),o.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(n.hide),super.render();let o=[i.symbol(this.done,this.aborted),e.bold(this.msg),i.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(o+=e.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),o+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+o),this.clear=f(o,this.out.columns)}}return ke=h,ke}var Ne,cr;function Yi(){if(cr)return Ne;cr=1;const e=q(),r=z(),n=Y(),t=n.style,s=n.clear,f=A(),i=f.erase,v=f.cursor;class h extends r{constructor(o={}){super(o),this.msg=o.message,this.value=o.initial,this.initialValue=!!o.initial,this.yesMsg=o.yes||"yes",this.yesOption=o.yesOption||"(Y/n)",this.noMsg=o.no||"no",this.noOption=o.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(`
|
|
48
48
|
`),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
49
49
|
`),this.close()}_(o,m){return o.toLowerCase()==="y"?(this.value=!0,this.submit()):o.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(v.hide):this.out.write(s(this.outputText,this.out.columns)),super.render(),this.outputText=[t.symbol(this.done,this.aborted),e.bold(this.msg),t.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:e.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(i.line+v.to(0)+this.outputText))}}return Ne=h,Ne}var Le,dr;function Bi(){return dr||(dr=1,Le={TextPrompt:Oi(),SelectPrompt:Ri(),TogglePrompt:Pi(),DatePrompt:ki(),NumberPrompt:Ni(),MultiselectPrompt:hr(),AutocompletePrompt:Li(),AutocompleteMultiselectPrompt:Vi(),ConfirmPrompt:Yi()}),Le}var fr;function Hi(){return fr||(fr=1,function(e){const r=e,n=Bi(),t=i=>i;function s(i,v,h={}){return new Promise((u,o)=>{const m=new n[i](v),d=h.onAbort||t,l=h.onSubmit||t,a=h.onExit||t;m.on("state",v.onState||t),m.on("submit",b=>u(l(b))),m.on("exit",b=>u(a(b))),m.on("abort",b=>o(d(b)))})}r.text=i=>s("TextPrompt",i),r.password=i=>(i.style="password",r.text(i)),r.invisible=i=>(i.style="invisible",r.text(i)),r.number=i=>s("NumberPrompt",i),r.date=i=>s("DatePrompt",i),r.confirm=i=>s("ConfirmPrompt",i),r.list=i=>{const v=i.separator||",";return s("TextPrompt",i,{onSubmit:h=>h.split(v).map(u=>u.trim())})},r.toggle=i=>s("TogglePrompt",i),r.select=i=>s("SelectPrompt",i),r.multiselect=i=>{i.choices=[].concat(i.choices||[]);const v=h=>h.filter(u=>u.selected).map(u=>u.value);return s("MultiselectPrompt",i,{onAbort:v,onSubmit:v})},r.autocompleteMultiselect=i=>{i.choices=[].concat(i.choices||[]);const v=h=>h.filter(u=>u.selected).map(u=>u.value);return s("AutocompleteMultiselectPrompt",i,{onAbort:v,onSubmit:v})};const f=(i,v)=>Promise.resolve(v.filter(h=>h.title.slice(0,i.length).toLowerCase()===i.toLowerCase()));r.autocomplete=i=>(i.suggest=i.suggest||f,i.choices=[].concat(i.choices||[]),s("AutocompletePrompt",i))}(le)),le}var Ve,pr;function Ji(){if(pr)return Ve;pr=1;function e(g,c){var p=Object.keys(g);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(g);c&&(y=y.filter(function(w){return Object.getOwnPropertyDescriptor(g,w).enumerable})),p.push.apply(p,y)}return p}function r(g){for(var c=1;c<arguments.length;c++){var p=arguments[c]!=null?arguments[c]:{};c%2?e(Object(p),!0).forEach(function(y){n(g,y,p[y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(g,Object.getOwnPropertyDescriptors(p)):e(Object(p)).forEach(function(y){Object.defineProperty(g,y,Object.getOwnPropertyDescriptor(p,y))})}return g}function n(g,c,p){return c in g?Object.defineProperty(g,c,{value:p,enumerable:!0,configurable:!0,writable:!0}):g[c]=p,g}function t(g,c){var p=typeof Symbol<"u"&&g[Symbol.iterator]||g["@@iterator"];if(!p){if(Array.isArray(g)||(p=s(g))||c){p&&(g=p);var y=0,w=function(){};return{s:w,n:function(){return y>=g.length?{done:!0}:{done:!1,value:g[y++]}},e:function(M){throw M},f:w}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
50
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var x=!0,$=!1,T;return{s:function(){p=p.call(g)},n:function(){var M=p.next();return x=M.done,M},e:function(M){$=!0,T=M},f:function(){try{!x&&p.return!=null&&p.return()}finally{if($)throw T}}}}function s(g,c){if(g){if(typeof g=="string")return f(g,c);var p=Object.prototype.toString.call(g).slice(8,-1);if(p==="Object"&&g.constructor&&(p=g.constructor.name),p==="Map"||p==="Set")return Array.from(g);if(p==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(p))return f(g,c)}}function f(g,c){(c==null||c>g.length)&&(c=g.length);for(var p=0,y=new Array(c);p<c;p++)y[p]=g[p];return y}function i(g,c,p,y,w,x,$){try{var T=g[x]($),O=T.value}catch(M){p(M);return}T.done?c(O):Promise.resolve(O).then(y,w)}function v(g){return function(){var c=this,p=arguments;return new Promise(function(y,w){var x=g.apply(c,p);function $(O){i(x,y,w,$,T,"next",O)}function T(O){i(x,y,w,$,T,"throw",O)}$(void 0)})}}const h=Hi(),u=["suggest","format","onState","validate","onRender","type"],o=()=>{};function m(){return d.apply(this,arguments)}function d(){return d=v(function*(g=[],{onSubmit:c=o,onCancel:p=o}={}){const y={},w=m._override||{};g=[].concat(g);let x,$,T,O,M,S;const R=function(){var k=v(function*(j,
|
|
50
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var x=!0,$=!1,T;return{s:function(){p=p.call(g)},n:function(){var M=p.next();return x=M.done,M},e:function(M){$=!0,T=M},f:function(){try{!x&&p.return!=null&&p.return()}finally{if($)throw T}}}}function s(g,c){if(g){if(typeof g=="string")return f(g,c);var p=Object.prototype.toString.call(g).slice(8,-1);if(p==="Object"&&g.constructor&&(p=g.constructor.name),p==="Map"||p==="Set")return Array.from(g);if(p==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(p))return f(g,c)}}function f(g,c){(c==null||c>g.length)&&(c=g.length);for(var p=0,y=new Array(c);p<c;p++)y[p]=g[p];return y}function i(g,c,p,y,w,x,$){try{var T=g[x]($),O=T.value}catch(M){p(M);return}T.done?c(O):Promise.resolve(O).then(y,w)}function v(g){return function(){var c=this,p=arguments;return new Promise(function(y,w){var x=g.apply(c,p);function $(O){i(x,y,w,$,T,"next",O)}function T(O){i(x,y,w,$,T,"throw",O)}$(void 0)})}}const h=Hi(),u=["suggest","format","onState","validate","onRender","type"],o=()=>{};function m(){return d.apply(this,arguments)}function d(){return d=v(function*(g=[],{onSubmit:c=o,onCancel:p=o}={}){const y={},w=m._override||{};g=[].concat(g);let x,$,T,O,M,S;const R=function(){var k=v(function*(j,X,Rt=!1){if(!(!Rt&&j.validate&&j.validate(X)!==!0))return j.format?yield j.format(X,y):X});return function(X,Rt){return k.apply(this,arguments)}}();var E=t(g),C;try{for(E.s();!(C=E.n()).done;){$=C.value;var F=$;if(O=F.name,M=F.type,typeof M=="function"&&(M=yield M(x,r({},y),$),$.type=M),!!M){for(let k in $){if(u.includes(k))continue;let j=$[k];$[k]=typeof j=="function"?yield j(x,r({},y),S):j}if(S=$,typeof $.message!="string")throw new Error("prompt message is required");var V=$;if(O=V.name,M=V.type,h[M]===void 0)throw new Error(`prompt type (${M}) is not defined`);if(w[$.name]!==void 0&&(x=yield R($,w[$.name]),x!==void 0)){y[O]=x;continue}try{x=m._injected?l(m._injected,$.initial):yield h[M]($),y[O]=x=yield R($,x,!0),T=yield c($,x,y)}catch{T=!(yield p($,y))}if(T)return y}}}catch(k){E.e(k)}finally{E.f()}return y}),d.apply(this,arguments)}function l(g,c){const p=g.shift();if(p instanceof Error)throw p;return p===void 0?c:p}function a(g){m._injected=(m._injected||[]).concat(g)}function b(g){m._override=Object.assign({},g)}return Ve=Object.assign(m,{prompt:m,prompts:h,inject:a,override:b}),Ve}var Ye={},Be,mr;function Ui(){return mr||(mr=1,Be=(e,r)=>{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(r){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}}),Be}var He,gr;function Je(){return gr||(gr=1,He=e=>{const r=["[\\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("|"),n=new RegExp(r,"g");return typeof e=="string"?e.replace(n,""):e}),He}var Ue,vr;function Gi(){if(vr)return Ue;vr=1;const e=Je(),{erase:r,cursor:n}=A(),t=s=>[...e(s)].length;return Ue=function(s,f){if(!f)return r.line+n.to(0);let i=0;const v=s.split(/\r?\n/);for(let h of v)i+=1+Math.floor(Math.max(t(h)-1,0)/f);return r.lines(i)},Ue}var Ge,br;function yr(){if(br)return Ge;br=1;const e={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},r={arrowUp:e.arrowUp,arrowDown:e.arrowDown,arrowLeft:e.arrowLeft,arrowRight:e.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"};return Ge=process.platform==="win32"?r:e,Ge}var We,wr;function Wi(){if(wr)return We;wr=1;const e=q(),r=yr(),n=Object.freeze({password:{scale:1,render:h=>"*".repeat(h.length)},emoji:{scale:2,render:h=>"\u{1F603}".repeat(h.length)},invisible:{scale:0,render:h=>""},default:{scale:1,render:h=>`${h}`}}),t=h=>n[h]||n.default,s=Object.freeze({aborted:e.red(r.cross),done:e.green(r.tick),exited:e.yellow(r.cross),default:e.cyan("?")});return We={styles:n,render:t,symbols:s,symbol:(h,u,o)=>u?s.aborted:o?s.exited:h?s.done:s.default,delimiter:h=>e.gray(h?r.ellipsis:r.pointerSmall),item:(h,u)=>e.gray(h?u?r.pointerSmall:"+":r.line)},We}var ze,xr;function zi(){if(xr)return ze;xr=1;const e=Je();return ze=function(r,n){let t=String(e(r)||"").split(/\r?\n/);return n?t.map(s=>Math.ceil(s.length/n)).reduce((s,f)=>s+f):t.length},ze}var Ke,Sr;function Ki(){return Sr||(Sr=1,Ke=(e,r={})=>{const n=Number.isSafeInteger(parseInt(r.margin))?new Array(parseInt(r.margin)).fill(" ").join(""):r.margin||"",t=r.width;return(e||"").split(/\r?\n/g).map(s=>s.split(/\s+/g).reduce((f,i)=>(i.length+n.length>=t||f[f.length-1].length+i.length+1<t?f[f.length-1]+=` ${i}`:f.push(`${n}${i}`),f),[n]).join(`
|
|
51
51
|
`)).join(`
|
|
52
52
|
`)}),Ke}var Ze,$r;function Zi(){return $r||($r=1,Ze=(e,r,n)=>{n=n||r;let t=Math.min(r-n,e-Math.floor(n/2));t<0&&(t=0);let s=Math.min(t+n,r);return{startIndex:t,endIndex:s}}),Ze}var Xe,Tr;function B(){return Tr||(Tr=1,Xe={action:Ui(),clear:Gi(),style:Wi(),strip:Je(),figures:yr(),lines:zi(),wrap:Ki(),entriesToDisplay:Zi()}),Xe}var Qe,Mr;function K(){if(Mr)return Qe;Mr=1;const e=Pt,{action:r}=B(),n=Ct,{beep:t,cursor:s}=A(),f=q();class i extends n{constructor(h={}){super(),this.firstRender=!0,this.in=h.stdin||process.stdin,this.out=h.stdout||process.stdout,this.onRender=(h.onRender||(()=>{})).bind(this);const u=e.createInterface({input:this.in,escapeCodeTimeout:50});e.emitKeypressEvents(this.in,u),this.in.isTTY&&this.in.setRawMode(!0);const o=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,m=(d,l)=>{let a=r(l,o);a===!1?this._&&this._(d,l):typeof this[a]=="function"?this[a](l):this.bell()};this.close=()=>{this.out.write(s.show),this.in.removeListener("keypress",m),this.in.isTTY&&this.in.setRawMode(!1),u.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",m)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(t)}render(){this.onRender(f),this.firstRender&&(this.firstRender=!1)}}return Qe=i,Qe}var et,Or;function Xi(){if(Or)return et;Or=1;const e=q(),r=K(),{erase:n,cursor:t}=A(),{style:s,clear:f,lines:i,figures:v}=B();class h extends r{constructor(o={}){super(o),this.transform=s.render(o.style),this.scale=this.transform.scale,this.msg=o.message,this.initial=o.initial||"",this.validator=o.validate||(()=>!0),this.value="",this.errorMsg=o.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=f("",this.out.columns),this.render()}set value(o){!o&&this.initial?(this.placeholder=!0,this.rendered=e.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(o)),this._value=o,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(`
|
|
53
53
|
`),this.close()}async validate(){let o=await this.validator(this.value);typeof o=="string"&&(this.errorMsg=o,o=!1),this.error=!o}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(`
|
|
@@ -98,7 +98,7 @@ Filtered results for: ${this.inputValue?this.inputValue:e.gray("Enter something
|
|
|
98
98
|
`:`
|
|
99
99
|
`)+n,s=t+1,t=e.indexOf(`
|
|
100
100
|
`,s)}while(t!==-1);return f+=e.slice(s),f}const{stdout:ti,stderr:ri}=Cs,Tt=Symbol("GENERATOR"),Q=Symbol("STYLER"),te=Symbol("IS_EMPTY"),ii=["ansi","ansi","ansi256","ansi16m"],ee=Object.create(null),_s=(e,r={})=>{if(r.level&&!(Number.isInteger(r.level)&&r.level>=0&&r.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");const n=ti?ti.level:0;e.level=r.level===void 0?n:r.level},qs=e=>{const r=(...n)=>n.join(" ");return _s(r,e),Object.setPrototypeOf(r,re.prototype),r};function re(e){return qs(e)}Object.setPrototypeOf(re.prototype,Function.prototype);for(const[e,r]of Object.entries(H))ee[e]={get(){const n=ne(this,Ot(r.open,r.close,this[Q]),this[te]);return Object.defineProperty(this,e,{value:n}),n}};ee.visible={get(){const e=ne(this,this[Q],!0);return Object.defineProperty(this,"visible",{value:e}),e}};const Mt=(e,r,n,...t)=>e==="rgb"?r==="ansi16m"?H[n].ansi16m(...t):r==="ansi256"?H[n].ansi256(H.rgbToAnsi256(...t)):H[n].ansi(H.rgbToAnsi(...t)):e==="hex"?Mt("rgb",r,n,...H.hexToRgb(...t)):H[n][e](...t),As=["rgb","hex","ansi256"];for(const e of As){ee[e]={get(){const{level:n}=this;return function(...t){const s=Ot(Mt(e,ii[n],"color",...t),H.color.close,this[Q]);return ne(this,s,this[te])}}};const r="bg"+e[0].toUpperCase()+e.slice(1);ee[r]={get(){const{level:n}=this;return function(...t){const s=Ot(Mt(e,ii[n],"bgColor",...t),H.bgColor.close,this[Q]);return ne(this,s,this[te])}}}}const Is=Object.defineProperties(()=>{},{...ee,level:{enumerable:!0,get(){return this[Tt].level},set(e){this[Tt].level=e}}}),Ot=(e,r,n)=>{let t,s;return n===void 0?(t=e,s=r):(t=n.openAll+e,s=r+n.closeAll),{open:e,close:r,openAll:t,closeAll:s,parent:n}},ne=(e,r,n)=>{const t=(...s)=>Fs(t,s.length===1?""+s[0]:s.join(" "));return Object.setPrototypeOf(t,Is),t[Tt]=e,t[Q]=r,t[te]=n,t},Fs=(e,r)=>{if(e.level<=0||!r)return e[te]?"":r;let n=e[Q];if(n===void 0)return r;const{openAll:t,closeAll:s}=n;if(r.includes("\x1B"))for(;n!==void 0;)r=Es(r,n.close,n.open),n=n.parent;const f=r.indexOf(`
|
|
101
|
-
`);return f!==-1&&(r=Ds(r,s,t,f)),t+r+s};Object.defineProperties(re.prototype,ee);const I=re();re({level:ri?ri.level:0});const P={backend:I.hex("#3677FF"),frontend:I.hex("#6DC6FE"),vanilla:I.hex("#EEC900"),react:I.hex("#3B89E0"),typescript:I.hex("#30B3ED"),ok:I.hex("#30ED86"),error:I.hex("#ED3066"),info:I.hex("#42ECDE"),gray:I.hex("#686868"),vue:I.hex("#54E6A5"),warn:I.hex("#EC9942"),webpack:I.hex("#75AFCC"),node:I.hex("#417E38"),rust:I.hex("#D34516"),experimental:I.hex("#FA2200")};function G(e){const r=22-e.length;return I.reset(P.gray(`${" ".repeat(r)}|${" ".repeat(2)}`))}function L(e){const r=e.split(" ");return e==="Frontend"?P.frontend(e):e==="Backend"?P.backend(e):e==="VanillaJS"?P.vanilla(e):e==="NodeJS"||r.includes("Node")?P.node(e):r.includes("JavaScript")?P.react(e):r.includes("Rspack")||r.includes("Rust")?P.rust(e):r.includes("TypeScript")?P.typescript(e):r.includes("React")?P.react(e):e}function W(e){return I.reset(e)}const si={Frontend:{VanillaJS:[{value:"vanilla-js",title:`${L("VanillaJS")}${G("VanillaJS")}${W(P.error("Vanilla JS + Vite."))}`}],"React JavaScript":[{value:"react",title:`${L("React")}${G("React")}${W(P.error("React + Vite."))}`},{value:"react-dev",title:`${L("React Dev")}${G("React Dev")}${W(P.error("Tailwind + Linter + Tests"))}`},{value:"react-webpack",title:`${L("React Webpack")}${G("React Webpack")}${W(P.error("React + Webpack."))}`},{value:"react-dev-webpack",title:`${L("React Dev Webpack")}${G("React Dev Webpack")}${W(P.error("Tailwind + Linter + Tests"))}`}],"React TypeScript":[{value:"react-typescript",title:`${L("React TypeScript")}${G("React TypeScript")}${W(P.error("React + Vite + TypeScript"))}`},{value:"react-dev-typescript",title:`${L("React Dev TypeScript")}${G("React Dev TypeScript")}${W(P.error("Tailwind + Linter + Tests"))}`}],"React Rust":[{value:"react-rspack",title:`${L("React Rspack")}${G("React Rspack")}${W(P.error("React + Rspack"))}`}]},Backend:{NodeJS:[{value:"node-express",title:`${L("Node Express")}${G("Node Express")}${W(P.error("Express + Sequelize + Linter + Tests"))}`}]}},ni=(e,r)=>{gi(e).forEach(n=>{const t=
|
|
101
|
+
`);return f!==-1&&(r=Ds(r,s,t,f)),t+r+s};Object.defineProperties(re.prototype,ee);const I=re();re({level:ri?ri.level:0});const P={backend:I.hex("#3677FF"),frontend:I.hex("#6DC6FE"),vanilla:I.hex("#EEC900"),react:I.hex("#3B89E0"),typescript:I.hex("#30B3ED"),ok:I.hex("#30ED86"),error:I.hex("#ED3066"),info:I.hex("#42ECDE"),gray:I.hex("#686868"),vue:I.hex("#54E6A5"),warn:I.hex("#EC9942"),webpack:I.hex("#75AFCC"),node:I.hex("#417E38"),rust:I.hex("#D34516"),experimental:I.hex("#FA2200")};function G(e){const r=22-e.length;return I.reset(P.gray(`${" ".repeat(r)}|${" ".repeat(2)}`))}function L(e){const r=e.split(" ");return e==="Frontend"?P.frontend(e):e==="Backend"?P.backend(e):e==="VanillaJS"?P.vanilla(e):e==="NodeJS"||r.includes("Node")?P.node(e):r.includes("JavaScript")?P.react(e):r.includes("Rspack")||r.includes("Rust")?P.rust(e):r.includes("TypeScript")?P.typescript(e):r.includes("React")?P.react(e):e}function W(e){return I.reset(e)}const si={Frontend:{VanillaJS:[{value:"vanilla-js",title:`${L("VanillaJS")}${G("VanillaJS")}${W(P.error("Vanilla JS + Vite."))}`}],"React JavaScript":[{value:"react",title:`${L("React")}${G("React")}${W(P.error("React + Vite."))}`},{value:"react-dev",title:`${L("React Dev")}${G("React Dev")}${W(P.error("Tailwind + Linter + Tests"))}`},{value:"react-webpack",title:`${L("React Webpack")}${G("React Webpack")}${W(P.error("React + Webpack."))}`},{value:"react-dev-webpack",title:`${L("React Dev Webpack")}${G("React Dev Webpack")}${W(P.error("Tailwind + Linter + Tests"))}`}],"React TypeScript":[{value:"react-typescript",title:`${L("React TypeScript")}${G("React TypeScript")}${W(P.error("React + Vite + TypeScript"))}`},{value:"react-dev-typescript",title:`${L("React Dev TypeScript")}${G("React Dev TypeScript")}${W(P.error("Tailwind + Linter + Tests"))}`}],"React Rust":[{value:"react-rspack",title:`${L("React Rspack")}${G("React Rspack")}${W(P.error("React + Rspack"))}`}]},Backend:{NodeJS:[{value:"node-express",title:`${L("Node Express")}${G("Node Express")}${W(P.error("Express + Sequelize + Linter + Tests"))}`}]}},ni=(e,r)=>{gi(e).forEach(n=>{const t=Z.join(e,n);let s=Z.join(r,n);n==="_gitignore"&&(s=Z.join(r,".gitignore"));try{vi(t).isDirectory()?(bi(s,{recursive:!0}),ni(t,s)):yi(t,s)}catch(f){throw new Error(`Failed to copy ${t} to ${s}`,{cause:f})}})},js=(e,r)=>{const n=Z.join(e,"package.json");try{const t=fi(n,"utf8"),s=JSON.parse(t);s.name=r,pi(n,JSON.stringify(s,null,2),"utf8")}catch(t){console.log(t.message)}};async function ks(e,r,n){const t=n===".",s=Dt(e),f=Dt(r);if(!s){console.log(P.error("Invalid Template"));return}if(f&&!t){console.log(P.error("Target directory already exist!"));return}t||(console.info(`\u{1F4C2} ${P.ok("Target directory doesn't exist")}`),console.info(`\u{1F6A7} ${P.ok("Creating directory")}`),mi(r,{recursive:!0}),console.info(`\u{1F4C1} ${P.ok("Finished creating directory")}`));const i=t?Z.basename(r):n;ni(e,r),js(r,i),console.info(`\u{1F680} ${P.ok(`Finished generating your app ${P.error(i)}`)}`),t||console.info(`\u{1F3E0} ${P.info(`cd ${n}`)}`),console.info(`\u{1F9EA} ${P.info("npm install")}`)}const Ns=e=>e==="."?".":e.toLowerCase().split(/[\s|_]/).join("-"),Ls=e=>e==="."||!e.match(/[^a-zA-Z0-9-\s]/g)?!0:"App name should not contain special characters except hyphen (-)",oi=`
|
|
102
102
|
Usage: create-enchilada [OPTION]... [DIRECTORY]
|
|
103
103
|
|
|
104
104
|
Create a new app. With no arguments,
|
|
@@ -145,4 +145,4 @@ Frontend
|
|
|
145
145
|
Backend
|
|
146
146
|
NodeJS
|
|
147
147
|
node-express Express + Sequelize + PostgreSQL + JWT + Passport + ESLint + Jest
|
|
148
|
-
`,Vs=Ss(ci.slice(2)),hi=(e,r)=>{const n=
|
|
148
|
+
`,Vs=Ss(ci.slice(2)),hi=(e,r)=>{const n=Z.join(process.cwd(),r),t=Z.resolve(ui(import.meta.url),"../../templates",`${e}`);ks(t,n,r)},ai=async e=>{const r=e.template||e.t,n=e._[0],{help:t,h:s,list:f,l:i}=e;if(t||s)return console.info(oi),oi;if(f||i)return console.info(li),li;if(!r||!n)try{const v=await ie([{type:"select",name:"category",message:"Select the type of project:",choices:Object.keys(si).map(l=>({title:L(l),value:l}))}]);v.category||process.exit(0);const h=si[v.category],u=await ie({type:"select",name:"subcategory",message:`Select the technology for ${v.category}:`,choices:Object.keys(h).map(l=>({title:L(l),value:l}))});u.subcategory||process.exit(0);const o=h[u.subcategory],m=await ie({type:"select",name:"template",message:`Select the template for ${u.subcategory}:`,choices:o});m.template||process.exit(0);const d=await ie({type:"text",name:"appName",message:P.typescript("Enter your app name (or . for current directory)"),initial:"my-app",format:l=>Ns(l),validate:l=>Ls(l)});d.appName||process.exit(0),hi(m.template,d.appName)}catch(v){console.error(P.error(v.message))}else try{hi(r,n)}catch(v){console.error(P.error(v.message))}return 0};ai(Vs);export{ai as default};
|