[object Object]

← back to Retrowalls

pull-from-shopify: use shared classifier with rails primary, local aestheticOf as fallback

21a9a16703b5da3994a5479fe7f22d5aefdbc54c · 2026-05-25 20:46:12 -0700 · Steve Abrams

Files touched

Diff

commit 21a9a16703b5da3994a5479fe7f22d5aefdbc54c
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Mon May 25 20:46:12 2026 -0700

    pull-from-shopify: use shared classifier with rails primary, local aestheticOf as fallback
---
 scripts/pull-from-shopify.js | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/scripts/pull-from-shopify.js b/scripts/pull-from-shopify.js
index 723349d..91814e9 100644
--- a/scripts/pull-from-shopify.js
+++ b/scripts/pull-from-shopify.js
@@ -1,6 +1,8 @@
 // Paginate DW Shopify /products.json, filter to retro by tags + keywords
 const https = require('https');
 const fs = require('fs');
+const { classifyAesthetic } = require('../../_shared/microsite-aesthetic');
+const SITE_CFG_RAILS = (() => { try { return require('../site.config.json').rails || []; } catch { return []; } })();
 
 const RETRO_TAGS = /^(art deco|deco|midcentury|mid-century|atomic|psychedelic|vintage|retro|paisley|geometric|moroccan|damask|toile|jacquard|art nouveau|nouveau|asian|chinoiserie|mod|bohemian|victorian|baroque|rococo|abstract)$/i;
 const RETRO_TITLE = /\b(retro|vintage|midcentury|atomic|deco|paisley|geometric|moroccan|psychedelic|damask|op art|toile|nouveau|chinoiserie)\b/i;
@@ -33,6 +35,12 @@ function aestheticOf(tags, title) {
   return 'vintage';
 }
 
+function classifyForSite(tags, title) {
+  const railsMatch = classifyAesthetic(tags, SITE_CFG_RAILS);
+  if (railsMatch && railsMatch !== 'all') return railsMatch;
+  return aestheticOf(tags, title);
+}
+
 (async () => {
   const all = [];
   for (let page = 1; page <= 30; page++) {
@@ -61,7 +69,7 @@ function aestheticOf(tags, title) {
       product_type: p.product_type,
       image_url: p.images[0].src,
       tags: p.tags || [],
-      aesthetic: aestheticOf(p.tags, p.title),
+      aesthetic: classifyForSite(p.tags, p.title),
       product_url: `https://designerwallcoverings.com/products/${p.handle}`,
     }));
 

← 30b2add retag aesthetic from PG: 573 rows updated  ·  back to Retrowalls  ·  wire api-vendor-redact middleware as first app.use() — strip b3bdcce →