Skip to content

Commit

Permalink
A few attempts to improve things visually, despite the various quirks…
Browse files Browse the repository at this point in the history
…. Not really the best... uncertain how to fully implement this well, but this was very valuable in my guessing: sindresorhus/ora#49 (comment)
  • Loading branch information
Luiserebii committed May 2, 2019
1 parent c1d654e commit 3b3c6b9
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
2 changes: 1 addition & 1 deletion deployments/compile/solc-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class SolcUtil {

//Generate input object, assuming Solidity as language, from filepath of sources
generateSolcInputDirectory(root) {
const spinner = ora('Generating solc input from directory ' + root + '...');
const spinner = ora('Generating solc input from directory ' + root).start().clear();
let input = { language: 'Solidity', sources: {}, settings: { outputSelection: { '*': { '*': [ '*' ] } } } };
//By default, we will print all output, therefore, we directly stick the output settings above ^^^

Expand Down
8 changes: 5 additions & 3 deletions deployments/deploy/deployer.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,28 +37,30 @@ class Deployer {

console.log(pp.miniheadline("Deploying " + contract.name + '...'));
const spinner = ora().start();
spinner.clear();
let spinnerConf;
let contractWeb3 = await (new this.web3.eth.Contract(contract.abi)
.deploy({ "data": contract.bytecode.indexOf('0x') === 0 ? contract.bytecode : '0x' + contract.bytecode, "arguments": args })
.send(sendOptions)
.on('receipt', (receipt) => {
spinner.succeed();
console.log(pp.arrow("status: " + receipt.status ? "Success!" : "Failed :("));
console.log(pp.arrow("transaction hash: " + receipt.transactionHash));
console.log(pp.arrow("contract address: " + receipt.contractAddress));
console.log(pp.arrow("from: " + receipt.from));
console.log(pp.arrow("block number: " + receipt.blockNumber));
console.log(pp.arrow("gas used: " + receipt.gasUsed));
console.log(pp.miniheadline("\nPausing for 2 confirmations..."));
spinnerConf = ora().start();
spinnerConf = ora().start()
spinnerConf.clear();

})
.on('confirmation', (num, receipt) => {
console.log("confirmation number: " + num + " (block: " + receipt.blockNumber + ")");
if(num === 2) {
spinnerConf.succeed();
console.log("...");
console.log("Confirmed!");
spinnerConf.succeed();
spinner.succeed();

process.exit(0);
console.log("\n\nExtra confirmations:\n")
Expand Down
25 changes: 25 additions & 0 deletions deployments/ora-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const ora = require('ora');

const spinner = ora('Starting deployment...').start();
spinner.clear();
console.log("a")
console.log("b")
console.log("c")
const anal = ora('mini-deploy').start();
anal.clear();
console.log("a")
console.log("b")
console.log("c")
anal.succeed();
spinner.succeed();

const doot = ora('uguu').start();
console.log("f")
console.log("g")
console.log("gfdsgfdsgfd\n\n")
doot.clear();
console.log("h")
console.log("i")
console.log("j")
doot.succeed();

0 comments on commit 3b3c6b9

Please sign in to comment.