@shipstatic/ship 0.8.11 → 0.8.12
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/cli.cjs +2 -2
- package/dist/cli.cjs.map +1 -1
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
`},V=(e,o)=>{let t=Object.entries(e).filter(([s,r])=>ct.includes(s)?!1:r!==void 0);if(t.length===0)return"";let n=t.map(([s,r])=>({property:s+":",value:dt(s,r,"details",o)}));return(0,xe.default)(n,{columnSplitter:" ",showHeaders:!1,config:{property:{dataTransform:s=>w(f.dim,s,o)}}}).split(`
|
|
14
14
|
`).map(s=>s.replace(/\0/g,"")).join(`
|
|
15
15
|
`)+`
|
|
16
|
-
`};var ke=(e,o)=>`https://setup.shipstatic.com/${e}/${o}`;function Xt(e,o,t){let{noColor:n}=t;if(e.deployments.length===0){console.log("no deployments found"),console.log();return}let i=["deployment","labels","files","size","created","via"];console.log(W(e.deployments,i,n))}function Zt(e,o,t){let{noColor:n}=t;if(e.domains.length===0){console.log("no domains found"),console.log();return}let i=["domain","deployment","labels","linked","links","created"];console.log(W(e.domains,i,n))}function Qt(e,o,t){let{noColor:n}=t,{_dnsRecords:i,_shareHash:s,isCreate:r,...a}=e;if(o.operation==="set"){let l=r?"created":"updated";E(`${e.url} domain ${l}`,!1,n)}i&&i.length>0&&(console.log(),_("DNS Records to configure:",!1,n),i.forEach(l=>{console.log(` ${l.type}: ${l.name} \u2192 ${l.value}`)})),s&&(console.log(),_(`Setup instructions: ${ke(s,e.domain)}`,!1,n)),console.log(V(a,n))}function eo(e,o,t){let{noColor:n}=t;o.operation==="upload"&&E(`${e.url} deployment uploaded`,!1,n),console.log(V(e,n));let i=e.claim;i
|
|
16
|
+
`};var ke=(e,o)=>`https://setup.shipstatic.com/${e}/${o}`;function Xt(e,o,t){let{noColor:n}=t;if(e.deployments.length===0){console.log("no deployments found"),console.log();return}let i=["deployment","labels","files","size","created","via"];console.log(W(e.deployments,i,n))}function Zt(e,o,t){let{noColor:n}=t;if(e.domains.length===0){console.log("no domains found"),console.log();return}let i=["domain","deployment","labels","linked","links","created"];console.log(W(e.domains,i,n))}function Qt(e,o,t){let{noColor:n}=t,{_dnsRecords:i,_shareHash:s,isCreate:r,...a}=e;if(o.operation==="set"){let l=r?"created":"updated";E(`${e.url} domain ${l}`,!1,n)}i&&i.length>0&&(console.log(),_("DNS Records to configure:",!1,n),i.forEach(l=>{console.log(` ${l.type}: ${l.name} \u2192 ${l.value}`)})),s&&(console.log(),_(`Setup instructions: ${ke(s,e.domain)}`,!1,n)),console.log(V(a,n))}function eo(e,o,t){let{noColor:n}=t;o.operation==="upload"&&E(`${e.url} deployment uploaded`,!1,n),console.log(V(e,n));let i=e.claim;if(i){let s=e.expires?Math.round((e.expires-e.created)/86400):null;console.log(`IMPORTANT: this deployment${s?` expires in ${s} day${s!==1?"s":""}`:" will expire"}, claim it to keep permanently:
|
|
17
17
|
${i}
|
|
18
|
-
`),_("configure a free API key with 'ship config' to deploy to your own account",!1,n)
|
|
18
|
+
`),_("configure a free API key with 'ship config' to deploy to your own account",!1,n)}}function to(e,o,t){let{noColor:n}=t;console.log(V(e,n))}function oo(e,o,t){let{noColor:n}=t;e.message&&E(e.message,!1,n)}function no(e,o,t){let{noColor:n}=t;if(e.valid){if(E("domain is valid",!1,n),console.log(),e.normalized&&console.log(` normalized: ${e.normalized}`),e.available!==null){let i=e.available?n?"available":"available \u2713":"already taken";console.log(` availability: ${i}`)}console.log()}else T(e.error||"domain is invalid",!1,n)}function io(e,o,t){let{noColor:n}=t;if(e.records.length===0){console.log("no records found"),console.log();return}let i=["type","name","value"];console.log(W(e.records,i,n))}function so(e,o,t){let{noColor:n}=t,i=e.dns?.provider?.name||null;console.log(V({domain:e.domain,provider:i},n))}function ro(e,o,t){let{noColor:n}=t;E(ke(e.hash,e.domain),!1,n)}function ao(e,o,t){let{noColor:n}=t;if(e.tokens.length===0){console.log("no tokens found"),console.log();return}let i=["token","labels","created","expires"];console.log(W(e.tokens,i,n))}function lo(e,o,t){let{noColor:n}=t;o.operation==="create"&&e.token&&E(`token ${e.token} created`,!1,n),console.log(V(e,n))}function mt(e,o,t){let{json:n,quiet:i,noColor:s}=t;if(i){if(e===void 0||typeof e=="boolean")return;if(e!==null&&typeof e=="object")if("deployments"in e)e.deployments.forEach(r=>console.log(r.deployment));else if("domains"in e)e.domains.forEach(r=>console.log(r.domain));else if("tokens"in e)e.tokens.forEach(r=>console.log(r.token));else if("records"in e)e.records.forEach(r=>console.log(`${r.type} ${r.name} ${r.value}`));else if("hash"in e){let r=e;console.log(ke(r.hash,r.domain))}else if("dns"in e){let r=e.dns?.provider?.name;r&&console.log(r)}else if("domain"in e)console.log(e.domain);else if("deployment"in e)console.log(e.deployment);else if("secret"in e)console.log(e.secret);else if("email"in e)console.log(e.email);else if("valid"in e){let r=e;r.valid&&r.normalized&&console.log(r.normalized)}else"message"in e&&console.log(e.message);return}if(e===void 0){o.operation==="remove"&&o.resourceType&&o.resourceId?E(`${o.resourceId} ${o.resourceType.toLowerCase()} removed`,n,s):E("removed successfully",n,s);return}if(typeof e=="boolean"){e?E("api reachable",n,s):T("api unreachable",n,s);return}if(n&&e!==null&&typeof e=="object"){let r={...e};delete r._dnsRecords,delete r._shareHash,delete r.isCreate,console.log(JSON.stringify(r,null,2)),console.log();return}e!==null&&typeof e=="object"?"deployments"in e?Xt(e,o,t):"domains"in e?Zt(e,o,t):"tokens"in e?ao(e,o,t):"records"in e?io(e,o,t):"hash"in e?ro(e,o,t):"dns"in e?so(e,o,t):"domain"in e?Qt(e,o,t):"deployment"in e?eo(e,o,t):"token"in e?lo(e,o,t):"email"in e?to(e,o,t):"valid"in e?no(e,o,t):"message"in e?oo(e,o,t):E("success",n,s):E("success",n,s)}var S=R(require("fs"),1),L=R(require("path"),1),Ie=R(require("os"),1);function ut(){let e=process.env.SHELL||"";return e.includes("bash")?"bash":e.includes("zsh")?"zsh":e.includes("fish")?"fish":null}function ft(e,o){switch(e){case"bash":return{completionFile:L.join(o,".ship_completion.bash"),profileFile:L.join(o,".bash_profile"),scriptName:"ship.bash"};case"zsh":return{completionFile:L.join(o,".ship_completion.zsh"),profileFile:L.join(o,".zshrc"),scriptName:"ship.zsh"};case"fish":return{completionFile:L.join(o,".config/fish/completions/ship.fish"),profileFile:null,scriptName:"ship.fish"}}}function ht(e,o={}){let{json:t,noColor:n}=o,i=ut(),s=Ie.homedir();if(!i){T(`unsupported shell: ${process.env.SHELL}. supported: bash, zsh, fish`,t,n);return}let r=ft(i,s),a=L.join(e,r.scriptName);try{if(i==="fish"){let p=L.dirname(r.completionFile);S.existsSync(p)||S.mkdirSync(p,{recursive:!0}),S.copyFileSync(a,r.completionFile),E("fish completion installed successfully",t,n),_("please restart your shell to apply the changes",t,n);return}S.copyFileSync(a,r.completionFile);let l=`# ship
|
|
19
19
|
source '${r.completionFile}'
|
|
20
20
|
# ship end`;if(r.profileFile){if(S.existsSync(r.profileFile)){let p=S.readFileSync(r.profileFile,"utf-8");if(!p.includes("# ship")||!p.includes("# ship end")){let d=p.length>0&&!p.endsWith(`
|
|
21
21
|
`)?`
|