#156326148 Updates to build and upload process and fixes for test_app/test.html
* Updated build to include deployment of contracts * updated the plugin uploadCmd to be a Promise for better bubbling of errors and messaging. * updated test.js imports so functionality works correctly.
This commit is contained in:
parent
6b7af4b647
commit
31a2a27e9a
27
lib/index.js
27
lib/index.js
|
@ -274,7 +274,7 @@ class Embark {
|
|||
if (cmdPlugin) {
|
||||
async.waterfall([
|
||||
|
||||
function buildDapp(callback){
|
||||
function (callback){
|
||||
engine.logger.debug('building dapp...');
|
||||
engine.startMonitor();
|
||||
engine.startService("libraryManager");
|
||||
|
@ -284,23 +284,30 @@ class Embark {
|
|||
engine.startService("deployment");
|
||||
engine.startService("ipfs");
|
||||
|
||||
// 3. upload to storage (outputDone event triggered after webpack finished)
|
||||
engine.events.on('outputDone', function () {
|
||||
engine.logger.debug('deploying...');
|
||||
cmdPlugin.uploadCmds[0].cb();
|
||||
engine.logger.debug('deploying to ' + platform + '...');
|
||||
cmdPlugin.uploadCmds[0].cb()
|
||||
.then((success) => {
|
||||
callback();
|
||||
})
|
||||
.catch((err) => {
|
||||
callback(err);
|
||||
});
|
||||
|
||||
// build the contracts
|
||||
engine.contractsManager.build(function(){
|
||||
// trigger code generation and dapp webpack
|
||||
});
|
||||
|
||||
// 1. build the contracts
|
||||
engine.deployManager.deployContracts(function (err) {
|
||||
if(err){
|
||||
callback(err);
|
||||
}
|
||||
|
||||
// 2. trigger code generation and dapp webpack
|
||||
engine.events.emit('asset-changed', engine.contractsManager);
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
function upload(callback){
|
||||
|
||||
callback();
|
||||
}
|
||||
], function (err, _result) {
|
||||
if (err) {
|
||||
|
|
|
@ -12,6 +12,7 @@ class IPFS {
|
|||
}
|
||||
|
||||
deploy() {
|
||||
return new Promise((resolve, reject) => {
|
||||
console.log("deploying!");
|
||||
let self = this;
|
||||
async.waterfall([
|
||||
|
@ -50,10 +51,12 @@ class IPFS {
|
|||
if (err) {
|
||||
console.log("error uploading to ipfs".red);
|
||||
console.log(err);
|
||||
reject(err);
|
||||
}
|
||||
else resolve('successfully uploaded to ipfs');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = IPFS;
|
||||
|
|
|
@ -9,6 +9,7 @@ class Swarm {
|
|||
}
|
||||
|
||||
deploy() {
|
||||
return new Promise((resolve, reject) => {
|
||||
let self = this;
|
||||
async.waterfall([
|
||||
function findBinary(callback) {
|
||||
|
@ -48,7 +49,10 @@ class Swarm {
|
|||
if (err) {
|
||||
console.log("error uploading to swarm".red);
|
||||
console.log(err);
|
||||
reject(err);
|
||||
}
|
||||
else resolve('successfully uploaded to swarm');
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,12 @@
|
|||
import $ from 'jquery';
|
||||
import AlreadyDeployedToken from 'Embark/contracts/AlreadyDeployedToken';
|
||||
import AnotherStorage from 'Embark/contracts/AnotherStorage';
|
||||
import async from 'async';
|
||||
import MyToken from 'Embark/contracts/MyToken';
|
||||
import MyToken2 from 'Embark/contracts/MyToken2';
|
||||
import SimpleStorage from 'Embark/contracts/SimpleStorage';
|
||||
import Token from 'Embark/contracts/Token';
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
|
|
Loading…
Reference in New Issue