create-better-t-stack 3.4.2-canary.2077910a → 3.4.2-canary.39ce1311
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 +1 -1
- package/dist/index.js +1 -1
- package/dist/{src-CFkY2F0Q.js → src-UXnIdUSH.js} +17 -13
- package/package.json +1 -1
- package/templates/db/prisma/mysql/src/index.ts.hbs +41 -9
- package/templates/db/prisma/postgres/prisma.config.ts.hbs +3 -3
- package/templates/db/prisma/postgres/src/index.ts.hbs +24 -6
- package/templates/db/prisma/sqlite/prisma.config.ts.hbs +20 -16
- package/templates/db/prisma/sqlite/src/index.ts.hbs +8 -4
package/dist/cli.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as router, i as init, n as createBtsCli, o as sponsors, r as docs, t as builder } from "./src-
|
|
2
|
+
import { a as router, i as init, n as createBtsCli, o as sponsors, r as docs, t as builder } from "./src-UXnIdUSH.js";
|
|
3
3
|
|
|
4
4
|
export { builder, createBtsCli, docs, init, router, sponsors };
|
|
@@ -73,21 +73,21 @@ const dependencyVersionMap = {
|
|
|
73
73
|
"@planetscale/database": "^1.19.0",
|
|
74
74
|
"@libsql/client": "^0.14.0",
|
|
75
75
|
libsql: "^0.5.22",
|
|
76
|
-
"@neondatabase/serverless": "^1.0.
|
|
76
|
+
"@neondatabase/serverless": "^1.0.2",
|
|
77
77
|
pg: "^8.14.1",
|
|
78
78
|
"@types/pg": "^8.11.11",
|
|
79
79
|
"@types/ws": "^8.18.1",
|
|
80
80
|
ws: "^8.18.3",
|
|
81
81
|
mysql2: "^3.14.0",
|
|
82
|
-
"@prisma/client": "
|
|
83
|
-
prisma: "
|
|
84
|
-
"@prisma/adapter-d1": "
|
|
85
|
-
"@prisma/adapter-neon": "
|
|
86
|
-
"@prisma/adapter-mariadb": "
|
|
87
|
-
"@prisma/adapter-libsql": "
|
|
88
|
-
"@prisma/adapter-better-sqlite3": "
|
|
89
|
-
"@prisma/adapter-pg": "
|
|
90
|
-
"@prisma/adapter-planetscale": "
|
|
82
|
+
"@prisma/client": "^7.0.0",
|
|
83
|
+
prisma: "^7.0.0",
|
|
84
|
+
"@prisma/adapter-d1": "^7.0.0",
|
|
85
|
+
"@prisma/adapter-neon": "^7.0.0",
|
|
86
|
+
"@prisma/adapter-mariadb": "^7.0.0",
|
|
87
|
+
"@prisma/adapter-libsql": "^7.0.0",
|
|
88
|
+
"@prisma/adapter-better-sqlite3": "^7.0.0",
|
|
89
|
+
"@prisma/adapter-pg": "^7.0.0",
|
|
90
|
+
"@prisma/adapter-planetscale": "^7.0.0",
|
|
91
91
|
mongoose: "^8.14.0",
|
|
92
92
|
"vite-plugin-pwa": "^1.0.1",
|
|
93
93
|
"@vite-pwa/assets-generator": "^1.0.0",
|
|
@@ -5625,9 +5625,12 @@ async function setupDatabase(config, cliInput) {
|
|
|
5625
5625
|
const prismaDevDependencies = ["prisma"];
|
|
5626
5626
|
if (database === "mysql" && dbSetup === "planetscale") prismaDependencies.push("@prisma/adapter-planetscale", "@planetscale/database");
|
|
5627
5627
|
else if (database === "mysql") prismaDependencies.push("@prisma/adapter-mariadb");
|
|
5628
|
-
else if (database === "sqlite") prismaDependencies.push("@prisma/adapter-
|
|
5629
|
-
else
|
|
5630
|
-
else {
|
|
5628
|
+
else if (database === "sqlite") if (dbSetup === "d1") prismaDependencies.push("@prisma/adapter-d1");
|
|
5629
|
+
else prismaDependencies.push("@prisma/adapter-libsql");
|
|
5630
|
+
else if (database === "postgres") if (dbSetup === "neon") {
|
|
5631
|
+
prismaDependencies.push("@prisma/adapter-neon", "@neondatabase/serverless", "ws");
|
|
5632
|
+
prismaDevDependencies.push("@types/ws");
|
|
5633
|
+
} else {
|
|
5631
5634
|
prismaDependencies.push("@prisma/adapter-pg");
|
|
5632
5635
|
prismaDependencies.push("pg");
|
|
5633
5636
|
prismaDevDependencies.push("@types/pg");
|
|
@@ -6299,6 +6302,7 @@ async function getDatabaseInstructions(database, orm, runCmd, _runtime, dbSetup,
|
|
|
6299
6302
|
if (database === "mysql" && orm === "drizzle") instructions.push(`${pc.yellow("NOTE:")} Enable foreign key constraints in PlanetScale database settings`);
|
|
6300
6303
|
if (database === "mysql" && orm === "prisma") instructions.push(`${pc.yellow("NOTE:")} How to handle Prisma migrations with PlanetScale:\n https://github.com/prisma/prisma/issues/7292`);
|
|
6301
6304
|
}
|
|
6305
|
+
if (dbSetup === "turso" && orm === "prisma") instructions.push(`${pc.yellow("NOTE:")} Follow Turso's Prisma guide for migrations via the Turso CLI:\n https://docs.turso.tech/sdk/ts/orm/prisma`);
|
|
6302
6306
|
if (orm === "prisma") {
|
|
6303
6307
|
if (database === "mongodb" && dbSetup === "docker") instructions.push(`${pc.yellow("WARNING:")} Prisma + MongoDB + Docker combination\n may not work.`);
|
|
6304
6308
|
if (dbSetup === "docker") instructions.push(`${pc.cyan("•")} Start docker container: ${`${runCmd} db:start`}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-better-t-stack",
|
|
3
|
-
"version": "3.4.2-canary.
|
|
3
|
+
"version": "3.4.2-canary.39ce1311",
|
|
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,4 +1,33 @@
|
|
|
1
|
+
{{#if (eq runtime "workers")}}
|
|
1
2
|
import { PrismaClient } from "../prisma/generated/client";
|
|
3
|
+
import { env } from "cloudflare:workers";
|
|
4
|
+
|
|
5
|
+
{{#if (eq dbSetup "planetscale")}}
|
|
6
|
+
import { PrismaPlanetScale } from "@prisma/adapter-planetscale";
|
|
7
|
+
|
|
8
|
+
const adapter = new PrismaPlanetScale({ url: env.DATABASE_URL || "" });
|
|
9
|
+
const prisma = new PrismaClient({ adapter });
|
|
10
|
+
{{else}}
|
|
11
|
+
import { PrismaMariaDb } from "@prisma/adapter-mariadb";
|
|
12
|
+
|
|
13
|
+
const databaseUrl: string = env.DATABASE_URL || "";
|
|
14
|
+
const url: URL = new URL(databaseUrl);
|
|
15
|
+
const connectionConfig = {
|
|
16
|
+
host: url.hostname,
|
|
17
|
+
port: parseInt(url.port || "3306"),
|
|
18
|
+
user: url.username,
|
|
19
|
+
password: url.password,
|
|
20
|
+
database: url.pathname.slice(1),
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const adapter = new PrismaMariaDb(connectionConfig);
|
|
24
|
+
const prisma = new PrismaClient({ adapter });
|
|
25
|
+
{{/if}}
|
|
26
|
+
|
|
27
|
+
export default prisma;
|
|
28
|
+
{{else}}
|
|
29
|
+
import { PrismaClient } from "../prisma/generated/client";
|
|
30
|
+
|
|
2
31
|
{{#if (eq dbSetup "planetscale")}}
|
|
3
32
|
import { PrismaPlanetScale } from "@prisma/adapter-planetscale";
|
|
4
33
|
|
|
@@ -7,16 +36,19 @@ const prisma = new PrismaClient({ adapter });
|
|
|
7
36
|
{{else}}
|
|
8
37
|
import { PrismaMariaDb } from "@prisma/adapter-mariadb";
|
|
9
38
|
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
39
|
+
const databaseUrl: string = process.env.DATABASE_URL || "";
|
|
40
|
+
const url: URL = new URL(databaseUrl);
|
|
41
|
+
const connectionConfig = {
|
|
42
|
+
host: url.hostname,
|
|
43
|
+
port: parseInt(url.port || "3306"),
|
|
44
|
+
user: url.username,
|
|
45
|
+
password: url.password,
|
|
46
|
+
database: url.pathname.slice(1),
|
|
47
|
+
};
|
|
18
48
|
|
|
49
|
+
const adapter = new PrismaMariaDb(connectionConfig);
|
|
19
50
|
const prisma = new PrismaClient({ adapter });
|
|
20
51
|
{{/if}}
|
|
21
52
|
|
|
22
|
-
export default prisma;
|
|
53
|
+
export default prisma;
|
|
54
|
+
{{/if}}
|
|
@@ -13,9 +13,9 @@ dotenv.config({
|
|
|
13
13
|
{{/unless}}
|
|
14
14
|
|
|
15
15
|
export default defineConfig({
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
schema: path.join("prisma", "schema"),
|
|
17
|
+
migrations: {
|
|
18
|
+
path: path.join("prisma", "migrations"),
|
|
19
19
|
},
|
|
20
20
|
datasource: {
|
|
21
21
|
url: env('DATABASE_URL'),
|
|
@@ -3,30 +3,48 @@ import { PrismaClient } from "../prisma/generated/client";
|
|
|
3
3
|
import { env } from "cloudflare:workers";
|
|
4
4
|
{{#if (eq dbSetup "neon")}}
|
|
5
5
|
import { PrismaNeon } from "@prisma/adapter-neon";
|
|
6
|
+
import { neonConfig } from "@neondatabase/serverless";
|
|
7
|
+
|
|
8
|
+
neonConfig.poolQueryViaFetch = true;
|
|
9
|
+
|
|
10
|
+
const prisma = new PrismaClient({
|
|
11
|
+
adapter: new PrismaNeon({
|
|
12
|
+
connectionString: env.DATABASE_URL || "",
|
|
13
|
+
}),
|
|
14
|
+
});
|
|
6
15
|
|
|
7
|
-
const adapter = new PrismaNeon({ connectionString: env.DATABASE_URL || "" });
|
|
8
16
|
{{else}}
|
|
9
17
|
import { PrismaPg } from "@prisma/adapter-pg";
|
|
10
18
|
|
|
11
19
|
const adapter = new PrismaPg({ connectionString: env.DATABASE_URL || "" });
|
|
12
|
-
{{/if}}
|
|
13
20
|
const prisma = new PrismaClient({ adapter });
|
|
14
21
|
|
|
22
|
+
{{/if}}
|
|
23
|
+
|
|
15
24
|
export default prisma;
|
|
16
25
|
{{else}}
|
|
17
26
|
import { PrismaClient } from "../prisma/generated/client";
|
|
18
27
|
{{#if (eq dbSetup "neon")}}
|
|
19
28
|
import { PrismaNeon } from "@prisma/adapter-neon";
|
|
20
|
-
import
|
|
29
|
+
import { neonConfig } from "@neondatabase/serverless";
|
|
30
|
+
import ws from "ws";
|
|
31
|
+
|
|
32
|
+
neonConfig.webSocketConstructor = ws;
|
|
33
|
+
neonConfig.poolQueryViaFetch = true;
|
|
34
|
+
|
|
35
|
+
const adapter = new PrismaNeon({
|
|
36
|
+
connectionString: process.env.DATABASE_URL || "",
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const prisma = new PrismaClient({ adapter });
|
|
21
40
|
|
|
22
|
-
dotenv.config();
|
|
23
|
-
const adapter = new PrismaNeon({ connectionString: process.env.DATABASE_URL || "" });
|
|
24
41
|
{{else}}
|
|
25
42
|
import { PrismaPg } from "@prisma/adapter-pg";
|
|
26
43
|
|
|
27
44
|
const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL || "" });
|
|
28
|
-
{{/if}}
|
|
29
45
|
const prisma = new PrismaClient({ adapter });
|
|
30
46
|
|
|
47
|
+
{{/if}}
|
|
48
|
+
|
|
31
49
|
export default prisma;
|
|
32
50
|
{{/if}}
|
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import { defineConfig, env } from
|
|
3
|
-
import dotenv from
|
|
2
|
+
import { defineConfig, env } from "prisma/config";
|
|
3
|
+
import dotenv from "dotenv";
|
|
4
4
|
|
|
5
5
|
dotenv.config({
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
})
|
|
6
|
+
{{#if (eq backend "self")}}
|
|
7
|
+
path: "../../apps/web/.env",
|
|
8
|
+
{{else}}
|
|
9
|
+
path: "../../apps/server/.env",
|
|
10
|
+
{{/if}}
|
|
11
|
+
});
|
|
12
12
|
|
|
13
13
|
export default defineConfig({
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
14
|
+
schema: path.join("prisma", "schema"),
|
|
15
|
+
migrations: {
|
|
16
|
+
path: path.join("prisma", "migrations"),
|
|
17
|
+
},
|
|
18
|
+
datasource: {
|
|
19
|
+
{{#if (eq dbSetup "turso")}}
|
|
20
|
+
url: "file:./dev.db",
|
|
21
|
+
{{else}}
|
|
22
|
+
url: env("DATABASE_URL"),
|
|
23
|
+
{{/if}}
|
|
24
|
+
},
|
|
25
|
+
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
{{#if (eq dbSetup "d1")}}
|
|
2
1
|
import { PrismaClient } from "../prisma/generated/client";
|
|
2
|
+
|
|
3
|
+
{{#if (eq dbSetup "d1")}}
|
|
3
4
|
import { PrismaD1 } from "@prisma/adapter-d1";
|
|
4
5
|
import { env } from "cloudflare:workers";
|
|
5
6
|
|
|
@@ -8,13 +9,16 @@ const prisma = new PrismaClient({ adapter });
|
|
|
8
9
|
|
|
9
10
|
export default prisma;
|
|
10
11
|
{{else}}
|
|
11
|
-
import { PrismaClient } from "../prisma/generated/client";
|
|
12
12
|
import { PrismaLibSql } from "@prisma/adapter-libsql";
|
|
13
|
+
{{#if (eq runtime "workers")}}
|
|
14
|
+
import { env } from "cloudflare:workers";
|
|
15
|
+
{{/if}}
|
|
13
16
|
|
|
14
17
|
const adapter = new PrismaLibSql({
|
|
15
|
-
url: process.env.DATABASE_URL || "",
|
|
18
|
+
url: {{#if (eq runtime "workers")}}env.DATABASE_URL || ""{{else}}process.env.DATABASE_URL || ""{{/if}},
|
|
16
19
|
{{#if (eq dbSetup "turso")}}
|
|
17
|
-
authToken: process.env.DATABASE_AUTH_TOKEN
|
|
20
|
+
authToken: {{#if (eq runtime "workers")}}env.DATABASE_AUTH_TOKEN || ""{{else}}process.env.DATABASE_AUTH_TOKEN ||
|
|
21
|
+
""{{/if}},
|
|
18
22
|
{{/if}}
|
|
19
23
|
});
|
|
20
24
|
|