@shopify/cli
Version:
A CLI tool to build for the Shopify platform
2 lines (1 loc) • 1.83 kB
JavaScript
import{l as T}from"./chunk-OY3PNHPZ.js";import{a as A}from"./chunk-Y7JGYGV7.js";import{c as C}from"./chunk-GVQIPEZT.js";import{m as b}from"./chunk-XITQULK4.js";import{s as w}from"./chunk-CBXSPL4W.js";import{a as P}from"./chunk-KR6QDE7D.js";import{O as u}from"./chunk-XONFGLJQ.js";import{v as h,x as y}from"./chunk-6G6TMKXF.js";import{Qb as O,va as p}from"./chunk-N5PQPIBF.js";import{d,q as m}from"./chunk-IU2ZQ6TE.js";import{g as c}from"./chunk-VPRTJUIN.js";c();async function q(e){A({verbose:e.verbose,noColor:e.noColor});let o=b({store:e.store}),t=await u(o,e.password);await v(t,{path:e.path??m(),force:e.force??!1,silent:e.silent??!1})}var g={article:"ARTICLE",blog:"BLOG",collection:"COLLECTION",company:"COMPANY",company_location:"COMPANY_LOCATION",location:"LOCATION",market:"MARKET",order:"ORDER",page:"PAGE",product:"PRODUCT",variant:"PRODUCTVARIANT",shop:"SHOP"};async function v(e,o){let{force:t,path:i,silent:n}=o;if(!await T(i)&&(process.env.SHOPIFY_LANGUAGE_SERVER==="1"||!await C(t)))return;let l=[],r=[];for(let[a,s]of Object.entries(g))l.push(w(s,e).catch(f=>(r.push(s),[])).then(f=>({[a]:f})));let S=(await Promise.all(l)).reduce((a,s)=>({...a,...s}));if(r.length===Object.values(g).length){n||y({body:"Failed to fetch metafield definitions.",nextSteps:["Check your network connection and try again.","Ensure you have the permission to fetch metafield definitions."],reference:[{link:{label:"Metafield Definition API",url:"https://shopify.dev/docs/api/admin-graphql/latest/queries/metafieldDefinition"}}]});return}await D(i,S),r.length>0&&O(`Failed to fetch metafield definitions for the following owner types: ${r.join(", ")}`),n||h({body:"Metafield definitions have been successfully downloaded."})}async function D(e,o){let t=await P(e),i=d(t,"metafields.json"),n=JSON.stringify(o,null,2);p(i,n)}export{q as a};