Create data folder if it doesn't exist

This commit is contained in:
Michael 2022-12-18 00:13:23 -06:00
parent a336e21a90
commit fb7b87c291

View file

@ -68,7 +68,12 @@ try {
// See https://stackoverflow.com/a/34347475
const helpJSON = JSON.stringify(JSON.parse(helpJSONString.replace(/,(?!\s*?[{["'\w])/g, '')), null, 4);
// write file to disk
// Create data folder if it doesn't exist
if (!fs.existsSync('data')) {
fs.mkdirSync('data');
}
// Write file to disk
fs.writeFile('./data/help-text.json', helpJSON, err => {
if (err) {
console.log(`Unable to write help-text.json: ${err}`);