create-better-t-stack 3.0.3 → 3.0.5

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-D7cz-mze.js";
2
+ import { createBtsCli } from "./src-YT9TBJQT.js";
3
3
 
4
4
  //#region src/cli.ts
5
5
  createBtsCli().run();
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-D7cz-mze.js";
2
+ import { builder, createBtsCli, docs, init, router, sponsors } from "./src-YT9TBJQT.js";
3
3
 
4
4
  export { builder, createBtsCli, docs, init, router, sponsors };
@@ -1819,6 +1819,7 @@ function validateFullConfig(config, providedFlags, options) {
1819
1819
  validateSelfBackendCompatibility(providedFlags, options, config);
1820
1820
  validateWorkersCompatibility(providedFlags, options, config);
1821
1821
  if (config.runtime === "workers" && config.serverDeploy === "none") exitWithError("Cloudflare Workers runtime requires a server deployment. Please choose 'wrangler' or 'alchemy' for --server-deploy.");
1822
+ if (providedFlags.has("serverDeploy") && (config.serverDeploy === "alchemy" || config.serverDeploy === "wrangler") && config.runtime !== "workers") exitWithError(`Server deployment '${config.serverDeploy}' requires '--runtime workers'. Please use '--runtime workers' or choose a different server deployment.`);
1822
1823
  if (config.addons && config.addons.length > 0) {
1823
1824
  validateAddonsAgainstFrontends(config.addons, config.frontend, config.auth);
1824
1825
  config.addons = [...new Set(config.addons)];
@@ -3347,17 +3348,10 @@ async function setupAlchemyServerDeploy(serverDir, _packageManager, projectDir)
3347
3348
  }
3348
3349
  }
3349
3350
  async function addAlchemyPackagesDependencies$1(projectDir) {
3350
- for (const packageName of [
3351
- "packages/api",
3352
- "packages/auth",
3353
- "packages/db"
3354
- ]) {
3355
- const packageDir = path.join(projectDir, packageName);
3356
- if (await fs.pathExists(packageDir)) await addPackageDependency({
3357
- devDependencies: ["@cloudflare/workers-types"],
3358
- projectDir: packageDir
3359
- });
3360
- }
3351
+ await addPackageDependency({
3352
+ devDependencies: ["@cloudflare/workers-types"],
3353
+ projectDir
3354
+ });
3361
3355
  }
3362
3356
 
3363
3357
  //#endregion
@@ -3940,17 +3934,10 @@ async function setupWorkersWebDeploy(projectDir, pkgManager) {
3940
3934
  await setupWorkersVitePlugin(projectDir);
3941
3935
  }
3942
3936
  async function addAlchemyPackagesDependencies(projectDir) {
3943
- for (const packageName of [
3944
- "packages/api",
3945
- "packages/auth",
3946
- "packages/db"
3947
- ]) {
3948
- const packageDir = path.join(projectDir, packageName);
3949
- if (await fs.pathExists(packageDir)) await addPackageDependency({
3950
- devDependencies: ["@cloudflare/workers-types"],
3951
- projectDir: packageDir
3952
- });
3953
- }
3937
+ await addPackageDependency({
3938
+ devDependencies: ["@cloudflare/workers-types"],
3939
+ projectDir
3940
+ });
3954
3941
  }
3955
3942
 
3956
3943
  //#endregion
@@ -4822,16 +4809,17 @@ async function setupCloudflareD1(config) {
4822
4809
  //#endregion
4823
4810
  //#region src/helpers/database-providers/docker-compose-setup.ts
4824
4811
  async function setupDockerCompose(config) {
4825
- const { database, projectDir, projectName } = config;
4812
+ const { database, projectDir, projectName, backend } = config;
4826
4813
  if (database === "none" || database === "sqlite") return;
4827
4814
  try {
4828
- await writeEnvFile$4(projectDir, database, projectName);
4815
+ await writeEnvFile$4(projectDir, database, projectName, backend);
4829
4816
  } catch (error) {
4830
4817
  if (error instanceof Error) console.error(`Error: ${error.message}`);
4831
4818
  }
4832
4819
  }
4833
- async function writeEnvFile$4(projectDir, database, projectName) {
4834
- const envPath = path.join(projectDir, "apps/server", ".env");
4820
+ async function writeEnvFile$4(projectDir, database, projectName, backend) {
4821
+ const targetApp = backend === "self" ? "apps/web" : "apps/server";
4822
+ const envPath = path.join(projectDir, targetApp, ".env");
4835
4823
  const variables = [{
4836
4824
  key: "DATABASE_URL",
4837
4825
  value: getDatabaseUrl(database, projectName),
@@ -6875,7 +6863,7 @@ async function createProject(options, cliInput) {
6875
6863
  await copyBaseTemplate(projectDir, options);
6876
6864
  await setupFrontendTemplates(projectDir, options);
6877
6865
  await setupBackendFramework(projectDir, options);
6878
- if (needsServerSetup) await setupDockerComposeTemplates(projectDir, options);
6866
+ if (needsServerSetup || isSelfBackend && options.dbSetup === "docker") await setupDockerComposeTemplates(projectDir, options);
6879
6867
  await setupAuthTemplate(projectDir, options);
6880
6868
  if (options.payments && options.payments !== "none") await setupPaymentsTemplate(projectDir, options);
6881
6869
  if (options.examples.length > 0 && options.examples[0] !== "none") await setupExamplesTemplate(projectDir, options);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-better-t-stack",
3
- "version": "3.0.3",
3
+ "version": "3.0.5",
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",
@@ -59,7 +59,7 @@ export const web = await Nextjs("web", {
59
59
  bindings: {
60
60
  {{#if (eq backend "convex")}}
61
61
  NEXT_PUBLIC_CONVEX_URL: process.env.NEXT_PUBLIC_CONVEX_URL || "",
62
- {{else}}
62
+ {{else if (ne backend "self")}}
63
63
  NEXT_PUBLIC_SERVER_URL: process.env.NEXT_PUBLIC_SERVER_URL || "",
64
64
  {{/if}}
65
65
  },
@@ -73,7 +73,7 @@ export const web = await Nuxt("web", {
73
73
  bindings: {
74
74
  {{#if (eq backend "convex")}}
75
75
  NUXT_PUBLIC_CONVEX_URL: process.env.NUXT_PUBLIC_CONVEX_URL || "",
76
- {{else}}
76
+ {{else if (ne backend "self")}}
77
77
  NUXT_PUBLIC_SERVER_URL: process.env.NUXT_PUBLIC_SERVER_URL || "",
78
78
  {{/if}}
79
79
  },
@@ -87,7 +87,7 @@ export const web = await SvelteKit("web", {
87
87
  bindings: {
88
88
  {{#if (eq backend "convex")}}
89
89
  PUBLIC_CONVEX_URL: process.env.PUBLIC_CONVEX_URL || "",
90
- {{else}}
90
+ {{else if (ne backend "self")}}
91
91
  PUBLIC_SERVER_URL: process.env.PUBLIC_SERVER_URL || "",
92
92
  {{/if}}
93
93
  },
@@ -101,7 +101,7 @@ export const web = await TanStackStart("web", {
101
101
  bindings: {
102
102
  {{#if (eq backend "convex")}}
103
103
  VITE_CONVEX_URL: process.env.VITE_CONVEX_URL || "",
104
- {{else}}
104
+ {{else if (ne backend "self")}}
105
105
  VITE_SERVER_URL: process.env.VITE_SERVER_URL || "",
106
106
  {{/if}}
107
107
  },
@@ -116,7 +116,7 @@ export const web = await Vite("web", {
116
116
  bindings: {
117
117
  {{#if (eq backend "convex")}}
118
118
  VITE_CONVEX_URL: process.env.VITE_CONVEX_URL || "",
119
- {{else}}
119
+ {{else if (ne backend "self")}}
120
120
  VITE_SERVER_URL: process.env.VITE_SERVER_URL || "",
121
121
  {{/if}}
122
122
  },
@@ -130,7 +130,7 @@ export const web = await ReactRouter("web", {
130
130
  bindings: {
131
131
  {{#if (eq backend "convex")}}
132
132
  VITE_CONVEX_URL: process.env.VITE_CONVEX_URL || "",
133
- {{else}}
133
+ {{else if (ne backend "self")}}
134
134
  VITE_SERVER_URL: process.env.VITE_SERVER_URL || "",
135
135
  {{/if}}
136
136
  },
@@ -145,7 +145,7 @@ export const web = await Vite("web", {
145
145
  bindings: {
146
146
  {{#if (eq backend "convex")}}
147
147
  VITE_CONVEX_URL: process.env.VITE_CONVEX_URL || "",
148
- {{else}}
148
+ {{else if (ne backend "self")}}
149
149
  VITE_SERVER_URL: process.env.VITE_SERVER_URL || "",
150
150
  {{/if}}
151
151
  },