Skip to content

Commit 6289726

Browse files
committed
Auto-compile before fetching output
1 parent aa6a754 commit 6289726

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

web3deployment/KatalystDeploy/katalystNetworkDeployer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ async function main() {
249249

250250
chainId = chainId || await web3.eth.net.getId()
251251
console.log('chainId', chainId);
252-
console.log('retrieving artifacts...');
252+
console.log('compiling contracts and retrieving artifacts...');
253253
output = await require("../retrieveArtifacts.js").retrieveArtifacts();
254254

255255
//reinstantiate web3 (solc overwrites something)

web3deployment/retrieveArtifacts.js

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,18 @@ const util = require('util');
33
const readdir = util.promisify(fs.readdir);
44
const path = require("path");
55
const artifactsPath = path.join(__dirname, "../artifacts/");
6+
const buidlerConfigSol5 = path.join(__dirname, "../buidlerConfigSol5.js");
7+
const buidlerConfigSol4 = path.join(__dirname, "../buidlerConfigSol4.js");
68
const execSync = require('child_process').execSync;
79

810
module.exports.retrieveArtifacts = main;
9-
async function main() {
10-
if (fs.existsSync(artifactsPath)) {
11-
let output = await packageArtifacts();
12-
return output;
13-
} else {
14-
compileArtifacts();
15-
main();
11+
async function main(skipCompilation) {
12+
if (!skipCompilation) {
13+
compileContracts();
1614
}
15+
let output = await packageArtifacts();
16+
console.log(output)
17+
return output;
1718
}
1819

1920
async function packageArtifacts() {
@@ -27,11 +28,11 @@ async function packageArtifacts() {
2728
}
2829

2930

30-
function compileArtifacts() {
31-
console.log("Artifacts not found. Compiling contracts...");
32-
execSync('npx buidler compile', { encoding: 'utf-8' });
33-
execSync('npx buidler compile --config ../buidlerConfigSol5.js', { encoding: 'utf-8'});
34-
execSync('npx buidler compile --config ../buidlerConfigSol4.js', { encoding: 'utf-8'});
31+
function compileContracts() {
32+
console.log("Compiling contracts...");
33+
execSync(`npx buidler compile`, { encoding: 'utf-8' });
34+
execSync(`npx buidler compile --config ${buidlerConfigSol5}`, { encoding: 'utf-8'});
35+
execSync(`npx buidler compile --config ${buidlerConfigSol4}`, { encoding: 'utf-8'});
3536
}
3637

3738
main();

0 commit comments

Comments
 (0)