|
|
|
@ -21,6 +21,7 @@ export class HardhatClient extends PluginClient { |
|
|
|
|
this.methods = ['compile', 'sync'] |
|
|
|
|
this.onActivation = () => { |
|
|
|
|
console.log('Hardhat plugin activated') |
|
|
|
|
this.call('terminal', 'log', { type: 'log', value: 'Hardhat plugin activated' }) |
|
|
|
|
this.startListening() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -148,6 +149,7 @@ export class HardhatClient extends PluginClient { |
|
|
|
|
listenOnHardHatFolder() { |
|
|
|
|
console.log('Hardhat artifacts folder doesn\'t exist... waiting for the compilation.') |
|
|
|
|
try { |
|
|
|
|
if(this.watcher) this.watcher.close() |
|
|
|
|
this.watcher = chokidar.watch(this.currentSharedFolder, { depth: 1, ignorePermissionErrors: true, ignoreInitial: true }) |
|
|
|
|
// watch for new folders
|
|
|
|
|
this.watcher.on('addDir', () => { |
|
|
|
@ -169,8 +171,8 @@ export class HardhatClient extends PluginClient { |
|
|
|
|
listenOnHardhatCompilation() { |
|
|
|
|
try { |
|
|
|
|
console.log('listening on Hardhat compilation...') |
|
|
|
|
if(this.watcher) this.watcher.close() |
|
|
|
|
this.watcher = chokidar.watch(this.buildPath, { depth: 1, ignorePermissionErrors: true, ignoreInitial: true }) |
|
|
|
|
|
|
|
|
|
this.watcher.on('change', async () => await this.triggerProcessArtifact()) |
|
|
|
|
this.watcher.on('add', async () => await this.triggerProcessArtifact()) |
|
|
|
|
// process the artifact on activation
|
|
|
|
|