CognxSafeTrack
chore: execute Sprint 38 technical debt resolution (Type Safety, Zod validation, Vitest, Mock LLM extracted)
d9879cf | import path from 'path'; | |
| import dotenv from 'dotenv'; | |
| // Load root .env | |
| dotenv.config({ path: path.resolve(__dirname, '../../../../.env') }); | |
| import { PrismaClient } from '@repo/database'; | |
| // @ts-ignore | |
| import { seedDatabase } from '@repo/database/seed'; | |
| const prisma = new PrismaClient(); | |
| async function runSync() { | |
| try { | |
| console.log('π Starting content synchronization...'); | |
| // Ensure Database URL is present | |
| if (!process.env.DATABASE_URL) { | |
| throw new Error('DATABASE_URL is not defined in .env'); | |
| } | |
| const result = await seedDatabase(prisma); | |
| if (result.seeded) { | |
| console.log(`β Success: ${result.message}`); | |
| } else { | |
| console.warn(`β οΈ Warning: ${result.message}`); | |
| } | |
| } catch (err: unknown) { | |
| console.error('β Sync failed:', (err instanceof Error ? (err instanceof Error ? err.message : String(err)) : String(err))); | |
| if ((err as Error).stack) console.debug((err as Error).stack); | |
| process.exit(1); | |
| } finally { | |
| await prisma.$disconnect(); | |
| } | |
| } | |
| runSync(); | |