build: support node 4 for building js file (by bypassing syntax checking if node < 6)

This commit is contained in:
bordun 2016-11-28 13:35:08 +01:00
parent e29ce249f8
commit df9db253af
3 changed files with 6 additions and 7 deletions

View file

@ -20,8 +20,7 @@
"watch-css": "nodemon --watch src/browser/scss -e scss -x \"npm run build-css\"",
"watch-js": "nodemon --watch src/browser/js -e js -x \"npm run build-js\"",
"build-css": "node-sass --include-path src/browser/scss src/browser/scss/style.scss app/browser/styles.css --output-style compressed",
"build-js": "browserify src/browser/js/browser.js -o app/browser/scripts.js --noparse=app/browser/scripts.js",
"build-js-node4": "node scripts/build-js.node4.js > app/browser/scripts.js",
"build-js": "node scripts/build-js.js > app/browser/scripts.js",
"deploy-docs": "cd resources && mkdocs gh-deploy --clean && rm -rf site",
"test": "npm run build"
},

View file

@ -57,7 +57,7 @@ Running the app from the sources slightly differs from using built binaries : in
**Requirements**
- [Node.js >= 6](https://nodejs.org/)
- [Node.js >= 4](https://nodejs.org/)
- [npm](https://www.npmjs.com/)
```bash

View file

@ -1,12 +1,12 @@
// browserify without syntax checking for building browser-js with node 4
var browserify = require('browserify'),
path = require('path')
var b = browserify(path.resolve(__dirname + '/../src/browser/js/browser.js'));
// bypass syntax-error check
b.pipeline.get('syntax').splice(0, 1);
// bypass syntax-error check if node version is < 6
if (parseInt(process.version.split('.')[0].replace('v',''))<6) {
b.pipeline.get('syntax').splice(0, 1);
}
b.bundle().pipe(process.stdout);