Skip to content

Commit 07c9e9f

Browse files
committed
improved error reporting for mandatory configuration
in the process, updated dependencies
1 parent 7ba4bda commit 07c9e9f

File tree

4 files changed

+17
-2
lines changed

4 files changed

+17
-2
lines changed

lib/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"use strict";
22

33
let Bundle = require("./bundle");
4+
let { abort, repr } = require("faucet-pipeline/lib/util")
45
let path = require("path");
56

67
module.exports = (config, assetManager, { watcher, browsers, compact } = {}) => {
@@ -56,6 +57,10 @@ function makeBundle(config, resolvePath, { browsers }) {
5657
// dissect configuration for constructor
5758
config = Object.assign({}, config);
5859
let [entryPoint, target] = extract(config, "source", "target");
60+
if(!entryPoint || !target) {
61+
let setting = entryPoint ? "target" : "source";
62+
abort(`ERROR: missing ${repr(setting, false)} configuration`);
63+
}
5964

6065
entryPoint = resolvePath(entryPoint);
6166
target = resolvePath(target, { enforceRelative: true });

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
},
2828
"dependencies": {
2929
"faucet-pipeline": "~1.0.0-rc.7",
30-
"rollup": "~0.61.2",
30+
"rollup": "~0.62.0",
3131
"rollup-plugin-cleanup": "~3.0.0-beta.1",
3232
"rollup-plugin-commonjs": "~9.1.3",
3333
"rollup-plugin-node-resolve": "~3.3.0"

pkg/faucet-pipeline-typescript/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
},
1818
"dependencies": {
1919
"faucet-pipeline-js": "1.0.0-rc.6",
20-
"rollup-plugin-typescript2": "~0.15.0",
20+
"rollup-plugin-typescript2": "~0.15.1",
2121
"typescript": "~2.9.2"
2222
}
2323
}

test/unit/test_bundling.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@ describe("bundling", _ => {
2121
process.exit = exit;
2222
});
2323

24+
it("should verify configuration", () => {
25+
let config = [{}];
26+
let assetManager = new MockAssetManager(FIXTURES_DIR);
27+
28+
let fn = _ => faucetJS(config, assetManager, DEFAULT_OPTIONS);
29+
assert.throws(fn, /exit 1/); // aborts with "missing `source` configuration"
30+
config[0].source = "./src/index.js";
31+
assert.throws(fn, /exit 1/); // aborts with "missing `target` configuration"
32+
});
33+
2434
it("should combine ES6 modules into a bundle", () => {
2535
let config = [{
2636
source: "./src/index.js",

0 commit comments

Comments
 (0)