🎨 prod flag import

This commit is contained in:
Timur Ercan
2023-03-09 13:17:44 +01:00
parent 7eaa21fc1e
commit 9c7c7d1a3c
3 changed files with 4 additions and 1 deletions

1
packages/lib/env.ts Normal file
View File

@ -0,0 +1 @@
export const isENVProd = process.env.NODE_ENV === "production";

View File

@ -2,3 +2,4 @@ export { coloredConsole } from "./coloredConsole";
export { default as classNames } from "./classNames";
export { NEXT_PUBLIC_WEBAPP_URL } from "./constants";
export { localStorage } from "./webstorage";
export { isENVProd } from "./env";

View File

@ -1,4 +1,5 @@
import { PrismaClient, Document, User } from "@prisma/client";
import { isENVProd } from "@documenso/lib"
declare global {
var client: PrismaClient | undefined;
@ -8,7 +9,7 @@ declare global {
const prisma = globalThis.client || new PrismaClient();
// Save for reuse in dev environment to avoid many client instances in dev where restart and reloads
if (process.env.NODE_ENV !== "production") {
if (!isENVProd) {
globalThis.client = prisma;
}