diff --git a/package.json b/package.json index 37420ee9..e8d83214 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "fetch-examples:prod": "cross-env NODE_ENV=production node ./dist/fetch-examples.bundle.js", "fetch-examples-gg:prod": "cross-env NODE_ENV=production node ./dist/fetch-examples-gg.bundle.js", "fetch-examples-ml5:prod": "cross-env NODE_ENV=production node ./dist/fetch-examples-ml5.bundle.js", + "update-syntax-highlighting": "node ./server/scripts/update-syntax-highlighting.js", "heroku-postbuild": "touch .env; npm run build" }, "husky": { diff --git a/server/scripts/update-syntax-highlighting.js b/server/scripts/update-syntax-highlighting.js index 2c3603a5..5d6adfe3 100644 --- a/server/scripts/update-syntax-highlighting.js +++ b/server/scripts/update-syntax-highlighting.js @@ -1,4 +1,5 @@ const fs = require('fs'); +const process = require('process'); const request = require('request'); request('https://p5js.org/reference/data.json', (err, res) => { @@ -33,7 +34,7 @@ request('https://p5js.org/reference/data.json', (err, res) => { generatedCode += `let p5FunctionKeywords = ${p5FunctionPart}; \n`; generatedCode += 'exports.p5FunctionKeywords = p5FunctionKeywords;\n'; generatedCode += 'exports.p5VariableKeywords = p5VariableKeywords;\n'; - fs.writeFile('../../client/utils/p5-javascript-template.js', generatedCode, (error) => { + fs.writeFile(`${process.cwd()}/client/utils/p5-javascript-template.js`, generatedCode, (error) => { if (error) { console.log("Error!! Couldn't write to the file", error); } else {