File tree Expand file tree Collapse file tree 4 files changed +8
-30
lines changed
helpers/database-providers
templates/db/prisma/postgres/src/db Expand file tree Collapse file tree 4 files changed +8
-30
lines changed Original file line number Diff line number Diff line change @@ -203,32 +203,6 @@ async function addPrismaAccelerateExtension(serverDir: string) {
203203 projectDir : serverDir ,
204204 } ) ;
205205
206- const prismaIndexPath = path . join ( serverDir , "prisma/index.ts" ) ;
207- const prismaIndexContent = `
208- import { PrismaClient } from "./generated/client";
209- import { withAccelerate } from "@prisma/extension-accelerate";
210-
211- const prisma = new PrismaClient().$extends(withAccelerate());
212-
213- export default prisma;
214- ` ;
215- await fs . writeFile ( prismaIndexPath , prismaIndexContent . trim ( ) ) ;
216-
217- const dbFilePath = path . join ( serverDir , "src/db/index.ts" ) ;
218- if ( await fs . pathExists ( dbFilePath ) ) {
219- let dbFileContent = await fs . readFile ( dbFilePath , "utf8" ) ;
220-
221- if ( ! dbFileContent . includes ( "@prisma/extension-accelerate" ) ) {
222- dbFileContent = `import { withAccelerate } from "@prisma/extension-accelerate";\n${ dbFileContent } ` ;
223-
224- dbFileContent = dbFileContent . replace (
225- "export const db = new PrismaClient();" ,
226- "export const db = new PrismaClient().$extends(withAccelerate());" ,
227- ) ;
228-
229- await fs . writeFile ( dbFilePath , dbFileContent ) ;
230- }
231- }
232206 return true ;
233207 } catch ( _error ) {
234208 log . warn (
Original file line number Diff line number Diff line change @@ -5,9 +5,7 @@ import handlebars from "handlebars";
55import type { ProjectConfig } from "../types" ;
66import { formatFileWithBiome } from "./biome-formatter" ;
77
8- const BINARY_EXTENSIONS = new Set ( [
9- ".png" , ".ico" , ".svg" ,
10- ] ) ;
8+ const BINARY_EXTENSIONS = new Set ( [ ".png" , ".ico" , ".svg" ] ) ;
119
1210function isBinaryFile ( filePath : string ) : boolean {
1311 const ext = path . extname ( filePath ) . toLowerCase ( ) ;
Original file line number Diff line number Diff line change 11import { PrismaClient } from "../../prisma/generated/client";
2+ {{ #if (or (eq dbSetup " prisma-postgres" ) (eq orm " prisma" ))}}
3+ import { withAccelerate } from "@prisma/extension-accelerate";
24
5+ const prisma = new PrismaClient().$extends(withAccelerate());
6+ {{ else }}
37const prisma = new PrismaClient();
8+ {{ /if }}
49
510export default prisma;
Original file line number Diff line number Diff line change 2020 " !**/schema.json" ,
2121 " !**/_generated" ,
2222 " !**/.smoke" ,
23- " !**/global.css"
23+ " !**/global.css" ,
24+ " !**/package.json"
2425 ]
2526 },
2627 "formatter" : {
You can’t perform that action at this time.
0 commit comments