feat: Add config generation

This commit is contained in:
Jan K9f 2025-06-19 07:45:02 +02:00
commit 418cced407
Signed by: jank
GPG key ID: 22BEAC760B3333D6
5 changed files with 52 additions and 1 deletions

View file

@ -1,2 +1,23 @@
console.log("Hello via Bun!");
import fs from "fs";
import { confirm } from "@inquirer/prompts";
import { exit } from "process";
import {
configPath,
generateDefaultConfig,
} from "./configuration/configuration";
if (!fs.existsSync(configPath + "config.toml")) {
const createConfig = await confirm({
message: "No cofig has been found. Would you like to generate a new one?",
});
if (createConfig) {
generateDefaultConfig();
} else {
console.log(
"This project can not run without the config. Either create it yourself or generate the default.",
);
exit(1);
}
}