create-better-t-stack 3.43.2 → 3.43.3
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-BSgSoI0r.mjs → src-uqnkdOQG.mjs} +11 -2
- package/package.json +3 -3
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { D as setProcessMode, i as SchemaNameSchema, l as create, m as getSchemaResult, s as add, u as createBtsCli, v as types_exports, y as getLatestCLIVersion } from "./src-
|
|
2
|
+
import { D as setProcessMode, i as SchemaNameSchema, l as create, m as getSchemaResult, s as add, u as createBtsCli, v as types_exports, y as getLatestCLIVersion } from "./src-uqnkdOQG.mjs";
|
|
3
3
|
import { lineByLineConsoleLogger } from "trpc-cli";
|
|
4
4
|
import z from "zod";
|
|
5
5
|
import { McpServer } from "@modelcontextprotocol/server";
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { C as DirectoryConflictError, E as ValidationError, S as DatabaseSetupError, T as UserCancelledError, _ as ProjectLauncherSchema, a as TEMPLATE_COUNT, b as CLIError, 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 ProjectCreationError, x as CompatibilityError } from "./src-
|
|
2
|
+
import { C as DirectoryConflictError, E as ValidationError, S as DatabaseSetupError, T as UserCancelledError, _ as ProjectLauncherSchema, a as TEMPLATE_COUNT, b as CLIError, 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 ProjectCreationError, x as CompatibilityError } from "./src-uqnkdOQG.mjs";
|
|
3
3
|
export { CLIError, CompatibilityError, DatabaseSetupError, DirectoryConflictError, EMBEDDED_TEMPLATES, GeneratorError, ProjectCreationError, ProjectLauncherSchema, Result, SchemaNameSchema, TEMPLATE_COUNT, UserCancelledError, ValidationError, VirtualFileSystem, add, builder, create, createBtsCli, createVirtual, docs, generate, getSchemaResult, router, sponsors };
|
|
@@ -23,6 +23,7 @@ import * as fs$1 from "node:fs/promises";
|
|
|
23
23
|
import { applyEdits, modify, parse } from "jsonc-parser";
|
|
24
24
|
import os$1 from "node:os";
|
|
25
25
|
import { clean, coerce, satisfies } from "semver";
|
|
26
|
+
import { ts } from "ts-morph";
|
|
26
27
|
import { format } from "oxfmt";
|
|
27
28
|
//#region src/utils/display-config.ts
|
|
28
29
|
const VALUE_LABELS = {
|
|
@@ -2381,10 +2382,18 @@ function addSvelteBetterAuthEvlogSetup(content, config) {
|
|
|
2381
2382
|
if (!content.includes("authHandle") || content.includes("evlogAuthHandle")) return content;
|
|
2382
2383
|
let nextContent = addNamedImport(content, "evlog/better-auth", ["createAuthMiddleware", "type BetterAuthInstance"]);
|
|
2383
2384
|
if (!nextContent.includes("from \"./services\"")) nextContent = prependMissingImports(nextContent, [getAuthImportLine(config, "./services")]);
|
|
2384
|
-
|
|
2385
|
+
let environmentBinding = "ENV";
|
|
2386
|
+
if (usesCreateAuthFactory(config) && config.webDeploy === "cloudflare") {
|
|
2387
|
+
const environmentImport = ts.createSourceFile("hooks.server.ts", nextContent, ts.ScriptTarget.Latest).statements.filter(ts.isImportDeclaration).filter((statement) => ts.isStringLiteral(statement.moduleSpecifier) && statement.moduleSpecifier.text === "./env.server" && !statement.importClause?.isTypeOnly).flatMap((statement) => {
|
|
2388
|
+
const bindings = statement.importClause?.namedBindings;
|
|
2389
|
+
return bindings && ts.isNamedImports(bindings) ? [...bindings.elements] : [];
|
|
2390
|
+
}).find((specifier) => !specifier.isTypeOnly && ["ENV", "env"].includes((specifier.propertyName ?? specifier.name).text));
|
|
2391
|
+
if (environmentImport) environmentBinding = environmentImport.name.text;
|
|
2392
|
+
else nextContent = prependMissingImports(nextContent, ["import { ENV } from \"./env.server\";"]);
|
|
2393
|
+
}
|
|
2385
2394
|
const authExpression = getAuthExpression(config);
|
|
2386
2395
|
const authOptions = "{ exclude: [\"/api/auth/**\"], maskEmail: true }";
|
|
2387
|
-
const authHandleSnippet = usesCreateAuthFactory(config) && config.webDeploy === "cloudflare" ? `const evlogAuthHandle: Handle = async ({ event, resolve }) => {\n\tif (building) {\n\t\treturn resolve(event);\n\t}\n\n\tconst authEnv = event.platform?.env ??
|
|
2396
|
+
const authHandleSnippet = usesCreateAuthFactory(config) && config.webDeploy === "cloudflare" ? `const evlogAuthHandle: Handle = async ({ event, resolve }) => {\n\tif (building) {\n\t\treturn resolve(event);\n\t}\n\n\tconst authEnv = event.platform?.env ?? ${environmentBinding};\n\tconst identifyUser = createAuthMiddleware((await createAuth(authEnv)) as BetterAuthInstance, ${authOptions});\n\tawait identifyUser(event.locals.log, event.request.headers, event.url.pathname);\n\treturn resolve(event);\n};\n\n` : `const identifyUser = createAuthMiddleware(${authExpression} as BetterAuthInstance, ${authOptions});\n\nconst evlogAuthHandle: Handle = async ({ event, resolve }) => {\n\tawait identifyUser(event.locals.log, event.request.headers, event.url.pathname);\n\treturn resolve(event);\n};\n\n`;
|
|
2388
2397
|
const evlogHandleDeclaration = nextContent.match(/const \{ handle: evlogHandle, handleError \} = createEvlogHooks\([\s\S]*?\);\n\n/)?.[0];
|
|
2389
2398
|
if (evlogHandleDeclaration) nextContent = insertAfterOnce(nextContent, evlogHandleDeclaration, authHandleSnippet, "evlogAuthHandle");
|
|
2390
2399
|
return nextContent.replace("sequence(evlogHandle as Handle, authHandle)", "sequence(evlogHandle as Handle, evlogAuthHandle, authHandle)").replace("sequence(evlogHandle, authHandle)", "sequence(evlogHandle as Handle, evlogAuthHandle, authHandle)");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-better-t-stack",
|
|
3
|
-
"version": "3.43.
|
|
3
|
+
"version": "3.43.3",
|
|
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,8 +70,8 @@
|
|
|
70
70
|
"prepublishOnly": "npm run build"
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@better-t-stack/template-generator": "^3.43.
|
|
74
|
-
"@better-t-stack/types": "^3.43.
|
|
73
|
+
"@better-t-stack/template-generator": "^3.43.3",
|
|
74
|
+
"@better-t-stack/types": "^3.43.3",
|
|
75
75
|
"@clack/core": "^1.5.0",
|
|
76
76
|
"@clack/prompts": "^1.8.0",
|
|
77
77
|
"@modelcontextprotocol/server": "2.0.0",
|