// The artist page's discography cards carry the record sheet too: a long // press on a family opens the sheet for its primary edition. const fs = require('fs'); const p = 'F:/Coding/SoulStream/src/mobile/screens/Artist.svelte'; let s = fs.readFileSync(p, 'utf8'); const a = ` onclick={() => openFamily(f)} />`; if (!s.includes(a) || s.indexOf(a) !== s.lastIndexOf(a)) throw new Error('family card anchor'); s = s.replace(a, () => ` onclick={() => openFamily(f)} onmore={() => openHalf("catalogAlbum", { album: { ...(f.editions?.[0] ?? f), artist: name } })} />`); if (!/import \{[^}]*\bopenHalf\b[^}]*\} from "\.\.\/nav\.svelte\.js"/.test(s)) { const m = s.match(/import \{ ([^}]*) \} from "\.\.\/nav\.svelte\.js";/); if (!m) throw new Error('nav import'); s = s.replace(m[0], `import { ${m[1]}, openHalf } from "../nav.svelte.js";`); } if (!/let \{[^}]*\bname\b[^}]*\} = \$props\(\)/.test(s)) throw new Error('the artist page has no `name` prop'); fs.writeFileSync(p, s); console.log('artist cards carry the sheet');