create-better-t-stack 2.45.0 → 2.45.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -5008,25 +5008,6 @@ async function addPrismaAccelerateExtension(serverDir) {
|
|
|
5008
5008
|
dependencies: ["@prisma/extension-accelerate"],
|
|
5009
5009
|
projectDir: serverDir
|
|
5010
5010
|
});
|
|
5011
|
-
const prismaIndexPath = path.join(serverDir, "prisma/index.ts");
|
|
5012
|
-
const prismaIndexContent = `
|
|
5013
|
-
import { PrismaClient } from "./generated/client";
|
|
5014
|
-
import { withAccelerate } from "@prisma/extension-accelerate";
|
|
5015
|
-
|
|
5016
|
-
const prisma = new PrismaClient().$extends(withAccelerate());
|
|
5017
|
-
|
|
5018
|
-
export default prisma;
|
|
5019
|
-
`;
|
|
5020
|
-
await fs.writeFile(prismaIndexPath, prismaIndexContent.trim());
|
|
5021
|
-
const dbFilePath = path.join(serverDir, "src/db/index.ts");
|
|
5022
|
-
if (await fs.pathExists(dbFilePath)) {
|
|
5023
|
-
let dbFileContent = await fs.readFile(dbFilePath, "utf8");
|
|
5024
|
-
if (!dbFileContent.includes("@prisma/extension-accelerate")) {
|
|
5025
|
-
dbFileContent = `import { withAccelerate } from "@prisma/extension-accelerate";\n${dbFileContent}`;
|
|
5026
|
-
dbFileContent = dbFileContent.replace("export const db = new PrismaClient();", "export const db = new PrismaClient().$extends(withAccelerate());");
|
|
5027
|
-
await fs.writeFile(dbFilePath, dbFileContent);
|
|
5028
|
-
}
|
|
5029
|
-
}
|
|
5030
5011
|
return true;
|
|
5031
5012
|
} catch (_error) {
|
|
5032
5013
|
log.warn(pc.yellow("Could not add Prisma Accelerate extension automatically"));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-better-t-stack",
|
|
3
|
-
"version": "2.45.
|
|
3
|
+
"version": "2.45.1",
|
|
4
4
|
"description": "A modern CLI tool for scaffolding end-to-end type-safe TypeScript projects with best practices and customizable configurations",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { PrismaClient } from "../../prisma/generated/client";
|
|
2
|
+
{{#if (or (eq dbSetup "prisma-postgres") (eq orm "prisma"))}}
|
|
3
|
+
import { withAccelerate } from "@prisma/extension-accelerate";
|
|
2
4
|
|
|
5
|
+
const prisma = new PrismaClient().$extends(withAccelerate());
|
|
6
|
+
{{else}}
|
|
3
7
|
const prisma = new PrismaClient();
|
|
8
|
+
{{/if}}
|
|
4
9
|
|
|
5
10
|
export default prisma;
|