← back to Novasuede Min Fix
theme-info.mjs
11 lines
import fs from 'fs';
const env=fs.readFileSync(process.env.HOME+'/Projects/secrets-manager/.env','utf8');
const get=k=>(env.match(new RegExp('^'+k+'=(.*)$','m'))||[])[1];
const TOKEN=get('SHOPIFY_ADMIN_TOKEN');
const SHOP='designer-laboratory-sandbox.myshopify.com';
async function rest(path){const r=await fetch(`https://${SHOP}/admin/api/2024-10/${path}`,{headers:{'X-Shopify-Access-Token':TOKEN}});return r.json();}
const t=await rest('themes.json');
const live=t.themes.find(x=>x.role==='main');
console.log('LIVE THEME:',live.id,live.name,'role='+live.role);
fs.writeFileSync('theme-id.txt',String(live.id));