mirror of
https://github.com/bubblecup-12/VogelSocialMedia.git
synced 2025-07-07 00:38:47 +00:00
fixed already installed bug
This commit is contained in:
parent
148e44a705
commit
2c4114ec0c
1 changed files with 5 additions and 7 deletions
|
@ -4,12 +4,15 @@ const execPromise = util.promisify(exec);
|
||||||
import fs, { read } from "fs";
|
import fs, { read } from "fs";
|
||||||
import readlineSync from "readline-sync";
|
import readlineSync from "readline-sync";
|
||||||
import crypto from "crypto";
|
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 json_path: string = "scripts/install.json"; // Path to the JSON file
|
||||||
const raw = fs.readFileSync(json_path, "utf8");
|
const raw = fs.readFileSync(json_path, "utf8");
|
||||||
const config = JSON.parse(raw); // Parse the JSON file
|
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
|
// Check if the script has already been run
|
||||||
console.log("Already installed");
|
console.log("Already installed");
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
|
@ -54,11 +57,6 @@ try {
|
||||||
break; // Stop execution if an error occurs
|
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");
|
console.log("Installation complete");
|
||||||
})();
|
})();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue