Skip to content

Commit

Permalink
Fix prepare-docs-solc.js for Hardhat
Browse files Browse the repository at this point in the history
  • Loading branch information
frangio committed Feb 4, 2021
1 parent 9425a7e commit ed76232
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions scripts/prepare-docs-solc.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
const path = require('path');
const bre = require('@nomiclabs/buidler');
const hre = require('hardhat');

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(
bre.config.solc.version,
path.join(bre.config.paths.cache, 'compilers'),
);
const [{ version }] = hre.config.solidity.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 });

0 comments on commit ed76232

Please sign in to comment.