Commit 29b4eb7e authored by aniket-engg's avatar aniket-engg Committed by Aniket

compiler configuration from remix IDE

parent 25edaefe
......@@ -57,9 +57,10 @@ class FileManager extends Plugin {
this.mode = mode
}
async compileWithHardhat (cmd) {
console.log('Inside compileWithHardhat, calling hardhat compile using appManager')
return await this.appManager.call('hardhat', 'compile', cmd)
async compileWithHardhat (fileContent) {
const configFilePath = 'remixCompiler.config.js'
this.setFileContent(configFilePath, fileContent)
return await this.appManager.call('hardhat', 'compile', configFilePath)
}
limitPluginScope (path) {
......
......@@ -83,7 +83,18 @@ class CompileTab {
console.log('mode is - ', this.fileManager.mode)
if (this.fileManager.mode === 'localhost') {
console.log('calling compilehardhat')
this.fileManager.compileWithHardhat('npx hardhat compile').then(console.log)
const { currentVersion, optimize, runs } = this.compiler.state
const fileContent = `module.exports = {
solidity: '${currentVersion.substring(0, currentVersion.indexOf('+commit'))}',
settings: {
optimizer: {
enabled: ${optimize},
runs: ${runs}
}
}
}
`
this.fileManager.compileWithHardhat(fileContent).then(console.log)
}
this.fileManager.saveCurrentFile()
this.miscApi.clearAnnotations()
......
......@@ -21,7 +21,8 @@ export class HardhatClient extends PluginClient {
this.currentSharedFolder = currentSharedFolder
}
compile (cmd: string) {
compile (configPath: string) {
const cmd = `npx hardhat compile --config ${configPath}`
const options = { cwd: this.currentSharedFolder, shell: true }
const child = spawn(cmd, options)
let result = ''
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment