Fix running seed via script

This commit is contained in:
Kalle (Sendou) 2021-12-05 13:12:55 +02:00
parent 83135e214a
commit fb89f5111b
4 changed files with 15 additions and 3 deletions

View File

@ -67,6 +67,6 @@
},
"sideEffects": false,
"prisma": {
"seed": "node --experimental-specifier-resolution=node --loader ts-node/esm prisma/seed.ts"
"seed": "node --experimental-specifier-resolution=node --loader ts-node/esm prisma/seed"
}
}

12
prisma/seed/index.ts Normal file
View File

@ -0,0 +1,12 @@
import { PrismaClient } from "@prisma/client";
const prisma = new PrismaClient();
import { seed } from "./script";
seed()
.catch((e) => {
console.error(e);
process.exit(1);
})
.finally(async () => {
await prisma.$disconnect();
});

View File

@ -4,7 +4,7 @@ import {
ADMIN_TEST_DISCORD_ID,
ADMIN_TEST_UUID,
stages as stagesList,
} from "../app/constants";
} from "../../app/constants";
import { readFile } from "fs/promises";
import path from "path";
import crypto from "crypto";

View File

@ -4,7 +4,7 @@ import compression from "compression";
import morgan from "morgan";
import { createRequestHandler } from "@remix-run/express";
import { setUpAuth } from "./auth";
import { seed } from "../prisma/seed";
import { seed } from "../prisma/seed/script";
const MODE = process.env.NODE_ENV;
const BUILD_DIR = path.join(process.cwd(), "server/build");