GRV-Email/scripts/sync.ts
kirukib 71c4e8fdb2 Add GRV-branded email templates, previews and backend sync
Templates: OTP, team invite, summit invitation, invitation to apply,
application saved/received, decisions (finalist, accepted into GRV,
shortlisted, not selected), request received for every website form,
partner confirmed, orders and tickets, staff notifications.
pnpm preview renders a gallery; pnpm sync copies src/ into the backend.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 22:41:00 +03:00

15 lines
779 B
TypeScript

// 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}`);