feat: throw error if no single radar item was found
This commit is contained in:
@@ -233,6 +233,13 @@ function postProcessItems(items: Item[]): {
|
|||||||
// Parse the data and write radar data to JSON file
|
// Parse the data and write radar data to JSON file
|
||||||
parseDirectory(dataPath("radar")).then((items) => {
|
parseDirectory(dataPath("radar")).then((items) => {
|
||||||
const data = postProcessItems(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);
|
const json = JSON.stringify(data, null, 2);
|
||||||
fs.writeFileSync(dataPath("data.json"), json);
|
fs.writeFileSync(dataPath("data.json"), json);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user