-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnotification.js
64 lines (53 loc) · 1.65 KB
/
notification.js
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
56
57
58
59
60
61
62
63
64
const mix = require('laravel-mix');
class Notifications {
passive = true;
name() {
return 'notification';
}
/**
* Boot the component. This method is triggered after the
* user's webpack.mix.js file has processed.
*/
boot() {
mix.disableNotifications();
}
/**
* Register the component.
*
* When your component is called, all user parameters
* will be passed to this method.
*
* Ex: register(src, output) {}
* Ex: mix.yourPlugin('src/path', 'output/path');
*
* @param {string} title
* @param {string} icon
* @param {boolean} always
* @return {void}
*
*/
register(title = '', icon = global.Mix.paths.root('node_modules/laravel-mix-storepress/icons/wp.png'), always = true) {
const File = require('laravel-mix/src/File');
const PackageFile = JSON.parse(File.find(global.Mix.paths.root('package.json')).read());
this.config = {
title : title || PackageFile.name.toUpperCase(),
contentImage : icon,
alwaysNotify : always,
timeout : false,
hint : process.platform === 'linux' ? 'int:transient:1' : undefined,
}
}
/*
* Plugins to be merged with the underlying webpack plugins array.
*
* @return {Array|Object}
*/
webpackPlugins() {
if (process.env.DISABLE_NOTIFICATIONS === '1') {
return [];
}
const WebpackNotifierPlugin = require('webpack-notifier');
return new WebpackNotifierPlugin(this.config);
}
};
mix.extend('notification', new Notifications());