Skip to content

Commit

Permalink
Merge pull request #7 from bloomberg/better-rollup
Browse files Browse the repository at this point in the history
Better rollup error handling
  • Loading branch information
mhkeller authored Nov 20, 2017
2 parents 904ffc0 + f022e7e commit 6c297bf
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 12 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Changelog
===

## 1.0.1

> 2017-11-20
Fix the Rollup on error handler.

* Update rollup config to remove unnecessary check on `event.input`. Make this task more future-proof by falling back to an `other` event if we don't have a code handler.
* [eac5cd349b25a67aa961c2de5ae1130ad6653f07](https://github.com/bloomberg/wsk.example/commit/eac5cd349b25a67aa961c2de5ae1130ad6653f07)

## 1.0.0

> 2017-11-16
Release!
16 changes: 6 additions & 10 deletions build/tasks/rollup/events/error.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
var fs = require('fs');
var notify = require('wsk').notify;
var cleanupOutPath = require('../helpers/cleanupOutPath');

// This event also fires if the file was deleted, so ignore if the file doesn't exist
module.exports = function (event, fileConfig) {
if (fs.existsSync(event.input)) {
notify({
message: 'Error compiling JS...',
value: cleanupOutPath(event, fileConfig),
display: 'error',
error: event.error || undefined
});
}
notify({
message: 'Error compiling JS...',
value: cleanupOutPath(event, fileConfig),
display: 'error',
error: event.error || undefined
});
};
3 changes: 2 additions & 1 deletion build/tasks/rollup/onEvent.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ function initWatcher (watch, fileConfig) {
rollupEvents.bundleInitial(event, fileConfig);
watchList[fileConfig.input].firstRun = false;
} else {
rollupEvents[event.code](event, fileConfig);
let evtHandler = rollupEvents[event.code] || rollupEvents['other'];
evtHandler(event, fileConfig);
}
});
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wsk.example",
"version": "1.0.0",
"version": "1.0.1",
"description": "A sample starter project using wsk.",
"main": "package.json",
"scripts": {
Expand Down

0 comments on commit 6c297bf

Please sign in to comment.