AI Resource Pro / website / scripts / seed-categories-only.ts
| 1 | import { seedCategories } from '../src/utils/seed-categories'; |
| 2 | import * as dotenv from 'dotenv'; |
| 3 | import path from 'path'; |
| 4 | import fs from 'fs'; |
| 5 | |
| 6 | // Load environment variables from .env.local |
| 7 | const envLocalPath = path.resolve(process.cwd(), '.env.local'); |
| 8 | if (fs.existsSync(envLocalPath)) { |
| 9 | console.log(`Loading environment from: ${envLocalPath}`); |
| 10 | dotenv.config({ path: envLocalPath }); |
| 11 | } else { |
| 12 | console.log(`No .env.local file found at: ${envLocalPath}`); |
| 13 | dotenv.config(); // Try loading from default .env |
| 14 | } |
| 15 | |
| 16 | async function main() { |
| 17 | try { |
| 18 | console.log('Starting categories seeding process...'); |
| 19 | await seedCategories(); |
| 20 | console.log('Categories seeding completed successfully.'); |
| 21 | } catch (error) { |
| 22 | console.error('Error seeding categories:', error); |
| 23 | process.exit(1); |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | main(); |