diff --git a/.eslintrc.js b/.eslintrc.js index a3f743cbd6022..193fc5033a689 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -2,7 +2,8 @@ module.exports = { "env": { "browser": true, "es6": true, - "jquery": true + "jquery": true, + "amd": true }, "extends": "eslint:recommended", "parserOptions": { diff --git a/compile_cgi.js b/compile_cgi.js new file mode 100644 index 0000000000000..32790e61806b4 --- /dev/null +++ b/compile_cgi.js @@ -0,0 +1,31 @@ +/*eslint no-console: "off"*/ +/*eslint no-await-in-loop: "off"*/ +/*global process*/ + +const util = require('util'); +const glob = util.promisify(require('glob').glob); +const execFile = util.promisify(require('child_process').execFile); + +async function main() { + const files = await glob('cgi/*.pl'); + for (var i = 0; i < files.length; ++i) { + const path = files[i]; + console.log(`Compiling ${path}`); + try { + const {stdout, stderr} = await execFile(`perl`, ['-c', '-CS', '-Ilib', files[i]]); + if (stderr) { + console.error(stderr); + } + + console.log(stdout); + } catch (e) { + console.error(e); + process.exitCode = e.code; + throw e; + } + } + + console.log('Done!'); +} + +main(); diff --git a/package.json b/package.json index 5b50caffe73ab..74d1796dc4845 100644 --- a/package.json +++ b/package.json @@ -15,9 +15,9 @@ "lint:js": "eslint html/js/product-multilingual.js html/js/search.js html/js/display-tag.js", "lint:css": "stylelint html/css/product-multilingual.css", "lint:scss": "stylelint scss/app.scss", - "perlc": "yarn run perlc:startup && yarn run perlc:product", + "perlc": "yarn run perlc:startup && yarn run perlc:cgi", "perlc:startup": "perl -c -CS -Ilib lib/startup_apache2.pl", - "perlc:product": "perl -c -CS -Ilib cgi/product_multilingual.pl", + "perlc:cgi": "node compile_cgi.js", "postinstall": "node -e \"try { require('fs').symlinkSync(require('path').resolve('node_modules/@bower_components'), 'html/bower_components', 'junction') } catch (e) { }\"" }, "repository": {