UNPKG

@shopify/cli

Version:

A CLI tool to build for the Shopify platform

16 lines (14 loc) 1.52 kB
import{b as h}from"./chunk-XOTA6JTZ.js";import{Ca as g,ua as u,wa as c}from"./chunk-N5PQPIBF.js";import{d as f,q as p}from"./chunk-IU2ZQ6TE.js";import{g as l}from"./chunk-VPRTJUIN.js";l();var d=f(p(),"/docs-shopify.dev/commands"),m=class extends h{static{this.description="Generate CLI commands documentation"}static{this.hidden=!0}async run(){let a=this.config.commands;await g(d),await c(d);let o=a.sort((e,i)=>e.id.length-i.id.length).filter(e=>!b(e)).map(e=>{let i=k(e);return N(e,i)});await Promise.all(o)}},C=["commands","help","plugins"];function b(t){return t.hidden?(C.push(t.id),!0):t.pluginType==="user"?!0:C.some(a=>t.id.startsWith(`${a}:`))}function k(t){let a=t.id.replace(/[:]/g," "),s=t.id.replace(/[:]/g,"-"),o=t.id.replace(/[:-]/g,"");return{commandName:a,fileName:s,interfaceName:o}}async function N(t,{commandName:a,fileName:s,interfaceName:o}){let e=Object.keys(t.flags).map(r=>{let n=t.flags[r];if(!n||n.hidden)return;let $=n.description??"",w=n.char?`-${n.char}, `:"",y=n.type==="option"?"string":"''",v=n.type==="option"?" <value>":"",x=n.required?"":"?",D=n.env!==void 0?` @environment ${n.env}`:"";return` /** * ${$} *${D} */ '${w}--${r}${v}'${x}: ${y}`}).filter(r=>r&&r?.length>0).join(` `),i=`// This is an autogenerated file. Don't edit this file manually. /** * The following flags are available for the \`${a}\` command: * @publicDocs */ export interface ${o} { ${e} } `;await c(`${d}/interfaces`),await u(`${d}/interfaces/${s}.interface.ts`,i)}export{m as a,k as b,N as c};