#!/usr/bin/env node /** * Downloads Figma design assets into public/images/figma/ * Run: node scripts/fetch-figma-assets.mjs * * Asset URLs expire in ~7 days after Figma MCP session. * Re-run this script after fetching fresh URLs via get_design_context. */ import { createWriteStream } from 'fs' import { mkdir } from 'fs/promises' import { pipeline } from 'stream/promises' import path from 'path' import { fileURLToPath } from 'url' const __dirname = path.dirname(fileURLToPath(import.meta.url)) const OUT_DIR = path.join(__dirname, '..', 'public', 'images', 'figma') const ASSETS = [ // Hero backgrounds { url: 'https://www.figma.com/api/mcp/asset/b60eaa19-60cc-4868-b3d2-5a70cd175f8f', file: 'hero-bg2.png' }, { url: 'https://www.figma.com/api/mcp/asset/7820b5a4-359e-4cd0-b6ff-6340b6c4bd64', file: 'hero-bg1.png' }, { url: 'https://www.figma.com/api/mcp/asset/80fb64f7-2769-448c-b243-e5c5f369fa58', file: 'hero-bg-family.png' }, { url: 'https://www.figma.com/api/mcp/asset/fc55cedd-c740-41d9-a16d-e7386cb8cc1c', file: 'hero-blur-mask.png' }, // Nav active underline { url: 'https://www.figma.com/api/mcp/asset/5b605e46-ac5d-43cd-9eb0-813e2a61f8bb', file: 'line-nav-active.svg' }, // Location images { url: 'https://www.figma.com/api/mcp/asset/5776a40f-2733-4797-9344-021203b8f303', file: 'loc-dinopark.jpg' }, { url: 'https://www.figma.com/api/mcp/asset/6c492141-cde3-49ee-9388-960a7206366c', file: 'loc-divo-lis.png' }, { url: 'https://www.figma.com/api/mcp/asset/89f989aa-9443-4301-a793-486af9855dbe', file: 'loc-map.jpg' }, // Accordion chevrons { url: 'https://www.figma.com/api/mcp/asset/fa96fe98-681a-47fc-b558-b476386c251f', file: 'polygon7.svg' }, { url: 'https://www.figma.com/api/mcp/asset/fe72fbef-115e-4141-84ee-459c54f20c25', file: 'polygon8.svg' }, // Birthday pricing { url: 'https://www.figma.com/api/mcp/asset/c54dc71e-3614-4299-8902-49968cd0a3a6', file: 'check-mark.png' }, { url: 'https://www.figma.com/api/mcp/asset/ea936806-4d1b-44c4-8d7b-497a232adb8a', file: 'line-divider.svg' }, // Video section { url: 'https://www.figma.com/api/mcp/asset/1c4ad091-229c-4fc8-af0d-e2d24174f4e9', file: 'video-preview.png' }, { url: 'https://www.figma.com/api/mcp/asset/f4487329-bc28-400c-919e-c65076f8e67d', file: 'btn-video-play.svg' }, // Reviews { url: 'https://www.figma.com/api/mcp/asset/3145004b-7bb7-4870-83b8-9854c780ad4e', file: 'rate-stars.svg' }, { url: 'https://www.figma.com/api/mcp/asset/375efe17-9f84-4d1a-9bc2-e655224ce14d', file: 'arrow1.svg' }, // News { url: 'https://www.figma.com/api/mcp/asset/97137f1c-...', file: 'arrow2.svg' }, // partial hash — skip if fails // Footer { url: 'https://www.figma.com/api/mcp/asset/35e5d3b6-2117-4f69-96bd-764cc7a4d523', file: 'footer-bg.png' }, // Buttons / icons { url: 'https://www.figma.com/api/mcp/asset/be36ff9b-ba10-462c-aa59-2cccd82e11c2', file: 'arrow-right-default.svg' }, { url: 'https://www.figma.com/api/mcp/asset/37ac801a-d2e4-4f25-8583-8f0d700f8964', file: 'arrow-right-hover.svg' }, { url: 'https://www.figma.com/api/mcp/asset/18e8679c-0649-48d7-94ea-5d5da35e84be', file: 'icon-arrow.svg' }, ] await mkdir(OUT_DIR, { recursive: true }) let ok = 0 let fail = 0 for (const asset of ASSETS) { if (asset.url.includes('...')) { console.log(`⏭ skipping ${asset.file} (incomplete URL)`) continue } try { const res = await fetch(asset.url, { headers: { 'User-Agent': 'Mozilla/5.0 Figma-Asset-Downloader/1.0' }, }) if (!res.ok) throw new Error(`HTTP ${res.status}`) const dest = path.join(OUT_DIR, asset.file) await pipeline(res.body, createWriteStream(dest)) console.log(`✅ ${asset.file}`) ok++ } catch (err) { console.error(`❌ ${asset.file}: ${err.message}`) fail++ } } console.log(`\nDone: ${ok} downloaded, ${fail} failed`)