updated syntax highlighting script and added it's entry to package.json

This commit is contained in:
Mayank Gautam 2020-04-30 12:31:04 +05:30
parent 720a897dca
commit dc265efa17
2 changed files with 3 additions and 1 deletions

View File

@ -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": {

View File

@ -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 {