@shopify/cli
Version:
A CLI tool to build for the Shopify platform
2 lines (1 loc) • 4.35 kB
JavaScript
import{a as w}from"../../../chunk-CEIQFLCN.js";import{a as E}from"../../../chunk-DN2IE3VY.js";import"../../../chunk-JAO53IH2.js";import{a as c,b as a,k as b,q as _}from"../../../chunk-XITQULK4.js";import"../../../chunk-SXTMSGUE.js";import{a as I,b as S}from"../../../chunk-QFWIDATO.js";import"../../../chunk-CBXSPL4W.js";import"../../../chunk-UJVH7FZS.js";import"../../../chunk-EKXY5COY.js";import"../../../chunk-4DCQNGUV.js";import{ua as s,xa as h}from"../../../chunk-XONFGLJQ.js";import"../../../chunk-4LNCYIS3.js";import"../../../chunk-L2MGAEV3.js";import"../../../chunk-PRKBO42R.js";import"../../../chunk-ZSBA6VIC.js";import"../../../chunk-F2QU6WWX.js";import"../../../chunk-XULPJ6UG.js";import{b as g,c as T}from"../../../chunk-XR6GMMEU.js";import"../../../chunk-3TNEIDOD.js";import"../../../chunk-MHWV5RQV.js";import"../../../chunk-XOTA6JTZ.js";import"../../../chunk-MOA33ZFO.js";import"../../../chunk-JUVAGMIH.js";import{g as m,u as l}from"../../../chunk-6G6TMKXF.js";import"../../../chunk-P6XE4MH5.js";import"../../../chunk-KLMDWDT2.js";import"../../../chunk-5CH3B62S.js";import"../../../chunk-QUTQDXSL.js";import"../../../chunk-WSDN25F5.js";import{d as v}from"../../../chunk-M56NDIMD.js";import"../../../chunk-PD5ZHJWI.js";import{r as $}from"../../../chunk-LDGAHMS7.js";import"../../../chunk-ZR76GGZ6.js";import"../../../chunk-EENHXSWU.js";import"../../../chunk-FUOIGXI4.js";import"../../../chunk-6M3ZYNGO.js";import"../../../chunk-QYR5VPQA.js";import"../../../chunk-OBEWZXOQ.js";import{Mb as f}from"../../../chunk-N5PQPIBF.js";import"../../../chunk-CERXUPGC.js";import"../../../chunk-T4M5CWAO.js";import"../../../chunk-PRVQAHWI.js";import"../../../chunk-YTNDFQJT.js";import"../../../chunk-ULQG3XQS.js";import"../../../chunk-IU2ZQ6TE.js";import"../../../chunk-PIBY5DDZ.js";import{e as P,g as i}from"../../../chunk-VPRTJUIN.js";i();i();function L(n,e){return{theme:{id:n.id,name:n.name,role:n.role,shop:e.storeFqdn,preview_url:I(n,e),editor_url:S(n,e)}}}function O(n){let{platform:e,arch:t}=m(),o=c(),r=null;return o&&(r=Number(a())||null),{store:o??"Not configured",development_theme_id:r,cli_version:n.cliVersion,os:`${e}-${t}`,shell:process.env.SHELL??"unknown",node_version:process.version}}async function A(n,e){let t;if(e.development)t=await new w(n).findOrCreate();else{let o={filter:{theme:e.theme}};t=await E(n,o)}return t?L(t,n):void 0}async function y(n){return[V(),await x(n)]}function V(){let n=c()??"Not configured",e=a();return h(`theme-command:info:dev-theme-loaded:${e}`),C("Theme Configuration",[["Store",n],["Development Theme ID",e?`#${e}`:{subdued:"Not set"}]])}async function x(n){let{platform:e,arch:t}=m();return C("Tooling and System",[["Shopify CLI",n.cliVersion],["OS",`${e}-${t}`],["Shell",process.env.SHELL??"unknown"],["Node version",process.version]])}function C(n,e){return{title:n,body:{tabularData:e,firstColumnSubdued:!0}}}async function D(n,e){let t=Object.entries(n.theme).map(([o,r])=>{if(o==="editor_url"||o==="preview_url"){let F=String(r),N=o==="editor_url"?"Open in Theme Editor":"Preview Theme";return[u(o),{link:{url:F,label:N}}]}else return o==="id"?[u(o),`#${r}`]:[u(o),`${r}`]});return{customSections:[...e.environment?[{title:"Theme information",body:[{subdued:`Environment name: ${e.environment}`}]}]:[],{title:"Theme Details",body:{tabularData:t,firstColumnSubdued:!0}}]}}function u(n){return n.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}var p=P($(),1);var d=class extends _{static{this.description="Displays information about your theme environment, including your current store. Can also retrieve information about a specific theme."}static{this.flags={...g,...T,...b,development:p.Flags.boolean({char:"d",description:"Retrieve info from your development theme.",env:"SHOPIFY_FLAG_DEVELOPMENT"}),theme:p.Flags.string({char:"t",description:"Theme ID or name of the remote theme.",env:"SHOPIFY_FLAG_THEME_ID"})}}static{this.multiEnvironmentsFlags=["store","password"]}async command(e,t){if(s("theme-command:info"),e.theme||e.development){let o=await A(t,e);if(!o)throw new v("Theme not found!");if(e.json)return f(JSON.stringify(o,null,2));let r=await D(o,e);l(r)}else{if(e.json)return f(JSON.stringify(O({cliVersion:this.config.version}),null,2));let o=await y({cliVersion:this.config.version});l({customSections:o})}s("theme-command:info")}};export{d as default};