From 94a7d4ce4f33edbf0d48f772c3e3b2efebdab6b3 Mon Sep 17 00:00:00 2001 From: Gray Gilmore Date: Tue, 3 Dec 2024 10:58:19 -0800 Subject: [PATCH 1/2] Allow empty theme files to be uploaded --- .changeset/honest-cobras-invite.md | 5 +++++ packages/cli-kit/src/public/node/themes/api.ts | 14 ++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) create mode 100644 .changeset/honest-cobras-invite.md diff --git a/.changeset/honest-cobras-invite.md b/.changeset/honest-cobras-invite.md new file mode 100644 index 00000000000..d50dc7836a8 --- /dev/null +++ b/.changeset/honest-cobras-invite.md @@ -0,0 +1,5 @@ +--- +'@shopify/cli-kit': patch +--- + +Fix bug preventing empty theme files from uploading diff --git a/packages/cli-kit/src/public/node/themes/api.ts b/packages/cli-kit/src/public/node/themes/api.ts index 23966667812..706a9eae093 100644 --- a/packages/cli-kit/src/public/node/themes/api.ts +++ b/packages/cli-kit/src/public/node/themes/api.ts @@ -119,24 +119,22 @@ export async function bulkUploadThemeAssets( function prepareFilesForUpload(assets: AssetParams[]): OnlineStoreThemeFilesUpsertFileInput[] { return assets.map((asset) => { - if (asset.value) { + if (asset.attachment) { return { filename: asset.key, body: { - type: 'TEXT' as const, - value: asset.value, + type: 'BASE64' as const, + value: asset.attachment, }, } - } else if (asset.attachment) { + } else { return { filename: asset.key, body: { - type: 'BASE64' as const, - value: asset.attachment, + type: 'TEXT' as const, + value: asset.value ?? '', }, } - } else { - unexpectedGraphQLError('Asset must have a value or attachment') } }) } From 6797334f2987919b0b3d8fdbdee8580f93d2cef2 Mon Sep 17 00:00:00 2001 From: Gray Gilmore Date: Tue, 3 Dec 2024 11:02:07 -0800 Subject: [PATCH 2/2] Update codeowners for themes API files --- .github/CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index ff4b5b7fd78..10ca6b6fb99 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -3,7 +3,7 @@ # Theme team and CLI owners should review theme changes packages/cli-kit/src/private/themes/* @shopify/advanced-edits @shopify/app-inner-loop -packages/cli-kit/src/public/themes/* @shopify/advanced-edits @shopify/app-inner-loop +packages/cli-kit/src/public/**/themes/* @shopify/advanced-edits @shopify/app-inner-loop packages/theme/** @shopify/advanced-edits @shopify/app-inner-loop # These are metafiles that can be reviewed by anyone