Skip to content

Commit

Permalink
Compile cgi/*.pl in the CI builds.
Browse files Browse the repository at this point in the history
  • Loading branch information
hangy committed Dec 23, 2018
1 parent ec8e26f commit 2631ff3
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ module.exports = {
"env": {
"browser": true,
"es6": true,
"jquery": true
"jquery": true,
"amd": true
},
"extends": "eslint:recommended",
"parserOptions": {
Expand Down
31 changes: 31 additions & 0 deletions compile_cgi.js
Original file line number Diff line number Diff line change
@@ -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();
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down

0 comments on commit 2631ff3

Please sign in to comment.