Refactor package dependency management and environment setup

This commit is contained in:
Aman Varshney
2025-03-20 16:31:09 +05:30
parent 938ddda351
commit 3172b5bebb
6 changed files with 93 additions and 113 deletions

View File

@@ -29,6 +29,12 @@ export async function setupEnvironmentVariables(
if (!envContent.includes("CORS_ORIGIN")) {
envContent += "\nCORS_ORIGIN=http://localhost:3001";
}
const clientEnvPath = path.join(clientDir, ".env");
if (!(await fs.pathExists(clientEnvPath))) {
const clientEnvContent = "VITE_SERVER_URL=http://localhost:3000\n";
await fs.writeFile(clientEnvPath, clientEnvContent);
}
}
if (options.database !== "none") {
@@ -40,22 +46,12 @@ export async function setupEnvironmentVariables(
envContent += databaseUrlLine;
}
if (options.database === "sqlite") {
if (options.database === "sqlite" && !options.turso) {
if (!envContent.includes("TURSO_CONNECTION_URL")) {
if (!options.turso) {
envContent += "\nTURSO_CONNECTION_URL=http://127.0.0.1:8080";
}
envContent += "\nTURSO_CONNECTION_URL=http://127.0.0.1:8080";
}
}
}
await fs.writeFile(envPath, envContent.trim());
if (options.auth) {
const clientEnvPath = path.join(clientDir, ".env");
if (!(await fs.pathExists(clientEnvPath))) {
const clientEnvContent = "VITE_SERVER_URL=http://localhost:3000\n";
await fs.writeFile(clientEnvPath, clientEnvContent);
}
}
}