diff options
author | Thomas Huang <tmashuang@users.noreply.github.com> | 2017-08-09 09:44:53 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-09 09:44:53 +0800 |
commit | 02a6cd255ba1d081bf2a37a9df05536eb169ca34 (patch) | |
tree | 5924be836a0f6a70ae4868a1995bbfa821baa230 | |
parent | 0e6bc6647ee5c0554a4e149514c87ca4d8585d2c (diff) | |
parent | 59e83d2b8063e7ef7c57c1fe9a2cd9c846637e20 (diff) | |
download | tangerine-wallet-browser-02a6cd255ba1d081bf2a37a9df05536eb169ca34.tar tangerine-wallet-browser-02a6cd255ba1d081bf2a37a9df05536eb169ca34.tar.gz tangerine-wallet-browser-02a6cd255ba1d081bf2a37a9df05536eb169ca34.tar.bz2 tangerine-wallet-browser-02a6cd255ba1d081bf2a37a9df05536eb169ca34.tar.lz tangerine-wallet-browser-02a6cd255ba1d081bf2a37a9df05536eb169ca34.tar.xz tangerine-wallet-browser-02a6cd255ba1d081bf2a37a9df05536eb169ca34.tar.zst tangerine-wallet-browser-02a6cd255ba1d081bf2a37a9df05536eb169ca34.zip |
Merge pull request #1879 from MetaMask/build-err-fix
Build sys - prevent err from being swallowed
-rw-r--r-- | gulpfile.js | 43 | ||||
-rw-r--r-- | package.json | 4 |
2 files changed, 28 insertions, 19 deletions
diff --git a/gulpfile.js b/gulpfile.js index cc723704a..ac36cf983 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -248,26 +248,27 @@ function zipTask(target) { } } -function generateBundler(opts) { - var browserifyOpts = assign({}, watchify.args, { +function generateBundler(opts, performBundle) { + const browserifyOpts = assign({}, watchify.args, { entries: ['./app/scripts/'+opts.filename], plugin: 'browserify-derequire', debug: debug, fullPaths: debug, }) - return browserify(browserifyOpts) -} - -function discTask(opts) { - let bundler = generateBundler(opts) + let bundler = browserify(browserifyOpts) if (opts.watch) { bundler = watchify(bundler) - // on any dep update, runs the bundler + // on any file update, re-runs the bundler bundler.on('update', performBundle) } + return bundler +} + +function discTask(opts) { + const bundler = generateBundler(opts, performBundle) // output build logs to terminal bundler.on('log', gutil.log) @@ -289,14 +290,7 @@ function discTask(opts) { function bundleTask(opts) { - let bundler = generateBundler(opts) - - if (opts.watch) { - bundler = watchify(bundler) - // on any file update, re-runs the bundler - bundler.on('update', performBundle) - } - + const bundler = generateBundler(opts, performBundle) // output build logs to terminal bundler.on('log', gutil.log) @@ -306,6 +300,17 @@ function bundleTask(opts) { return ( bundler.bundle() + + // handle errors + .on('error', (err) => { + beep() + if (opts.watch) { + console.warn(err.stack) + } else { + throw err + } + }) + // convert bundle stream to gulp vinyl stream .pipe(source(opts.filename)) // inject variables into bundle @@ -314,7 +319,7 @@ function bundleTask(opts) { .pipe(buffer()) // sourcemaps // loads map from browserify file - .pipe(gulpif(debug, sourcemaps.init({loadMaps: true}))) + .pipe(gulpif(debug, sourcemaps.init({ loadMaps: true }))) // writes .map file .pipe(gulpif(debug, sourcemaps.write('./'))) // write completed bundles @@ -328,3 +333,7 @@ function bundleTask(opts) { ) } } + +function beep () { + process.stdout.write('\x07') +} diff --git a/package.json b/package.json index 83c64cdab..d8f5c6167 100644 --- a/package.json +++ b/package.json @@ -155,8 +155,8 @@ "enzyme": "^2.8.2", "eslint-plugin-chai": "0.0.1", "eslint-plugin-mocha": "^4.9.0", - "fs-promise": "^2.0.3", "eth-json-rpc-middleware": "^1.2.7", + "fs-promise": "^2.0.3", "gulp": "github:gulpjs/gulp#4.0", "gulp-if": "^2.0.1", "gulp-json-editor": "^2.2.1", @@ -191,7 +191,7 @@ "uglifyify": "^4.0.2", "vinyl-buffer": "^1.0.0", "vinyl-source-stream": "^1.1.0", - "watchify": "^3.7.0" + "watchify": "^3.9.0" }, "engines": { "node": ">=0.8.0" |