@shipstatic/ship 2.0.0-beta.18 → 2.0.0-beta.19
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 +1 -1
- package/dist/cli.cjs.map +1 -1
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -193,6 +193,6 @@ ${t("EXAMPLES")}
|
|
|
193
193
|
|
|
194
194
|
${n("Please report any issues to https://github.com/shipstatic/ship/issues")}
|
|
195
195
|
`}var Te=e=>new p(h.Validation,e);function ie(e,t=[]){return t.concat([e])}function Ce(e){let t=Number.parseInt(e,10);if(Number.isNaN(t))throw new G.InvalidArgumentError("Not a number.");return t}function se(e,t){let n=e?.label?.length?e.label:t?.label;if(!n?.length)return;let o=n.filter(i=>i!=="");return o.length?o:[]}function rn(e,t){return e?.password??t?.password??(process.env.SHIP_PASSWORD||void 0)}function N(e){let t=e.optsWithGlobals();t.color===!1&&(t.noColor=!0);let n=!!process.env.FORCE_COLOR&&process.env.FORCE_COLOR!=="0";return!t.noColor&&!n&&(!process.stdout.isTTY||process.env.NO_COLOR!==void 0)&&(t.noColor=!0),t}function re(){let e=N(this),t=L(this).map(o=>o.name()),n=this.args.find(o=>!t.includes(o));n&&J(Te(`unknown command '${n}'`),e.json,e.noColor),e.json||console.log(`usage: ship ${this.name()} <${t.join("|")}>
|
|
196
|
-
`),process.exitCode=1}function Eo(e){let t={};try{t=he(e.config)}catch{}let n=Ke(e,Y(),t).token;return typeof n=="string"?n:void 0}async function an(e,t,n,o,i,s){if(!(0,q.existsSync)(t))throw p.file(`${t} path does not exist`,{filePath:t});let l=(0,q.statSync)(t);if(!l.isDirectory()&&!l.isFile())throw p.file(`${t} path must be a file or directory`,{filePath:t});let d={via:tt(process.env.SHIP_VIA)??$e.CLI};n!==void 0&&(d.labels=n),o!==void 0&&(d.password=o),i?.noPathDetect!==void 0&&(d.pathDetect=!i.noPathDetect),i?.noSpaDetect!==void 0&&(d.spaDetect=!i.noSpaDetect);let
|
|
196
|
+
`),process.exitCode=1}function Eo(e){let t={};try{t=he(e.config)}catch{}let n=Ke(e,Y(),t).token;return typeof n=="string"?n:void 0}async function an(e,t,n,o,i,s){if(!(0,q.existsSync)(t))throw p.file(`${t} path does not exist`,{filePath:t});let l=(0,q.statSync)(t);if(!l.isDirectory()&&!l.isFile())throw p.file(`${t} path must be a file or directory`,{filePath:t});let d={via:tt(process.env.SHIP_VIA)??$e.CLI};n!==void 0&&(d.labels=n);let m=process.env.SHIP_IDEMPOTENCY_KEY||void 0;m!==void 0&&(d.idempotencyKey=m),o!==void 0&&(d.password=o),i?.noPathDetect!==void 0&&(d.pathDetect=!i.noPathDetect),i?.noSpaDetect!==void 0&&(d.spaDetect=!i.noSpaDetect);let r=new AbortController;d.signal=r.signal;let a=null;if(process.stdout.isTTY&&!s.json&&!s.quiet&&!s.noColor){let{default:u}=await import("yocto-spinner");a=u({text:"uploading\u2026"}).start()}let c=()=>{r.abort(),a&&a.stop(),process.exit(130)};process.on("SIGINT",c);try{return await e.deployments.upload(t,d)}finally{process.removeListener("SIGINT",c),a&&a.stop()}}function ln(){let e=new G.Command;e.exitOverride(r=>{if(r.code==="commander.help"||r.code==="commander.version"||r.exitCode===0)throw r;let a=N(e),c=r.message||"unknown command error";throw c=c.replace(/^error: /,"").replace(/\n.*/,"").replace(/\.$/,"").toLowerCase(),J(Te(c),a.json,a.noColor),a.json||e.outputHelp(),r}).configureOutput({writeErr:r=>{r.startsWith("error:")||process.stderr.write(r)},writeOut:r=>process.stdout.write(r)});function t(r){let a=N(e),c=en(r);if(a.json)J(c,!0,a.noColor);else{let u=tn(c,{token:c.isAuthError()?Eo(e.opts()):void 0});J(u,!1,a.noColor),c.type===h.Validation&&u.includes("unknown command")&&e.outputHelp()}process.exitCode=1}function n(r,a){return async function(...c){let u=N(this);try{let{config:w,apiUrl:$,token:f}=e.opts(),g=Qt({config:w,apiUrl:$,token:f}),C=await r(g,u,...c);sn(C,a,{json:u.json,quiet:u.quiet,noColor:u.noColor})}catch(w){t(w)}}}e.name("ship").description("\u{1F680} Deploy static sites with simplicity").version(go.version,"-V, --version","Show version information").option("--token <token>","Any ship token: API key (ship-\u2026) or deploy token (deploy-\u2026)").option("--config <file>","Custom config file path").option("--api-url <url>","API URL (for development)").option("--json","Output results in JSON format").option("-q, --quiet","Output only the resource identifier").option("--no-color","Disable colored output").helpOption("-h, --help","Display help for command").helpCommand("help [command]","Display help for command").configureHelp({formatHelp:(r,a)=>r.parent===null?`${yo(N(r).noColor)}
|
|
197
197
|
`:G.Help.prototype.formatHelp.call(a,r,a)}).allowExcessArguments(),e.hook("preAction",r=>{let a=N(r);try{a.token&&typeof a.token=="string"&&B(a.token),a.apiUrl&&typeof a.apiUrl=="string"&&ct(a.apiUrl)}catch(c){throw A(c)?(J(c,a.json,a.noColor),new G.CommanderError(1,"ship.invalidOption",c.message)):c}}),e.command("ping").description("Check API connectivity").action(n((r,a)=>r.ping(),{operation:"ping"})),e.command("whoami").description("Get current account information").action(n((r,a)=>r.whoami(),{operation:"get",resource:"account"}));let o=e.command("deployments").description("Manage deployments").enablePositionalOptions().action(re);o.command("list").description("List deployments (one page \u2014 see --limit and --cursor)").option("--limit <count>","Maximum number of results per page",Ce).option("--cursor <cursor>","Continue from a previous page's cursor").action(n((r,a,c)=>r.deployments.list(c),{operation:"list",resource:"deployment"})),o.command("upload <path>").description("Upload deployment from file or directory").passThroughOptions().option("--label <label>","Label to add (can be repeated)",ie,[]).option("--password <password>","Password-protect this deployment").option("--no-path-detect","Disable automatic path optimization and flattening").option("--no-spa-detect","Disable automatic SPA detection and configuration").action(n((r,a,c,u)=>an(r,c,se(u,e.opts()),rn(u,e.opts()),u,a),{operation:"upload",resource:"deployment"})),o.command("get <deployment>").description("Show deployment information").action(n((r,a,c)=>r.deployments.get(c),{operation:"get",resource:"deployment"})),o.command("set <deployment>").description("Set deployment labels").passThroughOptions().option("--label <label>","Label to set (can be repeated)",ie,[]).action(n(async(r,a,c,u)=>{let w=se(u,e.opts())||[];return r.deployments.set(c,{labels:w})},{operation:"set",resource:"deployment"})),o.command("delete <deployment>").description("Delete deployment permanently").action(n((r,a,c)=>r.deployments.delete(c),{operation:"delete",resource:"deployment"}));let i=e.command("domains").description("Manage domains").enablePositionalOptions().action(re);i.command("list").description("List domains (one page \u2014 see --limit and --cursor)").option("--limit <count>","Maximum number of results per page",Ce).option("--cursor <cursor>","Continue from a previous page's cursor").action(n((r,a,c)=>r.domains.list(c),{operation:"list",resource:"domain"})),i.command("get <name>").description("Show domain information").action(n((r,a,c)=>r.domains.get(c),{operation:"get",resource:"domain"})),i.command("validate <name>").description("Check if domain name is valid and available").action(n(async(r,a,c)=>{let u=await r.domains.validate(c);return u.valid||(process.exitCode=1),u},{operation:"validate",resource:"domain"})),i.command("verify <name>").description("Trigger DNS verification for external domain").action(n((r,a,c)=>r.domains.verify(c),{operation:"verify",resource:"domain"})),i.command("records <name>").description("Show required DNS records for domain setup").action(n((r,a,c)=>r.domains.records(c),{operation:"records",resource:"domain"})),i.command("dns <name>").description("Look up DNS provider for a domain").action(n((r,a,c)=>r.domains.dns(c),{operation:"dns",resource:"domain"})),i.command("share <name>").description("Get shareable DNS setup link").action(n((r,a,c)=>r.domains.share(c),{operation:"share",resource:"domain"})),i.command("set <name> [deployment]").description("Create domain, link to deployment, or update labels").passThroughOptions().option("--label <label>","Label to set (can be repeated)",ie,[]).action(n(async(r,a,c,u,w)=>{!u&&!process.stdin.isTTY&&(u=await new Promise(C=>{let O="";process.stdin.on("data",H=>O+=H),process.stdin.on("end",()=>C(O.trim()||void 0))}));let $=se(w,e.opts()),f={};u&&(f.deployment=u),$!==void 0&&(f.labels=$);let g=await r.domains.set(c,f);if(g.isCreate&&c.includes("."))try{let[C,O]=await Promise.all([r.domains.records(c),r.domains.share(c)]);return{...g,_dnsRecords:C.records,_shareHash:O.hash}}catch{}return g},{operation:"set",resource:"domain"})),i.command("delete <name>").description("Delete domain permanently").action(n((r,a,c)=>r.domains.delete(c),{operation:"delete",resource:"domain"}));let s=e.command("tokens").description("Manage deploy tokens").enablePositionalOptions().action(re);s.command("list").description("List deploy tokens (one page \u2014 see --limit and --cursor)").option("--limit <count>","Maximum number of results per page",Ce).option("--cursor <cursor>","Continue from a previous page's cursor").action(n((r,a,c)=>r.tokens.list(c),{operation:"list",resource:"token"})),s.command("create").description("Create a new deploy token").option("--ttl <seconds>","Time to live in seconds (default: never expires)",Ce).option("--label <label>","Label to set (can be repeated)",ie,[]).action(n((r,a,c)=>{let u={};c?.ttl!==void 0&&(u.ttl=c.ttl);let w=se(c,e.opts());return w!==void 0&&(u.labels=w),r.tokens.create(u)},{operation:"create",resource:"token"})),s.command("get <token>").description("Show one deploy token").action(n((r,a,c)=>r.tokens.get(c),{operation:"get",resource:"token"})),s.command("delete <token>").description("Delete token permanently").action(n((r,a,c)=>r.tokens.delete(c),{operation:"delete",resource:"token"})),e.command("account").description("Manage account").action(re).command("get").description("Show account information").action(n((r,a)=>r.whoami(),{operation:"get",resource:"account"}));let d=e.command("completion").description("Setup shell completion").action(re);d.command("install").description("Install shell completion script").action(()=>{let r=N(e);try{bt(e,{json:r.json,noColor:r.noColor})}catch(a){t(a)}}),d.command("uninstall").description("Uninstall shell completion script").action(()=>{let r=N(e);try{wt({json:r.json,noColor:r.noColor})}catch(a){t(a)}}),e.command("config").description("Save your token").action(async()=>{let r=N(e);try{if(r.json)throw Te("ship config is interactive \u2014 run it without --json (it shows the token already saved)");await xt({noColor:r.noColor,configFile:r.config})}catch(a){t(a)}});let m=n((r,a,c,u)=>an(r,c,se(u,e.opts()),rn(u,e.opts()),u,a),{operation:"upload",resource:"deployment"});return e.argument("[path]","Path to deploy").option("--label <label>","Label to add (can be repeated)",ie,[]).option("--password <password>","Password-protect this deployment").option("--no-path-detect","Disable automatic path optimization and flattening").option("--no-spa-detect","Disable automatic SPA detection and configuration").action(async function(r,a){if(!r){this.outputHelp();return}if(!(0,q.existsSync)(r)&&!r.includes("/")&&!r.includes("\\")&&!r.includes(".")&&!r.startsWith("~")){t(Te(`unknown command '${r}'`));return}return m.call(this,r,a)}),e}ln().parseAsync(process.argv).catch(e=>{if(e instanceof pn.CommanderError){process.exitCode=e.exitCode;return}throw e});
|
|
198
198
|
//# sourceMappingURL=cli.cjs.map
|