From dc265efa177bd2ae1857377817371aa558063d3c Mon Sep 17 00:00:00 2001 From: Mayank Gautam Date: Thu, 30 Apr 2020 12:31:04 +0530 Subject: [PATCH] updated syntax highlighting script and added it's entry to package.json --- package.json | 1 + server/scripts/update-syntax-highlighting.js | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) 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 {