bugfix(@embark/code_generator): write blockchain config file before writing embarkjs artifact

This commit is contained in:
Iuri Matias 2019-03-18 17:24:54 -04:00
parent 832f16ae08
commit 9c74da3a7b
1 changed files with 10 additions and 2 deletions

View File

@ -153,14 +153,14 @@ class CodeGenerator {
});
}
generateContractConfig(contractConfig) {
generateContractConfig(contractConfig, callback) {
this.dappConfigs.blockchain = {
dappConnection: contractConfig.dappConnection,
dappAutoEnable: contractConfig.dappAutoEnable,
warnIfMetamask: this.blockchainConfig.isDev,
blockchainClient: this.blockchainConfig.ethereumClientName
};
this.generateArtifact(this.dappConfigs.blockchain, constants.dappArtifacts.blockchain, constants.dappArtifacts.dir);
this.generateArtifact(this.dappConfigs.blockchain, constants.dappArtifacts.blockchain, constants.dappArtifacts.dir, callback);
}
generateStorageConfig(storageConfig) {
@ -309,6 +309,14 @@ class CodeGenerator {
let code = "/* eslint-disable */";
async.waterfall([
// TODO: here due to a race condition when running embark build
function generateConfig(next) {
self.events.request("config:contractsConfig", (contractsConfig) => {
self.generateContractConfig(contractsConfig, () => {
next()
})
})
},
function getEmbarkJsLocation(next) {
self.events.request('version:downloadIfNeeded', 'embarkjs', (err, location) => {
if (err) {