nx-react-native-cli 3.0.2 → 3.0.3
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/lib/index.cjs +12 -12
- package/package.json +1 -1
- package/templates/19.7.0/apps/mobile/project.json +5 -5
- package/templates/21.2.2/apps/mobile/android/settings.gradle +10 -2
- package/templates/21.2.2/apps/mobile/project.json +5 -5
- package/templates/shared/apps/mobile/run-android.sh +16 -3
- package/templates/shared/apps/mobile/run-ios.sh +69 -60
- package/templates/shared/run-android.sh +4 -0
package/lib/index.cjs
CHANGED
|
@@ -38,7 +38,7 @@ Calls to async() callback can have unexpected results.`),p=!0,function(F,w){F?d(
|
|
|
38
38
|
`:`
|
|
39
39
|
`)+t,i=n+1,n=e.indexOf(`
|
|
40
40
|
`,i)}while(n!==-1);return u+=e.slice(i),u}var{stdout:Wl,stderr:Gl}=$l,Da=Symbol("GENERATOR"),ct=Symbol("STYLER"),En=Symbol("IS_EMPTY"),Hl=["ansi","ansi","ansi256","ansi16m"],lt=Object.create(null),x6=(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");let t=Wl?Wl.level:0;e.level=r.level===void 0?t:r.level};var d6=e=>{let r=(...t)=>t.join(" ");return x6(r,e),Object.setPrototypeOf(r,Fn.prototype),r};function Fn(e){return d6(e)}Object.setPrototypeOf(Fn.prototype,Function.prototype);for(let[e,r]of Object.entries(je))lt[e]={get(){let t=li(this,ma(r.open,r.close,this[ct]),this[En]);return Object.defineProperty(this,e,{value:t}),t}};lt.visible={get(){let e=li(this,this[ct],!0);return Object.defineProperty(this,"visible",{value:e}),e}};var ha=(e,r,t,...n)=>e==="rgb"?r==="ansi16m"?je[t].ansi16m(...n):r==="ansi256"?je[t].ansi256(je.rgbToAnsi256(...n)):je[t].ansi(je.rgbToAnsi(...n)):e==="hex"?ha("rgb",r,t,...je.hexToRgb(...n)):je[t][e](...n),p6=["rgb","hex","ansi256"];for(let e of p6){lt[e]={get(){let{level:t}=this;return function(...n){let i=ma(ha(e,Hl[t],"color",...n),je.color.close,this[ct]);return li(this,i,this[En])}}};let r="bg"+e[0].toUpperCase()+e.slice(1);lt[r]={get(){let{level:t}=this;return function(...n){let i=ma(ha(e,Hl[t],"bgColor",...n),je.bgColor.close,this[ct]);return li(this,i,this[En])}}}}var D6=Object.defineProperties(()=>{},{...lt,level:{enumerable:!0,get(){return this[Da].level},set(e){this[Da].level=e}}}),ma=(e,r,t)=>{let n,i;return t===void 0?(n=e,i=r):(n=t.openAll+e,i=r+t.closeAll),{open:e,close:r,openAll:n,closeAll:i,parent:t}},li=(e,r,t)=>{let n=(...i)=>h6(n,i.length===1?""+i[0]:i.join(" "));return Object.setPrototypeOf(n,D6),n[Da]=e,n[ct]=r,n[En]=t,n},h6=(e,r)=>{if(e.level<=0||!r)return e[En]?"":r;let t=e[ct];if(t===void 0)return r;let{openAll:n,closeAll:i}=t;if(r.includes("\x1B"))for(;t!==void 0;)r=Ul(r,t.close,t.open),t=t.parent;let u=r.indexOf(`
|
|
41
|
-
`);return u!==-1&&(r=Vl(r,i,n,u)),n+r+i};Object.defineProperties(Fn.prototype,lt);var m6=Fn(),JS=Fn({level:Gl?Gl.level:0});var z=m6;var Y1=require("child_process");var of=S(uf(),1),{program:yn,createCommand:uB,createArgument:oB,createOption:aB,CommanderError:sB,InvalidArgumentError:cB,InvalidOptionArgumentError:lB,Command:fB,Argument:xB,Option:dB,Help:pB}=of.default;var sr=e=>e.name==="up"||e.name==="k"||e.ctrl&&e.name==="p",ft=e=>e.name==="down"||e.name==="j"||e.ctrl&&e.name==="n",af=e=>e.name==="space",xt=e=>e.name==="backspace",di=e=>"123456789".includes(e.name),ue=e=>e.name==="enter"||e.name==="return";var pi=class extends Error{message="Prompt was canceled"},Di=class extends Error{},hi=class extends Error{},cr=class extends Error{};var Ma=require("node:async_hooks");var mi=require("node:async_hooks");var sf=new mi.AsyncLocalStorage;function P6(e){return{rl:e,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}function cf(e,r){let t=P6(e);return sf.run(t,()=>{r(t)})}function dt(){let e=sf.getStore();if(!e)throw new hi("[Inquirer] Hook functions can only be called from within a prompt");return e}function Pa(){return dt().rl}function ka(e){let r=(...t)=>{let n=dt(),i=!1,u=n.handleChange;n.handleChange=()=>{i=!0};let o=e(...t);return i&&u(),n.handleChange=u,o};return mi.AsyncResource.bind(r)}function pt(e){let r=dt(),{index:t}=r,n={get(){return r.hooks[t]},set(u){r.hooks[t]=u},initialized:t in r.hooks},i=e(n);return r.index++,i}function lf(){dt().handleChange()}var vi={queue(e){let r=dt(),{index:t}=r;r.hooksEffect.push(()=>{r.hooksCleanup[t]?.();let n=e(Pa());if(n!=null&&typeof n!="function")throw new cr("useEffect return value must be a cleanup function or nothing.");r.hooksCleanup[t]=n})},run(){let e=dt();ka(()=>{e.hooksEffect.forEach(r=>{r()}),e.hooksEffect.length=0})()}};function A(e){return pt(r=>{let t=i=>{r.get()!==i&&(r.set(i),lf())};if(r.initialized)return[r.get(),t];let n=typeof e=="function"?e():e;return r.set(n),[n,t]})}function Rr(e,r){pt(t=>{let n=t.get();(!Array.isArray(n)||r.some((u,o)=>!Object.is(u,n[o])))&&vi.queue(e),t.set(r)})}var Pe=S(Lr(),1),Ta=S(Ei(),1),Df={prefix:Pe.default.green("?"),spinner:{interval:Ta.default.dots.interval,frames:Ta.default.dots.frames.map(e=>Pe.default.yellow(e))},style:{answer:Pe.default.cyan,message:Pe.default.bold,error:e=>Pe.default.red(`> ${e}`),defaultAnswer:e=>Pe.default.dim(`(${e})`),help:Pe.default.dim,highlight:Pe.default.cyan,key:e=>Pe.default.cyan(Pe.default.bold(`<${e}>`))}};function hf(e){if(typeof e!="object"||e===null)return!1;let r=e;for(;Object.getPrototypeOf(r)!==null;)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(e)===r}function mf(...e){let r={};for(let t of e)for(let[n,i]of Object.entries(t)){let u=r[n];r[n]=hf(u)&&hf(i)?mf(u,i):i}return r}function J(...e){let r=[Df,...e.filter(t=>t!=null)];return mf(...r)}function
|
|
41
|
+
`);return u!==-1&&(r=Vl(r,i,n,u)),n+r+i};Object.defineProperties(Fn.prototype,lt);var m6=Fn(),JS=Fn({level:Gl?Gl.level:0});var z=m6;var Y1=require("child_process");var of=S(uf(),1),{program:yn,createCommand:uB,createArgument:oB,createOption:aB,CommanderError:sB,InvalidArgumentError:cB,InvalidOptionArgumentError:lB,Command:fB,Argument:xB,Option:dB,Help:pB}=of.default;var sr=e=>e.name==="up"||e.name==="k"||e.ctrl&&e.name==="p",ft=e=>e.name==="down"||e.name==="j"||e.ctrl&&e.name==="n",af=e=>e.name==="space",xt=e=>e.name==="backspace",di=e=>"123456789".includes(e.name),ue=e=>e.name==="enter"||e.name==="return";var pi=class extends Error{message="Prompt was canceled"},Di=class extends Error{},hi=class extends Error{},cr=class extends Error{};var Ma=require("node:async_hooks");var mi=require("node:async_hooks");var sf=new mi.AsyncLocalStorage;function P6(e){return{rl:e,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}function cf(e,r){let t=P6(e);return sf.run(t,()=>{r(t)})}function dt(){let e=sf.getStore();if(!e)throw new hi("[Inquirer] Hook functions can only be called from within a prompt");return e}function Pa(){return dt().rl}function ka(e){let r=(...t)=>{let n=dt(),i=!1,u=n.handleChange;n.handleChange=()=>{i=!0};let o=e(...t);return i&&u(),n.handleChange=u,o};return mi.AsyncResource.bind(r)}function pt(e){let r=dt(),{index:t}=r,n={get(){return r.hooks[t]},set(u){r.hooks[t]=u},initialized:t in r.hooks},i=e(n);return r.index++,i}function lf(){dt().handleChange()}var vi={queue(e){let r=dt(),{index:t}=r;r.hooksEffect.push(()=>{r.hooksCleanup[t]?.();let n=e(Pa());if(n!=null&&typeof n!="function")throw new cr("useEffect return value must be a cleanup function or nothing.");r.hooksCleanup[t]=n})},run(){let e=dt();ka(()=>{e.hooksEffect.forEach(r=>{r()}),e.hooksEffect.length=0})()}};function A(e){return pt(r=>{let t=i=>{r.get()!==i&&(r.set(i),lf())};if(r.initialized)return[r.get(),t];let n=typeof e=="function"?e():e;return r.set(n),[n,t]})}function Rr(e,r){pt(t=>{let n=t.get();(!Array.isArray(n)||r.some((u,o)=>!Object.is(u,n[o])))&&vi.queue(e),t.set(r)})}var Pe=S(Lr(),1),Ta=S(Ei(),1),Df={prefix:Pe.default.green("?"),spinner:{interval:Ta.default.dots.interval,frames:Ta.default.dots.frames.map(e=>Pe.default.yellow(e))},style:{answer:Pe.default.cyan,message:Pe.default.bold,error:e=>Pe.default.red(`> ${e}`),defaultAnswer:e=>Pe.default.dim(`(${e})`),help:Pe.default.dim,highlight:Pe.default.cyan,key:e=>Pe.default.cyan(Pe.default.bold(`<${e}>`))}};function hf(e){if(typeof e!="object"||e===null)return!1;let r=e;for(;Object.getPrototypeOf(r)!==null;)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(e)===r}function mf(...e){let r={};for(let t of e)for(let[n,i]of Object.entries(t)){let u=r[n];r[n]=hf(u)&&hf(i)?mf(u,i):i}return r}function J(...e){let r=[Df,...e.filter(t=>t!=null)];return mf(...r)}function ee({isLoading:e=!1,theme:r}){let[t,n]=A(!1),[i,u]=A(0),{prefix:o,spinner:a}=J(r);return Rr(()=>{if(e){let s,c=-1,f=setTimeout(Ma.AsyncResource.bind(()=>{n(!0),s=setInterval(Ma.AsyncResource.bind(()=>{c=c+1,u(c%a.frames.length)}),a.interval)}),300);return()=>{clearTimeout(f),clearInterval(s)}}else n(!1)},[e]),t?a.frames[i]:o}function Dt(e,r){return pt(t=>{let n=t.get();if(!n||n.dependencies.length!==r.length||n.dependencies.some((i,u)=>i!==r[u])){let i=e();return t.set({value:i,dependencies:r}),i}return n.value})}function $e(e){return A({current:e})[0]}function re(e){let r=$e(e);r.current=e,Rr(t=>{let n=ka((i,u)=>{r.current(u,t)});return t.input.on("keypress",n),()=>{t.input.removeListener("keypress",n)}},[])}var Hf=S(bf(),1),zf=S(Gf(),1);function wn(e,r){return e.split(`
|
|
42
42
|
`).flatMap(t=>(0,zf.default)(t,r,{trim:!1,hard:!0}).split(`
|
|
43
43
|
`).map(n=>n.trimEnd())).join(`
|
|
44
44
|
`)}function gi(){return(0,Hf.default)({defaultWidth:80,output:Pa().output})}function um(e,r){return wn(e,r).split(`
|
|
@@ -48,33 +48,33 @@ Calls to async() callback can have unexpected results.`),p=!0,function(F,w){F?d(
|
|
|
48
48
|
`).pop()??"",Sn=class{rl;height=0;extraLinesUnderPrompt=0;cursorPos;constructor(r){this.rl=r,this.rl=r,this.cursorPos=r.getCursorPos()}render(r,t=""){let n=lm(r),i=(0,rx.default)(n),u=i;this.rl.line.length>0&&(u=u.slice(0,-this.rl.line.length)),this.rl.setPrompt(u),this.cursorPos=this.rl.getCursorPos();let o=gi();r=wn(r,o),t=wn(t,o),i.length%o===0&&(r+=`
|
|
49
49
|
`);let a=r+(t?`
|
|
50
50
|
`+t:""),c=Math.floor(i.length/o)-this.cursorPos.rows+(t?ex(t):0);c>0&&(a+=lr.default.cursorUp(c)),a+=lr.default.cursorTo(this.cursorPos.cols),this.clean(),this.rl.output.unmute(),this.extraLinesUnderPrompt=c,this.height=ex(a),this.rl.output.write(a),this.rl.output.mute()}checkCursorPos(){let r=this.rl.getCursorPos();r.cols!==this.cursorPos.cols&&(this.rl.output.unmute(),this.rl.output.write(lr.default.cursorTo(r.cols)),this.rl.output.mute(),this.cursorPos=r)}clean(){this.rl.output.unmute(),this.rl.output.write([this.extraLinesUnderPrompt>0?lr.default.cursorDown(this.extraLinesUnderPrompt):"",lr.default.eraseLines(this.height)].join("")),this.extraLinesUnderPrompt=0,this.rl.output.mute()}clearContent(){this.rl.output.unmute(),this.rl.output.write([this.extraLinesUnderPrompt>0?lr.default.cursorDown(this.extraLinesUnderPrompt):"",`
|
|
51
|
-
`].join("")),this.rl.output.mute()}done(){this.rl.setPrompt(""),this.rl.output.unmute(),this.rl.output.write(lr.default.cursorShow),this.rl.output.end(),this.rl.close()}};function re(e){return(t,n)=>{let i=n?.input??process.stdin,u=new nx.default;u.pipe(n?.output??process.stdout);let o=tx.createInterface({terminal:!0,input:i,output:u}),a=new Sn(o),s=()=>{},c=new Ci((f,d)=>{cf(o,p=>{function D(){a.checkCursorPos()}let h=Qf((F,w)=>{m(),d(new Di(`User force closed the prompt with ${F} ${w}`))});function m(){try{p.hooksCleanup.forEach(F=>{F?.()})}catch(F){d(F)}n?.clearPromptOnDone?a.clean():a.clearContent(),a.done(),h(),p.rl.input.removeListener("keypress",D)}s=()=>{m(),d(new pi)};function v(F){setImmediate(()=>{m(),f(F)})}function b(){p.index=0;try{let F=e(t,v),[w,T]=typeof F=="string"?[F]:F;a.render(w,T),vi.run()}catch(F){m(),d(F)}}p.handleChange=()=>b(),b(),p.rl.input.on("keypress",D)})});return c.cancel=s,c}}var ox=S(Lr(),1);var ke=S(require("node:process"),1);function fm(){return ke.default.platform!=="win32"?ke.default.env.TERM!=="linux":!!ke.default.env.WT_SESSION||!!ke.default.env.TERMINUS_SUBLIME||ke.default.env.ConEmuTask==="{cmd::Cmder}"||ke.default.env.TERM_PROGRAM==="Terminus-Sublime"||ke.default.env.TERM_PROGRAM==="vscode"||ke.default.env.TERM==="xterm-256color"||ke.default.env.TERM==="alacritty"||ke.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var ix={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},ux={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},xm={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},dm={...ix,...ux},pm={...ix,...xm},Dm=fm(),hm=Dm?dm:pm,fr=hm,wq=Object.entries(ux);var se=class{separator=ox.default.dim(Array.from({length:15}).join(fr.line));type="separator";constructor(r){r&&(this.separator=r)}static isSeparator(r){return!!(r&&r.type==="separator")}};var rs=S(Lr(),1);var ax=S(Et(),1),mm={icon:{checked:rs.default.green(fr.circleFilled),unchecked:fr.circle,cursor:fr.pointer},style:{disabledChoice:e=>rs.default.dim(`- ${e}`),renderSelectedChoices:e=>e.map(r=>r.name||r.value).join(", ")},helpMode:"auto"};function xr(e){return!se.isSeparator(e)&&!e.disabled}function Za(e){return xr(e)&&!!e.checked}function es(e){return xr(e)?{...e,checked:!e.checked}:e}function vm(e){return function(r){return xr(r)?{...r,checked:e}:r}}var ts=re((e,r)=>{let{instructions:t,pageSize:n=7,loop:i=!0,choices:u,required:o,validate:a=()=>!0}=e,s=J(mm,e.theme),c=Z({theme:s}),f=$e(!0),[d,p]=A("pending"),[D,h]=A(u.map(M=>({...M}))),m=Dt(()=>{let M=D.findIndex(xr),Q=D.findLastIndex(xr);if(M<0)throw new cr("[checkbox prompt] No selectable choices. All choices are disabled.");return{first:M,last:Q}},[D]),[v,b]=A(m.first),[F,w]=A(!0),[T,C]=A();ee(async M=>{if(ue(M)){let Q=D.filter(Za),ie=await a([...Q]);o&&!D.some(Za)?C("At least one choice must be selected"):ie===!0?(p("done"),r(Q.map(st=>st.value))):C(ie||"You must select a valid value")}else if(sr(M)||ft(M)){if(i||sr(M)&&v!==m.first||ft(M)&&v!==m.last){let Q=sr(M)?-1:1,ie=v;do ie=(ie+Q+D.length)%D.length;while(!xr(D[ie]));b(ie)}}else if(af(M))C(void 0),w(!1),h(D.map((Q,ie)=>ie===v?es(Q):Q));else if(M.name==="a"){let Q=D.some(ie=>xr(ie)&&!ie.checked);h(D.map(vm(Q)))}else if(M.name==="i")h(D.map(es));else if(di(M)){let Q=Number(M.name)-1,ie=D[Q];ie!=null&&xr(ie)&&(b(Q),h(D.map((st,xa)=>xa===Q?es(st):st)))}});let O=s.style.message(e.message),$=An({items:D,active:v,renderItem({item:M,isActive:Q}){if(se.isSeparator(M))return` ${M.separator}`;let ie=M.name||M.value;if(M.disabled){let da=typeof M.disabled=="string"?M.disabled:"(disabled)";return s.style.disabledChoice(`${ie} ${da}`)}let st=M.checked?s.icon.checked:s.icon.unchecked,xa=Q?s.style.highlight:da=>da,X1=Q?s.icon.cursor:" ";return xa(`${X1}${st} ${ie}`)},pageSize:n,loop:i});if(d==="done"){let M=D.filter(Za),Q=s.style.answer(s.style.renderSelectedChoices(M,D));return`${c} ${O} ${Q}`}let U="",De="";(s.helpMode==="always"||s.helpMode==="auto"&&F&&(t===void 0||t))&&(typeof t=="string"?U=t:U=` (Press ${[`${s.style.key("space")} to select`,`${s.style.key("a")} to toggle all`,`${s.style.key("i")} to invert selection`,`and ${s.style.key("enter")} to proceed`].join(", ")})`,D.length>n&&(s.helpMode==="always"||s.helpMode==="auto"&&f.current)&&(De=`
|
|
51
|
+
`].join("")),this.rl.output.mute()}done(){this.rl.setPrompt(""),this.rl.output.unmute(),this.rl.output.write(lr.default.cursorShow),this.rl.output.end(),this.rl.close()}};function te(e){return(t,n)=>{let i=n?.input??process.stdin,u=new nx.default;u.pipe(n?.output??process.stdout);let o=tx.createInterface({terminal:!0,input:i,output:u}),a=new Sn(o),s=()=>{},c=new Ci((f,d)=>{cf(o,p=>{function D(){a.checkCursorPos()}let h=Qf((F,w)=>{m(),d(new Di(`User force closed the prompt with ${F} ${w}`))});function m(){try{p.hooksCleanup.forEach(F=>{F?.()})}catch(F){d(F)}n?.clearPromptOnDone?a.clean():a.clearContent(),a.done(),h(),p.rl.input.removeListener("keypress",D)}s=()=>{m(),d(new pi)};function v(F){setImmediate(()=>{m(),f(F)})}function b(){p.index=0;try{let F=e(t,v),[w,T]=typeof F=="string"?[F]:F;a.render(w,T),vi.run()}catch(F){m(),d(F)}}p.handleChange=()=>b(),b(),p.rl.input.on("keypress",D)})});return c.cancel=s,c}}var ox=S(Lr(),1);var ke=S(require("node:process"),1);function fm(){return ke.default.platform!=="win32"?ke.default.env.TERM!=="linux":!!ke.default.env.WT_SESSION||!!ke.default.env.TERMINUS_SUBLIME||ke.default.env.ConEmuTask==="{cmd::Cmder}"||ke.default.env.TERM_PROGRAM==="Terminus-Sublime"||ke.default.env.TERM_PROGRAM==="vscode"||ke.default.env.TERM==="xterm-256color"||ke.default.env.TERM==="alacritty"||ke.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var ix={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},ux={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},xm={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},dm={...ix,...ux},pm={...ix,...xm},Dm=fm(),hm=Dm?dm:pm,fr=hm,wq=Object.entries(ux);var se=class{separator=ox.default.dim(Array.from({length:15}).join(fr.line));type="separator";constructor(r){r&&(this.separator=r)}static isSeparator(r){return!!(r&&r.type==="separator")}};var rs=S(Lr(),1);var ax=S(Et(),1),mm={icon:{checked:rs.default.green(fr.circleFilled),unchecked:fr.circle,cursor:fr.pointer},style:{disabledChoice:e=>rs.default.dim(`- ${e}`),renderSelectedChoices:e=>e.map(r=>r.name||r.value).join(", ")},helpMode:"auto"};function xr(e){return!se.isSeparator(e)&&!e.disabled}function Za(e){return xr(e)&&!!e.checked}function es(e){return xr(e)?{...e,checked:!e.checked}:e}function vm(e){return function(r){return xr(r)?{...r,checked:e}:r}}var ts=te((e,r)=>{let{instructions:t,pageSize:n=7,loop:i=!0,choices:u,required:o,validate:a=()=>!0}=e,s=J(mm,e.theme),c=ee({theme:s}),f=$e(!0),[d,p]=A("pending"),[D,h]=A(u.map(M=>({...M}))),m=Dt(()=>{let M=D.findIndex(xr),Z=D.findLastIndex(xr);if(M<0)throw new cr("[checkbox prompt] No selectable choices. All choices are disabled.");return{first:M,last:Z}},[D]),[v,b]=A(m.first),[F,w]=A(!0),[T,C]=A();re(async M=>{if(ue(M)){let Z=D.filter(Za),ie=await a([...Z]);o&&!D.some(Za)?C("At least one choice must be selected"):ie===!0?(p("done"),r(Z.map(st=>st.value))):C(ie||"You must select a valid value")}else if(sr(M)||ft(M)){if(i||sr(M)&&v!==m.first||ft(M)&&v!==m.last){let Z=sr(M)?-1:1,ie=v;do ie=(ie+Z+D.length)%D.length;while(!xr(D[ie]));b(ie)}}else if(af(M))C(void 0),w(!1),h(D.map((Z,ie)=>ie===v?es(Z):Z));else if(M.name==="a"){let Z=D.some(ie=>xr(ie)&&!ie.checked);h(D.map(vm(Z)))}else if(M.name==="i")h(D.map(es));else if(di(M)){let Z=Number(M.name)-1,ie=D[Z];ie!=null&&xr(ie)&&(b(Z),h(D.map((st,xa)=>xa===Z?es(st):st)))}});let O=s.style.message(e.message),$=An({items:D,active:v,renderItem({item:M,isActive:Z}){if(se.isSeparator(M))return` ${M.separator}`;let ie=M.name||M.value;if(M.disabled){let da=typeof M.disabled=="string"?M.disabled:"(disabled)";return s.style.disabledChoice(`${ie} ${da}`)}let st=M.checked?s.icon.checked:s.icon.unchecked,xa=Z?s.style.highlight:da=>da,X1=Z?s.icon.cursor:" ";return xa(`${X1}${st} ${ie}`)},pageSize:n,loop:i});if(d==="done"){let M=D.filter(Za),Z=s.style.answer(s.style.renderSelectedChoices(M,D));return`${c} ${O} ${Z}`}let U="",De="";(s.helpMode==="always"||s.helpMode==="auto"&&F&&(t===void 0||t))&&(typeof t=="string"?U=t:U=` (Press ${[`${s.style.key("space")} to select`,`${s.style.key("a")} to toggle all`,`${s.style.key("i")} to invert selection`,`and ${s.style.key("enter")} to proceed`].join(", ")})`,D.length>n&&(s.helpMode==="always"||s.helpMode==="auto"&&f.current)&&(De=`
|
|
52
52
|
${s.style.help("(Use arrow keys to reveal more choices)")}`,f.current=!1));let ae="";return T&&(ae=`
|
|
53
53
|
${s.style.error(T)}`),`${c} ${O}${U}
|
|
54
|
-
${$}${De}${ae}${ax.default.cursorHide}`});var k2=require("node:async_hooks"),T2=S(P2(),1);var Gs=
|
|
54
|
+
${$}${De}${ae}${ax.default.cursorHide}`});var k2=require("node:async_hooks"),T2=S(P2(),1);var Gs=te((e,r)=>{let{waitForUseInput:t=!0,validate:n=()=>!0}=e,i=J(e.theme),[u,o]=A("pending"),[a,s]=A(e.default||""),[c,f]=A(),p=ee({isLoading:u==="loading",theme:i});function D(b){b.pause(),(0,T2.editAsync)(a,k2.AsyncResource.bind(async(F,w)=>{if(b.resume(),F)f(F.toString());else{o("loading");let T=await n(w);T===!0?(f(void 0),o("done"),r(w)):(s(w),f(T||"You must provide a valid value"),o("pending"))}}),{postfix:e.postfix||".txt"})}Rr(b=>{t||D(b)},[]),re((b,F)=>{u==="pending"&&ue(b)&&D(F)});let h=i.style.message(e.message),m="";if(u==="loading")m=i.style.help("Received");else if(u==="pending"){let b=i.style.key("enter");m=i.style.help(`Press ${b} to launch your preferred editor.`)}let v="";return c&&(v=i.style.error(c)),[[p,h,m].filter(Boolean).join(" "),v]});var Hs=te((e,r)=>{let{transformer:t=p=>p?"yes":"no"}=e,[n,i]=A("pending"),[u,o]=A(""),a=J(e.theme),s=ee({theme:a});re((p,D)=>{if(ue(p)){let h=e.default!==!1;/^(y|yes)/i.test(u)?h=!0:/^(n|no)/i.test(u)&&(h=!1),o(t(h)),i("done"),r(h)}else o(D.line)});let c=u,f="";n==="done"?c=a.style.answer(u):f=` ${a.style.defaultAnswer(e.default===!1?"y/N":"Y/n")}`;let d=a.style.message(e.message);return`${s} ${d}${f} ${c}`});var zs=te((e,r)=>{let{required:t,validate:n=()=>!0}=e,i=J(e.theme),[u,o]=A("pending"),[a="",s]=A(e.default),[c,f]=A(),[d,p]=A(""),h=ee({isLoading:u==="loading",theme:i});re(async(w,T)=>{if(u==="pending")if(ue(w)){let C=d||a;o("loading");let O=t&&!C?"You must provide a value":await n(C);O===!0?(p(C),o("done"),r(C)):(T.write(d),f(O||"You must provide a valid value"),o("pending"))}else xt(w)&&!d?s(void 0):w.name==="tab"&&!d?(s(void 0),T.clearLine(0),T.write(a),p(a)):(p(T.line),f(void 0))});let m=i.style.message(e.message),v=d;typeof e.transformer=="function"?v=e.transformer(d,{isFinal:u==="done"}):u==="done"&&(v=i.style.answer(d));let b;a&&u!=="done"&&!d&&(b=i.style.defaultAnswer(a));let F="";return c&&(F=i.style.error(c)),[[h,m,b,v].filter(w=>w!==void 0).join(" "),F]});function M2(e,{min:r,max:t,step:n}){return e==null||Number.isNaN(e)?!1:e<r||e>t?`Value must be between ${r} and ${t}`:n!=="any"&&(e-(Number.isFinite(r)?r:0))%n!==0?`Value must be a multiple of ${n}${Number.isFinite(r)?` starting from ${r}`:""}`:!0}var Ks=te((e,r)=>{let{validate:t=()=>!0,min:n=-1/0,max:i=1/0,step:u=1,required:o=!1}=e,a=J(e.theme),[s,c]=A("pending"),[f,d]=A(""),p=M2(e.default,{min:n,max:i,step:u})===!0?e.default?.toString():void 0,[D="",h]=A(p),[m,v]=A(),F=ee({isLoading:s==="loading",theme:a});re(async($,U)=>{if(s==="pending")if(ue($)){let De=f||D,ae=De===""?void 0:Number(De);c("loading");let M=!0;(o||ae!=null)&&(M=M2(ae,{min:n,max:i,step:u})),M===!0&&(M=await t(ae)),M===!0?(d(String(ae??"")),c("done"),r(ae)):(U.write(f),v(M||"You must provide a valid numeric value"),c("pending"))}else xt($)&&!f?h(void 0):$.name==="tab"&&!f?(h(void 0),U.clearLine(0),U.write(D),d(D)):(d(U.line),v(void 0))});let w=a.style.message(e.message),T=f;s==="done"&&(T=a.style.answer(f));let C;D&&s!=="done"&&!f&&(C=a.style.defaultAnswer(D));let O="";return m&&(O=a.style.error(m)),[[F,w,C,T].filter($=>$!==void 0).join(" "),O]});var Js=S(Lr(),1),ov={key:"h",name:"Help, list all options",value:void 0};function Ys(e,r){return r==="name"?"name"in e?e.name:e.value:"value"in e?e.value:e.name}var Xs=te((e,r)=>{let{choices:t,default:n="h",expanded:i=!1}=e,[u,o]=A("pending"),[a,s]=A(""),[c,f]=A(i),[d,p]=A(),D=J(e.theme),h=ee({theme:D});re((O,$)=>{if(ue(O)){let U=(a||n).toLowerCase();if(U==="h"&&!c)f(!0);else{let De=t.find(({key:ae})=>ae===U);if(De){let ae=Ys(De,"value");s(ae),o("done"),r(ae)}else p(a===""?"Please input a value":`"${Js.default.red(a)}" isn't an available option`)}}else s($.line),p(void 0)});let m=D.style.message(e.message);if(u==="done")return`${h} ${m} ${D.style.answer(a)}`;let v=c?t:[...t,ov],b="",F=v.map(O=>O.key===n?O.key.toUpperCase():O.key).join("");F=` ${D.style.defaultAnswer(F)}`,c&&(F="",b=v.map(O=>{let $=` ${O.key}) ${Ys(O,"name")}`;return O.key===a.toLowerCase()?D.style.highlight($):$}).join(`
|
|
55
55
|
`));let w="",T=v.find(({key:O})=>O===a.toLowerCase());T&&(w=`${Js.default.cyan(">>")} ${Ys(T,"name")}`);let C="";return d&&(C=D.style.error(d)),[`${h} ${m}${F} ${a}`,[b,w,C].filter(Boolean).join(`
|
|
56
|
-
`)]});var I2=S(Lr(),1);var av=/\d+/;function Qs(e){return e!=null&&!se.isSeparator(e)}var Zs=
|
|
56
|
+
`)]});var I2=S(Lr(),1);var av=/\d+/;function Qs(e){return e!=null&&!se.isSeparator(e)}var Zs=te((e,r)=>{let{choices:t}=e,[n,i]=A("pending"),[u,o]=A(""),[a,s]=A(),c=J(e.theme),f=ee({theme:c});re((m,v)=>{if(ue(m)){let b;if(av.test(u)){let F=Number.parseInt(u,10)-1;b=t.filter(Qs)[F]}else{let F=u.toLowerCase();b=t.find(w=>Qs(w)&&w.key===F)}Qs(b)?(o(b.name||String(b.value)),i("done"),r(b.value)):s(u===""?"Please input a value":`"${I2.default.red(u)}" isn't an available option`)}else o(v.line),s(void 0)});let d=c.style.message(e.message);if(n==="done")return`${f} ${d} ${c.style.answer(u)}`;let p=0,D=t.map(m=>{if(se.isSeparator(m))return` ${m.separator}`;p+=1;let v=` ${m.key||p}) ${m.name||m.value}`;return m.key===u.toLowerCase()||String(p)===u?c.style.highlight(v):v}).join(`
|
|
57
57
|
`),h="";return a&&(h=c.style.error(a)),[`${f} ${d} ${u}`,[D,h].filter(Boolean).join(`
|
|
58
|
-
`)]});var R2=S(Et(),1),ec=
|
|
58
|
+
`)]});var R2=S(Et(),1),ec=te((e,r)=>{let{validate:t=()=>!0}=e,n=J(e.theme),[i,u]=A("pending"),[o,a]=A(),[s,c]=A(""),d=ee({isLoading:i==="loading",theme:n});re(async(v,b)=>{if(i==="pending")if(ue(v)){let F=s;u("loading");let w=await t(F);w===!0?(c(F),u("done"),r(F)):(b.write(s),a(w||"You must provide a valid value"),u("pending"))}else c(b.line),a(void 0)});let p=n.style.message(e.message),D="",h;e.mask?D=(typeof e.mask=="string"?e.mask:"*").repeat(s.length):i!=="done"&&(h=`${n.style.help("[input is masked]")}${R2.default.cursorHide}`),i==="done"&&(D=n.style.answer(D));let m="";return o&&(m=n.style.error(o)),[[d,p,e.mask?D:h].join(" "),m]});var L2=S(Lr(),1);var N2=S(Et(),1);var sv={icon:{cursor:fr.pointer},style:{disabled:e=>L2.default.dim(`- ${e}`)},helpMode:"auto"};function Bt(e){return!se.isSeparator(e)&&!e.disabled}var zi=te((e,r)=>{let{choices:t,loop:n=!0,pageSize:i=7}=e,u=$e(!0),o=J(sv,e.theme),a=ee({theme:o}),[s,c]=A("pending"),f=$e(),d=Dt(()=>{let C=t.findIndex(Bt),O=t.findLastIndex(Bt);if(C<0)throw new cr("[select prompt] No selectable choices. All choices are disabled.");return{first:C,last:O}},[t]),p=Dt(()=>"default"in e?t.findIndex(C=>Bt(C)&&C.value===e.default):-1,[e.default,t]),[D,h]=A(p===-1?d.first:p),m=t[D];re((C,O)=>{if(clearTimeout(f.current),ue(C))c("done"),r(m.value);else if(sr(C)||ft(C)){if(O.clearLine(0),n||sr(C)&&D!==d.first||ft(C)&&D!==d.last){let $=sr(C)?-1:1,U=D;do U=(U+$+t.length)%t.length;while(!Bt(t[U]));h(U)}}else if(di(C)){O.clearLine(0);let $=Number(C.name)-1,U=t[$];U!=null&&Bt(U)&&h($)}else if(xt(C))O.clearLine(0);else{let $=O.line.toLowerCase(),U=t.findIndex(De=>se.isSeparator(De)||!Bt(De)?!1:String(De.name||De.value).toLowerCase().startsWith($));U>=0&&h(U),f.current=setTimeout(()=>{O.clearLine(0)},700)}});let v=o.style.message(e.message),b="",F="";(o.helpMode==="always"||o.helpMode==="auto"&&u.current)&&(u.current=!1,t.length>i?F=`
|
|
59
59
|
${o.style.help("(Use arrow keys to reveal more choices)")}`:b=o.style.help("(Use arrow keys)"));let w=An({items:t,active:D,renderItem({item:C,isActive:O}){if(se.isSeparator(C))return` ${C.separator}`;let $=C.name||C.value;if(C.disabled){let ae=typeof C.disabled=="string"?C.disabled:"(disabled)";return o.style.disabled(`${$} ${ae}`)}let U=O?o.style.highlight:ae=>ae,De=O?o.icon.cursor:" ";return U(`${De} ${$}`)},pageSize:i,loop:n});if(s==="done"){let C=m.name||String(m.value);return`${a} ${v} ${o.style.answer(C)}`}let T=m.description?`
|
|
60
60
|
${m.description}`:"";return`${[a,v,b].filter(Boolean).join(" ")}
|
|
61
61
|
${w}${T}${F}${N2.default.cursorHide}`});var b1=S(require("node:readline"),1),P=S(d1(),1),ml=S(m1(),1),E1=S(Ga(),1),F1=S(Et(),1),v1={set:(e,r="",t)=>{let n=e;r.split(".").forEach((i,u,o)=>{i==="__proto__"||i==="constructor"||(u===o.length-1?n[i]=t:i in n||(n[i]={}),n=n[i])})},get:(e,r="",t)=>{let n=u=>String.prototype.split.call(r,u).filter(Boolean).reduce((o,a)=>o!=null?o[a]:o,e),i=n(/[,[\]]+?/)||n(/[,.[\]]+?/);return i===void 0||i===e?t:i}};function Dl(e,r,t){if(r in e){let n=e[r];if(typeof n=="function")return(0,P.from)((0,ml.default)(n)(t).then(i=>Object.assign(e,{[r]:i})))}return(0,P.of)(e)}var hl=class extends Error{isTtyError=!0};function ES(e={}){e.skipTTYChecks=e.skipTTYChecks===void 0?!0:e.skipTTYChecks;let r=e.input||process.stdin;if(!e.skipTTYChecks&&!r.isTTY)throw new hl("Prompts can not be meaningfully rendered in non-TTY environments");let t=new E1.default;return t.pipe(e.output||process.stdout),{terminal:!0,...e,input:r,output:t}}function FS(e){return Object.values(e).every(r=>typeof r=="object"&&!Array.isArray(r)&&r!=null)}function _S(e){return e.prototype&&"run"in e.prototype&&typeof e.prototype.run=="function"}var Dn=class{prompts;answers={};process=P.EMPTY;onClose;opt;rl;constructor(r,t){this.opt=t,this.prompts=r}run(r,t){this.answers=typeof t=="object"?{...t}:{};let n;Array.isArray(r)?n=(0,P.from)(r):(0,P.isObservable)(r)?n=r:FS(r)?n=(0,P.from)(Object.entries(r).map(([u,o])=>Object.assign({},o,{name:u}))):n=(0,P.from)([r]),this.process=n.pipe((0,P.concatMap)(u=>this.processQuestion(u)));let i=(0,P.lastValueFrom)(this.process.pipe((0,P.reduce)((u,o)=>(v1.set(u,o.name,o.answer),u),this.answers))).then(()=>this.onCompletion(),u=>this.onError(u));return Object.assign(i,{ui:this})}onCompletion(){return this.close(),this.answers}onError(r){return this.close(),Promise.reject(r)}processQuestion(r){return r={...r},(0,P.defer)(()=>(0,P.of)(r).pipe((0,P.concatMap)(this.setDefaultType),(0,P.concatMap)(this.filterIfRunnable),(0,P.concatMap)(n=>Dl(n,"message",this.answers)),(0,P.concatMap)(n=>Dl(n,"default",this.answers)),(0,P.concatMap)(n=>Dl(n,"choices",this.answers)),(0,P.concatMap)(n=>("choices"in n&&(n.choices=n.choices.map(i=>typeof i=="string"?{name:i,value:i}:i)),(0,P.of)(n))),(0,P.concatMap)(n=>this.fetchAnswer(n))))}fetchAnswer(r){let t=this.prompts[r.type];if(t==null)throw new Error(`Prompt for type ${r.type} not found`);return _S(t)?(0,P.defer)(()=>{let n=b1.default.createInterface(ES(this.opt));n.resume();let i=()=>{n.removeListener("SIGINT",this.onForceClose),n.setPrompt(""),n.output.unmute(),n.output.write(F1.default.cursorShow),n.output.end(),n.close()};this.onClose=i,this.rl=n,process.on("exit",this.onForceClose),n.on("SIGINT",this.onForceClose);let u=new t(r,n,this.answers);return(0,P.from)(u.run().then(o=>(i(),this.onClose=void 0,this.rl=void 0,{name:r.name,answer:o})))}):(0,P.defer)(()=>(0,P.from)(t(r,this.opt).then(n=>({name:r.name,answer:n}))))}onForceClose=()=>{this.close(),process.kill(process.pid,"SIGINT"),console.log("")};close=()=>{process.removeListener("exit",this.onForceClose),typeof this.onClose=="function"&&this.onClose()};setDefaultType=r=>(this.prompts[r.type]||(r.type="input"),(0,P.defer)(()=>(0,P.of)(r)));filterIfRunnable=r=>{if(r.askAnswered!==!0&&v1.get(this.answers,r.name)!==void 0)return P.EMPTY;let{when:t}=r;return t===!1?P.EMPTY:typeof t!="function"?(0,P.of)(r):(0,P.defer)(()=>(0,P.from)((0,ml.default)(t)(this.answers).then(n=>{if(n)return r})).pipe((0,P.filter)(n=>n!=null)))}};var _1={input:zs,select:zi,list:zi,number:Ks,confirm:Hs,rawlist:Zs,expand:Xs,checkbox:ts,password:ec,editor:Gs};function y1(e){function r(t,n){let i=new Dn(r.prompts,e);try{return i.run(t,n)}catch(u){let o=Promise.reject(u);return Object.assign(o,{ui:i})}}return r.prompts={..._1},r.registerPrompt=function(t,n){return r.prompts[t]=n,this},r.restoreDefaultPrompts=function(){r.prompts={..._1}},r}var vl=y1();function yS(e,r){vl.registerPrompt(e,r)}function gS(){vl.restoreDefaultPrompts()}var CS={prompt:vl,ui:{Prompt:Dn},createPromptModule:y1,registerPrompt:yS,restoreDefaultPrompts:gS,Separator:se},ri=CS;var ui=S(require("node:process"),1);var _l=S(require("node:process"),1);var k1=S(require("node:process"),1),T1=S(A1(),1),M1=S(P1(),1),AS=(0,T1.default)(()=>{(0,M1.default)(()=>{k1.default.stderr.write("\x1B[?25h")},{alwaysLast:!0})}),I1=AS;var la=!1,bn={};bn.show=(e=_l.default.stderr)=>{e.isTTY&&(la=!1,e.write("\x1B[?25h"))};bn.hide=(e=_l.default.stderr)=>{e.isTTY&&(I1(),la=!0,e.write("\x1B[?25l"))};bn.toggle=(e,r)=>{e!==void 0&&(la=e),la?bn.show(r):bn.hide(r)};var yl=bn;var oi=S(Ei(),1);var Be=S(require("node:process"),1);function gl(){return Be.default.platform!=="win32"?Be.default.env.TERM!=="linux":!!Be.default.env.CI||!!Be.default.env.WT_SESSION||!!Be.default.env.TERMINUS_SUBLIME||Be.default.env.ConEmuTask==="{cmd::Cmder}"||Be.default.env.TERM_PROGRAM==="Terminus-Sublime"||Be.default.env.TERM_PROGRAM==="vscode"||Be.default.env.TERM==="xterm-256color"||Be.default.env.TERM==="alacritty"||Be.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var OS={info:z.blue("\u2139"),success:z.green("\u2714"),warning:z.yellow("\u26A0"),error:z.red("\u2716")},SS={info:z.blue("i"),success:z.green("\u221A"),warning:z.yellow("\u203C"),error:z.red("\xD7")},BS=gl()?OS:SS,ni=BS;function Cl({onlyFirst:e=!1}={}){let r=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(r,e?void 0:"g")}var qS=Cl();function ii(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(qS,"")}function R1(e){return e===161||e===164||e===167||e===168||e===170||e===173||e===174||e>=176&&e<=180||e>=182&&e<=186||e>=188&&e<=191||e===198||e===208||e===215||e===216||e>=222&&e<=225||e===230||e>=232&&e<=234||e===236||e===237||e===240||e===242||e===243||e>=247&&e<=250||e===252||e===254||e===257||e===273||e===275||e===283||e===294||e===295||e===299||e>=305&&e<=307||e===312||e>=319&&e<=322||e===324||e>=328&&e<=331||e===333||e===338||e===339||e===358||e===359||e===363||e===462||e===464||e===466||e===468||e===470||e===472||e===474||e===476||e===593||e===609||e===708||e===711||e>=713&&e<=715||e===717||e===720||e>=728&&e<=731||e===733||e===735||e>=768&&e<=879||e>=913&&e<=929||e>=931&&e<=937||e>=945&&e<=961||e>=963&&e<=969||e===1025||e>=1040&&e<=1103||e===1105||e===8208||e>=8211&&e<=8214||e===8216||e===8217||e===8220||e===8221||e>=8224&&e<=8226||e>=8228&&e<=8231||e===8240||e===8242||e===8243||e===8245||e===8251||e===8254||e===8308||e===8319||e>=8321&&e<=8324||e===8364||e===8451||e===8453||e===8457||e===8467||e===8470||e===8481||e===8482||e===8486||e===8491||e===8531||e===8532||e>=8539&&e<=8542||e>=8544&&e<=8555||e>=8560&&e<=8569||e===8585||e>=8592&&e<=8601||e===8632||e===8633||e===8658||e===8660||e===8679||e===8704||e===8706||e===8707||e===8711||e===8712||e===8715||e===8719||e===8721||e===8725||e===8730||e>=8733&&e<=8736||e===8739||e===8741||e>=8743&&e<=8748||e===8750||e>=8756&&e<=8759||e===8764||e===8765||e===8776||e===8780||e===8786||e===8800||e===8801||e>=8804&&e<=8807||e===8810||e===8811||e===8814||e===8815||e===8834||e===8835||e===8838||e===8839||e===8853||e===8857||e===8869||e===8895||e===8978||e>=9312&&e<=9449||e>=9451&&e<=9547||e>=9552&&e<=9587||e>=9600&&e<=9615||e>=9618&&e<=9621||e===9632||e===9633||e>=9635&&e<=9641||e===9650||e===9651||e===9654||e===9655||e===9660||e===9661||e===9664||e===9665||e>=9670&&e<=9672||e===9675||e>=9678&&e<=9681||e>=9698&&e<=9701||e===9711||e===9733||e===9734||e===9737||e===9742||e===9743||e===9756||e===9758||e===9792||e===9794||e===9824||e===9825||e>=9827&&e<=9829||e>=9831&&e<=9834||e===9836||e===9837||e===9839||e===9886||e===9887||e===9919||e>=9926&&e<=9933||e>=9935&&e<=9939||e>=9941&&e<=9953||e===9955||e===9960||e===9961||e>=9963&&e<=9969||e===9972||e>=9974&&e<=9977||e===9979||e===9980||e===9982||e===9983||e===10045||e>=10102&&e<=10111||e>=11094&&e<=11097||e>=12872&&e<=12879||e>=57344&&e<=63743||e>=65024&&e<=65039||e===65533||e>=127232&&e<=127242||e>=127248&&e<=127277||e>=127280&&e<=127337||e>=127344&&e<=127373||e===127375||e===127376||e>=127387&&e<=127404||e>=917760&&e<=917999||e>=983040&&e<=1048573||e>=1048576&&e<=1114109}function L1(e){return e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510}function N1(e){return e>=4352&&e<=4447||e===8986||e===8987||e===9001||e===9002||e>=9193&&e<=9196||e===9200||e===9203||e===9725||e===9726||e===9748||e===9749||e>=9800&&e<=9811||e===9855||e===9875||e===9889||e===9898||e===9899||e===9917||e===9918||e===9924||e===9925||e===9934||e===9940||e===9962||e===9970||e===9971||e===9973||e===9978||e===9981||e===9989||e===9994||e===9995||e===10024||e===10060||e===10062||e>=10067&&e<=10069||e===10071||e>=10133&&e<=10135||e===10160||e===10175||e===11035||e===11036||e===11088||e===11093||e>=11904&&e<=11929||e>=11931&&e<=12019||e>=12032&&e<=12245||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12353&&e<=12438||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=19968&&e<=42124||e>=42128&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=94176&&e<=94180||e===94192||e===94193||e>=94208&&e<=100343||e>=100352&&e<=101589||e>=101632&&e<=101640||e>=110576&&e<=110579||e>=110581&&e<=110587||e===110589||e===110590||e>=110592&&e<=110882||e===110898||e>=110928&&e<=110930||e===110933||e>=110948&&e<=110951||e>=110960&&e<=111355||e===126980||e===127183||e===127374||e>=127377&&e<=127386||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e===127568||e===127569||e>=127584&&e<=127589||e>=127744&&e<=127776||e>=127789&&e<=127797||e>=127799&&e<=127868||e>=127870&&e<=127891||e>=127904&&e<=127946||e>=127951&&e<=127955||e>=127968&&e<=127984||e===127988||e>=127992&&e<=128062||e===128064||e>=128066&&e<=128252||e>=128255&&e<=128317||e>=128331&&e<=128334||e>=128336&&e<=128359||e===128378||e===128405||e===128406||e===128420||e>=128507&&e<=128591||e>=128640&&e<=128709||e===128716||e>=128720&&e<=128722||e>=128725&&e<=128727||e>=128732&&e<=128735||e===128747||e===128748||e>=128756&&e<=128764||e>=128992&&e<=129003||e===129008||e>=129292&&e<=129338||e>=129340&&e<=129349||e>=129351&&e<=129535||e>=129648&&e<=129660||e>=129664&&e<=129672||e>=129680&&e<=129725||e>=129727&&e<=129733||e>=129742&&e<=129755||e>=129760&&e<=129768||e>=129776&&e<=129784||e>=131072&&e<=196605||e>=196608&&e<=262141}function jS(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}function $1(e,{ambiguousAsWide:r=!1}={}){return jS(e),L1(e)||N1(e)||r&&R1(e)?2:1}var W1=S(V1(),1),PS=new Intl.Segmenter,kS=/^\p{Default_Ignorable_Code_Point}$/u;function wl(e,r={}){if(typeof e!="string"||e.length===0)return 0;let{ambiguousIsNarrow:t=!0,countAnsiEscapeCodes:n=!1}=r;if(n||(e=ii(e)),e.length===0)return 0;let i=0,u={ambiguousAsWide:!t};for(let{segment:o}of PS.segment(e)){let a=o.codePointAt(0);if(!(a<=31||a>=127&&a<=159)&&!(a>=8203&&a<=8207||a===65279)&&!(a>=768&&a<=879||a>=6832&&a<=6911||a>=7616&&a<=7679||a>=8400&&a<=8447||a>=65056&&a<=65071)&&!(a>=55296&&a<=57343)&&!(a>=65024&&a<=65039)&&!kS.test(o)){if((0,W1.default)().test(o)){i+=2;continue}i+=$1(a,u)}}return i}function Al({stream:e=process.stdout}={}){return!!(e&&e.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}var Le=S(require("node:process"),1);function Ol(){return Le.default.platform!=="win32"?Le.default.env.TERM!=="linux":!!Le.default.env.WT_SESSION||!!Le.default.env.TERMINUS_SUBLIME||Le.default.env.ConEmuTask==="{cmd::Cmder}"||Le.default.env.TERM_PROGRAM==="Terminus-Sublime"||Le.default.env.TERM_PROGRAM==="vscode"||Le.default.env.TERM==="xterm-256color"||Le.default.env.TERM==="alacritty"||Le.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var Ne=S(require("node:process"),1),TS=3,Sl=class{#i=0;start(){this.#i++,this.#i===1&&this.#t()}stop(){if(this.#i<=0)throw new Error("`stop` called more times than `start`");this.#i--,this.#i===0&&this.#e()}#t(){Ne.default.platform==="win32"||!Ne.default.stdin.isTTY||(Ne.default.stdin.setRawMode(!0),Ne.default.stdin.on("data",this.#u),Ne.default.stdin.resume())}#e(){Ne.default.stdin.isTTY&&(Ne.default.stdin.off("data",this.#u),Ne.default.stdin.pause(),Ne.default.stdin.setRawMode(!1))}#u(r){r[0]===TS&&Ne.default.emit("SIGINT")}},MS=new Sl,Bl=MS;var IS=S(Ei(),1),ql=class{#i=0;#t=!1;#e=0;#u=0;#r;#o;#n;#x;#d;#c;#l;#f;#D;#a;#s;color;constructor(r){typeof r=="string"&&(r={text:r}),this.#r={color:"cyan",stream:ui.default.stderr,discardStdin:!0,hideCursor:!0,...r},this.color=this.#r.color,this.spinner=this.#r.spinner,this.#d=this.#r.interval,this.#n=this.#r.stream,this.#c=typeof this.#r.isEnabled=="boolean"?this.#r.isEnabled:Al({stream:this.#n}),this.#l=typeof this.#r.isSilent=="boolean"?this.#r.isSilent:!1,this.text=this.#r.text,this.prefixText=this.#r.prefixText,this.suffixText=this.#r.suffixText,this.indent=this.#r.indent,ui.default.env.NODE_ENV==="test"&&(this._stream=this.#n,this._isEnabled=this.#c,Object.defineProperty(this,"_linesToClear",{get(){return this.#i},set(t){this.#i=t}}),Object.defineProperty(this,"_frameIndex",{get(){return this.#u}}),Object.defineProperty(this,"_lineCount",{get(){return this.#e}}))}get indent(){return this.#f}set indent(r=0){if(!(r>=0&&Number.isInteger(r)))throw new Error("The `indent` option must be an integer from 0 and up");this.#f=r,this.#p()}get interval(){return this.#d??this.#o.interval??100}get spinner(){return this.#o}set spinner(r){if(this.#u=0,this.#d=void 0,typeof r=="object"){if(r.frames===void 0)throw new Error("The given spinner must have a `frames` property");this.#o=r}else if(!Ol())this.#o=oi.default.line;else if(r===void 0)this.#o=oi.default.dots;else if(r!=="default"&&oi.default[r])this.#o=oi.default[r];else throw new Error(`There is no built-in spinner named '${r}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`)}get text(){return this.#D}set text(r=""){this.#D=r,this.#p()}get prefixText(){return this.#a}set prefixText(r=""){this.#a=r,this.#p()}get suffixText(){return this.#s}set suffixText(r=""){this.#s=r,this.#p()}get isSpinning(){return this.#x!==void 0}#h(r=this.#a,t=" "){return typeof r=="string"&&r!==""?r+t:typeof r=="function"?r()+t:""}#m(r=this.#s,t=" "){return typeof r=="string"&&r!==""?t+r:typeof r=="function"?t+r():""}#p(){let r=this.#n.columns??80,t=this.#h(this.#a,"-"),n=this.#m(this.#s,"-"),i=" ".repeat(this.#f)+t+"--"+this.#D+"--"+n;this.#e=0;for(let u of ii(i).split(`
|
|
62
62
|
`))this.#e+=Math.max(1,Math.ceil(wl(u,{countAnsiEscapeCodes:!0})/r))}get isEnabled(){return this.#c&&!this.#l}set isEnabled(r){if(typeof r!="boolean")throw new TypeError("The `isEnabled` option must be a boolean");this.#c=r}get isSilent(){return this.#l}set isSilent(r){if(typeof r!="boolean")throw new TypeError("The `isSilent` option must be a boolean");this.#l=r}frame(){let{frames:r}=this.#o,t=r[this.#u];this.color&&(t=z[this.color](t)),this.#u=++this.#u%r.length;let n=typeof this.#a=="string"&&this.#a!==""?this.#a+" ":"",i=typeof this.text=="string"?" "+this.text:"",u=typeof this.#s=="string"&&this.#s!==""?" "+this.#s:"";return n+t+i+u}clear(){if(!this.#c||!this.#n.isTTY)return this;this.#n.cursorTo(0);for(let r=0;r<this.#i;r++)r>0&&this.#n.moveCursor(0,-1),this.#n.clearLine(1);return(this.#f||this.lastIndent!==this.#f)&&this.#n.cursorTo(this.#f),this.lastIndent=this.#f,this.#i=0,this}render(){return this.#l?this:(this.clear(),this.#n.write(this.frame()),this.#i=this.#e,this)}start(r){return r&&(this.text=r),this.#l?this:this.#c?this.isSpinning?this:(this.#r.hideCursor&&yl.hide(this.#n),this.#r.discardStdin&&ui.default.stdin.isTTY&&(this.#t=!0,Bl.start()),this.render(),this.#x=setInterval(this.render.bind(this),this.interval),this):(this.text&&this.#n.write(`- ${this.text}
|
|
63
63
|
`),this)}stop(){return this.#c?(clearInterval(this.#x),this.#x=void 0,this.#u=0,this.clear(),this.#r.hideCursor&&yl.show(this.#n),this.#r.discardStdin&&ui.default.stdin.isTTY&&this.#t&&(Bl.stop(),this.#t=!1),this):this}succeed(r){return this.stopAndPersist({symbol:ni.success,text:r})}fail(r){return this.stopAndPersist({symbol:ni.error,text:r})}warn(r){return this.stopAndPersist({symbol:ni.warning,text:r})}info(r){return this.stopAndPersist({symbol:ni.info,text:r})}stopAndPersist(r={}){if(this.#l)return this;let t=r.prefixText??this.#a,n=this.#h(t," "),i=r.symbol??" ",u=r.text??this.text,o=typeof u=="string"?" "+u:"",a=r.suffixText??this.#s,s=this.#m(a," "),c=n+i+o+s+`
|
|
64
|
-
`;return this.stop(),this.#n.write(c),this}};function pe(e){return new ql(e)}var z1=require("child_process"),qe=S(require("fs"),1),at=S(require("path"),1);var G1={dependencies:{"@gorhom/bottom-sheet":"5.2.8","@hookform/resolvers":"5.0.1","@legendapp/list":"2.0.19","@notifee/react-native":"9.1.8","@react-native-community/datetimepicker":"8.6.0","@react-native-community/hooks":"100.1.0","@react-navigation/bottom-tabs":"7.14.0","@react-navigation/core":"7.4.0","@react-navigation/material-top-tabs":"7.2.13","@react-navigation/native-stack":"7.2.1","@react-navigation/native":"7.0.15","@react-navigation/stack":"7.1.2","@shopify/flash-list":"2.2.2","@shopify/react-native-skia":"2.4.14","@tanstack/query-async-storage-persister":"5.67.3","@tanstack/query-core":"5.67.3","@tanstack/query-sync-storage-persister":"5.67.3","@tanstack/react-query-persist-client":"5.67.3","@tanstack/react-query":"5.67.3",axios:"1.13.2","babel-plugin-module-resolver":"5.0.2",dayjs:"1.11.19","jotai-optics":"0.4.0",jotai:"2.16.1","lodash-es":"4.17.22","patch-package":"8.0.1","react-hook-form":"7.56.4","react-native-bootsplash":"7.0.2","react-native-device-info":"15.0.1","react-native-dotenv":"3.4.11","react-native-gesture-handler":"2.29.1","react-native-get-random-values":"1.11.0","react-native-haptic-feedback":"2.3.3","react-native-keyboard-controller":"1.19.1","react-native-mmkv":"4.1.0","react-native-modal-datetime-picker":"18.0.0","react-native-modal":"14.0.0-rc.1","react-native-nitro-modules":"0.32.0","react-native-pager-view":"6.8.0","react-native-permissions":"5.4.4","react-native-reanimated":"4.2.1","react-native-safe-area-context":"5.6.0","react-native-screens":"4.19.0","react-native-simple-toast":"3.3.2","react-native-turbo-image":"1.22.1","react-native-url-polyfill":"2.0.0","react-native-worklets":"0.7.1","react-native":"0.83.1",react:"19.2.0",tailwindcss:"3.4.16",twrnc:"4.16.0",uuid:"11.1.0","zod-validation-error":"3.4.0",zod:"3.24.2",zustand:"5.0.5"}};var H1={devDependencies:{"@babel/core":"7.25.2","@babel/eslint-parser":"7.23.10","@babel/preset-env":"7.25.3","@babel/preset-react":"7.27.1","@babel/runtime":"7.25.0","@react-native-community/cli-platform-android":"20.0.0","@react-native-community/cli-platform-ios":"20.0.0","@react-native-community/cli":"20.0.0","@react-native/babel-preset":"0.83.1","@react-native/eslint-config":"0.83.1","@react-native/metro-config":"0.83.1","@react-native/typescript-config":"0.83.1","@swc-node/register":"~1.8.0","@tanstack/eslint-plugin-query":"5.91.2","@testing-library/jest-native":"5.4.3","@testing-library/react-native":"12.5.1","@types/jest":"29.5.13","@types/jwt-encode":"1.0.3","@types/lodash-es":"4.17.12","@types/react-native-vector-icons":"6.4.18","@types/react-test-renderer":"19.1.0","@types/react":"19.2.0","@typescript-eslint/eslint-plugin":"^6.13.2","@typescript-eslint/parser":"^6.21.0","babel-jest":"29.6.3","babel-plugin-module-resolver":"5.0.2","eslint-config-airbnb-typescript":"^17.1.0","eslint-config-prettier":"10.1.8","eslint-import-resolver-typescript":"^3.8.5","eslint-plugin-ft-flow":"2.0.3","eslint-plugin-import":"^2.31.0","eslint-plugin-jest":"27.9.0","eslint-plugin-prettier":"^5.2.3","eslint-plugin-react-hooks":"^4.6.0","eslint-plugin-react-perf":"^3.3.3","eslint-plugin-react":"^7.32.2","eslint-plugin-sonarjs":"0.25.1","eslint-plugin-sort-destructure-keys":"^2.0.0","eslint-plugin-sort-keys-fix":"^1.1.2","eslint-plugin-tailwindcss":"^3.18.0","eslint-plugin-testing-library":"6.2.2",eslint:"8.57.0",husky:"9.1.7","jest-environment-jsdom":"30.1.2",jest:"29.6.3","prettier-plugin-tailwindcss":"^0.6.11",prettier:"3.3.2","react-native-dotenv":"3.4.11","react-native-svg-transformer":"1.3.0","react-native-svg":"15.15.1","react-test-renderer":"19.2.0",typescript:"5.8.3"}};function fa(){return __dirname}var
|
|
64
|
+
`;return this.stop(),this.#n.write(c),this}};function pe(e){return new ql(e)}var z1=require("child_process"),qe=S(require("fs"),1),at=S(require("path"),1);var G1={dependencies:{"@gorhom/bottom-sheet":"5.2.8","@hookform/resolvers":"5.0.1","@legendapp/list":"2.0.19","@notifee/react-native":"9.1.8","@react-native-community/datetimepicker":"8.6.0","@react-native-community/hooks":"100.1.0","@react-navigation/bottom-tabs":"7.14.0","@react-navigation/core":"7.4.0","@react-navigation/material-top-tabs":"7.2.13","@react-navigation/native-stack":"7.2.1","@react-navigation/native":"7.0.15","@react-navigation/stack":"7.1.2","@shopify/flash-list":"2.2.2","@shopify/react-native-skia":"2.4.14","@tanstack/query-async-storage-persister":"5.67.3","@tanstack/query-core":"5.67.3","@tanstack/query-sync-storage-persister":"5.67.3","@tanstack/react-query-persist-client":"5.67.3","@tanstack/react-query":"5.67.3",axios:"1.13.2","babel-plugin-module-resolver":"5.0.2",dayjs:"1.11.19","jotai-optics":"0.4.0",jotai:"2.16.1","lodash-es":"4.17.22","patch-package":"8.0.1","react-hook-form":"7.56.4","react-native-bootsplash":"7.0.2","react-native-device-info":"15.0.1","react-native-dotenv":"3.4.11","react-native-gesture-handler":"2.29.1","react-native-get-random-values":"1.11.0","react-native-haptic-feedback":"2.3.3","react-native-keyboard-controller":"1.19.1","react-native-mmkv":"4.1.0","react-native-modal-datetime-picker":"18.0.0","react-native-modal":"14.0.0-rc.1","react-native-nitro-modules":"0.32.0","react-native-pager-view":"6.8.0","react-native-permissions":"5.4.4","react-native-reanimated":"4.2.1","react-native-safe-area-context":"5.6.0","react-native-screens":"4.19.0","react-native-simple-toast":"3.3.2","react-native-turbo-image":"1.22.1","react-native-url-polyfill":"2.0.0","react-native-worklets":"0.7.1","react-native":"0.83.1",react:"19.2.0",tailwindcss:"3.4.16",twrnc:"4.16.0",uuid:"11.1.0","zod-validation-error":"3.4.0",zod:"3.24.2",zustand:"5.0.5"}};var H1={devDependencies:{"@babel/core":"7.25.2","@babel/eslint-parser":"7.23.10","@babel/preset-env":"7.25.3","@babel/preset-react":"7.27.1","@babel/runtime":"7.25.0","@react-native-community/cli-platform-android":"20.0.0","@react-native-community/cli-platform-ios":"20.0.0","@react-native-community/cli":"20.0.0","@react-native/babel-preset":"0.83.1","@react-native/eslint-config":"0.83.1","@react-native/metro-config":"0.83.1","@react-native/typescript-config":"0.83.1","@swc-node/register":"~1.8.0","@tanstack/eslint-plugin-query":"5.91.2","@testing-library/jest-native":"5.4.3","@testing-library/react-native":"12.5.1","@types/jest":"29.5.13","@types/jwt-encode":"1.0.3","@types/lodash-es":"4.17.12","@types/react-native-vector-icons":"6.4.18","@types/react-test-renderer":"19.1.0","@types/react":"19.2.0","@typescript-eslint/eslint-plugin":"^6.13.2","@typescript-eslint/parser":"^6.21.0","babel-jest":"29.6.3","babel-plugin-module-resolver":"5.0.2","eslint-config-airbnb-typescript":"^17.1.0","eslint-config-prettier":"10.1.8","eslint-import-resolver-typescript":"^3.8.5","eslint-plugin-ft-flow":"2.0.3","eslint-plugin-import":"^2.31.0","eslint-plugin-jest":"27.9.0","eslint-plugin-prettier":"^5.2.3","eslint-plugin-react-hooks":"^4.6.0","eslint-plugin-react-perf":"^3.3.3","eslint-plugin-react":"^7.32.2","eslint-plugin-sonarjs":"0.25.1","eslint-plugin-sort-destructure-keys":"^2.0.0","eslint-plugin-sort-keys-fix":"^1.1.2","eslint-plugin-tailwindcss":"^3.18.0","eslint-plugin-testing-library":"6.2.2",eslint:"8.57.0",husky:"9.1.7","jest-environment-jsdom":"30.1.2",jest:"29.6.3","prettier-plugin-tailwindcss":"^0.6.11",prettier:"3.3.2","react-native-dotenv":"3.4.11","react-native-svg-transformer":"1.3.0","react-native-svg":"15.15.1","react-test-renderer":"19.2.0",typescript:"5.8.3"}};function fa(){return __dirname}var ne=(e,r)=>{(0,z1.execSync)(`cd ${e} && ${r}`,{stdio:"inherit"})},Q=(e,r,t,n)=>{let i=at.default.join(fa(),`../templates/${t}/${r}`);!qe.default.existsSync(i)&&n&&(i=at.default.join(fa(),`../templates/${n}/${r}`)),qe.default.copyFile(i,e,u=>{if(u){console.error(`Error copying file: ${u.message}`);return}})},ye=(e,r,t,n)=>{let i=at.default.join(fa(),`../templates/${t}/${r}`);!qe.default.existsSync(i)&&n&&(i=at.default.join(fa(),`../templates/${n}/${r}`)),qe.default.cpSync(i,e,{recursive:!0},u=>{if(u){console.error(`Error copying file: ${u.message}`);return}})},jl=e=>{qe.default.rmSync(e,{recursive:!0,force:!0},r=>{if(r){console.error(`Error removing directory: ${r.message}`);return}})},ai=e=>{qe.default.rmSync(e,{recursive:!0,force:!0},r=>{if(r){console.error(`Error removing file: ${r.message}`);return}})},Pl=e=>{let r={postinstall:"patch-package",doctor:"cd apps/mobile && npx @react-native-community/cli doctor",android:"bash ./run-android.sh","android:connect":"adb reverse tcp:8081 tcp:8081","check-env:mobile":"bash ./check-env.sh apps/mobile/.env apps/mobile/.env.template",ios:"npx nx run-ios mobile",clean:"bash ./clean-generated-outputs.sh","lint:all":"npx nx run-many -t lint -p mobile --parallel=1 --skip-nx-cache","lint:mobile":"npx nx run mobile:lint --skip-nx-cache",prepare:"husky install","serve:mobile":"npx nx start mobile --skip-nx-cache","serve:all":"npx nx run-many -t serve -p mobile --parallel=1 --skip-nx-cache",xcode:"bash apps/mobile/ios-only.sh 'xed -b ios'","touch-xcode":"bash apps/mobile/ios-only.sh 'touch ios/.xcode.env'","setup-fastlane":"cd apps/mobile && rbenv local && bundle install && bundle update","deploy:mobile":"bash apps/mobile/deploy.sh","ios-certificates":"bash apps/mobile/ios-only.sh 'rbenv local && bundle install && bundle update && bundle exec fastlane ios certificates --env development'","pod-install":"npx nx pod-install mobile","pod-install:force":"npx nx pod-install:force mobile","list:ios-configurations":"bash apps/mobile/ios-only.sh 'cd ios && xcodebuild -list'","list:ios-devices":"bash apps/mobile/ios-only.sh 'xcrun xctrace list devices'","react-native-asset":"cd apps/mobile && npx react-native-asset"},t=at.default.join(e,"package.json"),n=JSON.parse(qe.default.readFileSync(t,"utf8"));n.dependencies={...n.dependencies,...G1.dependencies},n.devDependencies={...n.devDependencies,...H1.devDependencies},n.scripts={...n.scripts,...r},qe.default.writeFileSync(t,JSON.stringify(n,null,2))},K1=e=>{let r=at.default.join(e,"nx.json");if(!qe.default.existsSync(r))return;let t=JSON.parse(qe.default.readFileSync(r,"utf-8"));t.tui={...t.tui||{},enabled:!1},qe.default.writeFileSync(r,JSON.stringify(t,null,2))},kl=(e,r)=>{let t=pe({text:"Configuring iOS Dev scheme and build configurations...",color:"cyan"}).start();try{ne(e,"bundle check || bundle install"),ne(e,"bundle exec ruby ./scripts/setup-ios-dev-scheme.rb"),t.succeed(r.success("iOS Dev scheme and build configurations configured successfully"))}catch(n){throw t.fail(r.error("Failed to configure iOS Dev scheme and build configurations")),n}};var NS="3.0.3",he="21.2.2",E={title:z.bold.cyan,subtitle:z.cyan,success:z.bold.green,info:z.bold.blue,warning:z.hex("#FFA500").bold,error:z.bold.red,highlight:z.bold.magenta,command:z.yellow.italic,path:z.green.underline,step:e=>z.bgCyan.black(` STEP ${e} `),emoji:{rocket:"\u{1F680}",check:"\u2705",warning:"\u26A0\uFE0F",star:"\u2B50",sparkles:"\u2728",tools:"\u{1F6E0}\uFE0F",mobile:"\u{1F4F1}",folder:"\u{1F4C1}",code:"\u{1F4BB}"}},J1=()=>{console.log(`
|
|
65
65
|
`),console.log(E.title("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")),console.log(E.title("\u2551 \u2551")),console.log(E.title("\u2551 ")+E.highlight("NX REACT NATIVE CLI")+E.title(" \u2551")),console.log(E.title("\u2551 ")+E.subtitle("A powerful starter for React Native with NX")+E.title(" \u2551")),console.log(E.title("\u2551 \u2551")),console.log(E.title("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D")),console.log(`
|
|
66
66
|
`)};yn.name("React Native Starter with NX").description("A starter script to create a new React Native project with NX").version(NS);yn.command("create [workspace_name] [bundle_id]").description("create nx workspace with react-native").option("--fresh","Create a fresh project without copying template files").option("--nx-version <version>","Specify Nx version to use",he).option("--package-manager <pm>","Package manager to use (yarn or npm)","yarn").option("--skip-install","Skip package install after adding dependencies").option("--skip-configs","Skip copying prettier, eslint, and husky configs").action(async(e,r,t)=>{J1(),e||(e=(await ri.prompt([{type:"input",name:"workspace_name",message:E.info("Enter the workspace name:")}])).workspace_name),r||(r=(await ri.prompt([{type:"input",name:"bundle_id",message:E.info("Enter the bundle ID: ex. org.reactjsnative.example")}])).bundle_id);let n=t.fresh||!1,i=t.nxVersion||he,u=t.packageManager||"yarn",o=t.skipInstall||!1,a=t.skipConfigs||!1,s=process.cwd(),c=`${s}/${e}`,f=`${c}/apps/mobile`;console.log(`
|
|
67
67
|
${E.step(1)} ${E.emoji.folder} ${E.success(`Creating Nx workspace in ${E.path(`./${e}`)}`)}`);let d=pe({text:"Setting up Nx workspace...",color:"cyan"}).start();(0,Y1.execSync)(`cd ${s} && npx create-nx-workspace@${i} --preset apps --workspaceType integrated --name ${e} --package-manager=${u} --interactive false --nxCloud skip`,{stdio:"inherit"}),K1(c),d.succeed(E.success("Nx workspace created successfully")),console.log(`
|
|
68
|
-
${E.step(2)} ${E.emoji.mobile} ${E.success("Adding React Native to your workspace")}`);let p=pe({text:"Installing React Native dependencies...",color:"cyan"}).start(),D=u==="npm"?`npm install --save-dev @nx/react-native@${i} --ignore-scripts`:`yarn add -D @nx/react-native@${i} @nx/eslint-plugin@${i} eslint-plugin-jsx-a11y --ignore-scripts`;
|
|
69
|
-
${E.step(3)} ${E.emoji.tools} ${E.success("Setting up project configuration")}`);let h=pe({text:"Configuring project files...",color:"cyan"}).start();
|
|
70
|
-
${E.step(4)} ${E.emoji.code} ${E.success("Finalizing setup")}`);let v=pe({text:"Renaming app...",color:"cyan"}).start();
|
|
68
|
+
${E.step(2)} ${E.emoji.mobile} ${E.success("Adding React Native to your workspace")}`);let p=pe({text:"Installing React Native dependencies...",color:"cyan"}).start(),D=u==="npm"?`npm install --save-dev @nx/react-native@${i} --ignore-scripts`:`yarn add -D @nx/react-native@${i} @nx/eslint-plugin@${i} eslint-plugin-jsx-a11y --ignore-scripts`;ne(c,D,{stdio:"inherit"}),ne(c,"npx nx g @nx/react-native:app apps/mobile --bundler vite --install false --skip-nx-cache",{stdio:"inherit"}),Pl(c),o?console.log(E.warning(`Skipping ${u} install (--skip-install flag set)`)):ne(c,u==="npm"?"npm install":"yarn install",{stdio:"inherit"}),p.succeed(E.success("React Native dependencies installed successfully")),console.log(`
|
|
69
|
+
${E.step(3)} ${E.emoji.tools} ${E.success("Setting up project configuration")}`);let h=pe({text:"Configuring project files...",color:"cyan"}).start();Q(`${c}/.gitignore`,".ignorefile","shared"),Q(`${c}/.nvmrc`,".nvmrc","shared"),Q(`${c}/check-env.sh`,"check-env.sh","shared"),Q(`${c}/clean-generated-outputs.sh`,"clean-generated-outputs.sh","shared"),Q(`${c}/run-android.sh`,"run-android.sh","shared"),Q(`${c}/.ruby-version`,".ruby-version",i,he),ye(`${c}/apps/mobile/scripts`,"apps/mobile/scripts","shared"),ye(`${c}/patches`,"patches","shared"),n||(ye(`${c}/.vscode`,".vscode","shared"),a?console.log(E.info("Skipping prettier, eslint, and husky configs (--skip-configs flag set)")):(ye(`${c}/.husky`,".husky","shared"),Q(`${c}/.prettierrc`,".prettierrc",i,he),Q(`${c}/.prettierignore`,".prettierignore",i,he),Q(`${c}/.eslintrc.json`,".eslintrc.json",i,he)),jl(`${c}/apps/mobile/src`),ai(`${c}/apps/mobile/.vite.config.ts`),ai(`${c}/apps/mobile/.babelrc.js`),ye(`${c}/apps`,"apps","shared"),ye(`${c}/apps`,"apps",i,he)),Q(`${c}/apps/mobile/.gitignore`,"apps/mobile/.ignorefile",i,he),ne(c,`keytool -genkey -keystore ${c}/apps/mobile/android/app/dev.keystore -keyalg RSA -keysize 2048 -validity 10000 -alias dev -dname "cn=Unknown, ou=Unknown, o=Unknown, c=Unknown" -storepass development -keypass development`,{stdio:"inherit"}),h.succeed(E.success("Project configuration completed"));let m=pe({text:"Linking assets...",color:"cyan"}).start();ne(f,"npx react-native-asset",{stdio:"inherit"}),m.succeed(E.success("Assets linked successfully")),console.log(`
|
|
70
|
+
${E.step(4)} ${E.emoji.code} ${E.success("Finalizing setup")}`);let v=pe({text:"Renaming app...",color:"cyan"}).start();ne(f,`npx nx-react-native-rename@latest "${e}" -b "${r}" --skipGitStatusCheck --exclude "package.json"`,{stdio:"inherit"}),v.succeed(E.success("Mobile package.json updated successfully")),kl(f,E);let b=pe({text:E.info("Generating bootsplash assets..."),spinner:"dots"}).start();ne(f,"npx react-native-bootsplash generate src/assets/images/logo.png --platforms=android,ios --background=ffffff --logo-width=100 --assets-output=src/assets/images/bootsplash --flavor=main",{stdio:"pipe"}),b.succeed(E.success("Bootsplash assets generated successfully"));let F=pe({text:E.info("Running postinstall..."),spinner:"dots"}).start();ne(c,"yarn postinstall",{stdio:"pipe"}),F.succeed(E.success("Postinstall completed successfully")),console.log(`
|
|
71
71
|
`),console.log(E.title("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")),console.log(E.title("\u2551 ")+E.emoji.rocket+" "+E.success("PROJECT CREATED SUCCESSFULLY")+E.title(" \u2551")),console.log(E.title("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D")),console.log(`
|
|
72
72
|
`),console.log(E.subtitle("\u{1F4CB} NEXT STEPS:"));let w=u==="npm"?"npm run serve:mobile":"yarn serve:mobile";console.log(`${E.emoji.star} ${E.info("Start your project:")} ${E.command(w)}`),console.log(`
|
|
73
73
|
`),console.log(E.highlight(`${E.emoji.sparkles} Happy coding! ${E.emoji.sparkles}`)),console.log(`
|
|
74
74
|
`)});yn.command("add [app_name] [bundle_id]").description("Add React Native to existing Nx workspace").option("--fresh","Add without copying template files").option("--package-manager <pm>","Package manager to use (yarn or npm)","yarn").option("--skip-install","Skip package install after adding dependencies").option("--skip-configs","Skip copying prettier, eslint, and husky configs").action(async(e,r,t)=>{J1();let n=process.cwd(),i=await import("fs"),u=await import("path"),o=n,a=`${o}/apps/mobile`;i.existsSync(u.join(n,"nx.json"))||(console.log(E.error("\u274C Error: Not in an NX workspace directory!")),console.log(E.info("Please run this command from the root of your NX workspace.")),process.exit(1)),i.existsSync(a)&&(console.log(E.error("\u274C Error: apps/mobile folder already exists!")),console.log(E.info("Please remove or rename the existing apps/mobile folder before proceeding.")),process.exit(1));let s=he;try{let C=u.join(n,"package.json"),O=JSON.parse(i.readFileSync(C,"utf-8")),$=O.dependencies?.["@nx/workspace"]||O.devDependencies?.["@nx/workspace"]||O.dependencies?.["@nrwl/workspace"]||O.devDependencies?.["@nrwl/workspace"];$?(s=$.replace(/^[\^~]/,""),console.log(E.info(`\u{1F4E6} Detected NX version: ${E.highlight(s)}`))):console.log(E.warning(`\u26A0\uFE0F Could not detect NX version, using default: ${s}`))}catch{console.log(E.warning("\u26A0\uFE0F Could not read package.json, using default NX version"))}e||(e=(await ri.prompt([{type:"input",name:"app_name",message:E.info("Enter the app name (for renaming):")}])).app_name),r||(r=(await ri.prompt([{type:"input",name:"bundle_id",message:E.info("Enter the bundle ID: ex. org.reactjsnative.example")}])).bundle_id);let c=t.fresh||!1,f=t.packageManager||"yarn",d=t.skipInstall||!1,p=t.skipConfigs||!1;console.log(`
|
|
75
|
-
${E.step(1)} ${E.emoji.mobile} ${E.success("Adding React Native to your workspace")}`);let D=pe({text:"Installing React Native dependencies...",color:"cyan"}).start(),h=f==="npm"?`npm install --save-dev @nx/react-native@${s} --ignore-scripts --ignore-workspace-root-check`:`yarn add -D @nx/react-native@${s} --ignore-scripts --ignore-workspace-root-check`;
|
|
76
|
-
${E.step(2)} ${E.emoji.tools} ${E.success("Setting up project configuration")}`);let m=pe({text:"Configuring project files...",color:"cyan"}).start();
|
|
77
|
-
${E.step(3)} ${E.emoji.code} ${E.success("Finalizing setup")}`);let b=pe({text:"Renaming app...",color:"cyan"}).start();
|
|
75
|
+
${E.step(1)} ${E.emoji.mobile} ${E.success("Adding React Native to your workspace")}`);let D=pe({text:"Installing React Native dependencies...",color:"cyan"}).start(),h=f==="npm"?`npm install --save-dev @nx/react-native@${s} --ignore-scripts --ignore-workspace-root-check`:`yarn add -D @nx/react-native@${s} --ignore-scripts --ignore-workspace-root-check`;ne(o,h,{stdio:"inherit"}),ne(o,"npx nx g @nx/react-native:app apps/mobile --bundler vite --install false --skip-nx-cache",{stdio:"inherit"}),Pl(o),d?console.log(E.warning(`Skipping ${f} install (--skip-install flag set)`)):ne(o,f==="npm"?"npm install":"yarn install",{stdio:"inherit"}),D.succeed(E.success("React Native dependencies installed successfully")),console.log(`
|
|
76
|
+
${E.step(2)} ${E.emoji.tools} ${E.success("Setting up project configuration")}`);let m=pe({text:"Configuring project files...",color:"cyan"}).start();Q(`${o}/.gitignore`,".ignorefile","shared"),Q(`${o}/.nvmrc`,".nvmrc","shared"),Q(`${o}/check-env.sh`,"check-env.sh","shared"),Q(`${o}/clean-generated-outputs.sh`,"clean-generated-outputs.sh","shared"),Q(`${o}/run-android.sh`,"run-android.sh","shared"),Q(`${o}/.ruby-version`,".ruby-version",s,he),ye(`${o}/apps/mobile/scripts`,"apps/mobile/scripts","shared"),ye(`${o}/patches`,"patches","shared"),c||(ye(`${o}/.vscode`,".vscode","shared"),p?console.log(E.info("Skipping prettier, eslint, and husky configs (--skip-configs flag set)")):(ye(`${o}/.husky`,".husky","shared"),Q(`${o}/.prettierrc`,".prettierrc",s,he),Q(`${o}/.prettierignore`,".prettierignore",s,he),Q(`${o}/.eslintrc.json`,".eslintrc.json",s,he)),jl(`${o}/apps/mobile/src`),ai(`${o}/apps/mobile/.vite.config.ts`),ai(`${o}/apps/mobile/.babelrc.js`),ye(`${o}/apps`,"apps","shared"),ye(`${o}/apps`,"apps",s,he)),Q(`${o}/apps/mobile/.gitignore`,"apps/mobile/.ignorefile",s,he),ne(o,`keytool -genkey -keystore ${o}/apps/mobile/android/app/dev.keystore -keyalg RSA -keysize 2048 -validity 10000 -alias dev -dname "cn=Unknown, ou=Unknown, o=Unknown, c=Unknown" -storepass development -keypass development`,{stdio:"inherit"}),m.succeed(E.success("Project configuration completed"));let v=pe({text:"Linking assets...",color:"cyan"}).start();ne(a,"npx react-native-asset",{stdio:"inherit"}),v.succeed(E.success("Assets linked successfully")),console.log(`
|
|
77
|
+
${E.step(3)} ${E.emoji.code} ${E.success("Finalizing setup")}`);let b=pe({text:"Renaming app...",color:"cyan"}).start();ne(a,`npx nx-react-native-rename@latest "${e}" -b "${r}" --skipGitStatusCheck --exclude "package.json"`,{stdio:"inherit"}),b.succeed(E.success("Mobile package.json updated successfully")),kl(a,E);let F=pe({text:E.info("Generating bootsplash assets..."),spinner:"dots"}).start();ne(a,"npx react-native-bootsplash generate src/assets/images/logo.png --platforms=android,ios --background=ffffff --logo-width=100 --assets-output=src/assets/images/bootsplash --flavor=main",{stdio:"pipe"}),F.succeed(E.success("Bootsplash assets generated successfully"));let w=pe({text:E.info("Running postinstall..."),spinner:"dots"}).start();ne(o,"yarn postinstall",{stdio:"pipe"}),w.succeed(E.success("Postinstall completed successfully")),console.log(`
|
|
78
78
|
`),console.log(E.title("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")),console.log(E.title("\u2551 ")+E.emoji.rocket+" "+E.success("REACT NATIVE ADDED SUCCESSFULLY")+E.title(" \u2551")),console.log(E.title("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D")),console.log(`
|
|
79
79
|
`),console.log(E.subtitle("\u{1F4CB} NEXT STEPS:"));let T=f==="npm"?"npm run serve:mobile":"yarn serve:mobile";console.log(`${E.emoji.star} ${E.info("Start your project:")} ${E.command(T)}`),console.log(`
|
|
80
80
|
`),console.log(E.highlight(`${E.emoji.sparkles} Happy coding! ${E.emoji.sparkles}`)),console.log(`
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"check-env": {
|
|
10
10
|
"executor": "nx:run-commands",
|
|
11
11
|
"options": {
|
|
12
|
-
"command": "./check-env.sh apps/mobile/.env apps/mobile/.env.template"
|
|
12
|
+
"command": "bash ./check-env.sh apps/mobile/.env apps/mobile/.env.template"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"start": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"executor": "nx:run-commands",
|
|
32
32
|
"dependsOn": ["pod-install"],
|
|
33
33
|
"options": {
|
|
34
|
-
"command": "
|
|
34
|
+
"command": "bash apps/mobile/run-ios.sh"
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
"bundle-ios": {
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"executor": "nx:run-commands",
|
|
49
49
|
"dependsOn": [],
|
|
50
50
|
"options": {
|
|
51
|
-
"command": "
|
|
51
|
+
"command": "bash apps/mobile/run-android.sh"
|
|
52
52
|
}
|
|
53
53
|
},
|
|
54
54
|
"build-android": {
|
|
@@ -69,13 +69,13 @@
|
|
|
69
69
|
"pod-install": {
|
|
70
70
|
"executor": "nx:run-commands",
|
|
71
71
|
"options": {
|
|
72
|
-
"command": "
|
|
72
|
+
"command": "bash apps/mobile/pod-install.sh"
|
|
73
73
|
}
|
|
74
74
|
},
|
|
75
75
|
"pod-install:force": {
|
|
76
76
|
"executor": "nx:run-commands",
|
|
77
77
|
"options": {
|
|
78
|
-
"command": "
|
|
78
|
+
"command": "bash apps/mobile/ios-only.sh 'cd ios && bundle install && bundle exec pod install --repo-update && cd .. && ./export-node-binary.sh'"
|
|
79
79
|
}
|
|
80
80
|
},
|
|
81
81
|
"bundle-android": {
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
pluginManagement {
|
|
2
|
-
|
|
1
|
+
pluginManagement {
|
|
2
|
+
includeBuild("../../../node_modules/@react-native/gradle-plugin")
|
|
3
|
+
plugins {
|
|
4
|
+
id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
plugins {
|
|
8
|
+
id("org.gradle.toolchains.foojay-resolver-convention")
|
|
9
|
+
id("com.facebook.react.settings")
|
|
10
|
+
}
|
|
3
11
|
extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }
|
|
4
12
|
rootProject.name = 'Mobile'
|
|
5
13
|
include ':app'
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"check-env": {
|
|
10
10
|
"executor": "nx:run-commands",
|
|
11
11
|
"options": {
|
|
12
|
-
"command": "./check-env.sh apps/mobile/.env apps/mobile/.env.template"
|
|
12
|
+
"command": "bash ./check-env.sh apps/mobile/.env apps/mobile/.env.template"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"start": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"executor": "nx:run-commands",
|
|
32
32
|
"dependsOn": ["pod-install"],
|
|
33
33
|
"options": {
|
|
34
|
-
"command": "
|
|
34
|
+
"command": "bash apps/mobile/run-ios.sh"
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
"bundle-ios": {
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"executor": "nx:run-commands",
|
|
49
49
|
"dependsOn": [],
|
|
50
50
|
"options": {
|
|
51
|
-
"command": "
|
|
51
|
+
"command": "bash apps/mobile/run-android.sh"
|
|
52
52
|
}
|
|
53
53
|
},
|
|
54
54
|
"build-android": {
|
|
@@ -69,13 +69,13 @@
|
|
|
69
69
|
"pod-install": {
|
|
70
70
|
"executor": "nx:run-commands",
|
|
71
71
|
"options": {
|
|
72
|
-
"command": "
|
|
72
|
+
"command": "bash apps/mobile/pod-install.sh"
|
|
73
73
|
}
|
|
74
74
|
},
|
|
75
75
|
"pod-install:force": {
|
|
76
76
|
"executor": "nx:run-commands",
|
|
77
77
|
"options": {
|
|
78
|
-
"command": "
|
|
78
|
+
"command": "bash apps/mobile/ios-only.sh 'cd ios && bundle install && bundle exec pod install --repo-update && cd .. && ./export-node-binary.sh'"
|
|
79
79
|
}
|
|
80
80
|
},
|
|
81
81
|
"bundle-android": {
|
|
@@ -17,12 +17,22 @@ if [ -z "$INSTALL_TASKS" ]; then
|
|
|
17
17
|
exit 1
|
|
18
18
|
fi
|
|
19
19
|
|
|
20
|
+
BASE_APP_ID=$(grep -m1 'applicationId' "$ANDROID_DIR/app/build.gradle" | sed -E 's/.*applicationId[[:space:]]+"([^"]+)".*/\1/' | tr -d '[:space:]')
|
|
21
|
+
|
|
20
22
|
TASK_ARRAY=()
|
|
21
23
|
DISPLAY_ARRAY=()
|
|
22
24
|
while IFS= read -r line; do
|
|
23
25
|
[ -z "$line" ] && continue
|
|
24
26
|
TASK_ARRAY+=("$line")
|
|
25
|
-
|
|
27
|
+
VARIANT="${line#install}"
|
|
28
|
+
# Derive bundle ID for display
|
|
29
|
+
VARIANT_FLAVOR=$(echo "$VARIANT" | sed -E 's/(Debug|Release)$//' | tr '[:upper:]' '[:lower:]')
|
|
30
|
+
if [ "$VARIANT_FLAVOR" != "production" ] && [ -n "$VARIANT_FLAVOR" ]; then
|
|
31
|
+
VARIANT_BUNDLE_ID="${BASE_APP_ID}.${VARIANT_FLAVOR}"
|
|
32
|
+
else
|
|
33
|
+
VARIANT_BUNDLE_ID="$BASE_APP_ID"
|
|
34
|
+
fi
|
|
35
|
+
DISPLAY_ARRAY+=("$VARIANT ($VARIANT_BUNDLE_ID)")
|
|
26
36
|
done <<< "$INSTALL_TASKS"
|
|
27
37
|
|
|
28
38
|
pick "Select a build variant:" "${DISPLAY_ARRAY[@]}" --key "android-variant"
|
|
@@ -32,11 +42,14 @@ SELECTED_VARIANT="${SELECTED_TASK#install}"
|
|
|
32
42
|
# Mode is the full variant name with first letter lowercased (e.g. devDebug, productionRelease)
|
|
33
43
|
MODE="$(tr '[:upper:]' '[:lower:]' <<< "${SELECTED_VARIANT:0:1}")${SELECTED_VARIANT:1}"
|
|
34
44
|
|
|
35
|
-
# Infer appIdSuffix
|
|
45
|
+
# Infer appIdSuffix and bundle ID from flavor
|
|
36
46
|
FLAVOR=$(echo "$SELECTED_VARIANT" | sed -E 's/(Debug|Release)$//' | tr '[:upper:]' '[:lower:]')
|
|
37
47
|
APP_ID_SUFFIX=""
|
|
38
48
|
if [ "$FLAVOR" != "production" ] && [ -n "$FLAVOR" ]; then
|
|
39
49
|
APP_ID_SUFFIX="$FLAVOR"
|
|
50
|
+
BUNDLE_ID="${BASE_APP_ID}.${APP_ID_SUFFIX}"
|
|
51
|
+
else
|
|
52
|
+
BUNDLE_ID="$BASE_APP_ID"
|
|
40
53
|
fi
|
|
41
54
|
|
|
42
55
|
# --- Device selection (booted devices + shutdown AVDs) ---
|
|
@@ -120,7 +133,7 @@ if [ "${DEVICE_TYPES[$SELECTED_INDEX]}" = "avd" ]; then
|
|
|
120
133
|
fi
|
|
121
134
|
|
|
122
135
|
echo ""
|
|
123
|
-
echo "Running: task=$SELECTED_TASK mode=$MODE device=$SELECTED_DEVICE"
|
|
136
|
+
echo "Running: task=$SELECTED_TASK mode=$MODE device=$SELECTED_DEVICE bundleId=$BUNDLE_ID"
|
|
124
137
|
echo ""
|
|
125
138
|
|
|
126
139
|
RN_ARGS="--tasks=$SELECTED_TASK --mode=$MODE --device=$SELECTED_DEVICE"
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
# Interactive iOS launcher - picks scheme, device, or simulator
|
|
3
3
|
|
|
4
4
|
if [[ "$OSTYPE" != "darwin"* ]]; then
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
echo "iOS builds only work on macOS"
|
|
6
|
+
exit 1
|
|
7
7
|
fi
|
|
8
8
|
|
|
9
9
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
@@ -16,20 +16,29 @@ SCHEMES=$(cd "$PROJECT_DIR" && xcodebuild -list -json 2>/dev/null | python3 -c "
|
|
|
16
16
|
import sys, json
|
|
17
17
|
data = json.load(sys.stdin)
|
|
18
18
|
for s in data.get('project', {}).get('schemes', []):
|
|
19
|
-
|
|
19
|
+
print(s)
|
|
20
20
|
")
|
|
21
21
|
|
|
22
22
|
if [ -z "$SCHEMES" ]; then
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
echo "Could not read schemes from Xcode project"
|
|
24
|
+
exit 1
|
|
25
25
|
fi
|
|
26
26
|
|
|
27
27
|
SCHEME_ARRAY=()
|
|
28
|
+
DISPLAY_SCHEME_ARRAY=()
|
|
28
29
|
while IFS= read -r line; do
|
|
29
|
-
|
|
30
|
+
[ -z "$line" ] && continue
|
|
31
|
+
SCHEME_ARRAY+=("$line")
|
|
32
|
+
# Derive bundle ID from Xcode build settings
|
|
33
|
+
BUNDLE_ID=$(cd "$PROJECT_DIR" && xcodebuild -showBuildSettings -scheme "$line" 2>/dev/null | grep 'PRODUCT_BUNDLE_IDENTIFIER' | grep -v 'DERIVE_' | awk '{print $NF}')
|
|
34
|
+
if [ -n "$BUNDLE_ID" ]; then
|
|
35
|
+
DISPLAY_SCHEME_ARRAY+=("$line ($BUNDLE_ID)")
|
|
36
|
+
else
|
|
37
|
+
DISPLAY_SCHEME_ARRAY+=("$line")
|
|
38
|
+
fi
|
|
30
39
|
done <<< "$SCHEMES"
|
|
31
40
|
|
|
32
|
-
pick "Select a scheme:" "${
|
|
41
|
+
pick "Select a scheme:" "${DISPLAY_SCHEME_ARRAY[@]}" --key "ios-scheme"
|
|
33
42
|
SELECTED_SCHEME="${SCHEME_ARRAY[$PICKED_INDEX]}"
|
|
34
43
|
|
|
35
44
|
# --- Device / Simulator selection ---
|
|
@@ -40,18 +49,18 @@ import sys, re
|
|
|
40
49
|
lines = sys.stdin.read().strip().split('\n')
|
|
41
50
|
# Skip header lines (name, dashes)
|
|
42
51
|
for line in lines[2:]:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
if not line.strip():
|
|
53
|
+
continue
|
|
54
|
+
# Parse columns: Name, Hostname, Identifier, State, Model
|
|
55
|
+
parts = re.split(r'\s{3,}', line.strip())
|
|
56
|
+
if len(parts) < 5:
|
|
57
|
+
continue
|
|
58
|
+
name, hostname, identifier, state, model = parts[0], parts[1], parts[2], parts[3], parts[4]
|
|
59
|
+
if 'iPhone' not in model:
|
|
60
|
+
continue
|
|
61
|
+
if 'available' not in state:
|
|
62
|
+
continue
|
|
63
|
+
print(f'[Device] {name} ({model})|{identifier}')
|
|
55
64
|
")
|
|
56
65
|
|
|
57
66
|
# Collect simulators via simctl
|
|
@@ -62,31 +71,31 @@ data = json.load(sys.stdin)
|
|
|
62
71
|
devices_list = []
|
|
63
72
|
|
|
64
73
|
for runtime, devices in data.get('devices', {}).items():
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
74
|
+
if 'iOS' not in runtime:
|
|
75
|
+
continue
|
|
76
|
+
ver_match = re.search(r'(\d+)[\-\.](\d+)', runtime)
|
|
77
|
+
if not ver_match:
|
|
78
|
+
continue
|
|
79
|
+
ver_major, ver_minor = int(ver_match.group(1)), int(ver_match.group(2))
|
|
80
|
+
ver = f'{ver_major}.{ver_minor}'
|
|
81
|
+
for d in devices:
|
|
82
|
+
is_booted = d['state'] == 'Booted'
|
|
83
|
+
devices_list.append((is_booted, d['name'], ver_major, ver_minor, ver))
|
|
75
84
|
|
|
76
85
|
# Parse model number from name (e.g. 'iPhone 16 Pro Max' -> 16)
|
|
77
86
|
def sort_key(x):
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
87
|
+
is_booted, name, ver_major, ver_minor, ver = x
|
|
88
|
+
is_iphone = name.startswith('iPhone')
|
|
89
|
+
model_match = re.search(r'(\d+)', name)
|
|
90
|
+
model_num = int(model_match.group(1)) if model_match else 0
|
|
91
|
+
# booted first, iPhone over iPad, highest model first, Pro Max > Pro > base, newest iOS first
|
|
92
|
+
return (not is_booted, not is_iphone, -model_num, name.count('Pro') == 0, 'Max' not in name, -ver_major, -ver_minor)
|
|
84
93
|
|
|
85
94
|
devices_list.sort(key=sort_key)
|
|
86
95
|
|
|
87
96
|
for is_booted, name, _, _, ver in devices_list:
|
|
88
|
-
|
|
89
|
-
|
|
97
|
+
prefix = '[Booted] ' if is_booted else ''
|
|
98
|
+
print(f'{prefix}{name} ({ver})')
|
|
90
99
|
")
|
|
91
100
|
|
|
92
101
|
# Merge: physical devices first, then simulators
|
|
@@ -94,34 +103,34 @@ ALL_DEVICES=""
|
|
|
94
103
|
DEVICE_UDIDS=()
|
|
95
104
|
|
|
96
105
|
if [ -n "$PHYSICAL_DEVICES" ]; then
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
106
|
+
while IFS= read -r line; do
|
|
107
|
+
display=$(echo "$line" | cut -d'|' -f1)
|
|
108
|
+
udid=$(echo "$line" | cut -d'|' -f2)
|
|
109
|
+
ALL_DEVICES+="$display"$'\n'
|
|
110
|
+
DEVICE_UDIDS+=("$udid")
|
|
111
|
+
done <<< "$PHYSICAL_DEVICES"
|
|
103
112
|
fi
|
|
104
113
|
|
|
105
114
|
PHYSICAL_COUNT=${#DEVICE_UDIDS[@]}
|
|
106
115
|
|
|
107
116
|
if [ -n "$SIMULATORS" ]; then
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
117
|
+
while IFS= read -r line; do
|
|
118
|
+
ALL_DEVICES+="$line"$'\n'
|
|
119
|
+
DEVICE_UDIDS+=("")
|
|
120
|
+
done <<< "$SIMULATORS"
|
|
112
121
|
fi
|
|
113
122
|
|
|
114
123
|
# Remove trailing newline
|
|
115
124
|
ALL_DEVICES=$(echo "$ALL_DEVICES" | sed '/^$/d')
|
|
116
125
|
|
|
117
126
|
if [ -z "$ALL_DEVICES" ]; then
|
|
118
|
-
|
|
119
|
-
|
|
127
|
+
echo "No iOS devices or simulators found"
|
|
128
|
+
exit 1
|
|
120
129
|
fi
|
|
121
130
|
|
|
122
131
|
DEVICE_ARRAY=()
|
|
123
132
|
while IFS= read -r line; do
|
|
124
|
-
|
|
133
|
+
DEVICE_ARRAY+=("$line")
|
|
125
134
|
done <<< "$ALL_DEVICES"
|
|
126
135
|
|
|
127
136
|
pick "Select a device:" "${DEVICE_ARRAY[@]}" --key "ios-device"
|
|
@@ -130,15 +139,15 @@ SELECTED="${DEVICE_ARRAY[$PICKED_INDEX]}"
|
|
|
130
139
|
echo ""
|
|
131
140
|
|
|
132
141
|
if [[ "$SELECTED" == "[Device]"* ]]; then
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
142
|
+
# Physical device — use UDID
|
|
143
|
+
UDID="${DEVICE_UDIDS[$PICKED_INDEX]}"
|
|
144
|
+
echo "Running: scheme=$SELECTED_SCHEME device=$SELECTED (udid=$UDID)"
|
|
145
|
+
echo ""
|
|
146
|
+
cd "$SCRIPT_DIR" && npx react-native run-ios --scheme="$SELECTED_SCHEME" --udid="$UDID"
|
|
138
147
|
else
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
148
|
+
# Simulator — strip [Booted] prefix to get "Name (version)"
|
|
149
|
+
SIM_NAME=$(echo "$SELECTED" | sed 's/^\[Booted\] //')
|
|
150
|
+
echo "Running: scheme=$SELECTED_SCHEME simulator=$SIM_NAME"
|
|
151
|
+
echo ""
|
|
152
|
+
cd "$SCRIPT_DIR" && npx react-native run-ios --scheme="$SELECTED_SCHEME" --simulator="$SIM_NAME"
|
|
144
153
|
fi
|