-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
55 lines (52 loc) · 1.63 KB
/
index.js
File metadata and controls
55 lines (52 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*jshint node: true*/
var notifier = new require('node-notifier');
var notify = function (opts) {
opts = opts || {};
notifier.notify(opts, function (error, response) {
if (error) {
console.log('node-notifier encountered an error:', error);
} else if (response) {
console.log('node-notifier:', response);
}
});
};
module.exports = function (bundler, opts) {
var entries = Array.isArray(bundler._options.entries) ? bundler._options.entries.join(', ') : bundler._options.entries;
bundler.on('bundle', function(bundle) {
var success = true;
notify({
title: 'Started browserifying "' + entries + '"',
message: "Fingers crossed...",
category: 'transfer',
icon: __dirname + '/assets/start.png'
});
bundle
.on('error', function (error) {
success = false;
notify({
title: 'Error browserifying "' + entries + '"',
message: error.message,
category: 'transfer.error',
icon: __dirname + '/assets/error.png'
});
})
.on('warn', function (error) {
notify({
title: 'Warning browserifying "' + entries + '"',
message: error.message,
category: 'transfer.error',
icon: __dirname + '/assets/warn.png'
});
})
.on('end', function () {
if (success) {
notify({
title: 'Finished browserifying "' + entries + '"',
message: "Job well done!",
category: 'transfer.complete',
icon: __dirname + '/assets/success.png'
});
}
});
});
};