create-better-t-stack 3.1.0 → 3.1.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/cli.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -3995,46 +3995,6 @@ async function addDeploymentToProject(input) {
|
|
|
3995
3995
|
}
|
|
3996
3996
|
}
|
|
3997
3997
|
|
|
3998
|
-
//#endregion
|
|
3999
|
-
//#region src/utils/better-auth-plugin-setup.ts
|
|
4000
|
-
async function setupBetterAuthPlugins(projectDir, config) {
|
|
4001
|
-
const authIndexPath = `${projectDir}/packages/auth/src/index.ts`;
|
|
4002
|
-
const authIndexFile = tsProject.addSourceFileAtPath(authIndexPath);
|
|
4003
|
-
if (!authIndexFile) {
|
|
4004
|
-
console.warn("Better Auth index file not found, skipping plugin setup");
|
|
4005
|
-
return;
|
|
4006
|
-
}
|
|
4007
|
-
const pluginsToAdd = [];
|
|
4008
|
-
const importsToAdd = [];
|
|
4009
|
-
if (config.backend === "self" && config.frontend?.includes("tanstack-start")) {
|
|
4010
|
-
pluginsToAdd.push("reactStartCookies()");
|
|
4011
|
-
importsToAdd.push("import { reactStartCookies } from \"better-auth/react-start\";");
|
|
4012
|
-
}
|
|
4013
|
-
if (config.frontend?.includes("native-nativewind") || config.frontend?.includes("native-unistyles")) {
|
|
4014
|
-
pluginsToAdd.push("expo()");
|
|
4015
|
-
importsToAdd.push("import { expo } from \"@better-auth/expo\";");
|
|
4016
|
-
}
|
|
4017
|
-
if (pluginsToAdd.length === 0) return;
|
|
4018
|
-
importsToAdd.forEach((importStatement) => {
|
|
4019
|
-
if (!authIndexFile.getImportDeclaration((declaration) => declaration.getModuleSpecifierValue().includes(importStatement.split("\"")[1]))) authIndexFile.insertImportDeclaration(0, {
|
|
4020
|
-
moduleSpecifier: importStatement.split("\"")[1],
|
|
4021
|
-
namedImports: [importStatement.split("{")[1].split("}")[0].trim()]
|
|
4022
|
-
});
|
|
4023
|
-
});
|
|
4024
|
-
const betterAuthCall = authIndexFile.getDescendantsOfKind(SyntaxKind.CallExpression).find((call) => call.getExpression().getText() === "betterAuth");
|
|
4025
|
-
if (betterAuthCall) {
|
|
4026
|
-
const configObject = betterAuthCall.getArguments()[0];
|
|
4027
|
-
if (configObject && configObject.getKind() === SyntaxKind.ObjectLiteralExpression) {
|
|
4028
|
-
const objLiteral = configObject.asKindOrThrow(SyntaxKind.ObjectLiteralExpression);
|
|
4029
|
-
const pluginsArray = ensureArrayProperty(objLiteral, "plugins");
|
|
4030
|
-
pluginsToAdd.forEach((plugin) => {
|
|
4031
|
-
pluginsArray.addElement(plugin);
|
|
4032
|
-
});
|
|
4033
|
-
}
|
|
4034
|
-
}
|
|
4035
|
-
authIndexFile.save();
|
|
4036
|
-
}
|
|
4037
|
-
|
|
4038
3998
|
//#endregion
|
|
4039
3999
|
//#region src/utils/setup-catalogs.ts
|
|
4040
4000
|
async function setupCatalogs(projectDir, options) {
|
|
@@ -4419,6 +4379,43 @@ async function setupBackendDependencies(config) {
|
|
|
4419
4379
|
});
|
|
4420
4380
|
}
|
|
4421
4381
|
|
|
4382
|
+
//#endregion
|
|
4383
|
+
//#region src/utils/better-auth-plugin-setup.ts
|
|
4384
|
+
async function setupBetterAuthPlugins(projectDir, config) {
|
|
4385
|
+
const authIndexPath = `${projectDir}/packages/auth/src/index.ts`;
|
|
4386
|
+
const authIndexFile = tsProject.addSourceFileAtPath(authIndexPath);
|
|
4387
|
+
if (!authIndexFile) return;
|
|
4388
|
+
const pluginsToAdd = [];
|
|
4389
|
+
const importsToAdd = [];
|
|
4390
|
+
if (config.backend === "self" && config.frontend?.includes("tanstack-start")) {
|
|
4391
|
+
pluginsToAdd.push("reactStartCookies()");
|
|
4392
|
+
importsToAdd.push("import { reactStartCookies } from \"better-auth/react-start\";");
|
|
4393
|
+
}
|
|
4394
|
+
if (config.frontend?.includes("native-nativewind") || config.frontend?.includes("native-unistyles")) {
|
|
4395
|
+
pluginsToAdd.push("expo()");
|
|
4396
|
+
importsToAdd.push("import { expo } from \"@better-auth/expo\";");
|
|
4397
|
+
}
|
|
4398
|
+
if (pluginsToAdd.length === 0) return;
|
|
4399
|
+
importsToAdd.forEach((importStatement) => {
|
|
4400
|
+
if (!authIndexFile.getImportDeclaration((declaration) => declaration.getModuleSpecifierValue().includes(importStatement.split("\"")[1]))) authIndexFile.insertImportDeclaration(0, {
|
|
4401
|
+
moduleSpecifier: importStatement.split("\"")[1],
|
|
4402
|
+
namedImports: [importStatement.split("{")[1].split("}")[0].trim()]
|
|
4403
|
+
});
|
|
4404
|
+
});
|
|
4405
|
+
const betterAuthCall = authIndexFile.getDescendantsOfKind(SyntaxKind.CallExpression).find((call) => call.getExpression().getText() === "betterAuth");
|
|
4406
|
+
if (betterAuthCall) {
|
|
4407
|
+
const configObject = betterAuthCall.getArguments()[0];
|
|
4408
|
+
if (configObject && configObject.getKind() === SyntaxKind.ObjectLiteralExpression) {
|
|
4409
|
+
const objLiteral = configObject.asKindOrThrow(SyntaxKind.ObjectLiteralExpression);
|
|
4410
|
+
const pluginsArray = ensureArrayProperty(objLiteral, "plugins");
|
|
4411
|
+
pluginsToAdd.forEach((plugin) => {
|
|
4412
|
+
pluginsArray.addElement(plugin);
|
|
4413
|
+
});
|
|
4414
|
+
}
|
|
4415
|
+
}
|
|
4416
|
+
authIndexFile.save();
|
|
4417
|
+
}
|
|
4418
|
+
|
|
4422
4419
|
//#endregion
|
|
4423
4420
|
//#region src/helpers/core/auth-setup.ts
|
|
4424
4421
|
async function setupAuth(config) {
|
|
@@ -4517,6 +4514,7 @@ async function setupAuth(config) {
|
|
|
4517
4514
|
});
|
|
4518
4515
|
}
|
|
4519
4516
|
}
|
|
4517
|
+
if (authPackageDirExists && auth === "better-auth") await setupBetterAuthPlugins(projectDir, config);
|
|
4520
4518
|
} catch (error) {
|
|
4521
4519
|
consola.error(pc.red("Failed to configure authentication dependencies"));
|
|
4522
4520
|
if (error instanceof Error) consola.error(pc.red(error.message));
|
|
@@ -6943,7 +6941,6 @@ async function createProject(options, cliInput) {
|
|
|
6943
6941
|
}
|
|
6944
6942
|
if (options.addons.length > 0 && options.addons[0] !== "none") await setupAddons(options);
|
|
6945
6943
|
if (options.auth && options.auth !== "none") await setupAuth(options);
|
|
6946
|
-
await setupBetterAuthPlugins(projectDir, options);
|
|
6947
6944
|
if (options.payments && options.payments !== "none") await setupPayments(options);
|
|
6948
6945
|
await handleExtras(projectDir, options);
|
|
6949
6946
|
await setupEnvironmentVariables(options);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[install]
|
|
2
2
|
{{#if (or (includes frontend "nuxt") (includes frontend "native-nativewind") (includes frontend "native-unistyles"))}}
|
|
3
|
-
|
|
3
|
+
linker = "hoisted" # having issues with Nuxt and NativeWind/Unistyles when linker is isolated
|
|
4
4
|
{{else}}
|
|
5
5
|
linker = "isolated"
|
|
6
6
|
{{/if}}
|