diff options
author | Fabio Berger <me@fabioberger.com> | 2018-03-28 02:16:13 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-03-28 02:16:13 +0800 |
commit | 005376276098a4e6cb832eaf5b5dbc07118e1f50 (patch) | |
tree | 543a431a5fd2a17f3b3582cfb0910f8c85357ac1 /packages/deployer/src/cli.ts | |
parent | eb89ef79eba3d044e10b8e52e20927bb88241ac2 (diff) | |
parent | 066d13f5b7260d28b13195c4f9aed48b4ae96cc3 (diff) | |
download | dexon-sol-tools-005376276098a4e6cb832eaf5b5dbc07118e1f50.tar dexon-sol-tools-005376276098a4e6cb832eaf5b5dbc07118e1f50.tar.gz dexon-sol-tools-005376276098a4e6cb832eaf5b5dbc07118e1f50.tar.bz2 dexon-sol-tools-005376276098a4e6cb832eaf5b5dbc07118e1f50.tar.lz dexon-sol-tools-005376276098a4e6cb832eaf5b5dbc07118e1f50.tar.xz dexon-sol-tools-005376276098a4e6cb832eaf5b5dbc07118e1f50.tar.zst dexon-sol-tools-005376276098a4e6cb832eaf5b5dbc07118e1f50.zip |
merge developmentx
Diffstat (limited to 'packages/deployer/src/cli.ts')
-rw-r--r-- | packages/deployer/src/cli.ts | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/packages/deployer/src/cli.ts b/packages/deployer/src/cli.ts index 7913c6344..d1bd645b3 100644 --- a/packages/deployer/src/cli.ts +++ b/packages/deployer/src/cli.ts @@ -10,6 +10,7 @@ import * as yargs from 'yargs'; import { commands } from './commands'; import { constants } from './utils/constants'; +import { consoleReporter } from './utils/error_reporter'; import { CliOptions, CompilerOptions, DeployerOptions } from './utils/types'; const DEFAULT_OPTIMIZER_ENABLED = false; @@ -24,11 +25,11 @@ const DEFAULT_CONTRACTS_LIST = '*'; * Compiles all contracts with options passed in through CLI. * @param argv Instance of process.argv provided by yargs. */ -async function onCompileCommand(argv: CliOptions): Promise<void> { +async function onCompileCommandAsync(argv: CliOptions): Promise<void> { const opts: CompilerOptions = { contractsDir: argv.contractsDir, networkId: argv.networkId, - optimizerEnabled: argv.shouldOptimize ? 1 : 0, + optimizerEnabled: argv.shouldOptimize, artifactsDir: argv.artifactsDir, specifiedContracts: getContractsSetFromList(argv.contracts), }; @@ -38,7 +39,7 @@ async function onCompileCommand(argv: CliOptions): Promise<void> { * Deploys a single contract with provided name and args. * @param argv Instance of process.argv provided by yargs. */ -async function onDeployCommand(argv: CliOptions): Promise<void> { +async function onDeployCommandAsync(argv: CliOptions): Promise<void> { const url = argv.jsonrpcUrl; const web3Provider = new Web3.providers.HttpProvider(url); const web3Wrapper = new Web3Wrapper(web3Provider); @@ -46,7 +47,7 @@ async function onDeployCommand(argv: CliOptions): Promise<void> { const compilerOpts: CompilerOptions = { contractsDir: argv.contractsDir, networkId, - optimizerEnabled: argv.shouldOptimize ? 1 : 0, + optimizerEnabled: argv.shouldOptimize, artifactsDir: argv.artifactsDir, specifiedContracts: getContractsSetFromList(argv.contracts), }; @@ -62,9 +63,9 @@ async function onDeployCommand(argv: CliOptions): Promise<void> { networkId, defaults, }; - const deployerArgsString = argv.args; + const deployerArgsString = argv.args as string; const deployerArgs = deployerArgsString.split(','); - await commands.deployAsync(argv.contract, deployerArgs, deployerOpts); + await commands.deployAsync(argv.contract as string, deployerArgs, deployerOpts); } /** * Creates a set of contracts to compile. @@ -142,7 +143,12 @@ function deployCommandBuilder(yargsInstance: any) { default: DEFAULT_CONTRACTS_LIST, description: 'comma separated list of contracts to compile', }) - .command('compile', 'compile contracts', identityCommandBuilder, onCompileCommand) - .command('deploy', 'deploy a single contract with provided arguments', deployCommandBuilder, onDeployCommand) + .command('compile', 'compile contracts', identityCommandBuilder, consoleReporter(onCompileCommandAsync)) + .command( + 'deploy', + 'deploy a single contract with provided arguments', + deployCommandBuilder, + consoleReporter(onDeployCommandAsync), + ) .help().argv; })(); |