mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
simplify auth setup
This commit is contained in:
@@ -6,7 +6,7 @@ import pc from "picocolors";
|
||||
import { PKG_ROOT } from "../constants";
|
||||
import type { ProjectConfig } from "../types";
|
||||
import { setupAddons } from "./addons-setup";
|
||||
import { configureAuth } from "./auth-setup";
|
||||
import { setupAuth } from "./auth-setup";
|
||||
import { createReadme } from "./create-readme";
|
||||
import { setupDatabase } from "./db-setup";
|
||||
import { displayPostInstallInstructions } from "./post-installation";
|
||||
@@ -24,6 +24,13 @@ export async function createProject(options: ProjectConfig): Promise<string> {
|
||||
}
|
||||
await fs.copy(templateDir, projectDir);
|
||||
|
||||
if (options.auth) {
|
||||
const authTemplateDir = path.join(PKG_ROOT, "template/with-auth");
|
||||
if (await fs.pathExists(authTemplateDir)) {
|
||||
await fs.copy(authTemplateDir, projectDir, { overwrite: true });
|
||||
}
|
||||
}
|
||||
|
||||
if (options.orm !== "none" && options.database !== "none") {
|
||||
const ormTemplateDir = path.join(
|
||||
PKG_ROOT,
|
||||
@@ -40,6 +47,10 @@ export async function createProject(options: ProjectConfig): Promise<string> {
|
||||
path.join(projectDir, "packages/server/_env"),
|
||||
path.join(projectDir, "packages/server/.env"),
|
||||
],
|
||||
[
|
||||
path.join(projectDir, "packages/client/_env"),
|
||||
path.join(projectDir, "packages/client/.env"),
|
||||
],
|
||||
];
|
||||
|
||||
for (const [source, target] of envFiles) {
|
||||
@@ -58,7 +69,8 @@ export async function createProject(options: ProjectConfig): Promise<string> {
|
||||
options.orm,
|
||||
options.turso ?? options.database === "sqlite",
|
||||
);
|
||||
await configureAuth(
|
||||
|
||||
await setupAuth(
|
||||
projectDir,
|
||||
options.auth,
|
||||
options.database !== "none",
|
||||
|
||||
Reference in New Issue
Block a user