create-better-t-stack 2.45.3 → 2.45.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/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { createBtsCli } from "./src-BMqgVYFI.js";
2
+ import { createBtsCli } from "./src-Cun9EO6e.js";
3
3
 
4
4
  //#region src/cli.ts
5
5
  createBtsCli().run();
package/dist/index.d.ts CHANGED
@@ -141,6 +141,7 @@ type CreateInput = {
141
141
  directoryConflict?: DirectoryConflict;
142
142
  renderTitle?: boolean;
143
143
  disableAnalytics?: boolean;
144
+ manualDb?: boolean;
144
145
  };
145
146
  type AddInput = {
146
147
  addons?: Addons[];
@@ -228,6 +229,7 @@ declare const router: trpcServer.TRPCBuiltRouter<{
228
229
  directoryConflict?: "error" | "merge" | "overwrite" | "increment" | undefined;
229
230
  renderTitle?: boolean | undefined;
230
231
  disableAnalytics?: boolean | undefined;
232
+ manualDb?: boolean | undefined;
231
233
  }];
232
234
  output: {
233
235
  success: boolean;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import { builder, createBtsCli, docs, init, router, sponsors } from "./src-BMqgVYFI.js";
2
+ import { builder, createBtsCli, docs, init, router, sponsors } from "./src-Cun9EO6e.js";
3
3
 
4
4
  export { builder, createBtsCli, docs, init, router, sponsors };
@@ -1736,7 +1736,7 @@ function validateFrontendConstraints(config, providedFlags) {
1736
1736
  }
1737
1737
  function validateApiConstraints(config, options) {
1738
1738
  if (config.api === "none") {
1739
- if (options.examples && !(options.examples.length === 1 && options.examples[0] === "none") && options.backend !== "convex") exitWithError("Cannot use '--examples' when '--api' is set to 'none'. Please remove the --examples flag or choose an API type.");
1739
+ if (options.examples && !(options.examples.length === 1 && options.examples[0] === "none") && options.backend !== "convex" && options.backend !== "none") exitWithError("Cannot use '--examples' when '--api' is set to 'none'. Please remove the --examples flag or choose an API type.");
1740
1740
  }
1741
1741
  }
1742
1742
  function validateFullConfig(config, providedFlags, options) {
@@ -2521,17 +2521,11 @@ async function installDependencies({ projectDir, packageManager }) {
2521
2521
 
2522
2522
  //#endregion
2523
2523
  //#region src/utils/biome-formatter.ts
2524
- let biome = null;
2525
- let projectKey = null;
2526
- async function initializeBiome() {
2527
- if (biome && projectKey !== null) return {
2528
- biome,
2529
- projectKey
2530
- };
2524
+ function initializeBiome() {
2531
2525
  try {
2532
- biome = new Biome();
2526
+ const biome = new Biome();
2533
2527
  const result = biome.openProject("./");
2534
- projectKey = result.projectKey;
2528
+ const projectKey = result.projectKey;
2535
2529
  biome.applyConfiguration(projectKey, {
2536
2530
  formatter: {
2537
2531
  enabled: true,
@@ -2575,13 +2569,13 @@ function shouldSkipFile(filePath) {
2575
2569
  ];
2576
2570
  return skipPatterns.some((pattern) => basename.includes(pattern));
2577
2571
  }
2578
- async function formatFileWithBiome(filePath, content) {
2572
+ function formatFileWithBiome(filePath, content) {
2579
2573
  if (!isSupportedFile(filePath) || shouldSkipFile(filePath)) return null;
2580
2574
  try {
2581
- const biomeResult = await initializeBiome();
2575
+ const biomeResult = initializeBiome();
2582
2576
  if (!biomeResult) return null;
2583
- const { biome: biomeInstance, projectKey: key } = biomeResult;
2584
- const result = biomeInstance.formatContent(key, content, { filePath: path.basename(filePath) });
2577
+ const { biome, projectKey } = biomeResult;
2578
+ const result = biome.formatContent(projectKey, content, { filePath: path.basename(filePath) });
2585
2579
  if (result.diagnostics && result.diagnostics.length > 0) consola.debug(`Biome formatting diagnostics for ${filePath}:`, result.diagnostics);
2586
2580
  return result.content;
2587
2581
  } catch (_error) {
@@ -4595,13 +4589,20 @@ ${pc.green("MongoDB Atlas Manual Setup Instructions:")}
4595
4589
  ${pc.dim("DATABASE_URL=\"your_connection_string\"")}
4596
4590
  `);
4597
4591
  }
4598
- async function setupMongoDBAtlas(config) {
4592
+ async function setupMongoDBAtlas(config, cliInput) {
4599
4593
  const { projectDir } = config;
4594
+ const manualDb = cliInput?.manualDb ?? false;
4600
4595
  const mainSpinner = spinner();
4601
4596
  mainSpinner.start("Setting up MongoDB Atlas...");
4602
4597
  const serverDir = path.join(projectDir, "apps/server");
4603
4598
  try {
4604
4599
  await fs.ensureDir(serverDir);
4600
+ if (manualDb) {
4601
+ mainSpinner.stop("MongoDB Atlas manual setup selected");
4602
+ await writeEnvFile$3(projectDir);
4603
+ displayManualSetupInstructions$3();
4604
+ return;
4605
+ }
4605
4606
  const mode = await select({
4606
4607
  message: "MongoDB Atlas setup: choose mode",
4607
4608
  options: [{
@@ -4751,9 +4752,15 @@ function displayManualSetupInstructions$2() {
4751
4752
 
4752
4753
  DATABASE_URL="your_connection_string"`);
4753
4754
  }
4754
- async function setupNeonPostgres(config) {
4755
+ async function setupNeonPostgres(config, cliInput) {
4755
4756
  const { packageManager, projectDir } = config;
4757
+ const manualDb = cliInput?.manualDb ?? false;
4756
4758
  try {
4759
+ if (manualDb) {
4760
+ await writeEnvFile$2(projectDir);
4761
+ displayManualSetupInstructions$2();
4762
+ return;
4763
+ }
4757
4764
  const mode = await select({
4758
4765
  message: "Neon setup: choose mode",
4759
4766
  options: [{
@@ -5014,11 +5021,17 @@ async function addPrismaAccelerateExtension(serverDir) {
5014
5021
  return false;
5015
5022
  }
5016
5023
  }
5017
- async function setupPrismaPostgres(config) {
5024
+ async function setupPrismaPostgres(config, cliInput) {
5018
5025
  const { packageManager, projectDir, orm } = config;
5026
+ const manualDb = cliInput?.manualDb ?? false;
5019
5027
  const serverDir = path.join(projectDir, "apps/server");
5020
5028
  try {
5021
5029
  await fs.ensureDir(serverDir);
5030
+ if (manualDb) {
5031
+ await writeEnvFile$1(projectDir);
5032
+ displayManualSetupInstructions$1();
5033
+ return;
5034
+ }
5022
5035
  const mode = await select({
5023
5036
  message: "Prisma Postgres setup: choose mode",
5024
5037
  options: [{
@@ -5171,11 +5184,17 @@ ${pc.dim(output)}` : ""}
5171
5184
  6. Add the DB URL to the .env file in \`apps/server/.env\` as \`DATABASE_URL\`:
5172
5185
  ${pc.gray("DATABASE_URL=\"your_supabase_db_url\"")}`);
5173
5186
  }
5174
- async function setupSupabase(config) {
5187
+ async function setupSupabase(config, cliInput) {
5175
5188
  const { projectDir, packageManager } = config;
5189
+ const manualDb = cliInput?.manualDb ?? false;
5176
5190
  const serverDir = path.join(projectDir, "apps", "server");
5177
5191
  try {
5178
5192
  await fs.ensureDir(serverDir);
5193
+ if (manualDb) {
5194
+ displayManualSupabaseInstructions();
5195
+ await writeSupabaseEnvFile(projectDir, "");
5196
+ return;
5197
+ }
5179
5198
  const mode = await select({
5180
5199
  message: "Supabase setup: choose mode",
5181
5200
  options: [{
@@ -5361,10 +5380,16 @@ function displayManualSetupInstructions() {
5361
5380
  DATABASE_URL=your_database_url
5362
5381
  DATABASE_AUTH_TOKEN=your_auth_token`);
5363
5382
  }
5364
- async function setupTurso(config) {
5383
+ async function setupTurso(config, cliInput) {
5365
5384
  const { orm, projectDir } = config;
5385
+ const manualDb = cliInput?.manualDb ?? false;
5366
5386
  const setupSpinner = spinner();
5367
5387
  try {
5388
+ if (manualDb) {
5389
+ await writeEnvFile(projectDir);
5390
+ displayManualSetupInstructions();
5391
+ return;
5392
+ }
5368
5393
  const mode = await select({
5369
5394
  message: "Turso setup: choose mode",
5370
5395
  options: [{
@@ -5448,7 +5473,7 @@ async function setupTurso(config) {
5448
5473
 
5449
5474
  //#endregion
5450
5475
  //#region src/helpers/core/db-setup.ts
5451
- async function setupDatabase(config) {
5476
+ async function setupDatabase(config, cliInput) {
5452
5477
  const { database, orm, dbSetup, backend, projectDir } = config;
5453
5478
  if (backend === "convex" || database === "none") {
5454
5479
  if (backend !== "convex") {
@@ -5522,16 +5547,16 @@ async function setupDatabase(config) {
5522
5547
  projectDir: serverDir
5523
5548
  });
5524
5549
  if (dbSetup === "docker") await setupDockerCompose(config);
5525
- else if (database === "sqlite" && dbSetup === "turso") await setupTurso(config);
5550
+ else if (database === "sqlite" && dbSetup === "turso") await setupTurso(config, cliInput);
5526
5551
  else if (database === "sqlite" && dbSetup === "d1") await setupCloudflareD1(config);
5527
5552
  else if (database === "postgres") {
5528
- if (dbSetup === "prisma-postgres") await setupPrismaPostgres(config);
5529
- else if (dbSetup === "neon") await setupNeonPostgres(config);
5553
+ if (dbSetup === "prisma-postgres") await setupPrismaPostgres(config, cliInput);
5554
+ else if (dbSetup === "neon") await setupNeonPostgres(config, cliInput);
5530
5555
  else if (dbSetup === "planetscale") await setupPlanetScale(config);
5531
- else if (dbSetup === "supabase") await setupSupabase(config);
5556
+ else if (dbSetup === "supabase") await setupSupabase(config, cliInput);
5532
5557
  } else if (database === "mysql") {
5533
5558
  if (dbSetup === "planetscale") await setupPlanetScale(config);
5534
- } else if (database === "mongodb" && dbSetup === "mongodb-atlas") await setupMongoDBAtlas(config);
5559
+ } else if (database === "mongodb" && dbSetup === "mongodb-atlas") await setupMongoDBAtlas(config, cliInput);
5535
5560
  } catch (error) {
5536
5561
  s.stop(pc.red("Failed to set up database"));
5537
5562
  if (error instanceof Error) consola.error(pc.red(error.message));
@@ -6317,7 +6342,7 @@ async function updateConvexPackageJson(projectDir, options) {
6317
6342
 
6318
6343
  //#endregion
6319
6344
  //#region src/helpers/core/create-project.ts
6320
- async function createProject(options) {
6345
+ async function createProject(options, cliInput) {
6321
6346
  const projectDir = options.projectDir;
6322
6347
  const isConvex = options.backend === "convex";
6323
6348
  try {
@@ -6336,7 +6361,7 @@ async function createProject(options) {
6336
6361
  await setupApi(options);
6337
6362
  if (!isConvex) {
6338
6363
  await setupBackendDependencies(options);
6339
- await setupDatabase(options);
6364
+ await setupDatabase(options, cliInput);
6340
6365
  await setupRuntime(options);
6341
6366
  if (options.examples.length > 0 && options.examples[0] !== "none") await setupExamples(options);
6342
6367
  }
@@ -6466,7 +6491,7 @@ async function createProjectHandler(input) {
6466
6491
  }
6467
6492
  config = await gatherConfig(flagConfig, finalBaseName, finalResolvedPath, finalPathInput);
6468
6493
  }
6469
- await createProject(config);
6494
+ await createProject(config, { manualDb: input.manualDb });
6470
6495
  const reproducibleCommand = generateReproducibleCommand(config);
6471
6496
  log.success(pc.blue(`You can reproduce this setup with the following command:\n${reproducibleCommand}`));
6472
6497
  await trackProjectCreation(config, input.disableAnalytics);
@@ -6680,7 +6705,8 @@ const router = t.router({
6680
6705
  serverDeploy: ServerDeploySchema.optional(),
6681
6706
  directoryConflict: DirectoryConflictSchema.optional(),
6682
6707
  renderTitle: z.boolean().optional(),
6683
- disableAnalytics: z.boolean().optional().default(false).describe("Disable analytics")
6708
+ disableAnalytics: z.boolean().optional().default(false).describe("Disable analytics"),
6709
+ manualDb: z.boolean().optional().default(false).describe("Skip automatic/manual database setup prompt and use manual setup")
6684
6710
  })])).mutation(async ({ input }) => {
6685
6711
  const [projectName, options] = input;
6686
6712
  const combinedInput = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-better-t-stack",
3
- "version": "2.45.3",
3
+ "version": "2.45.4",
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",
@@ -52,9 +52,8 @@
52
52
  "dev": "tsdown --watch",
53
53
  "check-types": "tsc --noEmit",
54
54
  "check": "biome check --write .",
55
- "test": "bun run build && vitest run",
55
+ "test": "bun run build && vitest run; rm -rf .smoke || true",
56
56
  "test:ui": "bun run build && vitest --ui",
57
- "test:with-build": "bun run build && WITH_BUILD=1 vitest --ui",
58
57
  "prepublishOnly": "npm run build"
59
58
  },
60
59
  "exports": {
@@ -1,2 +1,2 @@
1
1
  [install]
2
- # linker = "isolated"
2
+ linker = "isolated"