feat: Add config generation
This commit is contained in:
parent
c12b784b50
commit
418cced407
5 changed files with 52 additions and 1 deletions
23
index.ts
23
index.ts
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue