create-better-t-stack 3.4.2-canary.39d948b7 → 3.5.0
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-BEzWAB2k.js → src-C46pe-uS.js} +48 -29
- package/package.json +1 -1
- package/templates/api/orpc/server/package.json.hbs +1 -5
- package/templates/api/trpc/server/package.json.hbs +1 -5
- package/templates/auth/better-auth/server/base/package.json.hbs +1 -5
- package/templates/db/base/package.json.hbs +1 -5
- package/templates/db/prisma/mongodb/prisma/schema/schema.prisma.hbs +1 -1
- package/templates/db/prisma/mysql/prisma/schema/schema.prisma.hbs +8 -12
- package/templates/db/prisma/mysql/prisma.config.ts.hbs +17 -14
- package/templates/db/prisma/mysql/src/index.ts.hbs +46 -4
- package/templates/db/prisma/postgres/prisma/schema/schema.prisma.hbs +1 -5
- package/templates/db/prisma/postgres/prisma.config.ts.hbs +9 -6
- package/templates/db/prisma/postgres/src/index.ts.hbs +46 -1
- package/templates/db/prisma/sqlite/prisma/schema/schema.prisma.hbs +1 -12
- package/templates/db/prisma/sqlite/prisma.config.ts.hbs +16 -9
- package/templates/db/prisma/sqlite/src/index.ts.hbs +15 -15
- package/templates/frontend/native/uniwind/app/(drawer)/_layout.tsx.hbs +21 -13
- package/templates/api/orpc/server/tsdown.config.ts.hbs +0 -7
- package/templates/api/trpc/server/tsdown.config.ts.hbs +0 -7
- package/templates/auth/better-auth/server/base/tsdown.config.ts.hbs +0 -7
- package/templates/db/base/tsdown.config.ts.hbs +0 -7
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-C46pe-uS.js";
|
|
3
3
|
|
|
4
4
|
export { builder, createBtsCli, docs, init, router, sponsors };
|
|
@@ -73,17 +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-
|
|
86
|
-
"@prisma/adapter-
|
|
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",
|
|
87
91
|
mongoose: "^8.14.0",
|
|
88
92
|
"vite-plugin-pwa": "^1.0.1",
|
|
89
93
|
"@vite-pwa/assets-generator": "^1.0.0",
|
|
@@ -148,7 +152,7 @@ const dependencyVersionMap = {
|
|
|
148
152
|
"@cloudflare/workers-types": "^4.20250822.0",
|
|
149
153
|
alchemy: "^0.77.0",
|
|
150
154
|
dotenv: "^17.2.2",
|
|
151
|
-
tsdown: "^0.
|
|
155
|
+
tsdown: "^0.16.5",
|
|
152
156
|
zod: "^4.1.11",
|
|
153
157
|
srvx: "0.8.15",
|
|
154
158
|
"@polar-sh/better-auth": "^1.1.3",
|
|
@@ -1336,7 +1340,7 @@ const getLatestCLIVersion = () => {
|
|
|
1336
1340
|
*/
|
|
1337
1341
|
function isTelemetryEnabled() {
|
|
1338
1342
|
const BTS_TELEMETRY_DISABLED = process.env.BTS_TELEMETRY_DISABLED;
|
|
1339
|
-
const BTS_TELEMETRY = "
|
|
1343
|
+
const BTS_TELEMETRY = "1";
|
|
1340
1344
|
if (BTS_TELEMETRY_DISABLED !== void 0) return BTS_TELEMETRY_DISABLED !== "1";
|
|
1341
1345
|
if (BTS_TELEMETRY !== void 0) return BTS_TELEMETRY === "1";
|
|
1342
1346
|
return true;
|
|
@@ -1344,8 +1348,8 @@ function isTelemetryEnabled() {
|
|
|
1344
1348
|
|
|
1345
1349
|
//#endregion
|
|
1346
1350
|
//#region src/utils/analytics.ts
|
|
1347
|
-
const POSTHOG_API_KEY = "
|
|
1348
|
-
const POSTHOG_HOST = "
|
|
1351
|
+
const POSTHOG_API_KEY = "phc_8ZUxEwwfKMajJLvxz1daGd931dYbQrwKNficBmsdIrs";
|
|
1352
|
+
const POSTHOG_HOST = "https://us.i.posthog.com";
|
|
1349
1353
|
function generateSessionId() {
|
|
1350
1354
|
const rand = Math.random().toString(36).slice(2);
|
|
1351
1355
|
return `cli_${Date.now().toString(36)}${rand}`;
|
|
@@ -5611,26 +5615,37 @@ async function setupDatabase(config, cliInput) {
|
|
|
5611
5615
|
if (!await fs.pathExists(dbPackageDir)) return;
|
|
5612
5616
|
try {
|
|
5613
5617
|
if (orm === "prisma") {
|
|
5614
|
-
if (database === "
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
"@prisma/adapter-planetscale",
|
|
5618
|
-
"@planetscale/database"
|
|
5619
|
-
],
|
|
5620
|
-
devDependencies: ["prisma"],
|
|
5618
|
+
if (database === "mongodb") await addPackageDependency({
|
|
5619
|
+
customDependencies: { "@prisma/client": "6.19.0" },
|
|
5620
|
+
customDevDependencies: { prisma: "6.19.0" },
|
|
5621
5621
|
projectDir: dbPackageDir
|
|
5622
5622
|
});
|
|
5623
|
-
else
|
|
5624
|
-
|
|
5625
|
-
|
|
5626
|
-
|
|
5623
|
+
else {
|
|
5624
|
+
const prismaDependencies = ["@prisma/client"];
|
|
5625
|
+
const prismaDevDependencies = ["prisma"];
|
|
5626
|
+
if (database === "mysql" && dbSetup === "planetscale") prismaDependencies.push("@prisma/adapter-planetscale", "@planetscale/database");
|
|
5627
|
+
else if (database === "mysql") prismaDependencies.push("@prisma/adapter-mariadb");
|
|
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 {
|
|
5634
|
+
prismaDependencies.push("@prisma/adapter-pg");
|
|
5635
|
+
prismaDependencies.push("pg");
|
|
5636
|
+
prismaDevDependencies.push("@types/pg");
|
|
5637
|
+
}
|
|
5638
|
+
await addPackageDependency({
|
|
5639
|
+
dependencies: prismaDependencies,
|
|
5640
|
+
devDependencies: prismaDevDependencies,
|
|
5641
|
+
projectDir: dbPackageDir
|
|
5642
|
+
});
|
|
5643
|
+
}
|
|
5644
|
+
if (await fs.pathExists(webDir)) if (database === "mongodb") await addPackageDependency({
|
|
5645
|
+
customDependencies: { "@prisma/client": "6.19.0" },
|
|
5646
|
+
projectDir: webDir
|
|
5627
5647
|
});
|
|
5628
5648
|
else await addPackageDependency({
|
|
5629
|
-
dependencies: ["@prisma/client"],
|
|
5630
|
-
devDependencies: ["prisma"],
|
|
5631
|
-
projectDir: dbPackageDir
|
|
5632
|
-
});
|
|
5633
|
-
if (await fs.pathExists(webDir)) await addPackageDependency({
|
|
5634
5649
|
dependencies: ["@prisma/client"],
|
|
5635
5650
|
projectDir: webDir
|
|
5636
5651
|
});
|
|
@@ -6287,10 +6302,14 @@ async function getDatabaseInstructions(database, orm, runCmd, _runtime, dbSetup,
|
|
|
6287
6302
|
if (database === "mysql" && orm === "drizzle") instructions.push(`${pc.yellow("NOTE:")} Enable foreign key constraints in PlanetScale database settings`);
|
|
6288
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`);
|
|
6289
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`);
|
|
6290
6306
|
if (orm === "prisma") {
|
|
6291
6307
|
if (database === "mongodb" && dbSetup === "docker") instructions.push(`${pc.yellow("WARNING:")} Prisma + MongoDB + Docker combination\n may not work.`);
|
|
6292
6308
|
if (dbSetup === "docker") instructions.push(`${pc.cyan("•")} Start docker container: ${`${runCmd} db:start`}`);
|
|
6293
|
-
if (!(dbSetup === "d1" && serverDeploy === "alchemy"))
|
|
6309
|
+
if (!(dbSetup === "d1" && serverDeploy === "alchemy")) {
|
|
6310
|
+
instructions.push(`${pc.cyan("•")} Generate Prisma Client: ${`${runCmd} db:generate`}`);
|
|
6311
|
+
instructions.push(`${pc.cyan("•")} Apply schema: ${`${runCmd} db:push`}`);
|
|
6312
|
+
}
|
|
6294
6313
|
if (!(dbSetup === "d1" && serverDeploy === "alchemy")) instructions.push(`${pc.cyan("•")} Database UI: ${`${runCmd} db:studio`}`);
|
|
6295
6314
|
} else if (orm === "drizzle") {
|
|
6296
6315
|
if (dbSetup === "docker") instructions.push(`${pc.cyan("•")} Start docker container: ${`${runCmd} db:start`}`);
|
|
@@ -6338,7 +6357,7 @@ async function setupWorkspaceDependencies(projectDir, options) {
|
|
|
6338
6357
|
const projectName = options.projectName;
|
|
6339
6358
|
const workspaceVersion = options.packageManager === "npm" ? "*" : "workspace:*";
|
|
6340
6359
|
const commonDeps = ["dotenv", "zod"];
|
|
6341
|
-
const commonDevDeps = [
|
|
6360
|
+
const commonDevDeps = [];
|
|
6342
6361
|
const configPackageDir = path.join(projectDir, "packages/config");
|
|
6343
6362
|
const configDep = {};
|
|
6344
6363
|
if (await fs.pathExists(configPackageDir)) configDep[`@${projectName}/config`] = workspaceVersion;
|
|
@@ -6382,7 +6401,7 @@ async function setupWorkspaceDependencies(projectDir, options) {
|
|
|
6382
6401
|
if (options.database !== "none" && await fs.pathExists(dbPackageDir)) serverDeps[`@${projectName}/db`] = workspaceVersion;
|
|
6383
6402
|
await addPackageDependency({
|
|
6384
6403
|
dependencies: commonDeps,
|
|
6385
|
-
devDependencies: commonDevDeps,
|
|
6404
|
+
devDependencies: [...commonDevDeps, "tsdown"],
|
|
6386
6405
|
customDependencies: serverDeps,
|
|
6387
6406
|
customDevDependencies: configDep,
|
|
6388
6407
|
projectDir: serverPackageDir
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-better-t-stack",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0",
|
|
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",
|
|
@@ -2,18 +2,14 @@
|
|
|
2
2
|
"name": "@{{projectName}}/api",
|
|
3
3
|
"exports": {
|
|
4
4
|
".": {
|
|
5
|
-
"types": "./dist/index.d.ts",
|
|
6
5
|
"default": "./src/index.ts"
|
|
7
6
|
},
|
|
8
7
|
"./*": {
|
|
9
|
-
"types": "./dist/*.d.ts",
|
|
10
8
|
"default": "./src/*.ts"
|
|
11
9
|
}
|
|
12
10
|
},
|
|
13
11
|
"type": "module",
|
|
14
|
-
"scripts": {
|
|
15
|
-
"build": "tsdown"
|
|
16
|
-
},
|
|
12
|
+
"scripts": {},
|
|
17
13
|
"devDependencies": {},
|
|
18
14
|
"peerDependencies": {
|
|
19
15
|
"typescript": "^5"
|
|
@@ -2,18 +2,14 @@
|
|
|
2
2
|
"name": "@{{projectName}}/api",
|
|
3
3
|
"exports": {
|
|
4
4
|
".": {
|
|
5
|
-
"types": "./dist/index.d.ts",
|
|
6
5
|
"default": "./src/index.ts"
|
|
7
6
|
},
|
|
8
7
|
"./*": {
|
|
9
|
-
"types": "./dist/*.d.ts",
|
|
10
8
|
"default": "./src/*.ts"
|
|
11
9
|
}
|
|
12
10
|
},
|
|
13
11
|
"type": "module",
|
|
14
|
-
"scripts": {
|
|
15
|
-
"build": "tsdown"
|
|
16
|
-
},
|
|
12
|
+
"scripts": {},
|
|
17
13
|
"devDependencies": {},
|
|
18
14
|
"peerDependencies": {
|
|
19
15
|
"typescript": "^5"
|
|
@@ -2,18 +2,14 @@
|
|
|
2
2
|
"name": "@{{projectName}}/auth",
|
|
3
3
|
"exports": {
|
|
4
4
|
".": {
|
|
5
|
-
"types": "./dist/index.d.ts",
|
|
6
5
|
"default": "./src/index.ts"
|
|
7
6
|
},
|
|
8
7
|
"./*": {
|
|
9
|
-
"types": "./dist/*.d.ts",
|
|
10
8
|
"default": "./src/*.ts"
|
|
11
9
|
}
|
|
12
10
|
},
|
|
13
11
|
"type": "module",
|
|
14
|
-
"scripts": {
|
|
15
|
-
"build": "tsdown"
|
|
16
|
-
},
|
|
12
|
+
"scripts": {},
|
|
17
13
|
"devDependencies": {},
|
|
18
14
|
"peerDependencies": {
|
|
19
15
|
"typescript": "^5"
|
|
@@ -3,17 +3,13 @@
|
|
|
3
3
|
"type": "module",
|
|
4
4
|
"exports": {
|
|
5
5
|
".": {
|
|
6
|
-
"types": "./dist/index.d.ts",
|
|
7
6
|
"default": "./src/index.ts"
|
|
8
7
|
},
|
|
9
8
|
"./*": {
|
|
10
|
-
"types": "./dist/*.d.ts",
|
|
11
9
|
"default": "./src/*.ts"
|
|
12
10
|
}
|
|
13
11
|
},
|
|
14
|
-
"scripts": {
|
|
15
|
-
"build": "tsdown"
|
|
16
|
-
},
|
|
12
|
+
"scripts": {},
|
|
17
13
|
"devDependencies": {},
|
|
18
14
|
"peerDependencies": {
|
|
19
15
|
"typescript": "^5"
|
|
@@ -1,25 +1,21 @@
|
|
|
1
1
|
generator client {
|
|
2
|
-
provider
|
|
3
|
-
output
|
|
4
|
-
moduleFormat
|
|
2
|
+
provider = "prisma-client"
|
|
3
|
+
output = "../generated"
|
|
4
|
+
moduleFormat = "esm"
|
|
5
5
|
{{#if (eq runtime "bun")}}
|
|
6
|
-
runtime
|
|
6
|
+
runtime = "bun"
|
|
7
7
|
{{/if}}
|
|
8
8
|
{{#if (eq runtime "node")}}
|
|
9
|
-
runtime
|
|
9
|
+
runtime = "nodejs"
|
|
10
10
|
{{/if}}
|
|
11
|
-
{{#if (eq runtime "workers")}}
|
|
12
|
-
runtime
|
|
13
|
-
{{/if}}
|
|
14
|
-
{{#if (eq dbSetup "planetscale")}}
|
|
15
|
-
previewFeatures = ["driverAdapters"]
|
|
11
|
+
{{#if (or (eq runtime "workers") (and (eq backend "self") (eq webDeploy "alchemy")))}}
|
|
12
|
+
runtime = "workerd"
|
|
16
13
|
{{/if}}
|
|
17
14
|
}
|
|
18
15
|
|
|
19
16
|
datasource db {
|
|
20
17
|
provider = "mysql"
|
|
21
|
-
url = env("DATABASE_URL")
|
|
22
18
|
{{#if (eq dbSetup "planetscale")}}
|
|
23
19
|
relationMode = "prisma"
|
|
24
20
|
{{/if}}
|
|
25
|
-
}
|
|
21
|
+
}
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import
|
|
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
|
-
export default {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
export default defineConfig({
|
|
14
|
+
schema: path.join("prisma", "schema"),
|
|
15
|
+
migrations: {
|
|
16
|
+
path: path.join("prisma", "migrations"),
|
|
17
|
+
},
|
|
18
|
+
datasource: {
|
|
19
|
+
url: env('DATABASE_URL'),
|
|
20
|
+
},
|
|
21
|
+
})
|
|
@@ -1,12 +1,54 @@
|
|
|
1
|
+
{{#if (eq runtime "workers")}}
|
|
1
2
|
import { PrismaClient } from "../prisma/generated/client";
|
|
3
|
+
import { env } from "cloudflare:workers";
|
|
4
|
+
|
|
2
5
|
{{#if (eq dbSetup "planetscale")}}
|
|
3
|
-
import { PrismaPlanetScale } from
|
|
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";
|
|
4
12
|
|
|
5
|
-
const
|
|
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
|
+
};
|
|
6
22
|
|
|
7
|
-
const
|
|
23
|
+
const adapter = new PrismaMariaDb(connectionConfig);
|
|
24
|
+
const prisma = new PrismaClient({ adapter });
|
|
25
|
+
{{/if}}
|
|
26
|
+
|
|
27
|
+
export default prisma;
|
|
8
28
|
{{else}}
|
|
9
|
-
|
|
29
|
+
import { PrismaClient } from "../prisma/generated/client";
|
|
30
|
+
|
|
31
|
+
{{#if (eq dbSetup "planetscale")}}
|
|
32
|
+
import { PrismaPlanetScale } from "@prisma/adapter-planetscale";
|
|
33
|
+
|
|
34
|
+
const adapter = new PrismaPlanetScale({ url: process.env.DATABASE_URL || "" });
|
|
35
|
+
const prisma = new PrismaClient({ adapter });
|
|
36
|
+
{{else}}
|
|
37
|
+
import { PrismaMariaDb } from "@prisma/adapter-mariadb";
|
|
38
|
+
|
|
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
|
+
};
|
|
48
|
+
|
|
49
|
+
const adapter = new PrismaMariaDb(connectionConfig);
|
|
50
|
+
const prisma = new PrismaClient({ adapter });
|
|
10
51
|
{{/if}}
|
|
11
52
|
|
|
12
53
|
export default prisma;
|
|
54
|
+
{{/if}}
|
|
@@ -8,17 +8,13 @@ generator client {
|
|
|
8
8
|
{{#if (eq runtime "node")}}
|
|
9
9
|
runtime = "nodejs"
|
|
10
10
|
{{/if}}
|
|
11
|
-
{{#if (eq runtime "workers")}}
|
|
11
|
+
{{#if (or (eq runtime "workers") (and (eq backend "self") (eq webDeploy "alchemy")))}}
|
|
12
12
|
runtime = "workerd"
|
|
13
13
|
{{/if}}
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
datasource db {
|
|
17
17
|
provider = "postgresql"
|
|
18
|
-
url = env("DATABASE_URL")
|
|
19
|
-
{{#if (eq dbSetup "supabase")}}
|
|
20
|
-
directUrl = env("DIRECT_URL")
|
|
21
|
-
{{/if}}
|
|
22
18
|
{{#if (eq dbSetup "planetscale")}}
|
|
23
19
|
relationMode = "prisma"
|
|
24
20
|
{{/if}}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import
|
|
2
|
+
import { defineConfig, env } from 'prisma/config'
|
|
3
3
|
{{#unless (eq dbSetup "prisma-postgres")}}
|
|
4
|
-
import dotenv from
|
|
4
|
+
import dotenv from 'dotenv'
|
|
5
5
|
|
|
6
6
|
dotenv.config({
|
|
7
7
|
{{#if (eq backend "self")}}
|
|
@@ -9,12 +9,15 @@ dotenv.config({
|
|
|
9
9
|
{{else}}
|
|
10
10
|
path: "../../apps/server/.env",
|
|
11
11
|
{{/if}}
|
|
12
|
-
})
|
|
12
|
+
})
|
|
13
13
|
{{/unless}}
|
|
14
14
|
|
|
15
|
-
export default {
|
|
15
|
+
export default defineConfig({
|
|
16
16
|
schema: path.join("prisma", "schema"),
|
|
17
17
|
migrations: {
|
|
18
18
|
path: path.join("prisma", "migrations"),
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
},
|
|
20
|
+
datasource: {
|
|
21
|
+
url: env('DATABASE_URL'),
|
|
22
|
+
},
|
|
23
|
+
})
|
|
@@ -1,5 +1,50 @@
|
|
|
1
|
+
{{#if (eq runtime "workers")}}
|
|
1
2
|
import { PrismaClient } from "../prisma/generated/client";
|
|
3
|
+
import { env } from "cloudflare:workers";
|
|
4
|
+
{{#if (eq dbSetup "neon")}}
|
|
5
|
+
import { PrismaNeon } from "@prisma/adapter-neon";
|
|
6
|
+
import { neonConfig } from "@neondatabase/serverless";
|
|
2
7
|
|
|
3
|
-
|
|
8
|
+
neonConfig.poolQueryViaFetch = true;
|
|
9
|
+
|
|
10
|
+
const prisma = new PrismaClient({
|
|
11
|
+
adapter: new PrismaNeon({
|
|
12
|
+
connectionString: env.DATABASE_URL || "",
|
|
13
|
+
}),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
{{else}}
|
|
17
|
+
import { PrismaPg } from "@prisma/adapter-pg";
|
|
18
|
+
|
|
19
|
+
const adapter = new PrismaPg({ connectionString: env.DATABASE_URL || "" });
|
|
20
|
+
const prisma = new PrismaClient({ adapter });
|
|
21
|
+
|
|
22
|
+
{{/if}}
|
|
23
|
+
|
|
24
|
+
export default prisma;
|
|
25
|
+
{{else}}
|
|
26
|
+
import { PrismaClient } from "../prisma/generated/client";
|
|
27
|
+
{{#if (eq dbSetup "neon")}}
|
|
28
|
+
import { PrismaNeon } from "@prisma/adapter-neon";
|
|
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 });
|
|
40
|
+
|
|
41
|
+
{{else}}
|
|
42
|
+
import { PrismaPg } from "@prisma/adapter-pg";
|
|
43
|
+
|
|
44
|
+
const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL || "" });
|
|
45
|
+
const prisma = new PrismaClient({ adapter });
|
|
46
|
+
|
|
47
|
+
{{/if}}
|
|
4
48
|
|
|
5
49
|
export default prisma;
|
|
50
|
+
{{/if}}
|
|
@@ -8,22 +8,11 @@ generator client {
|
|
|
8
8
|
{{#if (eq runtime "node")}}
|
|
9
9
|
runtime = "nodejs"
|
|
10
10
|
{{/if}}
|
|
11
|
-
{{#if (eq runtime "workers")}}
|
|
11
|
+
{{#if (or (eq runtime "workers") (and (eq backend "self") (eq webDeploy "alchemy")))}}
|
|
12
12
|
runtime = "workerd"
|
|
13
|
-
{{#if (eq dbSetup "d1")}}
|
|
14
|
-
previewFeatures = ["driverAdapters"]
|
|
15
|
-
{{/if}}
|
|
16
|
-
{{/if}}
|
|
17
|
-
{{#if (eq dbSetup "turso")}}
|
|
18
|
-
previewFeatures = ["driverAdapters"]
|
|
19
13
|
{{/if}}
|
|
20
14
|
}
|
|
21
15
|
|
|
22
16
|
datasource db {
|
|
23
17
|
provider = "sqlite"
|
|
24
|
-
{{#if (eq dbSetup "turso")}}
|
|
25
|
-
url = "file:./local.db"
|
|
26
|
-
{{else}}
|
|
27
|
-
url = env("DATABASE_URL")
|
|
28
|
-
{{/if}}
|
|
29
18
|
}
|
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import
|
|
2
|
+
import { defineConfig, env } from "prisma/config";
|
|
3
3
|
import dotenv from "dotenv";
|
|
4
4
|
|
|
5
5
|
dotenv.config({
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
{{#if (eq backend "self")}}
|
|
7
|
+
path: "../../apps/web/.env",
|
|
8
|
+
{{else}}
|
|
9
|
+
path: "../../apps/server/.env",
|
|
10
|
+
{{/if}}
|
|
11
11
|
});
|
|
12
12
|
|
|
13
|
-
export default {
|
|
13
|
+
export default defineConfig({
|
|
14
14
|
schema: path.join("prisma", "schema"),
|
|
15
15
|
migrations: {
|
|
16
16
|
path: path.join("prisma", "migrations"),
|
|
17
|
-
}
|
|
18
|
-
|
|
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,28 +1,28 @@
|
|
|
1
|
+
import { PrismaClient } from "../prisma/generated/client";
|
|
2
|
+
|
|
1
3
|
{{#if (eq dbSetup "d1")}}
|
|
2
|
-
import { env } from "cloudflare:workers";
|
|
3
4
|
import { PrismaD1 } from "@prisma/adapter-d1";
|
|
4
|
-
import {
|
|
5
|
+
import { env } from "cloudflare:workers";
|
|
5
6
|
|
|
6
7
|
const adapter = new PrismaD1(env.DB);
|
|
7
8
|
const prisma = new PrismaClient({ adapter });
|
|
8
9
|
|
|
9
10
|
export default prisma;
|
|
10
|
-
{{else
|
|
11
|
-
import {
|
|
12
|
-
|
|
11
|
+
{{else}}
|
|
12
|
+
import { PrismaLibSql } from "@prisma/adapter-libsql";
|
|
13
|
+
{{#if (eq runtime "workers")}}
|
|
14
|
+
import { env } from "cloudflare:workers";
|
|
15
|
+
{{/if}}
|
|
13
16
|
|
|
14
|
-
const adapter = new
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
const adapter = new PrismaLibSql({
|
|
18
|
+
url: {{#if (eq runtime "workers")}}env.DATABASE_URL || ""{{else}}process.env.DATABASE_URL || ""{{/if}},
|
|
19
|
+
{{#if (eq dbSetup "turso")}}
|
|
20
|
+
authToken: {{#if (eq runtime "workers")}}env.DATABASE_AUTH_TOKEN || ""{{else}}process.env.DATABASE_AUTH_TOKEN ||
|
|
21
|
+
""{{/if}},
|
|
22
|
+
{{/if}}
|
|
17
23
|
});
|
|
18
24
|
|
|
19
25
|
const prisma = new PrismaClient({ adapter });
|
|
20
26
|
|
|
21
27
|
export default prisma;
|
|
22
|
-
{{
|
|
23
|
-
import { PrismaClient } from "../prisma/generated/client";
|
|
24
|
-
|
|
25
|
-
const prisma = new PrismaClient();
|
|
26
|
-
|
|
27
|
-
export default prisma;
|
|
28
|
-
{{/if}}
|
|
28
|
+
{{/if}}
|
|
@@ -3,7 +3,7 @@ import { Ionicons, MaterialIcons } from "@expo/vector-icons";
|
|
|
3
3
|
import { Link } from "expo-router";
|
|
4
4
|
import { Drawer } from "expo-router/drawer";
|
|
5
5
|
import { useThemeColor } from "heroui-native";
|
|
6
|
-
import { Pressable } from "react-native";
|
|
6
|
+
import { Pressable, Text } from "react-native";
|
|
7
7
|
import { ThemeToggle } from "@/components/theme-toggle";
|
|
8
8
|
|
|
9
9
|
function DrawerLayout() {
|
|
@@ -29,9 +29,11 @@ function DrawerLayout() {
|
|
|
29
29
|
name="index"
|
|
30
30
|
options=\{{
|
|
31
31
|
headerTitle: "Home",
|
|
32
|
-
drawerLabel:
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
drawerLabel: ({ color, focused }) => (
|
|
33
|
+
<Text style=\{{ color: focused ? color : themeColorForeground }}>Home</Text>
|
|
34
|
+
),
|
|
35
|
+
drawerIcon: ({ size, color, focused }) => (
|
|
36
|
+
<Ionicons name="home-outline" size={size} color={focused ? color : themeColorForeground} />
|
|
35
37
|
),
|
|
36
38
|
}}
|
|
37
39
|
/>
|
|
@@ -39,9 +41,11 @@ function DrawerLayout() {
|
|
|
39
41
|
name="(tabs)"
|
|
40
42
|
options=\{{
|
|
41
43
|
headerTitle: "Tabs",
|
|
42
|
-
drawerLabel:
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
drawerLabel: ({ color, focused }) => (
|
|
45
|
+
<Text style=\{{ color: focused ? color : themeColorForeground }}>Tabs</Text>
|
|
46
|
+
),
|
|
47
|
+
drawerIcon: ({ size, color, focused }) => (
|
|
48
|
+
<MaterialIcons name="border-bottom" size={size} color={focused ? color : themeColorForeground} />
|
|
45
49
|
),
|
|
46
50
|
headerRight: () => (
|
|
47
51
|
<Link href="/modal" asChild>
|
|
@@ -57,9 +61,11 @@ function DrawerLayout() {
|
|
|
57
61
|
name="todos"
|
|
58
62
|
options=\{{
|
|
59
63
|
headerTitle: "Todos",
|
|
60
|
-
drawerLabel:
|
|
61
|
-
|
|
62
|
-
|
|
64
|
+
drawerLabel: ({ color, focused }) => (
|
|
65
|
+
<Text style=\{{ color: focused ? color : themeColorForeground }}>Todos</Text>
|
|
66
|
+
),
|
|
67
|
+
drawerIcon: ({ size, color, focused }) => (
|
|
68
|
+
<Ionicons name="checkbox-outline" size={size} color={focused ? color : themeColorForeground} />
|
|
63
69
|
),
|
|
64
70
|
}}
|
|
65
71
|
/>
|
|
@@ -69,9 +75,11 @@ function DrawerLayout() {
|
|
|
69
75
|
name="ai"
|
|
70
76
|
options=\{{
|
|
71
77
|
headerTitle: "AI",
|
|
72
|
-
drawerLabel:
|
|
73
|
-
|
|
74
|
-
|
|
78
|
+
drawerLabel: ({ color, focused }) => (
|
|
79
|
+
<Text style=\{{ color: focused ? color : themeColorForeground }}>AI</Text>
|
|
80
|
+
),
|
|
81
|
+
drawerIcon: ({ size, color, focused }) => (
|
|
82
|
+
<Ionicons name="chatbubble-ellipses-outline" size={size} color={focused ? color : themeColorForeground} />
|
|
75
83
|
),
|
|
76
84
|
}}
|
|
77
85
|
/>
|