create-better-t-stack 3.26.0 → 3.26.1
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.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{src-BVuxTUEs.mjs → src-Kus6HC8q.mjs} +104 -70
- package/package.json +4 -4
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { _ as types_exports, i as SchemaNameSchema, l as create, m as getSchemaResult, s as add, u as createBtsCli, v as getLatestCLIVersion } from "./src-
|
|
2
|
+
import { _ as types_exports, i as SchemaNameSchema, l as create, m as getSchemaResult, s as add, u as createBtsCli, v as getLatestCLIVersion } from "./src-Kus6HC8q.mjs";
|
|
3
3
|
import z from "zod";
|
|
4
4
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
5
5
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { C as ProjectCreationError, S as DirectoryConflictError, T as ValidationError, a as TEMPLATE_COUNT, b as CompatibilityError, c as builder, d as createVirtual, f as docs, g as sponsors, h as router, i as SchemaNameSchema, l as create, m as getSchemaResult, n as GeneratorError, o as VirtualFileSystem, p as generate, r as Result, s as add, t as EMBEDDED_TEMPLATES, u as createBtsCli, w as UserCancelledError, x as DatabaseSetupError, y as CLIError } from "./src-
|
|
2
|
+
import { C as ProjectCreationError, S as DirectoryConflictError, T as ValidationError, a as TEMPLATE_COUNT, b as CompatibilityError, c as builder, d as createVirtual, f as docs, g as sponsors, h as router, i as SchemaNameSchema, l as create, m as getSchemaResult, n as GeneratorError, o as VirtualFileSystem, p as generate, r as Result, s as add, t as EMBEDDED_TEMPLATES, u as createBtsCli, w as UserCancelledError, x as DatabaseSetupError, y as CLIError } from "./src-Kus6HC8q.mjs";
|
|
3
3
|
export { CLIError, CompatibilityError, DatabaseSetupError, DirectoryConflictError, EMBEDDED_TEMPLATES, GeneratorError, ProjectCreationError, Result, SchemaNameSchema, TEMPLATE_COUNT, UserCancelledError, ValidationError, VirtualFileSystem, add, builder, create, createBtsCli, createVirtual, docs, generate, getSchemaResult, router, sponsors };
|
|
@@ -12,7 +12,7 @@ import envPaths from "env-paths";
|
|
|
12
12
|
import fs from "fs-extra";
|
|
13
13
|
import { fileURLToPath } from "node:url";
|
|
14
14
|
import { desktopWebFrontends as desktopWebFrontends$3 } from "@better-t-stack/types";
|
|
15
|
-
import { EMBEDDED_TEMPLATES, EMBEDDED_TEMPLATES as EMBEDDED_TEMPLATES$1, GeneratorError as GeneratorError$1, TEMPLATE_COUNT, VirtualFileSystem, VirtualFileSystem as VirtualFileSystem$1, dependencyVersionMap, generate, generate as generate$1, generateReproducibleCommand, processAddonTemplates, processAddonsDeps } from "@better-t-stack/template-generator";
|
|
15
|
+
import { EMBEDDED_TEMPLATES, EMBEDDED_TEMPLATES as EMBEDDED_TEMPLATES$1, GeneratorError, GeneratorError as GeneratorError$1, TEMPLATE_COUNT, VirtualFileSystem, VirtualFileSystem as VirtualFileSystem$1, dependencyVersionMap, generate, generate as generate$1, generateReproducibleCommand, processAddonTemplates, processAddonsDeps } from "@better-t-stack/template-generator";
|
|
16
16
|
import { consola, createConsola } from "consola";
|
|
17
17
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
18
18
|
import gradient from "gradient-string";
|
|
@@ -728,6 +728,21 @@ const WEB_FRAMEWORKS = [
|
|
|
728
728
|
];
|
|
729
729
|
//#endregion
|
|
730
730
|
//#region src/utils/compatibility-rules.ts
|
|
731
|
+
const CONVEX_BETTER_AUTH_INCOMPATIBLE_FRONTENDS = [
|
|
732
|
+
"nuxt",
|
|
733
|
+
"svelte",
|
|
734
|
+
"solid",
|
|
735
|
+
"astro"
|
|
736
|
+
];
|
|
737
|
+
const CONVEX_BETTER_AUTH_SUPPORTED_FRONTENDS = [
|
|
738
|
+
"tanstack-router",
|
|
739
|
+
"react-router",
|
|
740
|
+
"tanstack-start",
|
|
741
|
+
"next",
|
|
742
|
+
"native-bare",
|
|
743
|
+
"native-uniwind",
|
|
744
|
+
"native-unistyles"
|
|
745
|
+
];
|
|
731
746
|
function validationErr$1(message) {
|
|
732
747
|
return Result.err(new ValidationError({ message }));
|
|
733
748
|
}
|
|
@@ -781,7 +796,10 @@ function validateApiFrontendCompatibility(api, frontends = []) {
|
|
|
781
796
|
return Result.ok(void 0);
|
|
782
797
|
}
|
|
783
798
|
function isFrontendAllowedWithBackend(frontend, backend, auth) {
|
|
784
|
-
if (backend === "convex"
|
|
799
|
+
if (backend === "convex") {
|
|
800
|
+
if (auth === "better-auth" && CONVEX_BETTER_AUTH_INCOMPATIBLE_FRONTENDS.includes(frontend)) return false;
|
|
801
|
+
if (frontend === "solid" || frontend === "astro") return false;
|
|
802
|
+
}
|
|
785
803
|
if (auth === "clerk") {
|
|
786
804
|
if ([
|
|
787
805
|
"nuxt",
|
|
@@ -792,6 +810,9 @@ function isFrontendAllowedWithBackend(frontend, backend, auth) {
|
|
|
792
810
|
}
|
|
793
811
|
return true;
|
|
794
812
|
}
|
|
813
|
+
function supportsConvexBetterAuth(frontends = []) {
|
|
814
|
+
return frontends.some((frontend) => CONVEX_BETTER_AUTH_SUPPORTED_FRONTENDS.includes(frontend));
|
|
815
|
+
}
|
|
795
816
|
function allowedApisForFrontends(frontends = []) {
|
|
796
817
|
const includesNuxt = frontends.includes("nuxt");
|
|
797
818
|
const includesSvelte = frontends.includes("svelte");
|
|
@@ -3215,21 +3236,9 @@ async function getApiChoice(Api, frontend, backend) {
|
|
|
3215
3236
|
}
|
|
3216
3237
|
//#endregion
|
|
3217
3238
|
//#region src/prompts/auth.ts
|
|
3218
|
-
|
|
3219
|
-
if (
|
|
3220
|
-
|
|
3221
|
-
const supportedBetterAuthFrontends = frontend?.some((f) => [
|
|
3222
|
-
"tanstack-router",
|
|
3223
|
-
"tanstack-start",
|
|
3224
|
-
"next",
|
|
3225
|
-
"nuxt",
|
|
3226
|
-
"svelte",
|
|
3227
|
-
"solid",
|
|
3228
|
-
"native-bare",
|
|
3229
|
-
"native-uniwind",
|
|
3230
|
-
"native-unistyles"
|
|
3231
|
-
].includes(f));
|
|
3232
|
-
const hasClerkCompatibleFrontends = frontend?.some((f) => [
|
|
3239
|
+
function getAvailableAuthProviders(backend, frontend = []) {
|
|
3240
|
+
if (backend === "none") return ["none"];
|
|
3241
|
+
const hasClerkCompatibleFrontends = frontend.some((f) => [
|
|
3233
3242
|
"react-router",
|
|
3234
3243
|
"tanstack-router",
|
|
3235
3244
|
"tanstack-start",
|
|
@@ -3240,26 +3249,34 @@ async function getAuthChoice(auth, backend, frontend) {
|
|
|
3240
3249
|
].includes(f));
|
|
3241
3250
|
const options = [];
|
|
3242
3251
|
if (backend === "convex") {
|
|
3243
|
-
if (
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3252
|
+
if (supportsConvexBetterAuth(frontend)) options.push("better-auth");
|
|
3253
|
+
} else options.push("better-auth");
|
|
3254
|
+
if (hasClerkCompatibleFrontends) options.push("clerk");
|
|
3255
|
+
if (options.length === 0) return ["none"];
|
|
3256
|
+
return [...options, "none"];
|
|
3257
|
+
}
|
|
3258
|
+
async function getAuthChoice(auth, backend, frontend = []) {
|
|
3259
|
+
if (auth !== void 0) return auth;
|
|
3260
|
+
const availableProviders = getAvailableAuthProviders(backend, frontend);
|
|
3261
|
+
if (availableProviders.length === 1 && availableProviders[0] === "none") return "none";
|
|
3262
|
+
const options = availableProviders.map((provider) => {
|
|
3263
|
+
switch (provider) {
|
|
3264
|
+
case "better-auth": return {
|
|
3265
|
+
value: "better-auth",
|
|
3266
|
+
label: "Better-Auth",
|
|
3267
|
+
hint: "comprehensive auth framework for TypeScript"
|
|
3268
|
+
};
|
|
3269
|
+
case "clerk": return {
|
|
3270
|
+
value: "clerk",
|
|
3271
|
+
label: "Clerk",
|
|
3272
|
+
hint: "More than auth, Complete User Management"
|
|
3273
|
+
};
|
|
3274
|
+
default: return {
|
|
3275
|
+
value: "none",
|
|
3276
|
+
label: "None",
|
|
3277
|
+
hint: "No auth"
|
|
3278
|
+
};
|
|
3279
|
+
}
|
|
3263
3280
|
});
|
|
3264
3281
|
const response = await navigableSelect({
|
|
3265
3282
|
message: "Select authentication provider",
|
|
@@ -4356,15 +4373,10 @@ function validateConvexConstraints(config, providedFlags) {
|
|
|
4356
4373
|
if (has("dbSetup") && config.dbSetup !== "none") return validationErr("Convex backend requires '--db-setup none'. Please remove the --db-setup flag or set it to 'none'.");
|
|
4357
4374
|
if (has("serverDeploy") && config.serverDeploy !== "none") return validationErr("Convex backend requires '--server-deploy none'. Please remove the --server-deploy flag or set it to 'none'.");
|
|
4358
4375
|
if (has("auth") && config.auth === "better-auth") {
|
|
4359
|
-
const
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
"native-bare",
|
|
4364
|
-
"native-uniwind",
|
|
4365
|
-
"native-unistyles"
|
|
4366
|
-
];
|
|
4367
|
-
if (!config.frontend?.some((f) => supportedFrontends.includes(f))) return validationErr("Better-Auth with Convex backend requires a supported frontend (TanStack Router, TanStack Start, Next.js, or Native).");
|
|
4376
|
+
const incompatibleFrontends = config.frontend?.filter((f) => CONVEX_BETTER_AUTH_INCOMPATIBLE_FRONTENDS.includes(f)) ?? [];
|
|
4377
|
+
const hasSupportedFrontend = supportsConvexBetterAuth(config.frontend);
|
|
4378
|
+
if (incompatibleFrontends.length > 0) return validationErr(`Better Auth with '--backend convex' is not compatible with the following frontends: ${incompatibleFrontends.join(", ")}. Please use a React-based web frontend (next, tanstack-start, tanstack-router, react-router), a supported native frontend, or choose a different auth provider.`);
|
|
4379
|
+
if (!hasSupportedFrontend) return validationErr(`Better Auth with '--backend convex' requires a supported frontend (${CONVEX_BETTER_AUTH_SUPPORTED_FRONTENDS.join(", ")}).`);
|
|
4368
4380
|
}
|
|
4369
4381
|
return Result.ok(void 0);
|
|
4370
4382
|
}
|
|
@@ -5998,9 +6010,10 @@ async function displayPostInstallInstructions(config) {
|
|
|
5998
6010
|
const hasWeb = frontend?.some((f) => types_exports.desktopWebFrontends.includes(f));
|
|
5999
6011
|
const hasNative = frontend?.includes("native-bare") || frontend?.includes("native-uniwind") || frontend?.includes("native-unistyles");
|
|
6000
6012
|
const hasReactRouter = frontend?.includes("react-router");
|
|
6013
|
+
const hasTanStackRouter = frontend?.includes("tanstack-router");
|
|
6001
6014
|
const hasSvelte = frontend?.includes("svelte");
|
|
6002
6015
|
const hasAstro = frontend?.includes("astro");
|
|
6003
|
-
const webPort = hasReactRouter || hasSvelte ? "5173" : hasAstro ? "4321" : "3001";
|
|
6016
|
+
const webPort = hasReactRouter || hasTanStackRouter || hasSvelte ? "5173" : hasAstro ? "4321" : "3001";
|
|
6004
6017
|
const betterAuthConvexInstructions = isConvex && config.auth === "better-auth" ? getBetterAuthConvexInstructions(hasWeb ?? false, webPort, packageManager) : "";
|
|
6005
6018
|
const bunWebNativeWarning = packageManager === "bun" && hasNative && hasWeb ? getBunWebNativeWarning() : "";
|
|
6006
6019
|
const noOrmWarning = !isConvex && database !== "none" && orm === "none" ? getNoOrmWarning() : "";
|
|
@@ -6819,30 +6832,51 @@ async function builder() {
|
|
|
6819
6832
|
* ```
|
|
6820
6833
|
*/
|
|
6821
6834
|
async function createVirtual(options) {
|
|
6835
|
+
const config = {
|
|
6836
|
+
projectName: options.projectName || "my-project",
|
|
6837
|
+
projectDir: "/virtual",
|
|
6838
|
+
relativePath: "./virtual",
|
|
6839
|
+
addonOptions: options.addonOptions,
|
|
6840
|
+
dbSetupOptions: options.dbSetupOptions,
|
|
6841
|
+
database: options.database || "none",
|
|
6842
|
+
orm: options.orm || "none",
|
|
6843
|
+
backend: options.backend || "hono",
|
|
6844
|
+
runtime: options.runtime || "bun",
|
|
6845
|
+
frontend: options.frontend || ["tanstack-router"],
|
|
6846
|
+
addons: options.addons || [],
|
|
6847
|
+
examples: options.examples || [],
|
|
6848
|
+
auth: options.auth || "none",
|
|
6849
|
+
payments: options.payments || "none",
|
|
6850
|
+
git: options.git ?? false,
|
|
6851
|
+
packageManager: options.packageManager || "bun",
|
|
6852
|
+
install: false,
|
|
6853
|
+
dbSetup: options.dbSetup || "none",
|
|
6854
|
+
api: options.api || "trpc",
|
|
6855
|
+
webDeploy: options.webDeploy || "none",
|
|
6856
|
+
serverDeploy: options.serverDeploy || "none"
|
|
6857
|
+
};
|
|
6858
|
+
const validationResult = validateConfigCompatibility(config, new Set([
|
|
6859
|
+
"database",
|
|
6860
|
+
"orm",
|
|
6861
|
+
"backend",
|
|
6862
|
+
"runtime",
|
|
6863
|
+
"frontend",
|
|
6864
|
+
"addons",
|
|
6865
|
+
"examples",
|
|
6866
|
+
"auth",
|
|
6867
|
+
"dbSetup",
|
|
6868
|
+
"payments",
|
|
6869
|
+
"api",
|
|
6870
|
+
"webDeploy",
|
|
6871
|
+
"serverDeploy"
|
|
6872
|
+
]), config);
|
|
6873
|
+
if (validationResult.isErr()) return Result.err(new GeneratorError({
|
|
6874
|
+
message: validationResult.error.message,
|
|
6875
|
+
phase: "validation",
|
|
6876
|
+
cause: validationResult.error
|
|
6877
|
+
}));
|
|
6822
6878
|
return generate({
|
|
6823
|
-
config
|
|
6824
|
-
projectName: options.projectName || "my-project",
|
|
6825
|
-
projectDir: "/virtual",
|
|
6826
|
-
relativePath: "./virtual",
|
|
6827
|
-
addonOptions: options.addonOptions,
|
|
6828
|
-
dbSetupOptions: options.dbSetupOptions,
|
|
6829
|
-
database: options.database || "none",
|
|
6830
|
-
orm: options.orm || "none",
|
|
6831
|
-
backend: options.backend || "hono",
|
|
6832
|
-
runtime: options.runtime || "bun",
|
|
6833
|
-
frontend: options.frontend || ["tanstack-router"],
|
|
6834
|
-
addons: options.addons || [],
|
|
6835
|
-
examples: options.examples || [],
|
|
6836
|
-
auth: options.auth || "none",
|
|
6837
|
-
payments: options.payments || "none",
|
|
6838
|
-
git: options.git ?? false,
|
|
6839
|
-
packageManager: options.packageManager || "bun",
|
|
6840
|
-
install: false,
|
|
6841
|
-
dbSetup: options.dbSetup || "none",
|
|
6842
|
-
api: options.api || "trpc",
|
|
6843
|
-
webDeploy: options.webDeploy || "none",
|
|
6844
|
-
serverDeploy: options.serverDeploy || "none"
|
|
6845
|
-
},
|
|
6879
|
+
config,
|
|
6846
6880
|
templates: EMBEDDED_TEMPLATES
|
|
6847
6881
|
});
|
|
6848
6882
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-better-t-stack",
|
|
3
|
-
"version": "3.26.
|
|
3
|
+
"version": "3.26.1",
|
|
4
4
|
"description": "A modern CLI tool for scaffolding end-to-end type-safe TypeScript projects with best practices and customizable configurations",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"better-auth",
|
|
@@ -70,12 +70,12 @@
|
|
|
70
70
|
"prepublishOnly": "npm run build"
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@better-t-stack/template-generator": "^3.26.
|
|
74
|
-
"@better-t-stack/types": "^3.26.
|
|
73
|
+
"@better-t-stack/template-generator": "^3.26.1",
|
|
74
|
+
"@better-t-stack/types": "^3.26.1",
|
|
75
75
|
"@clack/core": "^1.1.0",
|
|
76
76
|
"@clack/prompts": "^1.1.0",
|
|
77
77
|
"@modelcontextprotocol/sdk": "1.27.1",
|
|
78
|
-
"@trpc/server": "^11.4
|
|
78
|
+
"@trpc/server": "^11.13.4",
|
|
79
79
|
"better-result": "^2.7.0",
|
|
80
80
|
"consola": "^3.4.2",
|
|
81
81
|
"env-paths": "^4.0.0",
|