diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-03-27 23:43:50 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-27 23:43:50 +0800 |
commit | 26e9696ddb004759a4a7c5f4a8901dc3255a70f9 (patch) | |
tree | 05eba54c557a472dfc1eb5982b8899a5eb30c3b2 /packages/deployer/src/cli.ts | |
parent | 3b45d4727b14d2ad15784a18f4a47cf0deb40f27 (diff) | |
parent | f30353087f9c4ec4fa5e096a065c9749e1164984 (diff) | |
download | dexon-sol-tools-26e9696ddb004759a4a7c5f4a8901dc3255a70f9.tar dexon-sol-tools-26e9696ddb004759a4a7c5f4a8901dc3255a70f9.tar.gz dexon-sol-tools-26e9696ddb004759a4a7c5f4a8901dc3255a70f9.tar.bz2 dexon-sol-tools-26e9696ddb004759a4a7c5f4a8901dc3255a70f9.tar.lz dexon-sol-tools-26e9696ddb004759a4a7c5f4a8901dc3255a70f9.tar.xz dexon-sol-tools-26e9696ddb004759a4a7c5f4a8901dc3255a70f9.tar.zst dexon-sol-tools-26e9696ddb004759a4a7c5f4a8901dc3255a70f9.zip |
Merge pull request #460 from 0xProject/feature/deployer-improvements
@0xproject/deployer improvements
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; })(); |