File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change 1
1
var path = require ( 'path' ) ;
2
2
var os = require ( 'os' ) ;
3
+ var exec = require ( 'child_process' ) . exec ;
3
4
var notifier = require ( 'node-notifier' ) ;
4
5
5
6
var DEFAULT_LOGO = path . join ( __dirname , 'logo.png' ) ;
6
7
7
8
var WebpackNotifierPlugin = module . exports = function ( options ) {
8
9
this . options = options || { } ;
9
10
this . lastBuildSucceeded = false ;
11
+
12
+ if ( this . options . editor ) {
13
+ notifier . on ( 'click' , function ( notifierObject , notifierOptions ) {
14
+ var file = notifierOptions . location . file ;
15
+ if ( file ) {
16
+ exec ( options . editor , [ file ] ) ;
17
+ }
18
+ } ) ;
19
+ }
10
20
} ;
11
21
12
22
WebpackNotifierPlugin . prototype . compileMessage = function ( stats ) {
@@ -64,7 +74,9 @@ WebpackNotifierPlugin.prototype.compilationDone = function(stats) {
64
74
title : this . options . title || 'Webpack' ,
65
75
message : msg . body ,
66
76
contentImage : contentImage ,
67
- icon : ( os . platform ( ) === 'win32' ) ? contentImage : undefined
77
+ icon : ( os . platform ( ) === 'win32' ) ? contentImage : undefined ,
78
+ wait : ! ! this . options . editor ,
79
+ location : msg . location
68
80
} ) ;
69
81
}
70
82
} ;
You can’t perform that action at this time.
0 commit comments