@@ -146,17 +146,11 @@ class Engine {
146146 self . currentAbi = abi ;
147147 self . contractsJSON = contractsJSON ;
148148 pipeline . build ( abi , contractsJSON , null , function ( ) {
149+ self . watch . restart ( ) ; // Necessary because changing a file while it is writing can stop it from being watched
149150 self . events . emit ( 'outputDone' ) ;
150151 } ) ;
151152 } ) ;
152153 } ) ;
153- // TODO: still need to redeploy contracts because the original contracts
154- // config is being corrupted
155- this . events . on ( 'file-event' , function ( fileType , _path ) {
156- if ( fileType === 'asset' ) {
157- self . events . emit ( 'asset-changed' , self . contractsManager ) ;
158- }
159- } ) ;
160154 }
161155
162156 codeGeneratorService ( _options ) {
@@ -213,6 +207,11 @@ class Engine {
213207 } ) ;
214208
215209 this . events . on ( 'file-event' , function ( fileType ) {
210+ // TODO: still need to redeploy contracts because the original contracts
211+ // config is being corrupted
212+ if ( fileType === 'asset' ) {
213+ self . events . emit ( 'asset-changed' , self . contractsManager ) ;
214+ }
216215 // TODO: for now need to deploy on asset chanes as well
217216 // because the contractsManager config is corrupted after a deploy
218217 if ( fileType === 'contract' || fileType === 'config' ) {
@@ -225,8 +224,8 @@ class Engine {
225224
226225 fileWatchService ( _options ) {
227226 this . events . emit ( "status" , "Watching for changes" ) ;
228- let watch = new Watch ( { logger : this . logger , events : this . events } ) ;
229- watch . start ( ) ;
227+ this . watch = new Watch ( { logger : this . logger , events : this . events } ) ;
228+ this . watch . start ( ) ;
230229 }
231230
232231 webServerService ( ) {
0 commit comments