Skip to content

Commit

Permalink
refactor(scripts): add --dump-map-list param to seed script
Browse files Browse the repository at this point in the history
My bad, accidently committed the uncommented version of this recently.
Probably best we just have an arg!
  • Loading branch information
tsa96 committed Sep 28, 2024
1 parent 5d682d8 commit 9cfb436
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions scripts/src/seed.script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { createHash } from 'node:crypto';
import { readFileSync } from 'node:fs';
import { readFileSync, writeFileSync } from 'node:fs';
import path from 'node:path';
import { promisify } from 'node:util';
import zlib from 'node:zlib';
Expand Down Expand Up @@ -156,7 +156,7 @@ prismaWrapper(async (prisma: PrismaClient) => {

if (args.has('-h') || args.has('--help')) {
console.log(
'usage: seed.js [-h] [--reset]\n\t' +
'usage: seed.js [-h] [--reset] [--dump-map-list]\n\t' +
Object.keys(defaultVars)
.map((v) => `--${v}=N (or N-M for min-max)`)
.join('\n\t')
Expand Down Expand Up @@ -1073,12 +1073,9 @@ prismaWrapper(async (prisma: PrismaClient) => {

const mapListJson = JSON.stringify(maps);

// Uncomment below line to write this out to disk if you want to debug output of this.
// eslint-disable-next-line unicorn/no-await-expression-member
(await import('node:fs')).writeFileSync(
`./map-list-${type}.json`,
mapListJson
);
if (args.has('--dump-map-list')) {
writeFileSync(`./map-list-${type}.json`, mapListJson);
}

const compressed = await promisify(zlib.deflate)(mapListJson);
await s3.send(
Expand Down

0 comments on commit 9cfb436

Please sign in to comment.