|
|
|
@ -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) => { |
|
|
|
|