@junobuild/cli 0.0.75 → 0.0.76
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -631,14 +631,14 @@ variant ${r} -> ${i.message}`)}}))return!0;throw new Error(`Invalid ${this.displ
|
|
|
631
631
|
`);return s!==-1&&(t=P$(t,i,n,s)),n+t+i};Object.defineProperties(B0.prototype,zf);var sve=B0(),IIe=B0({level:C$?C$.level:0});var io=sve;import G$ from"node:process";var U$=St(B$(),1),q$=St($$(),1);import ove from"node:process";var lve=(0,U$.default)(()=>{(0,q$.default)(()=>{ove.stderr.write("\x1B[?25h")},{alwaysLast:!0})}),V$=lve;var Cv=!1,Zf={};Zf.show=(e=G$.stderr)=>{e.isTTY&&(Cv=!1,e.write("\x1B[?25h"))};Zf.hide=(e=G$.stderr)=>{e.isTTY&&(V$(),Cv=!0,e.write("\x1B[?25l"))};Zf.toggle=(e,t)=>{e!==void 0&&(Cv=e),Cv?Zf.show(t):Zf.hide(t)};var UP=Zf;var M0=St(qP(),1);import so from"node:process";function VP(){return so.platform!=="win32"?so.env.TERM!=="linux":!!so.env.CI||!!so.env.WT_SESSION||!!so.env.TERMINUS_SUBLIME||so.env.ConEmuTask==="{cmd::Cmder}"||so.env.TERM_PROGRAM==="Terminus-Sublime"||so.env.TERM_PROGRAM==="vscode"||so.env.TERM==="xterm-256color"||so.env.TERM==="alacritty"||so.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var cve={info:io.blue("\u2139"),success:io.green("\u2714"),warning:io.yellow("\u26A0"),error:io.red("\u2716")},pve={info:io.blue("i"),success:io.green("\u221A"),warning:io.yellow("\u203C"),error:io.red("\xD7")},dve=VP()?cve:pve,R0=dve;function GP({onlyFirst:e=!1}={}){let t=["[\\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(t,e?void 0:"g")}var fve=GP();function j0(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(fve,"")}function z$(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 Y$(e){return e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510}function J$(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 hve(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}function X$(e,{ambiguousAsWide:t=!1}={}){return hve(e),Y$(e)||J$(e)||t&&z$(e)?2:1}var eU=St(Q$(),1);function HP(e,t={}){if(typeof e!="string"||e.length===0)return 0;let{ambiguousIsNarrow:r=!0,countAnsiEscapeCodes:n=!1}=t;if(n||(e=j0(e)),e.length===0)return 0;let i=0;for(let{segment:s}of new Intl.Segmenter().segment(e)){let a=s.codePointAt(0);if(!(a<=31||a>=127&&a<=159)&&!(a>=768&&a<=879)){if((0,eU.default)().test(s)){i+=2;continue}i+=X$(a,{ambiguousAsWide:!r})}}return i}function WP({stream:e=process.stdout}={}){return!!(e&&e.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}import ml from"node:process";function KP(){return ml.platform!=="win32"?ml.env.TERM!=="linux":!!ml.env.WT_SESSION||!!ml.env.TERMINUS_SUBLIME||ml.env.ConEmuTask==="{cmd::Cmder}"||ml.env.TERM_PROGRAM==="Terminus-Sublime"||ml.env.TERM_PROGRAM==="vscode"||ml.env.TERM==="xterm-256color"||ml.env.TERM==="alacritty"||ml.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}import yl from"node:process";var mve=3,zP=class{#t=0;start(){this.#t++,this.#t===1&&this.#n()}stop(){if(this.#t<=0)throw new Error("`stop` called more times than `start`");this.#t--,this.#t===0&&this.#i()}#n(){yl.platform==="win32"||!yl.stdin.isTTY||(yl.stdin.setRawMode(!0),yl.stdin.on("data",this.#e),yl.stdin.resume())}#i(){yl.stdin.isTTY&&(yl.stdin.off("data",this.#e),yl.stdin.pause(),yl.stdin.setRawMode(!1))}#e(t){t[0]===mve&&yl.emit("SIGINT")}},yve=new zP,YP=yve;var gve=St(qP(),1),JP=class{#t=0;#n=!1;#i=0;#e=0;#r;#a;#s;#c;#l;#o;#p;#f;#h;#u;#d;color;constructor(t){typeof t=="string"&&(t={text:t}),this.#r={color:"cyan",stream:Iv.stderr,discardStdin:!0,hideCursor:!0,...t},this.color=this.#r.color,this.spinner=this.#r.spinner,this.#l=this.#r.interval,this.#s=this.#r.stream,this.#o=typeof this.#r.isEnabled=="boolean"?this.#r.isEnabled:WP({stream:this.#s}),this.#p=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,Iv.env.NODE_ENV==="test"&&(this._stream=this.#s,this._isEnabled=this.#o,Object.defineProperty(this,"_linesToClear",{get(){return this.#t},set(r){this.#t=r}}),Object.defineProperty(this,"_frameIndex",{get(){return this.#e}}),Object.defineProperty(this,"_lineCount",{get(){return this.#i}}))}get indent(){return this.#f}set indent(t=0){if(!(t>=0&&Number.isInteger(t)))throw new Error("The `indent` option must be an integer from 0 and up");this.#f=t,this.#m()}get interval(){return this.#l??this.#a.interval??100}get spinner(){return this.#a}set spinner(t){if(this.#e=0,this.#l=void 0,typeof t=="object"){if(t.frames===void 0)throw new Error("The given spinner must have a `frames` property");this.#a=t}else if(!KP())this.#a=M0.default.line;else if(t===void 0)this.#a=M0.default.dots;else if(t!=="default"&&M0.default[t])this.#a=M0.default[t];else throw new Error(`There is no built-in spinner named '${t}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`)}get text(){return this.#h}set text(t=""){this.#h=t,this.#m()}get prefixText(){return this.#u}set prefixText(t=""){this.#u=t,this.#m()}get suffixText(){return this.#d}set suffixText(t=""){this.#d=t,this.#m()}get isSpinning(){return this.#c!==void 0}#y(t=this.#u,r=" "){return typeof t=="string"&&t!==""?t+r:typeof t=="function"?t()+r:""}#g(t=this.#d,r=" "){return typeof t=="string"&&t!==""?r+t:typeof t=="function"?r+t():""}#m(){let t=this.#s.columns??80,r=this.#y(this.#u,"-"),n=this.#g(this.#d,"-"),i=" ".repeat(this.#f)+r+"--"+this.#h+"--"+n;this.#i=0;for(let s of j0(i).split(`
|
|
632
632
|
`))this.#i+=Math.max(1,Math.ceil(HP(s,{countAnsiEscapeCodes:!0})/t))}get isEnabled(){return this.#o&&!this.#p}set isEnabled(t){if(typeof t!="boolean")throw new TypeError("The `isEnabled` option must be a boolean");this.#o=t}get isSilent(){return this.#p}set isSilent(t){if(typeof t!="boolean")throw new TypeError("The `isSilent` option must be a boolean");this.#p=t}frame(){let{frames:t}=this.#a,r=t[this.#e];this.color&&(r=io[this.color](r)),this.#e=++this.#e%t.length;let n=typeof this.#u=="string"&&this.#u!==""?this.#u+" ":"",i=typeof this.text=="string"?" "+this.text:"",s=typeof this.#d=="string"&&this.#d!==""?" "+this.#d:"";return n+r+i+s}clear(){if(!this.#o||!this.#s.isTTY)return this;this.#s.cursorTo(0);for(let t=0;t<this.#t;t++)t>0&&this.#s.moveCursor(0,-1),this.#s.clearLine(1);return(this.#f||this.lastIndent!==this.#f)&&this.#s.cursorTo(this.#f),this.lastIndent=this.#f,this.#t=0,this}render(){return this.#p?this:(this.clear(),this.#s.write(this.frame()),this.#t=this.#i,this)}start(t){return t&&(this.text=t),this.#p?this:this.#o?this.isSpinning?this:(this.#r.hideCursor&&UP.hide(this.#s),this.#r.discardStdin&&Iv.stdin.isTTY&&(this.#n=!0,YP.start()),this.render(),this.#c=setInterval(this.render.bind(this),this.interval),this):(this.text&&this.#s.write(`- ${this.text}
|
|
633
633
|
`),this)}stop(){return this.#o?(clearInterval(this.#c),this.#c=void 0,this.#e=0,this.clear(),this.#r.hideCursor&&UP.show(this.#s),this.#r.discardStdin&&Iv.stdin.isTTY&&this.#n&&(YP.stop(),this.#n=!1),this):this}succeed(t){return this.stopAndPersist({symbol:R0.success,text:t})}fail(t){return this.stopAndPersist({symbol:R0.error,text:t})}warn(t){return this.stopAndPersist({symbol:R0.warning,text:t})}info(t){return this.stopAndPersist({symbol:R0.info,text:t})}stopAndPersist(t={}){if(this.#p)return this;let r=t.prefixText??this.#u,n=this.#y(r," "),i=t.symbol??" ",s=t.text??this.text,a=typeof s=="string"?" "+s:"",l=t.suffixText??this.#d,u=this.#g(l," "),c=n+i+a+u+`
|
|
634
|
-
`;return this.stop(),this.#s.write(c),this}};function Vs(e){return new JP(e)}var sU=St(Gt(),1);var tU=St(rs(),1),rU=St(jw(),1);var nU=St(Gt(),1);var gl=async()=>{let e=uA()??await Rc();ir(e)&&(console.log(`${(0,nU.red)("No controller found.")} Are you logged in?`),process.exit(1));let t=rU.Ed25519KeyIdentity.fromParsedJson(e);if(EB.includes(t.getPrincipal().toText()))throw new Error("The controller has been revoked for security reason!");return{identity:t,fetch,...or(process.env.CONTAINER_URL)&&{container:process.env.CONTAINER_URL}}},iU=async()=>{let{identity:e,container:t,fetch:r}=await gl(),n=or(t)&&t!==!1,i=n?t===!0?"http://127.0.0.1:5987":t:"https://icp-api.io",s=new tU.HttpAgent({identity:e,host:i,retryTimes:10,fetch:r});return n&&await s.fetchRootKey(),s};var bi=async({satellite:{satelliteId:e,id:t,ids:r},env:{mode:n}})=>{let i=r?.[n]??t??e;return ir(i)&&(console.log(`${(0,sU.red)(`A satellite ID for ${n} must be set in your configuration.`)}`),process.exit(1)),{satelliteId:i,...await gl()}},Nv=async e=>(await m0()).find(({p:n})=>n===e)?.n??e,Fv=async e=>{let r=(await wu())?.find(({p:n})=>n===e);return r?.n!==void 0&&r?.n!==""?r.n:e};var Bv=async e=>{let t=Ci(e),{satellite:r}=await Ii(t),n=Vs("Clearing dapp assets...").start();try{let
|
|
634
|
+
`;return this.stop(),this.#s.write(c),this}};function Vs(e){return new JP(e)}var sU=St(Gt(),1);var tU=St(rs(),1),rU=St(jw(),1);var nU=St(Gt(),1);var gl=async()=>{let e=uA()??await Rc();ir(e)&&(console.log(`${(0,nU.red)("No controller found.")} Are you logged in?`),process.exit(1));let t=rU.Ed25519KeyIdentity.fromParsedJson(e);if(EB.includes(t.getPrincipal().toText()))throw new Error("The controller has been revoked for security reason!");return{identity:t,fetch,...or(process.env.CONTAINER_URL)&&{container:process.env.CONTAINER_URL}}},iU=async()=>{let{identity:e,container:t,fetch:r}=await gl(),n=or(t)&&t!==!1,i=n?t===!0?"http://127.0.0.1:5987":t:"https://icp-api.io",s=new tU.HttpAgent({identity:e,host:i,retryTimes:10,fetch:r});return n&&await s.fetchRootKey(),s};var bi=async({satellite:{satelliteId:e,id:t,ids:r},env:{mode:n}})=>{let i=r?.[n]??t??e;return ir(i)&&(console.log(`${(0,sU.red)(`A satellite ID for ${n} must be set in your configuration.`)}`),process.exit(1)),{satelliteId:i,...await gl()}},Nv=async e=>(await m0()).find(({p:n})=>n===e)?.n??e,Fv=async e=>{let r=(await wu())?.find(({p:n})=>n===e);return r?.n!==void 0&&r?.n!==""?r.n:e};var Bv=async e=>{let t=Ci(e),{satellite:r}=await Ii(t),n=await bi({satellite:r,env:t}),i=Vs("Clearing dapp assets...").start();try{let s=await Kc({satellite:n});await zL({collection:Am,satellite:n}),await pv({satellite:n,domains:s})}finally{i.stop()}},bve=e=>{let t=e.replace(/\\/g,"/");return`${t.startsWith("/")?"":"/"}${t}`},aU=async({fullPath:e,args:t})=>{let r=Ci(t),{satellite:n}=await Ii(r),i=Vs(`Clearing ${e}...`).start();try{await b$({collection:Am,satellite:await bi({satellite:n,env:r}),fullPath:bve(e)})}finally{i.stop()}};var oU=St(Gt(),1),Qf=()=>{console.log(`Oops! ${(0,oU.red)("No config file found.")} Try to run the command from your project root.`)};var uU=async e=>{if(!await Oi()){Qf();return}if(mn({args:e,options:["-f","--fullpath","--fullPath"]})){let t=Zr({args:e,option:"-f"})??Zr({args:e,option:"--fullpath"})??Zr({args:e,option:"--fullPath"});if(ir(t)){console.log(`You did not provide a ${(0,lU.yellow)("fullPath")} to delete.`);return}await aU({fullPath:t,args:e});return}await Bv(e)};var G0=St(OU(),1),FU=St(Xr(),1);var V0=St(Gt(),1),th=St(fu(),1);import{unlink as gxe}from"node:fs/promises";import{basename as bxe}from"node:path";var IU=St(fu(),1),jv=async()=>{let{configType:e}=await(0,IU.default)({type:"select",name:"configType",message:"What configuration file format do you prefer?",choices:[{title:"TypeScript",value:"ts"},{title:"JavaScript",value:"js"},{title:"JSON",value:"json"}],initial:0});return ci(e),e};var rh=async e=>{let t=await Rc();if(ir(t)){if(!await $p(`Your terminal is not authenticated. Would you like to ${(0,V0.cyan)("log in")} now?`))return;await x0(e)}await Oi()&&await Di("Your existing configuration will be overwritten. Are you sure you want to continue?"),await vxe()},vxe=async()=>{let e=await xxe(),t=await Exe(),r=await Txe(),{configType:n,configPath:i}=await _xe();await F7({config:{satellite:{id:e,source:r},...or(t)&&{orbiter:{id:t}}},configType:n,configPath:i}),or(i)&&bxe(i)==="juno.json"&&await gxe(i),n!=="json"&&console.log(`${mi}\u{1F4A1} You can leverage your IDE's intellisense with type hints by installing the library: ${(0,V0.yellow)("npm i @junobuild/config -D")}${mi}`)},xxe=async()=>{let e=await m0(),t=await(e?.length>0?wxe(e):NU());return t==="_manual_"?await NU():t},Exe=async()=>{let e=await wu();if(e===void 0||e.length===0)return;let t=await Sxe(e);if(t!=="_none_")return t},wxe=async e=>{let{satellite:t}=await(0,th.default)({type:"select",name:"satellite",message:"Which satellite should be linked with this dapp?",choices:[...e.map(({p:r,n})=>({title:n,value:r})),{title:"<not listed, manual entry>",value:"_manual_"}],initial:0});return ci(t),t},_xe=async()=>{if(!await Oi()){let e=N7();return or(e)?e:{configType:await jv()}}return I7()},NU=async()=>{let{satellite:e}=await(0,th.default)([{type:"text",name:"satellite",message:`What's the ${(0,V0.cyan)("id")} of your satellite?`}]);return ci(e,"The satellite ID is mandatory"),e},Txe=async()=>{let{output:e}=await(0,th.default)({type:"select",name:"output",message:"What is the output folder of your `npm run build` command?",choices:[{title:"build",value:"build"},{title:"dist",value:"dist"},{title:"<not listed, manual entry>",value:"_manual_"}],initial:0});if(ci(e),e!=="_manual_")return e;let{source:t}=await(0,th.default)([{type:"text",name:"source",message:"Please enter the name of your output folder"}]);return ci(t),t},Sxe=async e=>{let{orbiter:t}=await(0,th.default)({type:"select",name:"orbiter",message:"Which orbiter do you use for the analytics in this dapp?",choices:[...e.map(({p:r,n})=>({title:n??r,value:r})),{title:"<none>",value:"_none_"}],initial:0});return ci(t),t};var BU=async e=>{await Oi()||await rh();let t=Ci(e),{satellite:r}=await Ii(t),{storage:n,authentication:i,datastore:s,settings:a}=r,l=await bi({satellite:r,env:t}),u=Vs("Configuring...").start();try{await Promise.allSettled([qL({config:{headers:n?.headers??[],rewrites:n?.rewrites,redirects:n?.redirects,iframe:n?.iframe,rawAccess:n?.rawAccess,maxMemorySize:n?.maxMemorySize},satellite:l}),...ir(s)?[]:[VL({config:s,satellite:l})],...ir(i)?[]:[GL({config:i,satellite:l})],...ir(a)?[]:[Axe({settings:a,satellite:l})]])}finally{u.stop()}},Axe=async({settings:e,satellite:t})=>{let{freezingThreshold:r,reservedCyclesLimit:n,logVisibility:i,heapMemoryLimit:s,memoryAllocation:a,computeAllocation:l}=e,{satelliteId:u}=t,c=await iU(),{updateSettings:o}=G0.ICManagementCanister.create({agent:c});await o({canisterId:FU.Principal.fromText(u),settings:{freezingThreshold:r,reservedCyclesLimit:n,logVisibility:ir(i)?void 0:i==="public"?G0.LogVisibility.Public:G0.LogVisibility.Controllers,wasmMemoryLimit:s,memoryAllocation:a,computeAllocation:l}})};var UU=St(Gt(),1);import{lstatSync as Dxe}from"node:fs";var jU=St(Gt(),1),MU=St(kc(),1);var kU="0.0.14",RU=900000000n;var LU=async e=>{let t=Ci(e),{satellite:r}=await Ii(t),{assertions:n}=r;if(n?.heapMemory===!1)return;let i=await bi({satellite:r,env:t}),s=await Zp({satellite:i});if((0,MU.compare)(s,kU)<0){console.log(`Your satellite (${(0,jU.yellow)(`v${s}`)}) is not up-to-date, and the memory size cannot be verified.${mi}`);return}let a=n?.heapMemory!==void 0&&typeof n?.heapMemory!="boolean"?BigInt(n?.heapMemory):RU,{heap:l}=await KL({satellite:i});if(l<a)return;let u=c=>Intl.NumberFormat("en-US",{maximumSignificantDigits:3}).format(Number(c)/1e6);await Di(`\u26A0\uFE0F Your satellite's heap memory is ${u(l)} MB, which exceeds the recommended limit of ${u(a)} MB. Are you sure you want to proceed with the deployment?`)},aD=async({startAfter:e,env:t})=>{let{assets:r,items_page:n,matches_pages:i}=await g$({collection:Am,satellite:await bi(t),filter:{order:{desc:!0,field:"keys"},paginate:{startAfter:e,limit:500}}}),s=a=>{let{length:l,[l-1]:u}=a;return u};if((n??0n)<(i??0n)){let a=await aD({startAfter:s(r)?.fullPath,env:t});return[...r,...a]}return r};var $U=St(Gt(),1);var nh=e=>`https://${e}.icp0.io`,Mv=e=>`${vB}${e}`;var Lv=async e=>{if(T1()||!await Oi())return;let t=Ci(e),{satellite:r}=await Ii(t),n=await bi({satellite:r,env:t}),{satelliteId:i}=n,s=nh(i),a=Mv(i);try{let l=await Kc({satellite:n});if(console.log(`
|
|
635
635
|
\u{1F6E0}\uFE0F ${Of(a)}`),l.length===0){console.log(`\u{1F6F0}\uFE0F ${Of(s)}`);return}l.forEach(({domain:u})=>{console.log(`\u{1F30D} ${Of(`https://${u}`)}`)})}catch{console.log(`${(0,$U.red)("Cannot list the custom domains.")}`)}};var qU=async e=>{await Oi()||await rh(),mn({args:e,options:["-c","--clear"]})&&await Bv(e),await Cxe(e),await Lv(e)},Cxe=async e=>{let t=Ci(e),{satellite:r}=await Ii(t),n=async({startAfter:l})=>await aD({startAfter:l,env:{env:t,satellite:r}}),i=async()=>{await LU(e)},s=await bi({satellite:r,env:t});await jC({config:r,listAssets:n,assertSourceDirExists:Oxe,assertMemory:i,uploadFile:async({filename:l,fullPath:u,data:c,collection:o,headers:d,encoding:h})=>{await y$({satellite:s,filename:l,fullPath:u,data:c,collection:o,headers:d,encoding:h})}})},Oxe=e=>{try{Dxe(e)}catch{console.log(`${(0,UU.red)("Cannot proceed deployment.")}
|
|
636
636
|
Are you sure the folder containing your built app (the "source" tag in the configuration file for Juno) files is correctly configured, or have you built your app?`),process.exit(1)}};var xq=St(Gt(),1);var xl=St(Gt(),1);import{existsSync as Ixe}from"node:fs";import{lstat as Nxe,mkdir as Fxe,rename as Bxe,writeFile as zU}from"node:fs/promises";import{join as nd,relative as kxe}from"node:path";import{join as VU}from"node:path";var Su=VU(process.cwd(),"src","satellite"),oD="../templates/eject",ih=VU(oD,"src","satellite"),lD="1.70.0",sh="0.3.6",uD="24.0.0";var $v=async e=>{await Vc({template:"satellite.did",sourceFolder:ih,destinationFolder:Su,overwrite:e})},GU=async()=>await Hf({template:"satellite.did",sourceFolder:ih});var vl=St(Gt(),1),ah=St(kc(),1);var HU=()=>{try{let{version:e}=process;if((0,ah.major)(e)<u_)return console.log(`Your version of Node is ${(0,vl.yellow)(`${e.trim()}`)}. Juno CLI requires Node ${(0,vl.green)(`${u_}`)} or a more recent version.`),{valid:!1}}catch{return{valid:"error"}}return{valid:!0}},Uv=async()=>{try{let e="";await La({command:"rustc",args:["--version"],stdout:r=>e+=r});let t=e.trim().split(" ")[1];if((0,ah.lt)(t,lD))return console.log(`Your version of Rustc is ${(0,vl.yellow)(t.trim())}. Juno CLI requires ${(0,vl.green)(`${lD}`)} or a more recent version.`),{valid:!1}}catch{return console.error("Cannot detect your Rust version. Is Cargo installed on your machine?"),{valid:"error"}}return{valid:!0}},WU=async()=>{try{let e="";await La({command:"ic-wasm",args:["--version"],stdout:r=>e+=r});let t=e.trim().split(" ")[1];if((0,ah.lt)(t,sh))return console.log(`Your version of ic-wasm is ${(0,vl.yellow)(t.trim())}. Juno CLI requires ${(0,vl.green)(`${sh}`)} or a more recent version.`),{valid:!1}}catch{return{valid:"error"}}return{valid:!0}},cD=async()=>{try{let e="";await La({command:"docker",args:["--version"],stdout:r=>e+=r});let t=e.replaceAll(",","").trim().split(" ")[2];if((0,ah.lt)(t,uD))return console.log(`Your version of Docker is ${(0,vl.yellow)(t.trim())}. Juno CLI requires ${(0,vl.green)(`${uD}`)} or a more recent version.`),{valid:!1}}catch{return console.error("Cannot detect Docker version. Is Docker installed on your machine?"),{valid:"error"}}return{valid:!0}},pD=async()=>{try{await Jl({command:"docker",args:["ps","--quiet"]})}catch{process.exit(1)}},KU=async()=>{try{return await La({command:"candid-extractor",silentErrors:!0}),{valid:!0}}catch{return{valid:"error"}}};var YU=nd(process.cwd(),"target","wasm32-unknown-unknown","release"),JU=nd(process.cwd(),"target","deploy"),Sa=nd(JU,"satellite.wasm"),XU=async()=>{let{valid:e}=await Uv();if(e==="error"||!e)return;let{valid:t}=await $xe();if(!t)return;let{valid:r}=await Uxe();if(!r)return;let n=["build","--target","wasm32-unknown-unknown","-p","satellite","--release",...Ixe("Cargo.lock")?["--locked"]:[]];await Jl({command:"cargo",args:n});let i=Vs({text:"Finalizing...",discardStdin:!0}).start();try{await jxe(),await Mxe(),i.text="Compressing...",await _x({source:Sa,destination:`${Sa}.tmp.gz`}),await Bxe(`${Sa}.tmp.gz`,`${Sa}.gz`),await Lxe(i)}finally{i.stop()}},ZU=nd(Su,"satellite.did"),QU="satellite_extension.did",Rxe=nd(Su,QU),jxe=async()=>{let e="";if(await La({command:"candid-extractor",args:[nd(YU,"satellite.wasm")],stdout:n=>e+=n}),e.replace(/(\r\n|\n|\r)/gm,"").trim()===""){await $v(!0);return}await zU(Rxe,e,"utf-8");let r=await GU();await zU(ZU,`import service "${QU}";
|
|
637
637
|
|
|
638
638
|
${r}`,"utf-8")},Mxe=async()=>{await Fxe(JU,{recursive:!0}),await La({command:"ic-wasm",args:[nd(YU,"satellite.wasm"),"-o",Sa,"shrink"]}),await La({command:"ic-wasm",args:[Sa,"-o",Sa,"metadata","candid:service","-f",ZU,"-v","public"]}),await La({command:"ic-wasm",args:[Sa,"-o",Sa,"metadata","juno:build","-d","extended","-v","public"]}),await La({command:"ic-wasm",args:[Sa,"-o",Sa,"metadata","supported_certificate_versions","-d",'"1,2"',"-v","public"]})},Lxe=async e=>{let t=`${Sa}.gz`,{size:r}=await Nxe(t),n=i=>Intl.NumberFormat("en-US",{maximumSignificantDigits:2}).format(i/(1024*1024));e.succeed(`${(0,xl.green)("Success!")}
|
|
639
639
|
|
|
640
640
|
The satellite has been compiled.
|
|
641
|
-
Output file: ${(0,xl.yellow)(`${kxe(process.cwd(),t)}`)} ${(0,xl.grey)(`(${n(r)}MB)`)}`)},$xe=async()=>{let{valid:e}=await WU();return e===!1?{valid:e}:(e==="error"&&(await Di(`The ${(0,xl.magenta)("ic-wasm")} ${(0,xl.yellow)(`v${sh}`)} tool is required to build a satellite but appears to be not available. Would you like to install it on your machine?`),await Jl({command:"cargo",args:["install",`ic-wasm@${sh}`]})),{valid:!0})},Uxe=async()=>{let{valid:e}=await KU();return e===!1?{valid:e}:(e==="error"&&(await Di(`The ${(0,xl.magenta)("candid-extractor")} tool is required to generate the API ("did file") of your custom satellite but appears to be not available. Would you like to install it on your machine?`),await Jl({command:"cargo",args:["install","candid-extractor"]})),{valid:!0})};var nq=St(Gt(),1);import{existsSync as qxe}from"node:fs";import{writeFile as Vxe}from"node:fs/promises";import{basename as Gxe,join as Hxe}from"node:path";var dD={filename:_b},eq=async()=>await ev(dD),tq=()=>tv(dD),rq=()=>Gf(dD);var iq="../templates/docker",sq=process.cwd(),aq=async()=>{let{valid:e}=await cD();e==="error"||!e||(await pD(),await Wxe(),await zxe(),await Jl({command:"docker",args:["compose","up"]}))},oq=async()=>{let{valid:e}=await cD();e==="error"||!e||(await pD(),await Jl({command:"docker",args:["compose","stop"]}))},Wxe=async()=>{if(await eq())return;await Di("A config file is required for development. Would you like the CLI to create one for you?");let{configType:e,configPath:t}=await Kxe();await Vc({template:`${_b}.${e}`,sourceFolder:iq,destinationFolder:sq,...or(t)&&{destinationFilename:t}})},Kxe=async()=>{let e=tq();return or(e)?e:{configType:await jv()}},zxe=async()=>{if(qxe("docker-compose.yml"))return;await Di(`The CLI utilizes Docker Compose, which is handy for customizing configurations. Would you like the CLI to generate a default ${(0,nq.magenta)("docker-compose.yml")} file for you?`);let e=await Hf({template:"docker-compose.yml",sourceFolder:iq}),{configPath:t}=rq(),r=Gxe(t),n=e.replaceAll("<JUNO_DEV_CONFIG>",r);await Vxe(Hxe(sq,"docker-compose.yml"),n,"utf-8")};var Yc=St(Gt(),1);import{mkdir as Xxe}from"node:fs/promises";import{join as bq}from"node:path";var Tt=St(Gt(),1);var qv="0.0.
|
|
641
|
+
Output file: ${(0,xl.yellow)(`${kxe(process.cwd(),t)}`)} ${(0,xl.grey)(`(${n(r)}MB)`)}`)},$xe=async()=>{let{valid:e}=await WU();return e===!1?{valid:e}:(e==="error"&&(await Di(`The ${(0,xl.magenta)("ic-wasm")} ${(0,xl.yellow)(`v${sh}`)} tool is required to build a satellite but appears to be not available. Would you like to install it on your machine?`),await Jl({command:"cargo",args:["install",`ic-wasm@${sh}`]})),{valid:!0})},Uxe=async()=>{let{valid:e}=await KU();return e===!1?{valid:e}:(e==="error"&&(await Di(`The ${(0,xl.magenta)("candid-extractor")} tool is required to generate the API ("did file") of your custom satellite but appears to be not available. Would you like to install it on your machine?`),await Jl({command:"cargo",args:["install","candid-extractor"]})),{valid:!0})};var nq=St(Gt(),1);import{existsSync as qxe}from"node:fs";import{writeFile as Vxe}from"node:fs/promises";import{basename as Gxe,join as Hxe}from"node:path";var dD={filename:_b},eq=async()=>await ev(dD),tq=()=>tv(dD),rq=()=>Gf(dD);var iq="../templates/docker",sq=process.cwd(),aq=async()=>{let{valid:e}=await cD();e==="error"||!e||(await pD(),await Wxe(),await zxe(),await Jl({command:"docker",args:["compose","up"]}))},oq=async()=>{let{valid:e}=await cD();e==="error"||!e||(await pD(),await Jl({command:"docker",args:["compose","stop"]}))},Wxe=async()=>{if(await eq())return;await Di("A config file is required for development. Would you like the CLI to create one for you?");let{configType:e,configPath:t}=await Kxe();await Vc({template:`${_b}.${e}`,sourceFolder:iq,destinationFolder:sq,...or(t)&&{destinationFilename:t}})},Kxe=async()=>{let e=tq();return or(e)?e:{configType:await jv()}},zxe=async()=>{if(qxe("docker-compose.yml"))return;await Di(`The CLI utilizes Docker Compose, which is handy for customizing configurations. Would you like the CLI to generate a default ${(0,nq.magenta)("docker-compose.yml")} file for you?`);let e=await Hf({template:"docker-compose.yml",sourceFolder:iq}),{configPath:t}=rq(),r=Gxe(t),n=e.replaceAll("<JUNO_DEV_CONFIG>",r);await Vxe(Hxe(sq,"docker-compose.yml"),n,"utf-8")};var Yc=St(Gt(),1);import{mkdir as Xxe}from"node:fs/promises";import{join as bq}from"node:path";var Tt=St(Gt(),1);var qv="0.0.76";var Jxe=` __ __ __ __ _ ____
|
|
642
642
|
__) || | || \\| |/ \\
|
|
643
643
|
\\___/ \\___/ |_|\\__|\\____/`,El=`${Jxe} CLI ${(0,Tt.grey)(`v${qv}`)}`,Vv=`
|
|
644
644
|
${El}
|