create-better-t-stack 2.49.1 → 2.50.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-CKCxH6aF.js → src-BFx0Xu3C.js} +15 -69
- package/package.json +1 -1
- package/templates/auth/clerk/convex/web/react/tanstack-start/src/server.ts.hbs +1 -0
- package/templates/deploy/wrangler/web/react/tanstack-start/wrangler.jsonc.hbs +1 -1
- package/templates/frontend/react/tanstack-start/package.json.hbs +7 -7
- package/templates/frontend/react/tanstack-start/src/routes/__root.tsx.hbs +4 -4
- package/templates/frontend/react/tanstack-start/vite.config.ts.hbs +1 -1
package/dist/cli.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -65,7 +65,7 @@ const dependencyVersionMap = {
|
|
|
65
65
|
"@better-auth/expo": "^1.3.13",
|
|
66
66
|
"@clerk/nextjs": "^6.31.5",
|
|
67
67
|
"@clerk/clerk-react": "^5.45.0",
|
|
68
|
-
"@clerk/tanstack-react-start": "^0.
|
|
68
|
+
"@clerk/tanstack-react-start": "^0.25.1",
|
|
69
69
|
"@clerk/clerk-expo": "^2.14.25",
|
|
70
70
|
"drizzle-orm": "^0.44.2",
|
|
71
71
|
"drizzle-kit": "^0.31.2",
|
|
@@ -138,13 +138,13 @@ const dependencyVersionMap = {
|
|
|
138
138
|
"@tanstack/solid-query": "^5.87.4",
|
|
139
139
|
"@tanstack/solid-query-devtools": "^5.87.4",
|
|
140
140
|
"@tanstack/solid-router-devtools": "^1.131.44",
|
|
141
|
-
wrangler: "^4.
|
|
142
|
-
"@cloudflare/vite-plugin": "^1.
|
|
141
|
+
wrangler: "^4.40.3",
|
|
142
|
+
"@cloudflare/vite-plugin": "^1.13.8",
|
|
143
143
|
"@opennextjs/cloudflare": "^1.6.5",
|
|
144
144
|
"nitro-cloudflare-dev": "^0.2.2",
|
|
145
145
|
"@sveltejs/adapter-cloudflare": "^7.2.1",
|
|
146
146
|
"@cloudflare/workers-types": "^4.20250822.0",
|
|
147
|
-
alchemy: "^0.
|
|
147
|
+
alchemy: "^0.70.0",
|
|
148
148
|
nitropack: "^2.12.4",
|
|
149
149
|
dotenv: "^17.2.1",
|
|
150
150
|
"@polar-sh/better-auth": "^1.1.3",
|
|
@@ -3504,8 +3504,8 @@ async function setupTanStackStartAlchemyDeploy(projectDir, _packageManager, opti
|
|
|
3504
3504
|
await addPackageDependency({
|
|
3505
3505
|
devDependencies: [
|
|
3506
3506
|
"alchemy",
|
|
3507
|
-
"
|
|
3508
|
-
"
|
|
3507
|
+
"dotenv",
|
|
3508
|
+
"@cloudflare/vite-plugin"
|
|
3509
3509
|
],
|
|
3510
3510
|
projectDir: webAppDir
|
|
3511
3511
|
});
|
|
@@ -3533,17 +3533,6 @@ async function setupTanStackStartAlchemyDeploy(projectDir, _packageManager, opti
|
|
|
3533
3533
|
defaultImport: "alchemy"
|
|
3534
3534
|
});
|
|
3535
3535
|
else alchemyImport.setModuleSpecifier("alchemy/cloudflare/tanstack-start");
|
|
3536
|
-
const reactImport = sourceFile.getImportDeclaration("@vitejs/plugin-react");
|
|
3537
|
-
let reactPluginIdentifier = "viteReact";
|
|
3538
|
-
if (!reactImport) sourceFile.addImportDeclaration({
|
|
3539
|
-
moduleSpecifier: "@vitejs/plugin-react",
|
|
3540
|
-
defaultImport: "viteReact"
|
|
3541
|
-
});
|
|
3542
|
-
else {
|
|
3543
|
-
const defaultImport = reactImport.getDefaultImport();
|
|
3544
|
-
if (defaultImport) reactPluginIdentifier = defaultImport.getText();
|
|
3545
|
-
else reactImport.setDefaultImport("viteReact");
|
|
3546
|
-
}
|
|
3547
3536
|
const exportAssignment = sourceFile.getExportAssignment((d) => !d.isExportEquals());
|
|
3548
3537
|
if (!exportAssignment) return;
|
|
3549
3538
|
const defineConfigCall = exportAssignment.getExpression();
|
|
@@ -3551,47 +3540,11 @@ async function setupTanStackStartAlchemyDeploy(projectDir, _packageManager, opti
|
|
|
3551
3540
|
let configObject = defineConfigCall.getArguments()[0];
|
|
3552
3541
|
if (!configObject) configObject = defineConfigCall.addArgument("{}");
|
|
3553
3542
|
if (Node.isObjectLiteralExpression(configObject)) {
|
|
3554
|
-
if (!configObject.getProperty("build")) configObject.addPropertyAssignment({
|
|
3555
|
-
name: "build",
|
|
3556
|
-
initializer: `{
|
|
3557
|
-
target: "esnext",
|
|
3558
|
-
rollupOptions: {
|
|
3559
|
-
external: ["node:async_hooks", "cloudflare:workers"],
|
|
3560
|
-
},
|
|
3561
|
-
}`
|
|
3562
|
-
});
|
|
3563
3543
|
const pluginsProperty = configObject.getProperty("plugins");
|
|
3564
3544
|
if (pluginsProperty && Node.isPropertyAssignment(pluginsProperty)) {
|
|
3565
3545
|
const initializer = pluginsProperty.getInitializer();
|
|
3566
3546
|
if (Node.isArrayLiteralExpression(initializer)) {
|
|
3567
|
-
if (!initializer.getElements().some((el) => el.getText().includes("alchemy"))) initializer.addElement("alchemy()");
|
|
3568
|
-
const tanstackElements = initializer.getElements().filter((el) => el.getText().includes("tanstackStart"));
|
|
3569
|
-
let needsReactPlugin = false;
|
|
3570
|
-
tanstackElements.forEach((element) => {
|
|
3571
|
-
if (Node.isCallExpression(element)) {
|
|
3572
|
-
const args = element.getArguments();
|
|
3573
|
-
if (args.length === 0) {
|
|
3574
|
-
element.addArgument(`{
|
|
3575
|
-
target: "cloudflare-module",
|
|
3576
|
-
customViteReactPlugin: true,
|
|
3577
|
-
}`);
|
|
3578
|
-
needsReactPlugin = true;
|
|
3579
|
-
} else if (args.length === 1 && Node.isObjectLiteralExpression(args[0])) {
|
|
3580
|
-
const configObj = args[0];
|
|
3581
|
-
if (!configObj.getProperty("target")) configObj.addPropertyAssignment({
|
|
3582
|
-
name: "target",
|
|
3583
|
-
initializer: "\"cloudflare-module\""
|
|
3584
|
-
});
|
|
3585
|
-
if (!!!configObj.getProperty("customViteReactPlugin")) configObj.addPropertyAssignment({
|
|
3586
|
-
name: "customViteReactPlugin",
|
|
3587
|
-
initializer: "true"
|
|
3588
|
-
});
|
|
3589
|
-
needsReactPlugin = true;
|
|
3590
|
-
}
|
|
3591
|
-
}
|
|
3592
|
-
});
|
|
3593
|
-
const hasReactPlugin = initializer.getElements().some((el) => Node.isCallExpression(el) && el.getExpression().getText() === reactPluginIdentifier);
|
|
3594
|
-
if (needsReactPlugin && !hasReactPlugin) initializer.addElement(`${reactPluginIdentifier}()`);
|
|
3547
|
+
if (!initializer.getElements().some((el) => el.getText().includes("alchemy("))) initializer.addElement("alchemy()");
|
|
3595
3548
|
}
|
|
3596
3549
|
} else configObject.addPropertyAssignment({
|
|
3597
3550
|
name: "plugins",
|
|
@@ -3602,16 +3555,6 @@ async function setupTanStackStartAlchemyDeploy(projectDir, _packageManager, opti
|
|
|
3602
3555
|
} catch (error) {
|
|
3603
3556
|
console.warn("Failed to update vite.config.ts:", error);
|
|
3604
3557
|
}
|
|
3605
|
-
const nitroConfigPath = path.join(webAppDir, "nitro.config.ts");
|
|
3606
|
-
await fs.writeFile(nitroConfigPath, `import { defineNitroConfig } from "nitropack/config";
|
|
3607
|
-
|
|
3608
|
-
export default defineNitroConfig({
|
|
3609
|
-
preset: "cloudflare-module",
|
|
3610
|
-
cloudflare: {
|
|
3611
|
-
nodeCompat: true,
|
|
3612
|
-
},
|
|
3613
|
-
});
|
|
3614
|
-
`, "utf-8");
|
|
3615
3558
|
}
|
|
3616
3559
|
|
|
3617
3560
|
//#endregion
|
|
@@ -3778,7 +3721,7 @@ async function setupTanstackStartWorkersDeploy(projectDir, packageManager) {
|
|
|
3778
3721
|
const webAppDir = path.join(projectDir, "apps/web");
|
|
3779
3722
|
if (!await fs.pathExists(webAppDir)) return;
|
|
3780
3723
|
await addPackageDependency({
|
|
3781
|
-
devDependencies: ["wrangler"],
|
|
3724
|
+
devDependencies: ["wrangler", "@cloudflare/vite-plugin"],
|
|
3782
3725
|
projectDir: webAppDir
|
|
3783
3726
|
});
|
|
3784
3727
|
const pkgPath = path.join(webAppDir, "package.json");
|
|
@@ -3795,6 +3738,12 @@ async function setupTanstackStartWorkersDeploy(projectDir, packageManager) {
|
|
|
3795
3738
|
if (!await fs.pathExists(viteConfigPath)) return;
|
|
3796
3739
|
const sourceFile = tsProject.addSourceFileAtPathIfExists(viteConfigPath);
|
|
3797
3740
|
if (!sourceFile) return;
|
|
3741
|
+
const cfImport = sourceFile.getImportDeclaration("@cloudflare/vite-plugin");
|
|
3742
|
+
if (!cfImport) sourceFile.addImportDeclaration({
|
|
3743
|
+
moduleSpecifier: "@cloudflare/vite-plugin",
|
|
3744
|
+
namedImports: [{ name: "cloudflare" }]
|
|
3745
|
+
});
|
|
3746
|
+
else if (!cfImport.getNamedImports().some((ni) => ni.getName() === "cloudflare")) cfImport.addNamedImport({ name: "cloudflare" });
|
|
3798
3747
|
const reactImport = sourceFile.getImportDeclaration("@vitejs/plugin-react");
|
|
3799
3748
|
let reactPluginIdentifier = "viteReact";
|
|
3800
3749
|
if (!reactImport) sourceFile.addImportDeclaration({
|
|
@@ -3814,10 +3763,7 @@ async function setupTanstackStartWorkersDeploy(projectDir, packageManager) {
|
|
|
3814
3763
|
const configObj = defineCall.getArguments()[0];
|
|
3815
3764
|
if (!configObj) return;
|
|
3816
3765
|
const pluginsArray = ensureArrayProperty(configObj, "plugins");
|
|
3817
|
-
|
|
3818
|
-
const tanstackPluginText = "tanstackStart({ target: \"cloudflare-module\", customViteReactPlugin: true })";
|
|
3819
|
-
if (tanstackPluginIndex === -1) pluginsArray.addElement(tanstackPluginText);
|
|
3820
|
-
else pluginsArray.getElements()[tanstackPluginIndex].replaceWithText(tanstackPluginText);
|
|
3766
|
+
if (!pluginsArray.getElements().some((el) => el.getText().includes("cloudflare("))) pluginsArray.insertElement(0, "cloudflare({ viteEnvironment: { name: 'ssr' } })");
|
|
3821
3767
|
if (!pluginsArray.getElements().some((el) => Node.isCallExpression(el) && el.getExpression().getText() === reactPluginIdentifier)) {
|
|
3822
3768
|
const nextIndex = pluginsArray.getElements().findIndex((el) => el.getText().includes("tanstackStart(")) + 1;
|
|
3823
3769
|
if (nextIndex > 0) pluginsArray.insertElement(nextIndex, `${reactPluginIdentifier}()`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-better-t-stack",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.50.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",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "./node_modules/wrangler/config-schema.json",
|
|
3
3
|
"name": "{{projectName}}",
|
|
4
|
-
"main": "
|
|
4
|
+
"main": "@tanstack/react-start/server-entry",
|
|
5
5
|
"compatibility_date": "2025-07-05",
|
|
6
6
|
"compatibility_flags": ["nodejs_compat"],
|
|
7
7
|
"assets": {
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"radix-ui": "^1.4.2",
|
|
12
|
-
"@tanstack/react-form": "^1.
|
|
12
|
+
"@tanstack/react-form": "^1.23.5",
|
|
13
13
|
"@tailwindcss/vite": "^4.1.8",
|
|
14
14
|
"@tanstack/react-query": "^5.80.6",
|
|
15
|
-
"@tanstack/react-router": "^1.
|
|
16
|
-
"@tanstack/react-router-with-query": "^1.
|
|
17
|
-
"@tanstack/react-start": "^1.
|
|
18
|
-
"@tanstack/router-plugin": "^1.
|
|
15
|
+
"@tanstack/react-router": "^1.132.31",
|
|
16
|
+
"@tanstack/react-router-with-query": "^1.130.17",
|
|
17
|
+
"@tanstack/react-start": "^1.132.31",
|
|
18
|
+
"@tanstack/router-plugin": "^1.132.31",
|
|
19
19
|
"class-variance-authority": "^0.7.1",
|
|
20
20
|
"clsx": "^2.1.1",
|
|
21
21
|
"lucide-react": "^0.525.0",
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
"zod": "^4.0.2"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@tanstack/react-router-devtools": "^1.
|
|
33
|
+
"@tanstack/react-router-devtools": "^1.132.31",
|
|
34
34
|
"@testing-library/dom": "^10.4.0",
|
|
35
35
|
"@testing-library/react": "^16.2.0",
|
|
36
36
|
"@types/react": "~19.1.10",
|
|
37
37
|
"@types/react-dom": "^19.0.4",
|
|
38
|
-
"@vitejs/plugin-react": "^5.0.
|
|
38
|
+
"@vitejs/plugin-react": "^5.0.4",
|
|
39
39
|
"jsdom": "^26.0.0",
|
|
40
40
|
"typescript": "^5.7.2",
|
|
41
41
|
"vite": "^7.0.2",
|
|
@@ -30,24 +30,24 @@ import Loader from "@/components/loader";
|
|
|
30
30
|
import { ClerkProvider, useAuth } from "@clerk/tanstack-react-start";
|
|
31
31
|
import { getAuth } from "@clerk/tanstack-react-start/server";
|
|
32
32
|
import { createServerFn } from "@tanstack/react-start";
|
|
33
|
-
import {
|
|
33
|
+
import { getRequest } from "@tanstack/react-start/server";
|
|
34
34
|
import { ConvexProviderWithClerk } from "convex/react-clerk";
|
|
35
35
|
|
|
36
36
|
const fetchClerkAuth = createServerFn({ method: "GET" }).handler(async () => {
|
|
37
|
-
const auth = await getAuth(
|
|
37
|
+
const auth = await getAuth(getRequest());
|
|
38
38
|
const token = await auth.getToken({ template: "convex" });
|
|
39
39
|
return { userId: auth.userId, token };
|
|
40
40
|
});
|
|
41
41
|
{{else if (and (eq backend "convex") (eq auth "better-auth"))}}
|
|
42
42
|
import { createServerFn } from "@tanstack/react-start";
|
|
43
|
-
import {
|
|
43
|
+
import { getRequest, getCookie } from "@tanstack/react-start/server";
|
|
44
44
|
import { ConvexBetterAuthProvider } from "@convex-dev/better-auth/react";
|
|
45
45
|
import { fetchSession, getCookieName } from "@convex-dev/better-auth/react-start";
|
|
46
46
|
import { authClient } from "@/lib/auth-client";
|
|
47
47
|
import { createAuth } from "@{{projectName}}/backend/convex/auth";
|
|
48
48
|
|
|
49
49
|
const fetchAuth = createServerFn({ method: "GET" }).handler(async () => {
|
|
50
|
-
const { session } = await fetchSession(
|
|
50
|
+
const { session } = await fetchSession(getRequest());
|
|
51
51
|
const sessionCookieName = getCookieName(createAuth);
|
|
52
52
|
const token = getCookie(sessionCookieName);
|
|
53
53
|
return {
|