All files / src/database/seeds run.ts

0% Statements 0/15
0% Branches 0/4
0% Functions 0/1
0% Lines 0/15

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28                                                       
import { NestFactory } from '@nestjs/core';
import { SeedModule } from './seed.module';
import { SeedRunner } from './seed-runner';
import { SeedScale, SeedEnv } from './seed-context';
 
async function bootstrap() {
  const app = await NestFactory.createApplicationContext(SeedModule);
  const runner = app.get(SeedRunner);
 
  const scale = (process.env.SEED_SCALE || 'small') as SeedScale;
  const env = (process.env.SEED_ENV || 'dev') as SeedEnv;
  const dryRun = process.env.SEED_DRY_RUN === 'true';
 
  try {
    const result = await runner.runSeed(scale, env, dryRun);
    console.log(
      'Seeding finished successfully:',
      JSON.stringify(result, null, 2),
    );
    process.exit(0);
  } catch (err: any) {
    console.error('Seeding failed with error:', err);
    process.exit(1);
  }
}
 
bootstrap();