@better-t-stack/template-generator 3.19.2 → 3.19.4
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/index.d.mts +2 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +176 -61
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -79,8 +79,8 @@ declare const TEMPLATE_COUNT = 435;
|
|
|
79
79
|
//#region src/utils/add-deps.d.ts
|
|
80
80
|
declare const dependencyVersionMap: {
|
|
81
81
|
readonly typescript: "^5";
|
|
82
|
-
readonly "better-auth": "^1.4.
|
|
83
|
-
readonly "@better-auth/expo": "^1.4.
|
|
82
|
+
readonly "better-auth": "^1.4.18";
|
|
83
|
+
readonly "@better-auth/expo": "^1.4.18";
|
|
84
84
|
readonly "@clerk/nextjs": "^6.31.5";
|
|
85
85
|
readonly "@clerk/clerk-react": "^5.45.0";
|
|
86
86
|
readonly "@clerk/tanstack-react-start": "^0.26.3";
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/core/virtual-fs.ts","../src/core/template-processor.ts","../src/template-handlers/utils.ts","../src/template-handlers/addons.ts","../src/generator.ts","../src/processors/addons-deps.ts","../src/bts-config.ts","../src/templates.generated.ts","../src/utils/add-deps.ts","../src/utils/reproducible-command.ts"],"sourcesContent":[],"mappings":";;;;;;;cAOa,iBAAA;;;;;;EAAA,QAAA,CAAA,QAAA,EAAA,MAAiB,CAAA,EAAA,MAAA,GAAA,SAAA;EA6Ea,MAAA,CAAA,IAAA,EAAA,MAAA,CAAA,EAAA,OAAA;EAkCX,UAAA,CAAA,QAAA,EAAA,MAAA,CAAA,EAAA,OAAA;EAAgB,eAcrC,CAAA,OAAA,EAAA,MAAA,CAAA,EAAA,OAAA;EAAA,KAGJ,CAAA,OAAA,EAAA,MAAA,CAAA,EAAA,IAAA;EAAA,UAAA,CAAA,QAAA,EAAA,MAAA,CAAA,EAAA,OAAA;;2CAnDoC;;ECzE3B,WAAA,CAAA,CAAA,EAAA,MAAA,EAAA;EAIA,iBAAY,CAAA,CAAA,EAAA,MAAA,EAAA;EAIZ,YAAA,CAAA,CAAA,EAAA,MAAiB;EAUjB,iBAAA,CAAA,CAAA,EAAkB,MAAA;6BDyFF;;eAAgB,MAAA,CAcrC;EE9HC,KAAA,CAAA,CAAA,EF8HD,MAAA,CAGJ,GEjIoB;;;;ECAL,QAAA,aAAA;;;;iBFKN,qBAAA,2BAAgD;iBAIhD,YAAA;iBAIA,iBAAA;iBAUA,kBAAA,6CAGL;;;KC1BC,YAAA,GAAe;;;iBCAL,qBAAA,MACf,8BACM,sBACH,gBACP;;;;;AHHH;;;;;;;;;ACIA;AAIA;AAIgB,iBG8BM,QAAA,CH9BW,OAAA,EG+BtB,gBH/BsB,CAAA,EGgC9B,OHhC8B,CGgCtB,MHhCsB,CGgCf,eHhCe,EGgCE,cHhCF,CAAA,CAAA;;;iBIJjB,iBAAA,MAAuB,2BAA2B;;;;;;;iBCLlD,mBAAA,MACT,kCACU;;;cCTJ,oBAAoB;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/core/virtual-fs.ts","../src/core/template-processor.ts","../src/template-handlers/utils.ts","../src/template-handlers/addons.ts","../src/generator.ts","../src/processors/addons-deps.ts","../src/bts-config.ts","../src/templates.generated.ts","../src/utils/add-deps.ts","../src/utils/reproducible-command.ts"],"sourcesContent":[],"mappings":";;;;;;;cAOa,iBAAA;;;;;;EAAA,QAAA,CAAA,QAAA,EAAA,MAAiB,CAAA,EAAA,MAAA,GAAA,SAAA;EA6Ea,MAAA,CAAA,IAAA,EAAA,MAAA,CAAA,EAAA,OAAA;EAkCX,UAAA,CAAA,QAAA,EAAA,MAAA,CAAA,EAAA,OAAA;EAAgB,eAcrC,CAAA,OAAA,EAAA,MAAA,CAAA,EAAA,OAAA;EAAA,KAGJ,CAAA,OAAA,EAAA,MAAA,CAAA,EAAA,IAAA;EAAA,UAAA,CAAA,QAAA,EAAA,MAAA,CAAA,EAAA,OAAA;;2CAnDoC;;ECzE3B,WAAA,CAAA,CAAA,EAAA,MAAA,EAAA;EAIA,iBAAY,CAAA,CAAA,EAAA,MAAA,EAAA;EAIZ,YAAA,CAAA,CAAA,EAAA,MAAiB;EAUjB,iBAAA,CAAA,CAAA,EAAkB,MAAA;6BDyFF;;eAAgB,MAAA,CAcrC;EE9HC,KAAA,CAAA,CAAA,EF8HD,MAAA,CAGJ,GEjIoB;;;;ECAL,QAAA,aAAA;;;;iBFKN,qBAAA,2BAAgD;iBAIhD,YAAA;iBAIA,iBAAA;iBAUA,kBAAA,6CAGL;;;KC1BC,YAAA,GAAe;;;iBCAL,qBAAA,MACf,8BACM,sBACH,gBACP;;;;;AHHH;;;;;;;;;ACIA;AAIA;AAIgB,iBG8BM,QAAA,CH9BW,OAAA,EG+BtB,gBH/BsB,CAAA,EGgC9B,OHhC8B,CGgCtB,MHhCsB,CGgCf,eHhCe,EGgCE,cHhCF,CAAA,CAAA;;;iBIJjB,iBAAA,MAAuB,2BAA2B;;;;;;;iBCLlD,mBAAA,MACT,kCACU;;;cCTJ,oBAAoB;cAmiyBpB,cAAA;;;cCzhyBA;;;ERNA,SAAA,mBAAiB,EAAA,SAAA;EA6Ea,SAAA,eAAA,EAAA,SAAA;EAkCX,SAAA,oBAAA,EAAA,SAAA;EAAgB,SAcrC,6BAAA,EAAA,SAAA;EAAA,SAGJ,mBAAA,EAAA,UAAA;EAAA,SAAA,aAAA,EAAA,SAAA;;;;EC5HS,SAAA,MAAA,EAAA,QAAqB;EAIrB,SAAA,0BAAY,EAAA,QAAA;EAIZ,SAAA,EAAA,EAAA,SAAiB;EAUjB,SAAA,WAAA,EAAkB,SAAA;;;;ECvBtB,SAAA,gBAAY,EAAG,QAAG;;;;ECAR,SAAA,yBAAqB,EAAA,QAAA;EACpC,SAAA,wBAAA,EAAA,QAAA;EACM,SAAA,gCAAA,EAAA,QAAA;EACH,SAAA,oBAAA,EAAA,QAAA;EACP,SAAA,6BAAA,EAAA,QAAA;EAAO,SAAA,QAAA,EAAA,SAAA;;;;ECuCY,SAAA,gBAAQ,EAAA,QAAA;EACnB,SAAA,MAAA,EAAA,SAAA;EACO,SAAA,KAAA,EAAA,SAAA;EAAiB,SAAA,KAAA,EAAA,QAAA;EAAxB,SAAA,QAAA,EAAA,SAAA;EAAR,SAAA,aAAA,EAAA,SAAA;EAAO,SAAA,GAAA,EAAA,SAAA;;;;ECpCM,SAAA,gBAAiB,EAAA,QAAM;;;;ECLvB,SAAA,mBAAmB,EAAA,QAC5B;;;;ECRM,SAAA,gBAiiyBX,EAAA,QAjiyB+B;EAmiyBpB,SAAA,aAAc,EAAA,SAAA;;;;ECzhyBd,SAAA,EAAA,EAAA,QAAA;EA8ID,SAAA,gBAAqB,EAAA,QAAA;;;;EC5IjB,SAAA,kBAAA,EAAA,QAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KD4I/B,qBAAA,gBAAqC;;;iBC5IjC,2BAAA,SAAoC"}
|
package/dist/index.mjs
CHANGED
|
@@ -380,6 +380,28 @@ function updatePackageJsonsWithCatalogs(vfs, packagesInfo, catalog) {
|
|
|
380
380
|
}
|
|
381
381
|
}
|
|
382
382
|
|
|
383
|
+
//#endregion
|
|
384
|
+
//#region src/utils/db-scripts.ts
|
|
385
|
+
function getDbScriptSupport(config) {
|
|
386
|
+
const isD1Alchemy = config.dbSetup === "d1" && config.serverDeploy === "cloudflare";
|
|
387
|
+
if (!(config.backend !== "convex" && config.backend !== "none" && config.database !== "none" && config.orm !== "none" && config.orm !== "mongoose")) return {
|
|
388
|
+
hasDbScripts: false,
|
|
389
|
+
hasDbPush: false,
|
|
390
|
+
hasDbGenerate: false,
|
|
391
|
+
hasDbMigrate: false,
|
|
392
|
+
hasDbStudio: false,
|
|
393
|
+
isD1Alchemy
|
|
394
|
+
};
|
|
395
|
+
return {
|
|
396
|
+
hasDbScripts: true,
|
|
397
|
+
hasDbPush: true,
|
|
398
|
+
hasDbGenerate: true,
|
|
399
|
+
hasDbMigrate: config.orm === "prisma" || config.orm === "drizzle" && !isD1Alchemy,
|
|
400
|
+
hasDbStudio: !isD1Alchemy,
|
|
401
|
+
isD1Alchemy
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
|
|
383
405
|
//#endregion
|
|
384
406
|
//#region src/post-process/package-configs.ts
|
|
385
407
|
/**
|
|
@@ -408,12 +430,13 @@ function updateRootPackageJson(vfs, config) {
|
|
|
408
430
|
else if (pkgJson.workspaces && typeof pkgJson.workspaces === "object" && pkgJson.workspaces.packages) workspaces = pkgJson.workspaces.packages;
|
|
409
431
|
pkgJson.workspaces = workspaces;
|
|
410
432
|
const scripts = pkgJson.scripts;
|
|
411
|
-
const { projectName, packageManager, backend, database, orm, dbSetup,
|
|
433
|
+
const { projectName, packageManager, backend, database, orm, dbSetup, addons } = config;
|
|
412
434
|
const backendPackageName = backend === "convex" ? `@${projectName}/backend` : "server";
|
|
413
435
|
const dbPackageName = `@${projectName}/db`;
|
|
414
436
|
const hasTurborepo = addons.includes("turborepo");
|
|
415
|
-
const
|
|
416
|
-
const
|
|
437
|
+
const dbSupport = getDbScriptSupport(config);
|
|
438
|
+
const needsDbScripts = dbSupport.hasDbScripts;
|
|
439
|
+
const isD1Alchemy = dbSupport.isD1Alchemy;
|
|
417
440
|
const pmConfig = getPackageManagerConfig(packageManager, hasTurborepo);
|
|
418
441
|
scripts.dev = pmConfig.dev;
|
|
419
442
|
scripts.build = pmConfig.build;
|
|
@@ -490,8 +513,8 @@ function updateDbPackageJson(vfs, config) {
|
|
|
490
513
|
pkgJson.name = `@${config.projectName}/db`;
|
|
491
514
|
pkgJson.scripts = pkgJson.scripts || {};
|
|
492
515
|
const scripts = pkgJson.scripts;
|
|
493
|
-
const { database, orm, dbSetup
|
|
494
|
-
const isD1Alchemy =
|
|
516
|
+
const { database, orm, dbSetup } = config;
|
|
517
|
+
const { isD1Alchemy } = getDbScriptSupport(config);
|
|
495
518
|
if (database !== "none") {
|
|
496
519
|
if (database === "sqlite" && dbSetup !== "d1") scripts["db:local"] = "turso dev --db-file local.db";
|
|
497
520
|
if (orm === "prisma") {
|
|
@@ -599,8 +622,8 @@ function renameDevScriptsForAlchemy(vfs, config) {
|
|
|
599
622
|
//#region src/utils/add-deps.ts
|
|
600
623
|
const dependencyVersionMap = {
|
|
601
624
|
typescript: "^5",
|
|
602
|
-
"better-auth": "^1.4.
|
|
603
|
-
"@better-auth/expo": "^1.4.
|
|
625
|
+
"better-auth": "^1.4.18",
|
|
626
|
+
"@better-auth/expo": "^1.4.18",
|
|
604
627
|
"@clerk/nextjs": "^6.31.5",
|
|
605
628
|
"@clerk/clerk-react": "^5.45.0",
|
|
606
629
|
"@clerk/tanstack-react-start": "^0.26.3",
|
|
@@ -2179,7 +2202,7 @@ function processReadme(vfs, config) {
|
|
|
2179
2202
|
vfs.writeFile("README.md", content);
|
|
2180
2203
|
}
|
|
2181
2204
|
function generateReadmeContent(options) {
|
|
2182
|
-
const { projectName, packageManager, database, auth, addons = [], orm = "drizzle", runtime = "bun", frontend = ["tanstack-router"], backend = "hono", api = "trpc", webDeploy, serverDeploy
|
|
2205
|
+
const { projectName, packageManager, database, auth, addons = [], orm = "drizzle", runtime = "bun", frontend = ["tanstack-router"], backend = "hono", api = "trpc", webDeploy, serverDeploy } = options;
|
|
2183
2206
|
const isConvex = backend === "convex";
|
|
2184
2207
|
const hasReactRouter = frontend.includes("react-router");
|
|
2185
2208
|
const hasNative = frontend.some((f) => [
|
|
@@ -2224,7 +2247,7 @@ ${auth === "clerk" ? `
|
|
|
2224
2247
|
|
|
2225
2248
|
- Follow the guide: [Convex + Clerk](https://docs.convex.dev/auth/clerk)
|
|
2226
2249
|
- Set \`CLERK_JWT_ISSUER_DOMAIN\` in Convex Dashboard
|
|
2227
|
-
- Set \`CLERK_PUBLISHABLE_KEY\` in \`apps/*/.env\`` : ""}` : generateDatabaseSetup(
|
|
2250
|
+
- Set \`CLERK_PUBLISHABLE_KEY\` in \`apps/*/.env\`` : ""}` : generateDatabaseSetup(options, packageManagerRunCmd)}
|
|
2228
2251
|
|
|
2229
2252
|
Then, run the development server:
|
|
2230
2253
|
|
|
@@ -2240,12 +2263,12 @@ ${generateGitHooksSection(packageManagerRunCmd, addons)}
|
|
|
2240
2263
|
## Project Structure
|
|
2241
2264
|
|
|
2242
2265
|
\`\`\`
|
|
2243
|
-
${generateProjectStructure(
|
|
2266
|
+
${generateProjectStructure(options)}
|
|
2244
2267
|
\`\`\`
|
|
2245
2268
|
|
|
2246
2269
|
## Available Scripts
|
|
2247
2270
|
|
|
2248
|
-
${generateScriptsList(packageManagerRunCmd,
|
|
2271
|
+
${generateScriptsList(packageManagerRunCmd, options, hasNative)}
|
|
2249
2272
|
`;
|
|
2250
2273
|
}
|
|
2251
2274
|
function generateStackDescription(frontend, backend, api, isConvex) {
|
|
@@ -2281,7 +2304,9 @@ function generateRunningInstructions(frontend, backend, webPort, hasNative, isCo
|
|
|
2281
2304
|
else if (backend !== "none" && !isBackendSelf) instructions.push("The API is running at [http://localhost:3000](http://localhost:3000).");
|
|
2282
2305
|
return instructions.join("\n");
|
|
2283
2306
|
}
|
|
2284
|
-
function generateProjectStructure(
|
|
2307
|
+
function generateProjectStructure(config) {
|
|
2308
|
+
const { projectName, frontend, backend, addons, api, auth, database, orm } = config;
|
|
2309
|
+
const isConvex = backend === "convex";
|
|
2285
2310
|
const structure = [`${projectName}/`, "├── apps/"];
|
|
2286
2311
|
const hasFrontend = frontend.length > 0 && !frontend.includes("none");
|
|
2287
2312
|
const isBackendSelf = backend === "self";
|
|
@@ -2290,6 +2315,7 @@ function generateProjectStructure(projectName, frontend, backend, addons, isConv
|
|
|
2290
2315
|
"native-uniwind",
|
|
2291
2316
|
"native-unistyles"
|
|
2292
2317
|
].includes(f));
|
|
2318
|
+
const hasDbPackage = !isConvex && database !== "none" && orm !== "none";
|
|
2293
2319
|
if (hasFrontend) {
|
|
2294
2320
|
const frontendTypes = {
|
|
2295
2321
|
"tanstack-router": "React + TanStack Router",
|
|
@@ -2321,9 +2347,9 @@ function generateProjectStructure(projectName, frontend, backend, addons, isConv
|
|
|
2321
2347
|
if (auth === "clerk") structure.push("│ │ ├── convex/ # Convex functions and schema", "│ │ └── .env.local # Convex environment variables");
|
|
2322
2348
|
}
|
|
2323
2349
|
if (!isConvex) {
|
|
2324
|
-
structure.push("│ ├── api/ # API layer / business logic");
|
|
2350
|
+
if (api !== "none") structure.push("│ ├── api/ # API layer / business logic");
|
|
2325
2351
|
if (auth !== "none") structure.push("│ ├── auth/ # Authentication configuration & logic");
|
|
2326
|
-
if (
|
|
2352
|
+
if (hasDbPackage) structure.push("│ └── db/ # Database schema & queries");
|
|
2327
2353
|
}
|
|
2328
2354
|
}
|
|
2329
2355
|
return structure.join("\n");
|
|
@@ -2393,11 +2419,18 @@ function generateFeaturesList(database, auth, addons, orm, runtime, frontend, ba
|
|
|
2393
2419
|
for (const addon of addons) if (addonFeatures[addon]) features.push(addonFeatures[addon]);
|
|
2394
2420
|
return features.join("\n");
|
|
2395
2421
|
}
|
|
2396
|
-
function generateDatabaseSetup(
|
|
2422
|
+
function generateDatabaseSetup(config, packageManagerRunCmd) {
|
|
2423
|
+
const { database, orm, dbSetup, backend } = config;
|
|
2397
2424
|
if (database === "none") return "";
|
|
2398
2425
|
const isBackendSelf = backend === "self";
|
|
2399
2426
|
const envPath = isBackendSelf ? "apps/web/.env" : "apps/server/.env";
|
|
2400
|
-
const ormDesc = orm === "
|
|
2427
|
+
const ormDesc = orm === "none" ? "" : ` with ${{
|
|
2428
|
+
drizzle: "Drizzle ORM",
|
|
2429
|
+
prisma: "Prisma",
|
|
2430
|
+
mongoose: "Mongoose",
|
|
2431
|
+
none: "ORM"
|
|
2432
|
+
}[orm] || orm}`;
|
|
2433
|
+
const dbSupport = getDbScriptSupport(config);
|
|
2401
2434
|
let setup = "## Database Setup\n\n";
|
|
2402
2435
|
const dbDescriptions = {
|
|
2403
2436
|
sqlite: `This project uses SQLite${ormDesc}.
|
|
@@ -2422,7 +2455,7 @@ ${packageManagerRunCmd} db:local
|
|
|
2422
2455
|
2. Update your \`${envPath}\` file with your MongoDB connection URI.`
|
|
2423
2456
|
};
|
|
2424
2457
|
setup += dbDescriptions[database] || "";
|
|
2425
|
-
setup += `
|
|
2458
|
+
if (dbSupport.hasDbPush) setup += `
|
|
2426
2459
|
|
|
2427
2460
|
3. Apply the schema to your database:
|
|
2428
2461
|
\`\`\`bash
|
|
@@ -2431,9 +2464,11 @@ ${packageManagerRunCmd} db:push
|
|
|
2431
2464
|
`;
|
|
2432
2465
|
return setup;
|
|
2433
2466
|
}
|
|
2434
|
-
function generateScriptsList(packageManagerRunCmd,
|
|
2467
|
+
function generateScriptsList(packageManagerRunCmd, config, hasNative) {
|
|
2468
|
+
const { database, addons, backend, dbSetup } = config;
|
|
2435
2469
|
const isConvex = backend === "convex";
|
|
2436
2470
|
const isBackendSelf = backend === "self";
|
|
2471
|
+
const dbSupport = getDbScriptSupport(config);
|
|
2437
2472
|
let scripts = `- \`${packageManagerRunCmd} dev\`: Start all applications in development mode
|
|
2438
2473
|
- \`${packageManagerRunCmd} build\`: Build all applications`;
|
|
2439
2474
|
if (!isBackendSelf) scripts += `\n- \`${packageManagerRunCmd} dev:web\`: Start only the web application`;
|
|
@@ -2441,11 +2476,13 @@ function generateScriptsList(packageManagerRunCmd, database, orm, hasNative, add
|
|
|
2441
2476
|
else if (backend !== "none" && !isBackendSelf) scripts += `\n- \`${packageManagerRunCmd} dev:server\`: Start only the server`;
|
|
2442
2477
|
scripts += `\n- \`${packageManagerRunCmd} check-types\`: Check TypeScript types across all apps`;
|
|
2443
2478
|
if (hasNative) scripts += `\n- \`${packageManagerRunCmd} dev:native\`: Start the React Native/Expo development server`;
|
|
2444
|
-
if (
|
|
2445
|
-
scripts += `\n- \`${packageManagerRunCmd} db:push\`: Push schema changes to database
|
|
2446
|
-
- \`${packageManagerRunCmd} db:
|
|
2447
|
-
if (
|
|
2479
|
+
if (dbSupport.hasDbScripts) {
|
|
2480
|
+
scripts += `\n- \`${packageManagerRunCmd} db:push\`: Push schema changes to database`;
|
|
2481
|
+
if (dbSupport.hasDbGenerate) scripts += `\n- \`${packageManagerRunCmd} db:generate\`: Generate database client/types`;
|
|
2482
|
+
if (dbSupport.hasDbMigrate) scripts += `\n- \`${packageManagerRunCmd} db:migrate\`: Run database migrations`;
|
|
2483
|
+
if (dbSupport.hasDbStudio) scripts += `\n- \`${packageManagerRunCmd} db:studio\`: Open database studio UI`;
|
|
2448
2484
|
}
|
|
2485
|
+
if (database === "sqlite" && dbSetup !== "d1" && dbSupport.hasDbScripts) scripts += `\n- \`${packageManagerRunCmd} db:local\`: Start the local SQLite database`;
|
|
2449
2486
|
if (addons.includes("biome")) scripts += `\n- \`${packageManagerRunCmd} check\`: Run Biome formatting and linting`;
|
|
2450
2487
|
if (addons.includes("oxlint")) scripts += `\n- \`${packageManagerRunCmd} check\`: Run Oxlint and Oxfmt`;
|
|
2451
2488
|
if (addons.includes("pwa")) scripts += `\n- \`cd apps/web && ${packageManagerRunCmd} generate-pwa-assets\`: Generate PWA assets`;
|
|
@@ -2522,11 +2559,12 @@ function processTurboConfig(vfs, config) {
|
|
|
2522
2559
|
vfs.writeFile("turbo.json", JSON.stringify(turboConfig, null, " "));
|
|
2523
2560
|
}
|
|
2524
2561
|
function generateTurboConfig(config) {
|
|
2525
|
-
const { backend, database,
|
|
2562
|
+
const { backend, database, dbSetup, webDeploy, serverDeploy, frontend } = config;
|
|
2526
2563
|
const isConvex = backend === "convex";
|
|
2527
|
-
const
|
|
2564
|
+
const dbSupport = getDbScriptSupport(config);
|
|
2565
|
+
const hasDatabase = dbSupport.hasDbScripts;
|
|
2528
2566
|
const isDocker = dbSetup === "docker";
|
|
2529
|
-
const isSqliteLocal = database === "sqlite" && dbSetup !== "d1";
|
|
2567
|
+
const isSqliteLocal = database === "sqlite" && dbSetup !== "d1" && hasDatabase;
|
|
2530
2568
|
const hasCloudflare = webDeploy === "cloudflare" || serverDeploy === "cloudflare";
|
|
2531
2569
|
return {
|
|
2532
2570
|
$schema: "https://turbo.build/schema.json",
|
|
@@ -2534,7 +2572,7 @@ function generateTurboConfig(config) {
|
|
|
2534
2572
|
tasks: {
|
|
2535
2573
|
...getBaseTasks(frontend),
|
|
2536
2574
|
...isConvex ? getConvexTasks() : {},
|
|
2537
|
-
...!isConvex && hasDatabase ? getDatabaseTasks() : {},
|
|
2575
|
+
...!isConvex && hasDatabase ? getDatabaseTasks(dbSupport) : {},
|
|
2538
2576
|
...isDocker ? getDockerTasks() : {},
|
|
2539
2577
|
...isSqliteLocal ? getSqliteLocalTask() : {},
|
|
2540
2578
|
...hasCloudflare ? getDeployTasks() : {}
|
|
@@ -2567,19 +2605,19 @@ function getConvexTasks() {
|
|
|
2567
2605
|
persistent: true
|
|
2568
2606
|
} };
|
|
2569
2607
|
}
|
|
2570
|
-
function getDatabaseTasks() {
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
"db:generate": { cache: false }
|
|
2608
|
+
function getDatabaseTasks(dbSupport) {
|
|
2609
|
+
const tasks = {};
|
|
2610
|
+
if (dbSupport.hasDbPush) tasks["db:push"] = { cache: false };
|
|
2611
|
+
if (dbSupport.hasDbGenerate) tasks["db:generate"] = { cache: false };
|
|
2612
|
+
if (dbSupport.hasDbMigrate) tasks["db:migrate"] = {
|
|
2613
|
+
cache: false,
|
|
2614
|
+
persistent: true
|
|
2615
|
+
};
|
|
2616
|
+
if (dbSupport.hasDbStudio) tasks["db:studio"] = {
|
|
2617
|
+
cache: false,
|
|
2618
|
+
persistent: true
|
|
2582
2619
|
};
|
|
2620
|
+
return tasks;
|
|
2583
2621
|
}
|
|
2584
2622
|
function getDockerTasks() {
|
|
2585
2623
|
return {
|
|
@@ -3167,10 +3205,21 @@ async function processDeployTemplates(vfs, templates, config) {
|
|
|
3167
3205
|
|
|
3168
3206
|
//#endregion
|
|
3169
3207
|
//#region src/utils/reproducible-command.ts
|
|
3208
|
+
function normalizeMultiValues(values) {
|
|
3209
|
+
if (!values || values.length === 0) return [];
|
|
3210
|
+
const filtered = values.filter((value) => value !== "none");
|
|
3211
|
+
return Array.from(new Set(filtered));
|
|
3212
|
+
}
|
|
3213
|
+
function formatMultiFlag(flag, values) {
|
|
3214
|
+
if (values.length === 0) return `${flag} none`;
|
|
3215
|
+
return `${flag} ${values.join(" ")}`;
|
|
3216
|
+
}
|
|
3170
3217
|
function generateReproducibleCommand(config) {
|
|
3171
3218
|
const flags = [];
|
|
3172
|
-
|
|
3173
|
-
|
|
3219
|
+
const frontend = normalizeMultiValues(config.frontend);
|
|
3220
|
+
const addons = normalizeMultiValues(config.addons);
|
|
3221
|
+
const examples = normalizeMultiValues(config.examples);
|
|
3222
|
+
flags.push(formatMultiFlag("--frontend", frontend));
|
|
3174
3223
|
flags.push(`--backend ${config.backend}`);
|
|
3175
3224
|
flags.push(`--runtime ${config.runtime}`);
|
|
3176
3225
|
flags.push(`--database ${config.database}`);
|
|
@@ -3178,10 +3227,8 @@ function generateReproducibleCommand(config) {
|
|
|
3178
3227
|
flags.push(`--api ${config.api}`);
|
|
3179
3228
|
flags.push(`--auth ${config.auth}`);
|
|
3180
3229
|
flags.push(`--payments ${config.payments}`);
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
if (config.examples && config.examples.length > 0) flags.push(`--examples ${config.examples.join(" ")}`);
|
|
3184
|
-
else flags.push("--examples none");
|
|
3230
|
+
flags.push(formatMultiFlag("--addons", addons));
|
|
3231
|
+
flags.push(formatMultiFlag("--examples", examples));
|
|
3185
3232
|
flags.push(`--db-setup ${config.dbSetup}`);
|
|
3186
3233
|
flags.push(`--web-deploy ${config.webDeploy}`);
|
|
3187
3234
|
flags.push(`--server-deploy ${config.serverDeploy}`);
|
|
@@ -3918,6 +3965,7 @@ import type { AppRouterClient } from "@{{projectName}}/api/routers/index";
|
|
|
3918
3965
|
import { env } from "@{{projectName}}/env/native";
|
|
3919
3966
|
{{#if (eq auth "better-auth")}}
|
|
3920
3967
|
import { authClient } from "@/lib/auth-client";
|
|
3968
|
+
import { Platform } from "react-native";
|
|
3921
3969
|
{{/if}}
|
|
3922
3970
|
|
|
3923
3971
|
export const queryClient = new QueryClient({
|
|
@@ -3939,7 +3987,19 @@ export const link = new RPCLink({
|
|
|
3939
3987
|
url: \`\${env.EXPO_PUBLIC_SERVER_URL}/rpc\`,
|
|
3940
3988
|
{{/if}}
|
|
3941
3989
|
{{#if (eq auth "better-auth")}}
|
|
3990
|
+
fetch:
|
|
3991
|
+
Platform.OS !== "web"
|
|
3992
|
+
? undefined
|
|
3993
|
+
: function (url, options) {
|
|
3994
|
+
return fetch(url, {
|
|
3995
|
+
...options,
|
|
3996
|
+
credentials: "include",
|
|
3997
|
+
});
|
|
3998
|
+
},
|
|
3942
3999
|
headers() {
|
|
4000
|
+
if (Platform.OS === "web") {
|
|
4001
|
+
return {};
|
|
4002
|
+
}
|
|
3943
4003
|
const headers = new Map<string, string>();
|
|
3944
4004
|
const cookies = authClient.getCookie();
|
|
3945
4005
|
if (cookies) {
|
|
@@ -4602,6 +4662,7 @@ export const Route = createFileRoute('/api/trpc/$')({
|
|
|
4602
4662
|
`],
|
|
4603
4663
|
["api/trpc/native/utils/trpc.ts.hbs", `{{#if (eq auth "better-auth")}}
|
|
4604
4664
|
import { authClient } from "@/lib/auth-client";
|
|
4665
|
+
import { Platform } from "react-native";
|
|
4605
4666
|
{{/if}}
|
|
4606
4667
|
import { QueryClient } from "@tanstack/react-query";
|
|
4607
4668
|
import { createTRPCClient, httpBatchLink } from "@trpc/client";
|
|
@@ -4620,7 +4681,19 @@ const trpcClient = createTRPCClient<AppRouter>({
|
|
|
4620
4681
|
url: \`\${env.EXPO_PUBLIC_SERVER_URL}/trpc\`,
|
|
4621
4682
|
{{/if}}
|
|
4622
4683
|
{{#if (eq auth "better-auth")}}
|
|
4684
|
+
fetch:
|
|
4685
|
+
Platform.OS !== "web"
|
|
4686
|
+
? undefined
|
|
4687
|
+
: function (url, options) {
|
|
4688
|
+
return fetch(url, {
|
|
4689
|
+
...options,
|
|
4690
|
+
credentials: "include",
|
|
4691
|
+
});
|
|
4692
|
+
},
|
|
4623
4693
|
headers() {
|
|
4694
|
+
if (Platform.OS === "web") {
|
|
4695
|
+
return {};
|
|
4696
|
+
}
|
|
4624
4697
|
const headers = new Map<string, string>();
|
|
4625
4698
|
const cookies = authClient.getCookie();
|
|
4626
4699
|
if (cookies) {
|
|
@@ -5064,11 +5137,11 @@ function createAuth(ctx: GenericCtx<DataModel>) {
|
|
|
5064
5137
|
return betterAuth({
|
|
5065
5138
|
{{#if (and (or (includes frontend "native-bare") (includes frontend "native-uniwind") (includes frontend "native-unistyles")) (or (includes frontend "tanstack-start") (includes frontend "next")))}}
|
|
5066
5139
|
baseURL: siteUrl,
|
|
5067
|
-
trustedOrigins: [siteUrl, nativeAppUrl],
|
|
5140
|
+
trustedOrigins: [siteUrl, nativeAppUrl, ...(process.env.NODE_ENV === "development" ? ["exp://", "exp://**", "exp://192.168.*.*:*/**"] : [])],
|
|
5068
5141
|
{{else if (and (or (includes frontend "native-bare") (includes frontend "native-uniwind") (includes frontend "native-unistyles")) (or (includes frontend "tanstack-router") (includes frontend "react-router") (includes frontend "nuxt") (includes frontend "svelte") (includes frontend "solid")))}}
|
|
5069
|
-
trustedOrigins: [siteUrl, nativeAppUrl],
|
|
5142
|
+
trustedOrigins: [siteUrl, nativeAppUrl, ...(process.env.NODE_ENV === "development" ? ["exp://", "exp://**", "exp://192.168.*.*:*/**"] : [])],
|
|
5070
5143
|
{{else if (or (includes frontend "native-bare") (includes frontend "native-uniwind") (includes frontend "native-unistyles"))}}
|
|
5071
|
-
trustedOrigins: [nativeAppUrl],
|
|
5144
|
+
trustedOrigins: [nativeAppUrl, ...(process.env.NODE_ENV === "development" ? ["exp://", "exp://**", "exp://192.168.*.*:*/**"] : [])],
|
|
5072
5145
|
{{else if (or (includes frontend "tanstack-start") (includes frontend "next"))}}
|
|
5073
5146
|
baseURL: siteUrl,
|
|
5074
5147
|
trustedOrigins: [siteUrl],
|
|
@@ -8515,7 +8588,15 @@ export const auth = betterAuth({
|
|
|
8515
8588
|
trustedOrigins: [
|
|
8516
8589
|
env.CORS_ORIGIN,
|
|
8517
8590
|
{{#if (or (includes frontend "native-bare") (includes frontend "native-uniwind") (includes frontend "native-unistyles"))}}
|
|
8518
|
-
"mybettertapp://",
|
|
8591
|
+
"mybettertapp://",
|
|
8592
|
+
...(env.NODE_ENV === "development"
|
|
8593
|
+
? [
|
|
8594
|
+
"exp://",
|
|
8595
|
+
"exp://**",
|
|
8596
|
+
"exp://192.168.*.*:*/**",
|
|
8597
|
+
"http://localhost:8081",
|
|
8598
|
+
]
|
|
8599
|
+
: []),
|
|
8519
8600
|
{{/if}}
|
|
8520
8601
|
],
|
|
8521
8602
|
emailAndPassword: {
|
|
@@ -8578,7 +8659,15 @@ export const auth = betterAuth({
|
|
|
8578
8659
|
trustedOrigins: [
|
|
8579
8660
|
env.CORS_ORIGIN,
|
|
8580
8661
|
{{#if (or (includes frontend "native-bare") (includes frontend "native-uniwind") (includes frontend "native-unistyles"))}}
|
|
8581
|
-
"mybettertapp://",
|
|
8662
|
+
"mybettertapp://",
|
|
8663
|
+
...(env.NODE_ENV === "development"
|
|
8664
|
+
? [
|
|
8665
|
+
"exp://",
|
|
8666
|
+
"exp://**",
|
|
8667
|
+
"exp://192.168.*.*:*/**",
|
|
8668
|
+
"http://localhost:8081",
|
|
8669
|
+
]
|
|
8670
|
+
: []),
|
|
8582
8671
|
{{/if}}
|
|
8583
8672
|
],
|
|
8584
8673
|
emailAndPassword: {
|
|
@@ -8640,7 +8729,15 @@ export const auth = betterAuth({
|
|
|
8640
8729
|
trustedOrigins: [
|
|
8641
8730
|
env.CORS_ORIGIN,
|
|
8642
8731
|
{{#if (or (includes frontend "native-bare") (includes frontend "native-uniwind") (includes frontend "native-unistyles"))}}
|
|
8643
|
-
"mybettertapp://",
|
|
8732
|
+
"mybettertapp://",
|
|
8733
|
+
...(env.NODE_ENV === "development"
|
|
8734
|
+
? [
|
|
8735
|
+
"exp://",
|
|
8736
|
+
"exp://**",
|
|
8737
|
+
"exp://192.168.*.*:*/**",
|
|
8738
|
+
"http://localhost:8081",
|
|
8739
|
+
]
|
|
8740
|
+
: []),
|
|
8644
8741
|
{{/if}}
|
|
8645
8742
|
],
|
|
8646
8743
|
emailAndPassword: {
|
|
@@ -8709,7 +8806,15 @@ export const auth = betterAuth({
|
|
|
8709
8806
|
trustedOrigins: [
|
|
8710
8807
|
env.CORS_ORIGIN,
|
|
8711
8808
|
{{#if (or (includes frontend "native-bare") (includes frontend "native-uniwind") (includes frontend "native-unistyles"))}}
|
|
8712
|
-
"mybettertapp://",
|
|
8809
|
+
"mybettertapp://",
|
|
8810
|
+
...(env.NODE_ENV === "development"
|
|
8811
|
+
? [
|
|
8812
|
+
"exp://",
|
|
8813
|
+
"exp://**",
|
|
8814
|
+
"exp://192.168.*.*:*/**",
|
|
8815
|
+
"http://localhost:8081",
|
|
8816
|
+
]
|
|
8817
|
+
: []),
|
|
8713
8818
|
{{/if}}
|
|
8714
8819
|
],
|
|
8715
8820
|
emailAndPassword: {
|
|
@@ -8763,7 +8868,15 @@ export const auth = betterAuth({
|
|
|
8763
8868
|
trustedOrigins: [
|
|
8764
8869
|
env.CORS_ORIGIN,
|
|
8765
8870
|
{{#if (or (includes frontend "native-bare") (includes frontend "native-uniwind") (includes frontend "native-unistyles"))}}
|
|
8766
|
-
"mybettertapp://",
|
|
8871
|
+
"mybettertapp://",
|
|
8872
|
+
...(env.NODE_ENV === "development"
|
|
8873
|
+
? [
|
|
8874
|
+
"exp://",
|
|
8875
|
+
"exp://**",
|
|
8876
|
+
"exp://192.168.*.*:*/**",
|
|
8877
|
+
"http://localhost:8081",
|
|
8878
|
+
]
|
|
8879
|
+
: []),
|
|
8767
8880
|
{{/if}}
|
|
8768
8881
|
],
|
|
8769
8882
|
emailAndPassword: {
|
|
@@ -23529,19 +23642,21 @@ module.exports = config;
|
|
|
23529
23642
|
"web": "expo start --web"
|
|
23530
23643
|
},
|
|
23531
23644
|
"dependencies": {
|
|
23532
|
-
"@expo/vector-icons": "^15.0.
|
|
23533
|
-
"@react-navigation/bottom-tabs": "^7.
|
|
23534
|
-
"@react-navigation/drawer": "^7.
|
|
23535
|
-
"@react-navigation/native": "^7.1.
|
|
23645
|
+
"@expo/vector-icons": "^15.0.3",
|
|
23646
|
+
"@react-navigation/bottom-tabs": "^7.4.0",
|
|
23647
|
+
"@react-navigation/drawer": "^7.5.0",
|
|
23648
|
+
"@react-navigation/native": "^7.1.8",
|
|
23536
23649
|
{{#if (includes examples "ai")}}
|
|
23537
23650
|
"@stardazed/streams-text-encoding": "^1.0.2",
|
|
23538
23651
|
"@ungap/structured-clone": "^1.3.0",
|
|
23539
23652
|
{{/if}}
|
|
23540
23653
|
"@tanstack/react-form": "^1.0.5",
|
|
23541
|
-
"expo": "
|
|
23654
|
+
"babel-preset-expo": "~54.0.10",
|
|
23655
|
+
"expo": "~54.0.33",
|
|
23542
23656
|
"expo-constants": "~18.0.8",
|
|
23543
23657
|
"expo-crypto": "~15.0.6",
|
|
23544
23658
|
"expo-linking": "~8.0.7",
|
|
23659
|
+
"expo-network": "~8.0.8",
|
|
23545
23660
|
"expo-router": "~6.0.0",
|
|
23546
23661
|
"expo-secure-store": "~15.0.6",
|
|
23547
23662
|
"expo-splash-screen": "~31.0.8",
|
|
@@ -23551,15 +23666,15 @@ module.exports = config;
|
|
|
23551
23666
|
"expo-web-browser": "~15.0.6",
|
|
23552
23667
|
"react": "19.1.0",
|
|
23553
23668
|
"react-dom": "19.1.0",
|
|
23554
|
-
"react-native": "0.81.
|
|
23669
|
+
"react-native": "0.81.5",
|
|
23555
23670
|
"react-native-edge-to-edge": "^1.7.0",
|
|
23556
23671
|
"react-native-gesture-handler": "~2.28.0",
|
|
23557
|
-
"react-native-nitro-modules": "^0.
|
|
23672
|
+
"react-native-nitro-modules": "^0.33.2",
|
|
23558
23673
|
"react-native-reanimated": "~4.1.0",
|
|
23559
23674
|
"react-native-safe-area-context": "~5.6.0",
|
|
23560
23675
|
"react-native-screens": "~4.16.0",
|
|
23561
|
-
"react-native-unistyles": "^3.0.
|
|
23562
|
-
"react-native-web": "^0.21.
|
|
23676
|
+
"react-native-unistyles": "^3.0.22",
|
|
23677
|
+
"react-native-web": "^0.21.2",
|
|
23563
23678
|
"react-native-worklets": "^0.5.1"
|
|
23564
23679
|
},
|
|
23565
23680
|
"devDependencies": {
|