create-better-t-stack 2.29.0 → 2.29.2
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/index.js +26 -33
- package/package.json +6 -7
- package/templates/extras/bunfig.toml.hbs +1 -1
package/dist/index.js
CHANGED
|
@@ -7,7 +7,6 @@ import z from "zod";
|
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
import fs from "fs-extra";
|
|
9
9
|
import { fileURLToPath } from "node:url";
|
|
10
|
-
import { PostHog } from "posthog-node";
|
|
11
10
|
import gradient from "gradient-string";
|
|
12
11
|
import * as JSONC from "jsonc-parser";
|
|
13
12
|
import { $, execa } from "execa";
|
|
@@ -1136,31 +1135,28 @@ function isTelemetryEnabled() {
|
|
|
1136
1135
|
const POSTHOG_API_KEY = "phc_8ZUxEwwfKMajJLvxz1daGd931dYbQrwKNficBmsdIrs";
|
|
1137
1136
|
const POSTHOG_HOST = "https://us.i.posthog.com";
|
|
1138
1137
|
async function trackProjectCreation(config) {
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1138
|
+
if (!isTelemetryEnabled()) return;
|
|
1139
|
+
const sessionId = `cli_${crypto.randomUUID().replace(/-/g, "")}`;
|
|
1140
|
+
const { projectName, projectDir, relativePath,...safeConfig } = config;
|
|
1141
|
+
const payload = {
|
|
1142
|
+
api_key: POSTHOG_API_KEY,
|
|
1143
|
+
event: "project_created",
|
|
1144
|
+
properties: {
|
|
1145
|
+
...safeConfig,
|
|
1146
|
+
cli_version: getLatestCLIVersion(),
|
|
1147
|
+
node_version: process.version,
|
|
1148
|
+
platform: process.platform,
|
|
1149
|
+
$ip: null
|
|
1150
|
+
},
|
|
1151
|
+
distinct_id: sessionId
|
|
1152
|
+
};
|
|
1147
1153
|
try {
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
event: "project_created",
|
|
1153
|
-
properties: {
|
|
1154
|
-
...safeConfig,
|
|
1155
|
-
cli_version: getLatestCLIVersion(),
|
|
1156
|
-
node_version: process.version,
|
|
1157
|
-
platform: process.platform,
|
|
1158
|
-
$ip: null
|
|
1159
|
-
}
|
|
1154
|
+
await fetch(`${POSTHOG_HOST}/capture`, {
|
|
1155
|
+
method: "POST",
|
|
1156
|
+
headers: { "Content-Type": "application/json" },
|
|
1157
|
+
body: JSON.stringify(payload)
|
|
1160
1158
|
});
|
|
1161
|
-
} catch (_error) {}
|
|
1162
|
-
await posthog.shutdown();
|
|
1163
|
-
}
|
|
1159
|
+
} catch (_error) {}
|
|
1164
1160
|
}
|
|
1165
1161
|
|
|
1166
1162
|
//#endregion
|
|
@@ -1620,7 +1616,7 @@ const BTS_CONFIG_FILE = "bts.jsonc";
|
|
|
1620
1616
|
async function writeBtsConfig(projectConfig) {
|
|
1621
1617
|
const btsConfig = {
|
|
1622
1618
|
version: getLatestCLIVersion(),
|
|
1623
|
-
createdAt: new Date().toISOString(),
|
|
1619
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1624
1620
|
database: projectConfig.database,
|
|
1625
1621
|
orm: projectConfig.orm,
|
|
1626
1622
|
backend: projectConfig.backend,
|
|
@@ -1635,7 +1631,7 @@ async function writeBtsConfig(projectConfig) {
|
|
|
1635
1631
|
webDeploy: projectConfig.webDeploy
|
|
1636
1632
|
};
|
|
1637
1633
|
const baseContent = {
|
|
1638
|
-
$schema: "https://better-t-stack.dev/schema.json",
|
|
1634
|
+
$schema: "https://r2.better-t-stack.dev/schema.json",
|
|
1639
1635
|
version: btsConfig.version,
|
|
1640
1636
|
createdAt: btsConfig.createdAt,
|
|
1641
1637
|
database: btsConfig.database,
|
|
@@ -1861,11 +1857,11 @@ async function setupTauri(config) {
|
|
|
1861
1857
|
};
|
|
1862
1858
|
await fs.writeJson(clientPackageJsonPath, packageJson, { spaces: 2 });
|
|
1863
1859
|
}
|
|
1864
|
-
|
|
1860
|
+
frontend.includes("tanstack-router");
|
|
1865
1861
|
const hasReactRouter = frontend.includes("react-router");
|
|
1866
1862
|
const hasNuxt = frontend.includes("nuxt");
|
|
1867
1863
|
const hasSvelte = frontend.includes("svelte");
|
|
1868
|
-
|
|
1864
|
+
frontend.includes("solid");
|
|
1869
1865
|
const hasNext = frontend.includes("next");
|
|
1870
1866
|
const devUrl = hasReactRouter || hasSvelte ? "http://localhost:5173" : hasNext ? "http://localhost:3001" : "http://localhost:3001";
|
|
1871
1867
|
const frontendDist = hasNuxt ? "../.output/public" : hasSvelte ? "../build" : hasNext ? "../.next" : hasReactRouter ? "../build/client" : "../dist";
|
|
@@ -2294,7 +2290,6 @@ async function setupFrontendTemplates(projectDir, context) {
|
|
|
2294
2290
|
const hasSolidWeb = context.frontend.includes("solid");
|
|
2295
2291
|
const hasNativeWind = context.frontend.includes("native-nativewind");
|
|
2296
2292
|
const hasUnistyles = context.frontend.includes("native-unistyles");
|
|
2297
|
-
const _hasNative = hasNativeWind || hasUnistyles;
|
|
2298
2293
|
const isConvex = context.backend === "convex";
|
|
2299
2294
|
if (hasReactWeb || hasNuxtWeb || hasSvelteWeb || hasSolidWeb) {
|
|
2300
2295
|
const webAppDir = path.join(projectDir, "apps/web");
|
|
@@ -2705,7 +2700,7 @@ async function setupNuxtWorkersDeploy(projectDir, packageManager) {
|
|
|
2705
2700
|
if (!defineCall) return;
|
|
2706
2701
|
const configObj = defineCall.getArguments()[0];
|
|
2707
2702
|
if (!configObj) return;
|
|
2708
|
-
const today = new Date().toISOString().slice(0, 10);
|
|
2703
|
+
const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
2709
2704
|
const compatProp = configObj.getProperty("compatibilityDate");
|
|
2710
2705
|
if (compatProp && compatProp.getKind() === SyntaxKind.PropertyAssignment) compatProp.setInitializer(`'${today}'`);
|
|
2711
2706
|
else configObj.addPropertyAssignment({
|
|
@@ -3206,7 +3201,7 @@ async function setupAuth(config) {
|
|
|
3206
3201
|
function generateAuthSecret(length = 32) {
|
|
3207
3202
|
const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
3208
3203
|
let result = "";
|
|
3209
|
-
const charactersLength =
|
|
3204
|
+
const charactersLength = 62;
|
|
3210
3205
|
for (let i = 0; i < length; i++) result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
|
3211
3206
|
return result;
|
|
3212
3207
|
}
|
|
@@ -4178,13 +4173,11 @@ DATABASE_AUTH_TOKEN=your_auth_token`);
|
|
|
4178
4173
|
}
|
|
4179
4174
|
async function setupTurso(config) {
|
|
4180
4175
|
const { orm, projectDir } = config;
|
|
4181
|
-
const _isDrizzle = orm === "drizzle";
|
|
4182
4176
|
const setupSpinner = spinner();
|
|
4183
4177
|
setupSpinner.start("Checking Turso CLI availability...");
|
|
4184
4178
|
try {
|
|
4185
4179
|
const platform = os.platform();
|
|
4186
4180
|
const isMac = platform === "darwin";
|
|
4187
|
-
const _isLinux = platform === "linux";
|
|
4188
4181
|
const isWindows = platform === "win32";
|
|
4189
4182
|
if (isWindows) {
|
|
4190
4183
|
setupSpinner.stop(pc.yellow("Turso setup not supported on Windows"));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-better-t-stack",
|
|
3
|
-
"version": "2.29.
|
|
3
|
+
"version": "2.29.2",
|
|
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",
|
|
@@ -62,15 +62,14 @@
|
|
|
62
62
|
"handlebars": "^4.7.8",
|
|
63
63
|
"jsonc-parser": "^3.3.1",
|
|
64
64
|
"picocolors": "^1.1.1",
|
|
65
|
-
"
|
|
66
|
-
"trpc-cli": "^0.10.0",
|
|
65
|
+
"trpc-cli": "^0.10.2",
|
|
67
66
|
"ts-morph": "^26.0.0",
|
|
68
|
-
"zod": "^4.0.
|
|
67
|
+
"zod": "^4.0.14"
|
|
69
68
|
},
|
|
70
69
|
"devDependencies": {
|
|
71
70
|
"@types/fs-extra": "^11.0.4",
|
|
72
|
-
"@types/node": "^24.0
|
|
73
|
-
"tsdown": "^0.
|
|
74
|
-
"typescript": "^5.
|
|
71
|
+
"@types/node": "^24.2.0",
|
|
72
|
+
"tsdown": "^0.13.3",
|
|
73
|
+
"typescript": "^5.9.2"
|
|
75
74
|
}
|
|
76
75
|
}
|