create-better-t-stack 2.33.9-canary.20c8e952 → 2.33.9-canary.2ec142a9
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-CpB-qAME.js → src-DlHyCY_I.js} +19 -6
- package/package.json +1 -1
- package/templates/db/drizzle/sqlite/drizzle.config.ts.hbs +2 -0
- package/templates/deploy/alchemy/alchemy.run.ts.hbs +8 -0
- package/templates/deploy/alchemy/wrangler.jsonc.hbs +11 -0
- package/templates/frontend/nuxt/tsconfig.json.hbs +1 -3
package/dist/cli.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -1707,9 +1707,9 @@ function validateFrontendConstraints(config, providedFlags) {
|
|
|
1707
1707
|
if (frontend && frontend.length > 0) {
|
|
1708
1708
|
ensureSingleWebAndNative(frontend);
|
|
1709
1709
|
if (providedFlags.has("api") && providedFlags.has("frontend") && config.api) validateApiFrontendCompatibility(config.api, frontend);
|
|
1710
|
-
const hasWebFrontendFlag = frontend.some((f) => isWebFrontend(f));
|
|
1711
|
-
validateWebDeployRequiresWebFrontend(config.webDeploy, hasWebFrontendFlag);
|
|
1712
1710
|
}
|
|
1711
|
+
const hasWebFrontendFlag = (frontend ?? []).some((f) => isWebFrontend(f));
|
|
1712
|
+
validateWebDeployRequiresWebFrontend(config.webDeploy, hasWebFrontendFlag);
|
|
1713
1713
|
}
|
|
1714
1714
|
function validateApiConstraints(config, options) {
|
|
1715
1715
|
if (config.api === "none") {
|
|
@@ -1765,6 +1765,12 @@ function extractAndValidateProjectName(projectName, projectDirectory, throwOnErr
|
|
|
1765
1765
|
//#endregion
|
|
1766
1766
|
//#region src/validation.ts
|
|
1767
1767
|
function processAndValidateFlags(options, providedFlags, projectName) {
|
|
1768
|
+
if (options.yolo) {
|
|
1769
|
+
const cfg = processFlags(options, projectName);
|
|
1770
|
+
const validatedProjectName$1 = extractAndValidateProjectName(projectName, options.projectDirectory, true);
|
|
1771
|
+
if (validatedProjectName$1) cfg.projectName = validatedProjectName$1;
|
|
1772
|
+
return cfg;
|
|
1773
|
+
}
|
|
1768
1774
|
try {
|
|
1769
1775
|
validateArrayOptions(options);
|
|
1770
1776
|
} catch (error) {
|
|
@@ -1783,6 +1789,7 @@ function processProvidedFlagsWithoutValidation(options, projectName) {
|
|
|
1783
1789
|
return config;
|
|
1784
1790
|
}
|
|
1785
1791
|
function validateConfigCompatibility(config, providedFlags, options) {
|
|
1792
|
+
if (options?.yolo) return;
|
|
1786
1793
|
if (options && providedFlags) validateFullConfig(config, providedFlags, options);
|
|
1787
1794
|
else validateConfigForProgrammaticUse(config);
|
|
1788
1795
|
}
|
|
@@ -2333,7 +2340,10 @@ async function setupDeploymentTemplates(projectDir, context) {
|
|
|
2333
2340
|
if (await fs.pathExists(alchemyTemplateSrc)) {
|
|
2334
2341
|
await processAndCopyFiles("alchemy.run.ts.hbs", alchemyTemplateSrc, projectDir, context);
|
|
2335
2342
|
const serverAppDir = path.join(projectDir, "apps/server");
|
|
2336
|
-
if (await fs.pathExists(serverAppDir))
|
|
2343
|
+
if (await fs.pathExists(serverAppDir)) {
|
|
2344
|
+
await processAndCopyFiles("env.d.ts.hbs", alchemyTemplateSrc, serverAppDir, context);
|
|
2345
|
+
await processAndCopyFiles("wrangler.jsonc.hbs", alchemyTemplateSrc, serverAppDir, context);
|
|
2346
|
+
}
|
|
2337
2347
|
}
|
|
2338
2348
|
} else {
|
|
2339
2349
|
if (context.webDeploy === "alchemy") {
|
|
@@ -2347,6 +2357,7 @@ async function setupDeploymentTemplates(projectDir, context) {
|
|
|
2347
2357
|
if (await fs.pathExists(alchemyTemplateSrc) && await fs.pathExists(serverAppDir)) {
|
|
2348
2358
|
await processAndCopyFiles("alchemy.run.ts.hbs", alchemyTemplateSrc, serverAppDir, context);
|
|
2349
2359
|
await processAndCopyFiles("env.d.ts.hbs", alchemyTemplateSrc, serverAppDir, context);
|
|
2360
|
+
await processAndCopyFiles("wrangler.jsonc.hbs", alchemyTemplateSrc, serverAppDir, context);
|
|
2350
2361
|
}
|
|
2351
2362
|
}
|
|
2352
2363
|
}
|
|
@@ -4757,8 +4768,10 @@ async function setupPrismaPostgres(config) {
|
|
|
4757
4768
|
else prismaConfig = await initPrismaDatabase(serverDir, packageManager);
|
|
4758
4769
|
if (prismaConfig) {
|
|
4759
4770
|
await writeEnvFile$1(projectDir, prismaConfig);
|
|
4760
|
-
|
|
4761
|
-
|
|
4771
|
+
if (orm === "prisma") {
|
|
4772
|
+
await addDotenvImportToPrismaConfig(projectDir);
|
|
4773
|
+
await addPrismaAccelerateExtension(serverDir);
|
|
4774
|
+
}
|
|
4762
4775
|
log.success(pc.green("Prisma Postgres database configured successfully!"));
|
|
4763
4776
|
} else {
|
|
4764
4777
|
await writeEnvFile$1(projectDir);
|
|
@@ -5678,7 +5691,7 @@ async function getDatabaseInstructions(database, orm, runCmd, _runtime, dbSetup,
|
|
|
5678
5691
|
instructions.push(`${pc.cyan("5.")} Apply migrations locally: ${pc.white(`${packageManager} wrangler d1 migrations apply YOUR_DB_NAME --local`)}`);
|
|
5679
5692
|
instructions.push(`${pc.cyan("6.")} Apply migrations to production: ${pc.white(`${packageManager} wrangler d1 migrations apply YOUR_DB_NAME`)}`);
|
|
5680
5693
|
}
|
|
5681
|
-
if (dbSetup === "d1" && serverDeploy === "alchemy")
|
|
5694
|
+
if (dbSetup === "d1" && serverDeploy === "alchemy") {}
|
|
5682
5695
|
if (orm === "prisma") {
|
|
5683
5696
|
if (dbSetup === "turso") instructions.push(`${pc.yellow("NOTE:")} Turso support with Prisma is in Early Access and requires\n additional setup. Learn more at:\n https://www.prisma.io/docs/orm/overview/databases/turso`);
|
|
5684
5697
|
if (database === "mongodb" && dbSetup === "docker") instructions.push(`${pc.yellow("WARNING:")} Prisma + MongoDB + Docker combination\n may not work.`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-better-t-stack",
|
|
3
|
-
"version": "2.33.9-canary.
|
|
3
|
+
"version": "2.33.9-canary.2ec142a9",
|
|
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",
|
|
@@ -7,11 +7,13 @@ export default defineConfig({
|
|
|
7
7
|
// DOCS: https://orm.drizzle.team/docs/guides/d1-http-with-drizzle-kit
|
|
8
8
|
dialect: "sqlite",
|
|
9
9
|
driver: "d1-http",
|
|
10
|
+
{{#if (eq serverDeploy "wrangler")}}
|
|
10
11
|
dbCredentials: {
|
|
11
12
|
accountId: process.env.CLOUDFLARE_ACCOUNT_ID!,
|
|
12
13
|
databaseId: process.env.CLOUDFLARE_DATABASE_ID!,
|
|
13
14
|
token: process.env.CLOUDFLARE_D1_TOKEN!,
|
|
14
15
|
},
|
|
16
|
+
{{/if}}
|
|
15
17
|
{{else}}
|
|
16
18
|
dialect: "turso",
|
|
17
19
|
dbCredentials: {
|
|
@@ -22,6 +22,9 @@ import { Worker, WranglerJson } from "alchemy/cloudflare";
|
|
|
22
22
|
import { D1Database } from "alchemy/cloudflare";
|
|
23
23
|
{{/if}}
|
|
24
24
|
{{/if}}
|
|
25
|
+
{{#if (and (eq serverDeploy "alchemy") (eq dbSetup "d1"))}}
|
|
26
|
+
import { Exec } from "alchemy/os";
|
|
27
|
+
{{/if}}
|
|
25
28
|
import { config } from "dotenv";
|
|
26
29
|
|
|
27
30
|
{{#if (and (eq webDeploy "alchemy") (eq serverDeploy "alchemy"))}}
|
|
@@ -35,6 +38,11 @@ config({ path: "./.env" });
|
|
|
35
38
|
const app = await alchemy("{{projectName}}");
|
|
36
39
|
|
|
37
40
|
{{#if (and (eq serverDeploy "alchemy") (eq dbSetup "d1"))}}
|
|
41
|
+
await Exec("db-generate", {
|
|
42
|
+
{{#if (and (eq webDeploy "alchemy") (eq serverDeploy "alchemy"))}}cwd: "apps/server",{{/if}}
|
|
43
|
+
command: "{{packageManager}} run db:generate",
|
|
44
|
+
});
|
|
45
|
+
|
|
38
46
|
const db = await D1Database("database", {
|
|
39
47
|
name: `${app.name}-${app.stage}-db`,
|
|
40
48
|
migrationsDir: "apps/server/src/db/migrations",
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// This is a temporary wrangler.jsonc file that will be overwritten by alchemy
|
|
2
|
+
// It's only here so that `wrangler dev` can work or use alchemy dev instead
|
|
3
|
+
{
|
|
4
|
+
"name": "{{projectName}}",
|
|
5
|
+
"main": "src/index.ts",
|
|
6
|
+
"compatibility_date": "2025-08-16",
|
|
7
|
+
"compatibility_flags": [
|
|
8
|
+
"nodejs_compat",
|
|
9
|
+
"nodejs_compat_populate_process_env"
|
|
10
|
+
]
|
|
11
|
+
}
|