MCPcopy Create free account
hub / github.com/cameri/nostream / runSeed

Function runSeed

src/cli/commands/seed.ts:9–33  ·  view source on GitHub ↗
(options: SeedOptions)

Source from the content-addressed store, hash-verified

7}
8
9export const runSeed = async (options: SeedOptions): Promise<number> => {
10 if (options.count !== undefined) {
11 if (!Number.isSafeInteger(options.count) || options.count <= 0) {
12 throw new Error('--count must be a positive integer')
13 }
14 }
15
16 const spinner = ora('Seeding relay data...').start()
17
18 const code = await runCommand('pnpm', ['run', 'db:seed'], {
19 env: options.count ? { NOSTREAM_SEED_COUNT: String(options.count) } : undefined,
20 })
21
22 if (code === 0) {
23 if (options.count) {
24 spinner.succeed(`Seed completed with ${options.count} events requested`)
25 } else {
26 spinner.succeed('Seed completed')
27 }
28 } else {
29 spinner.fail('Seed failed')
30 }
31
32 return code
33}

Callers 1

index.tsFile · 0.90

Calls 1

runCommandFunction · 0.90

Tested by

no test coverage detected