Add mostly-functional initial setup script

This commit is contained in:
TheArcaneBrony
2022-08-18 22:17:36 +02:00
parent c0e00d04c0
commit c0c939fb80
3 changed files with 12 additions and 4 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ let lines3 = lines2.filter((y) => y.includes(": BitFlag("));
let lines4 = lines3.map((x) => x.split("//")[0].trim());
function BitFlag(int) {
return 1n << eval(`${int}n`);
return 1n << BigInt(int);
}
let rights = [];
+2 -3
View File
@@ -1,6 +1,5 @@
import { Plugin } from "util/plugin";
import * as example_plugin from "./example-plugin/TestPlugin";
export const PluginIndex: any = {
"example-plugin": new example_plugin.default(),
};
"example-plugin": new example_plugin.default()
};
+9
View File
@@ -5,6 +5,7 @@ import { ConfigValue } from "../config";
import { ConfigEntity } from "../entities/Config";
const overridePath = process.env.CONFIG_PATH ?? "";
const initialPath = path.join(process.cwd(), "initial.json");
let config: ConfigValue;
let pairs: ConfigEntity[];
@@ -28,6 +29,14 @@ export const Config = {
} catch (error) {
fs.writeFileSync(overridePath, JSON.stringify(config, null, 4));
}
if (fs.existsSync(initialPath)) {
console.log("[Config] Importing initial configuration...");
try {
const overrideConfig = JSON.parse(fs.readFileSync(initialPath, { encoding: "utf8" }));
config = overrideConfig.merge(config);
fs.rmSync(initialPath);
} catch (error) {}
}
if (fs.existsSync(path.join(process.cwd(), "initial.json")))
try {