close watchers

pull/5370/head
filip mertens 2 years ago
parent bdc1741373
commit 0830469570
  1. 3
      libs/remixd/src/services/foundryClient.ts
  2. 4
      libs/remixd/src/services/hardhatClient.ts
  3. 4
      libs/remixd/src/services/truffleClient.ts

@ -22,6 +22,7 @@ export class FoundryClient extends PluginClient {
this.methods = ['compile', 'sync']
this.onActivation = () => {
console.log('Foundry plugin activated')
this.call('terminal', 'log', { type: 'log', value: 'Foundry plugin activated' })
this.startListening()
}
}
@ -141,8 +142,8 @@ export class FoundryClient extends PluginClient {
listenOnFoundryCompilation() {
try {
if(this.watcher) this.watcher.close()
this.watcher = chokidar.watch(this.cachePath, { depth: 0, 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

@ -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

@ -21,6 +21,7 @@ export class TruffleClient extends PluginClient {
this.methods = ['compile', 'sync']
this.onActivation = () => {
console.log('Truffle plugin activated')
this.call('terminal', 'log', { type: 'log', value: 'Truffle plugin activated' })
this.startListening()
}
}
@ -51,6 +52,7 @@ export class TruffleClient extends PluginClient {
listenOnTruffleFolder() {
console.log('Truffle build 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', () => {
@ -141,8 +143,8 @@ export class TruffleClient extends PluginClient {
listenOnTruffleCompilation() {
try {
if (this.watcher) this.watcher.close()
this.watcher = chokidar.watch(this.buildPath, { depth: 3, 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

Loading…
Cancel
Save