diff --git a/libs/remix-ui/solidity-compiler/src/lib/logic/compileTabLogic.ts b/libs/remix-ui/solidity-compiler/src/lib/logic/compileTabLogic.ts index 93475dc666..cb4229cd64 100644 --- a/libs/remix-ui/solidity-compiler/src/lib/logic/compileTabLogic.ts +++ b/libs/remix-ui/solidity-compiler/src/lib/logic/compileTabLogic.ts @@ -110,10 +110,9 @@ export class CompileTabLogic { } async isTruffleProject () { - return true - // if (this.api.getFileManagerMode() === 'localhost') { - // return await this.api.fileExists('truffle.config.js') - // } else return false + if (this.api.getFileManagerMode() === 'localhost') { + return await this.api.fileExists('truffle-config.js') + } else return false } runCompiler (externalCompType) { diff --git a/libs/remixd/src/bin/remixd.ts b/libs/remixd/src/bin/remixd.ts index 4a29c5d9d9..d315b44b8e 100644 --- a/libs/remixd/src/bin/remixd.ts +++ b/libs/remixd/src/bin/remixd.ts @@ -102,15 +102,18 @@ function errorHandler (error: any, service: string) { sharedFolderClient.setWebSocket(ws) sharedFolderClient.sharedFolder(program.sharedFolder) }) - - startService('truffle', (ws: WS, sharedFolderClient: servicesList.Sharedfolder, error: any) => { - if (error) { - errorHandler(error, 'truffle') - return false - } - sharedFolderClient.setWebSocket(ws) - sharedFolderClient.sharedFolder(program.sharedFolder) - }) + // Run truffle service if a truffle project is shared as folder + const truffleConfigFilePath = absolutePath('./', program.sharedFolder) + '/truffle-config.js' + if (existsSync(truffleConfigFilePath)) { + startService('truffle', (ws: WS, sharedFolderClient: servicesList.Sharedfolder, error: any) => { + if (error) { + errorHandler(error, 'truffle') + return false + } + sharedFolderClient.setWebSocket(ws) + sharedFolderClient.sharedFolder(program.sharedFolder) + }) + } // Run hardhat service if a hardhat project is shared as folder const hardhatConfigFilePath = absolutePath('./', program.sharedFolder) const isHardhatProject = existsSync(hardhatConfigFilePath + '/hardhat.config.js') || existsSync(hardhatConfigFilePath + '/hardhat.config.ts')