UNPKG

@shopify/cli

Version:

A CLI tool to build for the Shopify platform

2 lines (1 loc) 1.36 kB
import{a as c,b as d}from"./chunk-ULFWK45W.js";import{m as p,n as f}from"./chunk-XONFGLJQ.js";import{d as n}from"./chunk-M56NDIMD.js";import{Ga as l,na as m}from"./chunk-N5PQPIBF.js";import{d as a}from"./chunk-IU2ZQ6TE.js";import{g as s}from"./chunk-VPRTJUIN.js";s();import{writeFile as E}from"fs/promises";var u=1024*1024,h=100,w=h*u;async function _(r,t){let e=a(t,"manifest.json");await E(e,JSON.stringify(r,null,2))}var S=["!**/*.js.map","!**/*.metafile.json"];async function b(r,t,e){let o=e??["**/*",...S];t.endsWith(".br")?await d({inputDirectory:r,outputPath:t,matchFilePattern:o}):await c({inputDirectory:r,outputZipPath:t,matchFilePattern:o})}async function C(r,t){let e=await l(t);if(e>w){let g=`${(Math.ceil(e/u*100)/100).toFixed(2)} MB`;throw new n(`Your app bundle exceeds the ${h} MB upload limit (it is ${g}).`,"Check the asset paths in your extension configuration \u2014 a misconfigured source can pull in much more than intended. Exclude large files or directories from your bundle, then try again.")}let o=p(),i=m(t);o.append("my_upload",i),await f(r,{method:"put",body:i,headers:o.getHeaders()},"slow-request")}async function N(r,t){let e=await r.generateSignedUploadUrl(t);if(!e.assetUrl||e.userErrors?.length>0){let o=e.userErrors.map(i=>i.message).join(", ");throw new n(o)}return e.assetUrl}export{_ as a,S as b,b as c,C as d,N as e};