Complain if no config-files are loaded

This commit is contained in:
4censord 2024-08-03 17:42:59 +02:00
parent 5496aa27db
commit 12aeaa5f95
No known key found for this signature in database
GPG key ID: C8E54F9D13822E41
2 changed files with 10 additions and 3 deletions

View file

@ -222,8 +222,15 @@ export function loadConfig(): Config {
JSON.parse(fs.readFileSync(`${_dirname}/../../../built/_vite_/manifest.json`, 'utf-8'))
: { 'src/_boot_.ts': { file: 'src/_boot_.ts' } };
const config = globSync(path).sort()
.map(path => fs.readFileSync(path, 'utf-8'))
const configFiles = globSync(path).sort();
if (configFiles.length === 0
&& !process.env['MK_WARNED_ABOUT_CONFIG']) {
console.log('No config files loaded, check if this is intentional');
process.env['MK_WARNED_ABOUT_CONFIG'] = true;
}
const config = configFiles.map(path => fs.readFileSync(path, 'utf-8'))
.map(contents => yaml.load(contents) as Source)
.reduce(
(acc: Source, cur: Source) => Object.assign(acc, cur),