fix all clients

pull/5370/head
filip mertens 2 years ago committed by Aniket
parent 5b177de770
commit 4c9dfc53af
  1. 3
      libs/remixd/src/services/foundryClient.ts
  2. 5
      libs/remixd/src/services/hardhatClient.ts
  3. 19
      libs/remixd/src/services/truffleClient.ts

@ -45,9 +45,8 @@ export class FoundryClient extends PluginClient {
try {
this.watcher = chokidar.watch(this.currentSharedFolder, { depth: 1, ignorePermissionErrors: true, ignoreInitial: true })
// watch for new folders
this.watcher.on('addDir', (path) => {
this.watcher.on('addDir', () => {
if (fs.existsSync(this.buildPath) && fs.existsSync(this.cachePath)) {
this.buildPath = path
this.listenOnFoundryCompilation()
}
})

@ -125,9 +125,8 @@ export class HardhatClient extends PluginClient {
try {
this.watcher = chokidar.watch(this.currentSharedFolder, { depth: 1, ignorePermissionErrors: true, ignoreInitial: true })
// watch for new folders
this.watcher.on('addDir', (path) => {
if (path.endsWith('artifacts/contracts')) {
this.buildPath = path
this.watcher.on('addDir', () => {
if (fs.existsSync(this.buildPath)) {
this.listenOnHardhatCompilation()
}
})

@ -30,8 +30,27 @@ export class TruffleClient extends PluginClient {
sharedFolder (currentSharedFolder: string): void {
this.currentSharedFolder = currentSharedFolder
this.buildPath = utils.absolutePath('build/contracts', this.currentSharedFolder)
if (fs.existsSync(this.buildPath)) {
this.listenOnTruffleCompilation()}
else {
console.log('Truffle build folder doesn\'t exist... waiting for the first compilation.')
this.listenOnTruffleFolder()
}
}
listenOnTruffleFolder () {
try {
this.watcher = chokidar.watch(this.currentSharedFolder, { depth: 1, ignorePermissionErrors: true, ignoreInitial: true })
// watch for new folders
this.watcher.on('addDir', () => {
if (fs.existsSync(this.buildPath)) {
this.listenOnTruffleCompilation()
}
})
} catch (e) {
console.log(e)
}
}
compile (configPath: string) {
return new Promise((resolve, reject) => {

Loading…
Cancel
Save