feat: throw error if no single radar item was found

This commit is contained in:
Mathias Schopmans
2024-03-14 14:31:20 +01:00
parent 1a7ea3527f
commit c267082c9f

View File

@@ -233,6 +233,13 @@ function postProcessItems(items: Item[]): {
// Parse the data and write radar data to JSON file
parseDirectory(dataPath("radar")).then((items) => {
const data = postProcessItems(items);
if (data.items.length === 0) {
console.error("No valid radar items found.");
console.log("Please check the markdown files in the `radar` directory.");
process.exit(1);
}
const json = JSON.stringify(data, null, 2);
fs.writeFileSync(dataPath("data.json"), json);
});