// Copies the templates into the backend so it sends exactly what this repo previews. // pnpm sync → ../GRV-Backend/src/shared/email // BACKEND_DIR=/path/to/GRV-Backend pnpm sync import { mkdirSync, readFileSync, writeFileSync } from 'node:fs'; import { join } from 'node:path'; const backend = process.env.BACKEND_DIR ?? '../GRV-Backend'; const dest = join(backend, 'src/shared/email'); mkdirSync(dest, { recursive: true }); const header = '// GENERATED from the GRV-Email repo (src/). Do not edit here: change GRV-Email and run `pnpm sync`.\n'; for (const f of ['layout.ts', 'templates.ts', 'catalog.ts', 'index.ts']) { writeFileSync(join(dest, f), header + readFileSync(join('src', f), 'utf8')); } console.log(`Synced templates to ${dest}`);