[object Object]

← back to All Designerwallcoverings

shopify-push: portable Shopify-lib resolution (env/mac3/co-located) for deploy safety

de111d4fb0286cc762f3bcb5aefa906dbf027a42 · 2026-07-08 12:06:11 -0700 · Steve

Files touched

Diff

commit de111d4fb0286cc762f3bcb5aefa906dbf027a42
Author: Steve <steve@designerwallcoverings.com>
Date:   Wed Jul 8 12:06:11 2026 -0700

    shopify-push: portable Shopify-lib resolution (env/mac3/co-located) for deploy safety
---
 scripts/shopify-push.mjs | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/scripts/shopify-push.mjs b/scripts/shopify-push.mjs
index 4f0487e..1a7699a 100644
--- a/scripts/shopify-push.mjs
+++ b/scripts/shopify-push.mjs
@@ -23,7 +23,19 @@
 //   node scripts/shopify-push.mjs <dw_sku> --commit   # write (requires SHOPIFY_PUSH_ENABLED=1)
 
 import pg from 'pg';
-import { gql } from '/Users/macstudio3/Projects/designerwallcoverings/scripts/lib/shopify.mjs';
+import fs from 'node:fs';
+import { pathToFileURL } from 'node:url';
+// Portable resolve of the shared Shopify Admin client — env override first, then the mac3
+// designerwallcoverings repo, then a co-located copy if one is vendored. Keeps the worker from
+// hard-crashing on a missing absolute path when it runs somewhere other than mac3.
+const SHOPIFY_LIB = [
+  process.env.SHOPIFY_LIB,
+  '/Users/macstudio3/Projects/designerwallcoverings/scripts/lib/shopify.mjs',
+  new URL('./lib/shopify.mjs', import.meta.url).pathname,
+].find((p) => p && fs.existsSync(p));
+const gql = SHOPIFY_LIB
+  ? (await import(pathToFileURL(SHOPIFY_LIB).href)).gql
+  : () => { throw new Error('Shopify client not found (set SHOPIFY_LIB or install the shared lib)'); };
 
 const DSN = process.env.DATABASE_URL || 'postgresql:///dw_unified?host=/tmp';
 const dwSkuArg = process.argv[2];

← 25613cb List view: add Mfr # column with DW·Shop·FM mismatch breakou  ·  back to All Designerwallcoverings  ·  all.dw grid: manufacturer-SKU search — backfill mfr_sku from 75328f4 →