File tree Expand file tree Collapse file tree 3 files changed +14
-5
lines changed Expand file tree Collapse file tree 3 files changed +14
-5
lines changed Original file line number Diff line number Diff line change 1313 "any" : " any"
1414 },
1515 "events" : {
16- "contractFilesChanged" : " contractFilesChanged"
16+ "contractFilesChanged" : " contractFilesChanged" ,
17+ "contractConfigChanged" : " contractConfigChanged"
1718 }
1819}
Original file line number Diff line number Diff line change @@ -19,8 +19,11 @@ class ContractsManager {
1919 this . deployOnlyOnConfig = false ;
2020 this . events = options . events ;
2121
22- this . events . on ( constants . events . contractFilesChanged , ( newContracts ) => {
23- this . contractFiles = newContracts ;
22+ this . events . on ( constants . events . contractFilesChanged , ( newContractFiles ) => {
23+ this . contractFiles = newContractFiles ;
24+ } ) ;
25+ this . events . on ( constants . events . contractConfigChanged , ( newContracts ) => {
26+ this . contractsConfig = newContracts ;
2427 } ) ;
2528 }
2629
Original file line number Diff line number Diff line change @@ -142,7 +142,12 @@ Config.prototype.loadContractsConfigFile = function() {
142142
143143 let configFilePath = this . _getFileOrOject ( this . configDir , 'contracts.json' , 'contracts' ) ;
144144
145- this . contractsConfig = this . _mergeConfig ( configFilePath , configObject , this . env ) ;
145+ const newContractsConfig = this . _mergeConfig ( configFilePath , configObject , this . env ) ;
146+
147+ if ( ! deepEqual ( newContractsConfig , this . contractsConfig ) ) {
148+ this . events . emit ( constants . events . contractConfigChanged , newContractsConfig ) ;
149+ this . contractsConfig = newContractsConfig ;
150+ }
146151} ;
147152
148153Config . prototype . loadExternalContractsFiles = function ( ) {
@@ -220,7 +225,7 @@ Config.prototype.loadWebServerConfigFile = function() {
220225Config . prototype . loadEmbarkConfigFile = function ( ) {
221226 const contracts = this . embarkConfig . contracts ;
222227 const newContractsFiles = this . loadFiles ( contracts ) ;
223- if ( newContractsFiles . length !== this . contractFiles || deepEqual ( newContractsFiles , this . contractFiles ) ) {
228+ if ( ! this . contractFiles || newContractsFiles . length !== this . contractFiles . length || ! deepEqual ( newContractsFiles , this . contractFiles ) ) {
224229 this . events . emit ( constants . events . contractFilesChanged , newContractsFiles ) ;
225230 this . contractsFiles = newContractsFiles ;
226231 }
You can’t perform that action at this time.
0 commit comments