@shipstatic/ship 0.8.15 → 0.8.16
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
|
@@ -81,7 +81,7 @@ ${o("EXAMPLES")}
|
|
|
81
81
|
ship ./dist -q | ship domains set www.example.com
|
|
82
82
|
|
|
83
83
|
${t("Please report any issues to https://github.com/shipstatic/ship/issues")}
|
|
84
|
-
`;console.log(i)}function oe(e,o=[]){return o.concat([e])}function ne(e,o){let t=e?.label?.length?e.label:o?.label;if(!t?.length)return;let n=t.filter(i=>i!=="");return n.length?n:[]}function Ft(e,o){return e?.password??o?.password??process.env.SHIP_PASSWORD}function ie(e,o){return(...t)=>{let n=$(f),i=t[t.length-1];if(i?.args?.length){let s=i.args.find(r=>!o.includes(r));s&&R(`unknown command '${s}'`,n.json,n.noColor)}n.json||console.log(`usage: ship ${e} <${o.join("|")}>
|
|
84
|
+
`;console.log(i)}function oe(e,o=[]){return o.concat([e])}function ne(e,o){let t=e?.label?.length?e.label:o?.label;if(!t?.length)return;let n=t.filter(i=>i!=="");return n.length?n:[]}function Ft(e,o){return e?.password??o?.password??(process.env.SHIP_PASSWORD||void 0)}function ie(e,o){return(...t)=>{let n=$(f),i=t[t.length-1];if(i?.args?.length){let s=i.args.find(r=>!o.includes(r));s&&R(`unknown command '${s}'`,n.json,n.noColor)}n.json||console.log(`usage: ship ${e} <${o.join("|")}>
|
|
85
85
|
`),process.exit(1)}}function $(e){let o=e.optsWithGlobals();o.color===!1&&(o.noColor=!0);let t=!!process.env.FORCE_COLOR&&process.env.FORCE_COLOR!=="0";return!o.noColor&&!t&&(!process.stdout.isTTY||process.env.NO_COLOR!==void 0)&&(o.noColor=!0),o}function Pt(e,o){let t=$(f),n=xt(e),i=Ot(n,o,{apiKey:t.apiKey,deployToken:t.deployToken});t.json?console.error(kt(i,n.details)+`
|
|
86
86
|
`):(R(i,!1,t.noColor),n.isValidationError()&&i.includes("unknown command")&&te(t.noColor)),process.exit(1)}function D(e,o){return async function(...t){let n=$(this),i=o?{operation:o.operation,resourceType:o.resourceType,resourceId:o.getResourceId?.(...t)}:{};try{let s=So(),r=await e(s,n,...t);yt(r,i,{json:n.json,quiet:n.quiet,noColor:n.noColor})}catch(s){Pt(s,i)}}}function So(){let{config:e,apiUrl:o,apiKey:t,deployToken:n}=f.opts();return new me({configFile:e,apiUrl:o,apiKey:t,deployToken:n})}async function $t(e,o,t,n,i,s){if(!(0,G.existsSync)(o))throw l.file(`${o} path does not exist`,o);let r=(0,G.statSync)(o);if(!r.isDirectory()&&!r.isFile())throw l.file(`${o} path must be a file or directory`,o);let c={via:process.env.SHIP_VIA||"cli"};t!==void 0&&(c.labels=t),n!==void 0&&(c.password=n),i?.noPathDetect!==void 0&&(c.pathDetect=!i.noPathDetect),i?.noSpaDetect!==void 0&&(c.spaDetect=!i.noSpaDetect);let p=new AbortController;c.signal=p.signal;let a=null;if(process.stdout.isTTY&&!s.json&&!s.quiet&&!s.noColor){let{default:m}=await import("yocto-spinner");a=m({text:"uploading\u2026"}).start()}let d=()=>{p.abort(),a&&a.stop(),process.exit(130)};process.on("SIGINT",d);try{return await e.deployments.upload(o,c)}finally{process.removeListener("SIGINT",d),a&&a.stop()}}f.name("ship").description("\u{1F680} Deploy static sites with simplicity").version(yo.version,"--version","Show version information").option("--api-key <key>","API key for authenticated deployments").option("--deploy-token <token>","Deploy token for single-use deployments").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").option("--help","Display help for command").helpOption(!1);f.hook("preAction",e=>{let o=$(e);o.help&&(te(o.noColor),process.exit(0))});f.hook("preAction",e=>{let o=$(e);try{o.apiKey&&typeof o.apiKey=="string"&&re(o.apiKey),o.deployToken&&typeof o.deployToken=="string"&&je(o.deployToken),o.apiUrl&&typeof o.apiUrl=="string"&&Ke(o.apiUrl)}catch(t){throw x(t)&&(R(t.message,o.json,o.noColor),process.exit(1)),t}});f.command("ping").description("Check API connectivity").action(D((e,o)=>e.ping()));f.command("whoami").description("Get current account information").action(D((e,o)=>e.whoami(),{operation:"get",resourceType:"Account"}));var se=f.command("deployments").description("Manage deployments").enablePositionalOptions().action(ie("deployments",["list","upload","get","set","remove"]));se.command("list").description("List all deployments").action(D((e,o)=>e.deployments.list()));se.command("upload <path>").description("Upload deployment from file or directory").passThroughOptions().option("--label <label>","Label to add (can be repeated)",oe,[]).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(D((e,o,t,n)=>$t(e,t,ne(n,f.opts()),Ft(n,f.opts()),n,o),{operation:"upload"}));se.command("get <deployment>").description("Show deployment information").action(D((e,o,t)=>e.deployments.get(t),{operation:"get",resourceType:"Deployment",getResourceId:e=>e}));se.command("set <deployment>").description("Set deployment labels").passThroughOptions().option("--label <label>","Label to set (can be repeated)",oe,[]).action(D(async(e,o,t,n)=>{let i=ne(n,f.opts())||[];return e.deployments.set(t,{labels:i})},{operation:"set",resourceType:"Deployment",getResourceId:e=>e}));se.command("remove <deployment>").description("Delete deployment permanently").action(D((e,o,t)=>e.deployments.remove(t),{operation:"remove",resourceType:"Deployment",getResourceId:e=>e}));var _=f.command("domains").description("Manage domains").enablePositionalOptions().action(ie("domains",["list","get","set","validate","records","dns","share","verify","remove"]));_.command("list").description("List all domains").action(D((e,o)=>e.domains.list()));_.command("get <name>").description("Show domain information").action(D((e,o,t)=>e.domains.get(t),{operation:"get",resourceType:"Domain",getResourceId:e=>e}));_.command("validate <name>").description("Check if domain name is valid and available").action(D(async(e,o,t)=>{let n=await e.domains.validate(t);return n.valid||(process.exitCode=1),n},{operation:"validate",resourceType:"Domain",getResourceId:e=>e}));_.command("verify <name>").description("Trigger DNS verification for external domain").action(D((e,o,t)=>e.domains.verify(t),{operation:"verify",resourceType:"Domain",getResourceId:e=>e}));_.command("records <name>").description("Show required DNS records for domain setup").action(D((e,o,t)=>e.domains.records(t),{operation:"records",resourceType:"Domain",getResourceId:e=>e}));_.command("dns <name>").description("Look up DNS provider for a domain").action(D((e,o,t)=>e.domains.dns(t),{operation:"dns",resourceType:"Domain",getResourceId:e=>e}));_.command("share <name>").description("Get shareable DNS setup link").action(D((e,o,t)=>e.domains.share(t),{operation:"share",resourceType:"Domain",getResourceId:e=>e}));_.command("set <name> [deployment]").description("Create domain, link to deployment, or update labels").passThroughOptions().option("--label <label>","Label to set (can be repeated)",oe,[]).action(D(async(e,o,t,n,i)=>{!n&&!process.stdin.isTTY&&(n=await new Promise(p=>{let a="";process.stdin.on("data",d=>a+=d),process.stdin.on("end",()=>p(a.trim()||void 0))}));let s=ne(i,f.opts()),r={};n&&(r.deployment=n),s!==void 0&&(r.labels=s);let c=await e.domains.set(t,r);if(c.isCreate&&t.includes("."))try{let[p,a]=await Promise.all([e.domains.records(t),e.domains.share(t)]);return{...c,_dnsRecords:p.records,_shareHash:a.hash}}catch{}return c},{operation:"set",resourceType:"Domain",getResourceId:e=>e}));_.command("remove <name>").description("Delete domain permanently").action(D((e,o,t)=>e.domains.remove(t),{operation:"remove",resourceType:"Domain",getResourceId:e=>e}));var Le=f.command("tokens").description("Manage deploy tokens").enablePositionalOptions().action(ie("tokens",["list","create","remove"]));Le.command("list").description("List all tokens").action(D((e,o)=>e.tokens.list()));Le.command("create").description("Create a new deploy token").option("--ttl <seconds>","Time to live in seconds (default: never expires)",parseInt).option("--label <label>","Label to set (can be repeated)",oe,[]).action(D((e,o,t)=>{let n={};t?.ttl!==void 0&&(n.ttl=t.ttl);let i=ne(t,f.opts());return i!==void 0&&(n.labels=i),e.tokens.create(n)},{operation:"create",resourceType:"Token"}));Le.command("remove <token>").description("Delete token permanently").action(D((e,o,t)=>e.tokens.remove(t),{operation:"remove",resourceType:"Token",getResourceId:e=>e}));var Do=f.command("account").description("Manage account").action(ie("account",["get"]));Do.command("get").description("Show account information").action(D((e,o)=>e.whoami(),{operation:"get",resourceType:"Account"}));var Lt=f.command("completion").description("Setup shell completion").action(ie("completion",["install","uninstall"]));Lt.command("install").description("Install shell completion script").action(()=>{let e=$(f),o=ge.resolve(__dirname,"completions");bt(o,{json:e.json,noColor:e.noColor})});Lt.command("uninstall").description("Uninstall shell completion script").action(()=>{let e=$(f);Ct({json:e.json,noColor:e.noColor})});f.command("config").description("Save your API key").action(async()=>{let e=$(f);try{await At({noColor:e.noColor,json:e.json})}catch(o){Pt(o)}});f.argument("[path]","Path to deploy").option("--label <label>","Label to add (can be repeated)",oe,[]).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(D(async(e,o,t,n)=>{if(t||(te(o.noColor),process.exit(0)),!(0,G.existsSync)(t)&&!t.includes("/")&&!t.includes("\\")&&!t.includes(".")&&!t.startsWith("~"))throw l.validation(`unknown command '${t}'`);return $t(e,t,ne(n,f.opts()),Ft(n,f.opts()),n,o)},{operation:"upload"}));function bo(){let e=process.argv,o=e.includes("--compbash"),t=e.includes("--compzsh"),n=e.includes("--compfish");if(!o&&!t&&!n)return;console.log(["ping","whoami","deployments","domains","tokens","account","config","completion"].join(n?`
|
|
87
87
|
`:" ")),process.exit(0)}process.env.NODE_ENV!=="test"&&(process.argv.includes("--compbash")||process.argv.includes("--compzsh")||process.argv.includes("--compfish"))&&bo();if(process.env.NODE_ENV!=="test")try{f.parse(process.argv)}catch(e){if(e instanceof Error&&"code"in e){let o=e.code,t=e.exitCode;o?.startsWith("commander.")&&process.exit(t||1)}throw e}
|