From 2c4114ec0c4040e6a070591ce740a6f1657f7175 Mon Sep 17 00:00:00 2001 From: qajus Date: Thu, 15 May 2025 19:55:34 +0200 Subject: [PATCH] fixed already installed bug --- code/backend/scripts/install.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/code/backend/scripts/install.ts b/code/backend/scripts/install.ts index 3b0a989..39f6e28 100644 --- a/code/backend/scripts/install.ts +++ b/code/backend/scripts/install.ts @@ -4,12 +4,15 @@ const execPromise = util.promisify(exec); import fs, { read } from "fs"; import readlineSync from "readline-sync"; import crypto from "crypto"; +import dotenv from "dotenv" +import path from "path"; const json_path: string = "scripts/install.json"; // Path to the JSON file const raw = fs.readFileSync(json_path, "utf8"); const config = JSON.parse(raw); // Parse the JSON file -if (config.installed) { +//check if there is a .env file and abort the installation +if (fs.existsSync(".env") ) { // Check if the script has already been run console.log("Already installed"); process.exit(0); @@ -54,11 +57,6 @@ try { break; // Stop execution if an error occurs } } - config.installed = true; // Set the installed flag to true - fs.writeFile(json_path, JSON.stringify(config), (err) => { - if (err) { - console.error("Error writing to file:", err); - } - }); + console.log("Installation complete"); })();