create-better-t-stack 2.35.2 → 2.35.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 +1 -1
- package/dist/index.js +1 -1
- package/dist/{src-BytnIoY2.js → src-X-NzEC_t.js} +42 -12
- package/package.json +1 -1
- package/templates/backend/server/server-base/tsconfig.json.hbs +9 -14
- package/templates/frontend/react/tanstack-start/package.json.hbs +1 -1
- package/templates/frontend/react/tanstack-start/{vite.config.ts → vite.config.ts.hbs} +7 -1
package/dist/cli.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -2626,7 +2626,7 @@ async function setupUltracite(config, hasHusky) {
|
|
|
2626
2626
|
label: editor.label,
|
|
2627
2627
|
hint: editor.hint
|
|
2628
2628
|
})),
|
|
2629
|
-
required:
|
|
2629
|
+
required: true
|
|
2630
2630
|
});
|
|
2631
2631
|
if (isCancel(editors)) return exitCancelled("Operation cancelled");
|
|
2632
2632
|
const rules = await multiselect({
|
|
@@ -2636,7 +2636,7 @@ async function setupUltracite(config, hasHusky) {
|
|
|
2636
2636
|
label: rule.label,
|
|
2637
2637
|
hint: rule.hint
|
|
2638
2638
|
})),
|
|
2639
|
-
required:
|
|
2639
|
+
required: true
|
|
2640
2640
|
});
|
|
2641
2641
|
if (isCancel(rules)) return exitCancelled("Operation cancelled");
|
|
2642
2642
|
const ultraciteArgs = [
|
|
@@ -2983,11 +2983,7 @@ async function setupWorkersServerDeploy(serverDir, _packageManager) {
|
|
|
2983
2983
|
};
|
|
2984
2984
|
await fs.writeJson(packageJsonPath, packageJson, { spaces: 2 });
|
|
2985
2985
|
await addPackageDependency({
|
|
2986
|
-
devDependencies: [
|
|
2987
|
-
"wrangler",
|
|
2988
|
-
"@types/node",
|
|
2989
|
-
"@cloudflare/workers-types"
|
|
2990
|
-
],
|
|
2986
|
+
devDependencies: ["wrangler", "@types/node"],
|
|
2991
2987
|
projectDir: serverDir
|
|
2992
2988
|
});
|
|
2993
2989
|
}
|
|
@@ -3012,7 +3008,6 @@ async function setupAlchemyServerDeploy(serverDir, _packageManager) {
|
|
|
3012
3008
|
"alchemy",
|
|
3013
3009
|
"wrangler",
|
|
3014
3010
|
"@types/node",
|
|
3015
|
-
"@cloudflare/workers-types",
|
|
3016
3011
|
"dotenv"
|
|
3017
3012
|
],
|
|
3018
3013
|
projectDir: serverDir
|
|
@@ -3380,6 +3375,17 @@ async function setupTanStackStartAlchemyDeploy(projectDir, _packageManager) {
|
|
|
3380
3375
|
defaultImport: "alchemy"
|
|
3381
3376
|
});
|
|
3382
3377
|
else alchemyImport.setModuleSpecifier("alchemy/cloudflare/tanstack-start");
|
|
3378
|
+
const reactImport = sourceFile.getImportDeclaration("@vitejs/plugin-react");
|
|
3379
|
+
let reactPluginIdentifier = "viteReact";
|
|
3380
|
+
if (!reactImport) sourceFile.addImportDeclaration({
|
|
3381
|
+
moduleSpecifier: "@vitejs/plugin-react",
|
|
3382
|
+
defaultImport: "viteReact"
|
|
3383
|
+
});
|
|
3384
|
+
else {
|
|
3385
|
+
const defaultImport = reactImport.getDefaultImport();
|
|
3386
|
+
if (defaultImport) reactPluginIdentifier = defaultImport.getText();
|
|
3387
|
+
else reactImport.setDefaultImport("viteReact");
|
|
3388
|
+
}
|
|
3383
3389
|
const exportAssignment = sourceFile.getExportAssignment((d) => !d.isExportEquals());
|
|
3384
3390
|
if (!exportAssignment) return;
|
|
3385
3391
|
const defineConfigCall = exportAssignment.getExpression();
|
|
@@ -3403,26 +3409,33 @@ async function setupTanStackStartAlchemyDeploy(projectDir, _packageManager) {
|
|
|
3403
3409
|
const hasShim = initializer.getElements().some((el) => el.getText().includes("alchemy"));
|
|
3404
3410
|
if (!hasShim) initializer.addElement("alchemy()");
|
|
3405
3411
|
const tanstackElements = initializer.getElements().filter((el) => el.getText().includes("tanstackStart"));
|
|
3412
|
+
let needsReactPlugin = false;
|
|
3406
3413
|
tanstackElements.forEach((element) => {
|
|
3407
3414
|
if (Node.isCallExpression(element)) {
|
|
3408
3415
|
const args = element.getArguments();
|
|
3409
|
-
if (args.length === 0)
|
|
3416
|
+
if (args.length === 0) {
|
|
3417
|
+
element.addArgument(`{
|
|
3410
3418
|
target: "cloudflare-module",
|
|
3411
3419
|
customViteReactPlugin: true,
|
|
3412
3420
|
}`);
|
|
3413
|
-
|
|
3421
|
+
needsReactPlugin = true;
|
|
3422
|
+
} else if (args.length === 1 && Node.isObjectLiteralExpression(args[0])) {
|
|
3414
3423
|
const configObj = args[0];
|
|
3415
3424
|
if (!configObj.getProperty("target")) configObj.addPropertyAssignment({
|
|
3416
3425
|
name: "target",
|
|
3417
3426
|
initializer: "\"cloudflare-module\""
|
|
3418
3427
|
});
|
|
3419
|
-
|
|
3428
|
+
const hasCustomViteReactPlugin = !!configObj.getProperty("customViteReactPlugin");
|
|
3429
|
+
if (!hasCustomViteReactPlugin) configObj.addPropertyAssignment({
|
|
3420
3430
|
name: "customViteReactPlugin",
|
|
3421
3431
|
initializer: "true"
|
|
3422
3432
|
});
|
|
3433
|
+
needsReactPlugin = true;
|
|
3423
3434
|
}
|
|
3424
3435
|
}
|
|
3425
3436
|
});
|
|
3437
|
+
const hasReactPlugin = initializer.getElements().some((el) => Node.isCallExpression(el) && el.getExpression().getText() === reactPluginIdentifier);
|
|
3438
|
+
if (needsReactPlugin && !hasReactPlugin) initializer.addElement(`${reactPluginIdentifier}()`);
|
|
3426
3439
|
}
|
|
3427
3440
|
} else configObject.addPropertyAssignment({
|
|
3428
3441
|
name: "plugins",
|
|
@@ -3631,6 +3644,17 @@ async function setupTanstackStartWorkersDeploy(projectDir, packageManager) {
|
|
|
3631
3644
|
if (!await fs.pathExists(viteConfigPath)) return;
|
|
3632
3645
|
const sourceFile = tsProject.addSourceFileAtPathIfExists(viteConfigPath);
|
|
3633
3646
|
if (!sourceFile) return;
|
|
3647
|
+
const reactImport = sourceFile.getImportDeclaration("@vitejs/plugin-react");
|
|
3648
|
+
let reactPluginIdentifier = "viteReact";
|
|
3649
|
+
if (!reactImport) sourceFile.addImportDeclaration({
|
|
3650
|
+
moduleSpecifier: "@vitejs/plugin-react",
|
|
3651
|
+
defaultImport: "viteReact"
|
|
3652
|
+
});
|
|
3653
|
+
else {
|
|
3654
|
+
const defaultImport = reactImport.getDefaultImport();
|
|
3655
|
+
if (defaultImport) reactPluginIdentifier = defaultImport.getText();
|
|
3656
|
+
else reactImport.setDefaultImport("viteReact");
|
|
3657
|
+
}
|
|
3634
3658
|
const defineCall = sourceFile.getDescendantsOfKind(SyntaxKind.CallExpression).find((expr) => {
|
|
3635
3659
|
const expression = expr.getExpression();
|
|
3636
3660
|
return Node.isIdentifier(expression) && expression.getText() === "defineConfig";
|
|
@@ -3640,9 +3664,15 @@ async function setupTanstackStartWorkersDeploy(projectDir, packageManager) {
|
|
|
3640
3664
|
if (!configObj) return;
|
|
3641
3665
|
const pluginsArray = ensureArrayProperty(configObj, "plugins");
|
|
3642
3666
|
const tanstackPluginIndex = pluginsArray.getElements().findIndex((el) => el.getText().includes("tanstackStart("));
|
|
3643
|
-
const tanstackPluginText = "tanstackStart({ target: \"cloudflare-module\" })";
|
|
3667
|
+
const tanstackPluginText = "tanstackStart({ target: \"cloudflare-module\", customViteReactPlugin: true })";
|
|
3644
3668
|
if (tanstackPluginIndex === -1) pluginsArray.addElement(tanstackPluginText);
|
|
3645
3669
|
else pluginsArray.getElements()[tanstackPluginIndex].replaceWithText(tanstackPluginText);
|
|
3670
|
+
const hasReactPlugin = pluginsArray.getElements().some((el) => Node.isCallExpression(el) && el.getExpression().getText() === reactPluginIdentifier);
|
|
3671
|
+
if (!hasReactPlugin) {
|
|
3672
|
+
const nextIndex = pluginsArray.getElements().findIndex((el) => el.getText().includes("tanstackStart(")) + 1;
|
|
3673
|
+
if (nextIndex > 0) pluginsArray.insertElement(nextIndex, `${reactPluginIdentifier}()`);
|
|
3674
|
+
else pluginsArray.addElement(`${reactPluginIdentifier}()`);
|
|
3675
|
+
}
|
|
3646
3676
|
await tsProject.save();
|
|
3647
3677
|
}
|
|
3648
3678
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-better-t-stack",
|
|
3
|
-
"version": "2.35.
|
|
3
|
+
"version": "2.35.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",
|
|
@@ -8,28 +8,23 @@
|
|
|
8
8
|
"skipLibCheck": true,
|
|
9
9
|
"baseUrl": "./",
|
|
10
10
|
"paths": {
|
|
11
|
-
"@/*": ["./src/*"]
|
|
12
|
-
|
|
13
|
-
"prisma": ["node_modules/prisma"]
|
|
14
|
-
{{/if}}
|
|
11
|
+
"@/*": ["./src/*"]{{#if (eq orm "prisma")}},
|
|
12
|
+
"prisma": ["node_modules/prisma"]{{/if}}
|
|
15
13
|
},
|
|
16
14
|
"outDir": "./dist",
|
|
17
15
|
"types": [
|
|
18
16
|
{{#if (eq runtime "node")}}
|
|
19
|
-
|
|
17
|
+
"node"
|
|
20
18
|
{{else if (eq runtime "bun")}}
|
|
21
|
-
|
|
19
|
+
"bun"
|
|
22
20
|
{{else if (eq runtime "workers")}}
|
|
23
|
-
|
|
24
|
-
"node"
|
|
21
|
+
"node"
|
|
25
22
|
{{else}}
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
"node",
|
|
24
|
+
"bun"
|
|
28
25
|
{{/if}}
|
|
29
|
-
],
|
|
30
|
-
{{
|
|
31
|
-
"composite": true,
|
|
32
|
-
{{/unless}}
|
|
26
|
+
]{{#unless (or (eq backend "convex") (eq backend "none"))}},
|
|
27
|
+
"composite": true{{/unless}},
|
|
33
28
|
"jsx": "react-jsx"{{#if (eq backend "hono")}},
|
|
34
29
|
"jsxImportSource": "hono/jsx"{{/if}}
|
|
35
30
|
}
|
|
@@ -2,7 +2,13 @@ import { defineConfig } from "vite";
|
|
|
2
2
|
import tsconfigPaths from "vite-tsconfig-paths";
|
|
3
3
|
import { tanstackStart } from "@tanstack/react-start/plugin/vite";
|
|
4
4
|
import tailwindcss from "@tailwindcss/vite";
|
|
5
|
+
import viteReact from "@vitejs/plugin-react";
|
|
5
6
|
|
|
6
7
|
export default defineConfig({
|
|
7
|
-
plugins: [
|
|
8
|
+
plugins: [
|
|
9
|
+
tsconfigPaths(),
|
|
10
|
+
tailwindcss(),
|
|
11
|
+
tanstackStart({ customViteReactPlugin: true }),
|
|
12
|
+
viteReact(),
|
|
13
|
+
],
|
|
8
14
|
});
|