Commit ed762327 by Francisco Giordano

Fix prepare-docs-solc.js for Hardhat

parent 9425a7e0
const path = require('path'); const hre = require('hardhat');
const bre = require('@nomiclabs/buidler');
const { Compiler } = require('@nomiclabs/buidler/internal/solidity/compiler'); const { getCompilersDir } = require('hardhat/internal/util/global-dir');
const { CompilerDownloader } = require('hardhat/internal/solidity/compiler/downloader');
const { Compiler } = require('hardhat/internal/solidity/compiler');
const compiler = new Compiler( const [{ version }] = hre.config.solidity.compilers;
bre.config.solc.version,
path.join(bre.config.paths.cache, 'compilers'),
);
module.exports = Object.assign(compiler.getSolc(), { __esModule: true }); async function getSolc () {
const downloader = new CompilerDownloader(await getCompilersDir(), { forceSolcJs: true });
const { compilerPath } = await downloader.getDownloadedCompilerPath(version);
const compiler = new Compiler(compilerPath);
return compiler.getSolc();
}
module.exports = Object.assign(getSolc(), { __esModule: true });
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