[object Object]

← back to Shopify Sample Shipping

install-theme-engine: read themeDuplicate.newTheme (payload has no 'theme' field)

84328625ef5b65fdd94a4b3d19b9bb0af1852cfa · 2026-09-24 16:00:12 -0700 · Steve Abrams

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SrEDNvrmHyv2QgB23Lm151

Files touched

Diff

commit 84328625ef5b65fdd94a4b3d19b9bb0af1852cfa
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Thu Sep 24 16:00:12 2026 -0700

    install-theme-engine: read themeDuplicate.newTheme (payload has no 'theme' field)
    
    Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_01SrEDNvrmHyv2QgB23Lm151
---
 install-theme-engine.mjs | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/install-theme-engine.mjs b/install-theme-engine.mjs
index 5a3d19f..52e0c29 100644
--- a/install-theme-engine.mjs
+++ b/install-theme-engine.mjs
@@ -59,14 +59,15 @@ if (!APPLY) {
 // ---------------- APPLY ----------------
 console.log('\n=== APPLY ===');
 // 1) duplicate
-const dup = (await query(`mutation($id:ID!,$name:String){themeDuplicate(id:$id,name:$name){theme{id name role} userErrors{field message}}}`, { id: MAIN_THEME_GID, name: DEV_NAME })).themeDuplicate;
+const dup = (await query(`mutation($id:ID!,$name:String){themeDuplicate(id:$id,name:$name){newTheme{id name role} userErrors{field message}}}`, { id: MAIN_THEME_GID, name: DEV_NAME })).themeDuplicate;
 if (dup.userErrors.length) { console.error('themeDuplicate errors:', dup.userErrors); process.exit(1); }
-const devGid = dup.theme.id, devId = devGid.split('/').pop();
-console.log(`Duplicated -> ${dup.theme.name} [${dup.theme.role}] ${devGid}`);
-if (String(dup.theme.role).toUpperCase() === 'MAIN' || String(dup.theme.role).toUpperCase() === 'PUBLISHED') { console.error('SAFETY ABORT: duplicate came back published?! Not proceeding.'); process.exit(1); }
+const dt = dup.newTheme;
+const devGid = dt.id, devId = devGid.split('/').pop();
+console.log(`Duplicated -> ${dt.name} [${dt.role}] ${devGid}`);
+if (String(dt.role).toUpperCase() === 'MAIN' || String(dt.role).toUpperCase() === 'PUBLISHED') { console.error('SAFETY ABORT: duplicate came back published?! Not proceeding.'); process.exit(1); }
 
 // record immediately so undo works even if a later step fails
-fs.writeFileSync(REC, JSON.stringify({ at: new Date().toISOString(), devThemeGid: devGid, devThemeId: devId, devThemeName: dup.theme.name, sourceThemeId: MAIN_THEME_ID, modifiedFiles: [SNIPPET_KEY, CART_FILE], published: false }, null, 2) + '\n');
+fs.writeFileSync(REC, JSON.stringify({ at: new Date().toISOString(), devThemeGid: devGid, devThemeId: devId, devThemeName: dt.name, sourceThemeId: MAIN_THEME_ID, modifiedFiles: [SNIPPET_KEY, CART_FILE], published: false }, null, 2) + '\n');
 
 // 2) wait for duplication to finish processing before uploading assets
 for (let i = 0; i < 40; i++) { const t = await restGetTheme(devId); if (!t.processing) break; await new Promise(r => setTimeout(r, 3000)); }
@@ -89,7 +90,7 @@ else {
   console.log('Injected render into', CART_FILE);
 }
 
-console.log(`\n✅ DONE. DEV theme "${dup.theme.name}" (${devId}) — UNPUBLISHED, nothing published.`);
-console.log(`Preview it: Admin -> Online Store -> Themes -> "${dup.theme.name}" -> Preview.`);
+console.log(`\n✅ DONE. DEV theme "${dt.name}" (${devId}) — UNPUBLISHED, nothing published.`);
+console.log(`Preview it: Admin -> Online Store -> Themes -> "${dt.name}" -> Preview.`);
 console.log(`Undo (delete the dev theme): node theme-engine-undo.mjs --apply`);
 console.log(`Record: ${REC.pathname}`);

← 9ca4cf5 Track publish-rollback.mjs and proof-designer.mjs (git-hygie  ·  back to Shopify Sample Shipping  ·  install-theme-engine: abort (with undo hint) if the dev them 48e9229 →