create-better-t-stack 2.43.0 → 2.44.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
CHANGED
package/dist/index.js
CHANGED
|
@@ -13,6 +13,7 @@ import { $, execa } from "execa";
|
|
|
13
13
|
import { IndentationText, Node, Project, QuoteKind, SyntaxKind } from "ts-morph";
|
|
14
14
|
import { glob } from "tinyglobby";
|
|
15
15
|
import handlebars from "handlebars";
|
|
16
|
+
import { Biome } from "@biomejs/js-api/nodejs";
|
|
16
17
|
import os from "node:os";
|
|
17
18
|
|
|
18
19
|
//#region src/utils/get-package-manager.ts
|
|
@@ -94,7 +95,7 @@ const dependencyVersionMap = {
|
|
|
94
95
|
"@elysiajs/node": "^1.3.1",
|
|
95
96
|
"@elysiajs/cors": "^1.3.3",
|
|
96
97
|
"@elysiajs/trpc": "^1.1.0",
|
|
97
|
-
|
|
98
|
+
elysia: "^1.3.21",
|
|
98
99
|
"@hono/node-server": "^1.14.4",
|
|
99
100
|
"@hono/trpc-server": "^0.4.0",
|
|
100
101
|
hono: "^4.8.2",
|
|
@@ -105,7 +106,7 @@ const dependencyVersionMap = {
|
|
|
105
106
|
fastify: "^5.3.3",
|
|
106
107
|
"@fastify/cors": "^11.0.1",
|
|
107
108
|
turbo: "^2.5.4",
|
|
108
|
-
|
|
109
|
+
ai: "^5.0.39",
|
|
109
110
|
"@ai-sdk/google": "^2.0.13",
|
|
110
111
|
"@ai-sdk/vue": "^2.0.39",
|
|
111
112
|
"@ai-sdk/svelte": "^3.0.39",
|
|
@@ -2518,21 +2519,94 @@ async function installDependencies({ projectDir, packageManager }) {
|
|
|
2518
2519
|
}
|
|
2519
2520
|
}
|
|
2520
2521
|
|
|
2522
|
+
//#endregion
|
|
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
|
+
};
|
|
2531
|
+
try {
|
|
2532
|
+
biome = new Biome();
|
|
2533
|
+
const result = biome.openProject("./");
|
|
2534
|
+
projectKey = result.projectKey;
|
|
2535
|
+
biome.applyConfiguration(projectKey, {
|
|
2536
|
+
formatter: {
|
|
2537
|
+
enabled: true,
|
|
2538
|
+
indentStyle: "tab",
|
|
2539
|
+
indentWidth: 2,
|
|
2540
|
+
lineWidth: 80
|
|
2541
|
+
},
|
|
2542
|
+
linter: { enabled: false },
|
|
2543
|
+
javascript: { formatter: { enabled: true } },
|
|
2544
|
+
json: { formatter: { enabled: true } }
|
|
2545
|
+
});
|
|
2546
|
+
return {
|
|
2547
|
+
biome,
|
|
2548
|
+
projectKey
|
|
2549
|
+
};
|
|
2550
|
+
} catch (error) {
|
|
2551
|
+
consola.error("Failed to initialize Biome:", error);
|
|
2552
|
+
throw error;
|
|
2553
|
+
}
|
|
2554
|
+
}
|
|
2555
|
+
function isSupportedFile(filePath) {
|
|
2556
|
+
const ext = path.extname(filePath).toLowerCase();
|
|
2557
|
+
const supportedExtensions = [
|
|
2558
|
+
".js",
|
|
2559
|
+
".jsx",
|
|
2560
|
+
".ts",
|
|
2561
|
+
".tsx",
|
|
2562
|
+
".json",
|
|
2563
|
+
".jsonc"
|
|
2564
|
+
];
|
|
2565
|
+
return supportedExtensions.includes(ext);
|
|
2566
|
+
}
|
|
2567
|
+
function shouldSkipFile(filePath) {
|
|
2568
|
+
const basename = path.basename(filePath);
|
|
2569
|
+
const skipPatterns = [
|
|
2570
|
+
".hbs",
|
|
2571
|
+
"package-lock.json",
|
|
2572
|
+
"yarn.lock",
|
|
2573
|
+
"pnpm-lock.yaml",
|
|
2574
|
+
"bun.lock",
|
|
2575
|
+
".d.ts"
|
|
2576
|
+
];
|
|
2577
|
+
return skipPatterns.some((pattern) => basename.includes(pattern));
|
|
2578
|
+
}
|
|
2579
|
+
async function formatFileWithBiome(filePath, content) {
|
|
2580
|
+
if (!isSupportedFile(filePath) || shouldSkipFile(filePath)) return null;
|
|
2581
|
+
try {
|
|
2582
|
+
const { biome: biomeInstance, projectKey: key } = await initializeBiome();
|
|
2583
|
+
const result = biomeInstance.formatContent(key, content, { filePath: path.basename(filePath) });
|
|
2584
|
+
if (result.diagnostics && result.diagnostics.length > 0) consola.debug(`Biome formatting diagnostics for ${filePath}:`, result.diagnostics);
|
|
2585
|
+
return result.content;
|
|
2586
|
+
} catch (error) {
|
|
2587
|
+
consola.warn(`Failed to format ${filePath} with Biome:`, error);
|
|
2588
|
+
return null;
|
|
2589
|
+
}
|
|
2590
|
+
}
|
|
2591
|
+
|
|
2521
2592
|
//#endregion
|
|
2522
2593
|
//#region src/utils/template-processor.ts
|
|
2523
|
-
/**
|
|
2524
|
-
* Processes a Handlebars template file and writes the output to the destination.
|
|
2525
|
-
* @param srcPath Path to the source .hbs template file.
|
|
2526
|
-
* @param destPath Path to write the processed file.
|
|
2527
|
-
* @param context Data to be passed to the Handlebars template.
|
|
2528
|
-
*/
|
|
2529
2594
|
async function processTemplate(srcPath, destPath, context) {
|
|
2530
2595
|
try {
|
|
2531
|
-
const templateContent = await fs.readFile(srcPath, "utf-8");
|
|
2532
|
-
const template = handlebars.compile(templateContent);
|
|
2533
|
-
const processedContent = template(context);
|
|
2534
2596
|
await fs.ensureDir(path.dirname(destPath));
|
|
2535
|
-
|
|
2597
|
+
let content;
|
|
2598
|
+
if (srcPath.endsWith(".hbs")) {
|
|
2599
|
+
const templateContent = await fs.readFile(srcPath, "utf-8");
|
|
2600
|
+
const template = handlebars.compile(templateContent);
|
|
2601
|
+
content = template(context);
|
|
2602
|
+
} else content = await fs.readFile(srcPath, "utf-8");
|
|
2603
|
+
try {
|
|
2604
|
+
const formattedContent = await formatFileWithBiome(destPath, content);
|
|
2605
|
+
if (formattedContent) content = formattedContent;
|
|
2606
|
+
} catch (formatError) {
|
|
2607
|
+
consola.debug(`Failed to format ${destPath}:`, formatError);
|
|
2608
|
+
}
|
|
2609
|
+
await fs.writeFile(destPath, content);
|
|
2536
2610
|
} catch (error) {
|
|
2537
2611
|
consola.error(`Error processing template ${srcPath}:`, error);
|
|
2538
2612
|
throw new Error(`Failed to process template ${srcPath}`);
|
|
@@ -2564,8 +2638,7 @@ async function processAndCopyFiles(sourcePattern, baseSourceDir, destDir, contex
|
|
|
2564
2638
|
const destPath = path.join(destDir, relativeDestPath);
|
|
2565
2639
|
await fs.ensureDir(path.dirname(destPath));
|
|
2566
2640
|
if (!overwrite && await fs.pathExists(destPath)) continue;
|
|
2567
|
-
|
|
2568
|
-
else await fs.copy(srcPath, destPath, { overwrite: true });
|
|
2641
|
+
await processTemplate(srcPath, destPath, context);
|
|
2569
2642
|
}
|
|
2570
2643
|
}
|
|
2571
2644
|
async function copyBaseTemplate(projectDir, context) {
|
|
@@ -3092,7 +3165,8 @@ async function setupNextAlchemyDeploy(projectDir, _packageManager, options) {
|
|
|
3092
3165
|
devDependencies: [
|
|
3093
3166
|
"alchemy",
|
|
3094
3167
|
"dotenv",
|
|
3095
|
-
"wrangler"
|
|
3168
|
+
"wrangler",
|
|
3169
|
+
"@cloudflare/workers-types"
|
|
3096
3170
|
],
|
|
3097
3171
|
projectDir: webAppDir
|
|
3098
3172
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-better-t-stack",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.44.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",
|
|
@@ -64,6 +64,8 @@
|
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
+
"@biomejs/js-api": "^3.0.0",
|
|
68
|
+
"@biomejs/wasm-nodejs": "^2.2.4",
|
|
67
69
|
"@clack/prompts": "^1.0.0-alpha.4",
|
|
68
70
|
"consola": "^3.4.2",
|
|
69
71
|
"execa": "^9.6.0",
|
|
@@ -21,16 +21,22 @@
|
|
|
21
21
|
],
|
|
22
22
|
"paths": {
|
|
23
23
|
"@/*": ["./src/*"]
|
|
24
|
-
}
|
|
24
|
+
}{{#if (or (eq serverDeploy "alchemy") (eq webDeploy "alchemy"))}},
|
|
25
|
+
"types": [
|
|
26
|
+
"@cloudflare/workers-types"
|
|
27
|
+
]{{/if}}
|
|
25
28
|
},
|
|
26
29
|
"include": [
|
|
30
|
+
{{#if (eq serverDeploy "alchemy")}}
|
|
31
|
+
"../server/env.d.ts",
|
|
32
|
+
{{/if}}
|
|
33
|
+
{{#if (eq serverDeploy "wrangler")}}
|
|
34
|
+
"../server/worker-configuration.d.ts",
|
|
35
|
+
{{/if}}
|
|
27
36
|
"./next-env.d.ts",
|
|
28
37
|
"./**/*.ts",
|
|
29
38
|
"./**/*.tsx",
|
|
30
|
-
"./.next/types/**/*.ts"
|
|
31
|
-
{{#if (eq runtime "workers")}}
|
|
32
|
-
"../server/worker-configuration.d.ts"
|
|
33
|
-
{{/if}}
|
|
39
|
+
"./.next/types/**/*.ts"
|
|
34
40
|
],
|
|
35
41
|
"exclude": [
|
|
36
42
|
"./node_modules"
|