Skip to content

Commit

Permalink
chore: 🤖 prisma-client add logger.info
Browse files Browse the repository at this point in the history
  • Loading branch information
meetqy committed Mar 17, 2023
1 parent f6645fb commit 73d2dba
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions packages/prisma-client/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ import { PrismaClient } from "@prisma/client";
import _ from "lodash";
export * from "@prisma/client";
import chokidar from "chokidar";
import { logger } from "@eagleuse/utils";

let prisma: PrismaClient;
let watchDBFile = false;

const updatePrismaClient = _.debounce(() => {
prisma.$disconnect();
prisma = new PrismaClient();
logger.info("[prisma-client] update prisma.");
}, 5000);

export const getPrisma = () => {
Expand Down
3 changes: 2 additions & 1 deletion packages/prisma-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"@prisma/client": "^4.10.1",
"chokidar": "^3.5.3",
"lodash": "^4.17.21",
"prisma": "^4.10.1"
"prisma": "^4.10.1",
"@eagleuse/utils": "workspace:*"
},
"main": "./dist/index.js",
"module": "./dist/index.js",
Expand Down
3 changes: 2 additions & 1 deletion packages/prisma-client/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@ export default defineConfig({
},
rollupOptions: {
// 确保外部化处理那些你不想打包进库的依赖
external: ["prisma", "@prisma/client", "lodash", "chokidar"],
external: ["prisma", "@prisma/client", "lodash", "chokidar", "@eagleuse/utils"],
output: {
// 在 UMD 构建模式下为这些外部化的依赖提供一个全局变量
globals: {
prisma: "prisma",
lodash: "_",
chokidar: "chokidar",
"@prisma/client": "PrismaClient",
"@eagleuse/utils": "Utils",
},
},
},
Expand Down

0 comments on commit 73d2dba

Please sign in to comment.