From fb7b87c2916e20e22ccc14884e052a14f7b11282 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 18 Dec 2022 00:13:23 -0600 Subject: [PATCH] Create `data` folder if it doesn't exist --- deploy-commands.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/deploy-commands.js b/deploy-commands.js index ab1d5fe..28594a8 100644 --- a/deploy-commands.js +++ b/deploy-commands.js @@ -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}`);