@shopify/cli
Version:
A CLI tool to build for the Shopify platform
2 lines (1 loc) • 4.25 kB
JavaScript
import{a as P}from"../../../../chunk-JCL2RRU6.js";import{a as b}from"../../../../chunk-AGNMOFJS.js";import{Ba as O,ca as E}from"../../../../chunk-54CAKCYR.js";import"../../../../chunk-7ESSIN27.js";import"../../../../chunk-GZS44BUW.js";import"../../../../chunk-K2WUCOQJ.js";import"../../../../chunk-7QIOUDCX.js";import"../../../../chunk-7MUKLZOL.js";import"../../../../chunk-VBUZWRUL.js";import"../../../../chunk-DCPBRWVC.js";import"../../../../chunk-KR6QDE7D.js";import"../../../../chunk-UXVZ2P63.js";import"../../../../chunk-QSTEVZFQ.js";import"../../../../chunk-5Y7GIF2W.js";import"../../../../chunk-EKXY5COY.js";import"../../../../chunk-4DCQNGUV.js";import"../../../../chunk-QBSKKQBN.js";import"../../../../chunk-FQWB2F75.js";import"../../../../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 k,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{C as A}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 y}from"../../../../chunk-M56NDIMD.js";import"../../../../chunk-PD5ZHJWI.js";import"../../../../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{Gb as v,Ib as L,Mb as C,Nb as m,Wb as w,ca as u,tb as h}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{j as d}from"../../../../chunk-IU2ZQ6TE.js";import"../../../../chunk-PIBY5DDZ.js";import{g as p}from"../../../../chunk-VPRTJUIN.js";p();p();var S=12;async function I(a,t,n){let r=await a.appVersions(t);if(!r.app)throw new y(`Invalid API Key: ${t.apiKey}`);let s=r.app.appVersions.nodes.map(e=>{let i=e.message??"";return{...e,status:e.status==="active"&&!n?h.green(`\u2605 ${e.status}`):e.status,createdBy:e.createdBy?.displayName??"",createdAt:u(new Date(e.createdAt)),message:i}});if(!n){let e=(process.stdout.columns??75)-S,i=e;s.forEach(o=>{let f=o.message.length+(o.versionTag?.length??0)+w(o.status).length+o.createdAt.length+o.createdBy.length;if(f>e){let R=f-o.message.length,g=Math.max(e-R,10);g<i&&(i=g)}}),s.forEach(o=>{o.message.length>i&&(o.message=`${o.message.slice(0,i-3)}...`)})}return{appVersions:s,totalResults:r.app.appVersions.pageInfo.totalResults,app:r.app}}async function l(a){let{remoteApp:t,developerPlatformClient:n,organization:r}=a,{appVersions:s,totalResults:e}=await I(n,t,a.json);if(a.json)return C(JSON.stringify(s,null,2));if(E({org:r.businessName,appName:t.title,configFile:d(a.app.configPath)}),s.length===0){m("No app versions found for this app");return}A({rows:s,columns:{versionTag:{header:"VERSION"},status:{header:"STATUS"},message:{header:"MESSAGE"},createdAt:{header:"DATE CREATED"},createdBy:{header:"CREATED BY"}}});let i=v.link(n.webUiName,[await n.appDeepLink(t),"versions"].join("/"));m(L`\nView all ${String(e)} app versions in the ${i}`)}var c=class a extends P{static{this.summary="List deployed versions of your app."}static{this.descriptionWithMarkdown="Lists the deployed app versions. An app version is a snapshot of your app extensions."}static{this.description=this.descriptionWithoutMarkdown()}static{this.flags={...k,...b,...T}}async run(){let{flags:t}=await this.parse(a),{app:n,remoteApp:r,developerPlatformClient:s,organization:e}=await O({directory:t.path,clientId:t["client-id"],forceRelink:t.reset,userProvidedConfigName:t.config});return await l({app:n,remoteApp:r,organization:e,developerPlatformClient:s,json:t.json}),{app:n}}};export{c as default};