Install types for yargs

This commit is contained in:
Leonid Logvinov 2017-12-18 16:27:14 +01:00
parent 04268d7f4b
commit a5d2cbfd6f
No known key found for this signature in database
GPG Key ID: 0DD294BFDE8C95D4
6 changed files with 15 additions and 11 deletions

View File

@ -38,7 +38,7 @@
"@types/handlebars": "^4.0.36", "@types/handlebars": "^4.0.36",
"@types/mkdirp": "^0.5.1", "@types/mkdirp": "^0.5.1",
"@types/node": "^8.0.53", "@types/node": "^8.0.53",
"@types/yargs": "^8.0.2", "@types/yargs": "^10.0.0",
"npm-run-all": "^4.1.2", "npm-run-all": "^4.1.2",
"shx": "^0.2.2", "shx": "^0.2.2",
"tslint": "5.8.0", "tslint": "5.8.0",

View File

@ -23,12 +23,12 @@ const DEFAULT_GAS_PRICE = ((10 ** 9) * 2).toString();
* Compiles all contracts with options passed in through CLI. * Compiles all contracts with options passed in through CLI.
* @param argv Instance of process.argv provided by yargs. * @param argv Instance of process.argv provided by yargs.
*/ */
async function onCompileCommand(args: CliOptions): Promise<void> { async function onCompileCommand(argv: CliOptions): Promise<void> {
const opts: CompilerOptions = { const opts: CompilerOptions = {
contractsDir: args.contractsDir, contractsDir: argv.contractsDir,
networkId: args.networkId, networkId: argv.networkId,
optimizerEnabled: args.shouldOptimize ? 1 : 0, optimizerEnabled: argv.shouldOptimize ? 1 : 0,
artifactsDir: args.artifactsDir, artifactsDir: argv.artifactsDir,
}; };
await commands.compileAsync(opts); await commands.compileAsync(opts);
} }
@ -150,11 +150,11 @@ function deployCommandBuilder(yargsInstance: any) {
}) })
.command('compile', .command('compile',
'compile contracts', 'compile contracts',
_.noop, _.identity,
onCompileCommand) onCompileCommand)
.command('migrate', .command('migrate',
'compile and deploy contracts using migration scripts', 'compile and deploy contracts using migration scripts',
_.noop, _.identity,
onMigrateCommand) onMigrateCommand)
.command('deploy', .command('deploy',
'deploy a single contract with provided arguments', 'deploy a single contract with provided arguments',

View File

@ -1,5 +1,6 @@
import {TxData} from '@0xproject/types'; import {TxData} from '@0xproject/types';
import * as Web3 from 'web3'; import * as Web3 from 'web3';
import * as yargs from 'yargs';
export enum AbiType { export enum AbiType {
Function = 'function', Function = 'function',
@ -32,7 +33,7 @@ export interface SolcErrors {
[key: string]: boolean; [key: string]: boolean;
} }
export interface CliOptions { export interface CliOptions extends yargs.Arguments {
artifactsDir: string; artifactsDir: string;
contractsDir: string; contractsDir: string;
jsonrpcPort: number; jsonrpcPort: number;

View File

@ -2,7 +2,6 @@ declare module 'bn.js';
declare module 'ethereumjs-abi'; declare module 'ethereumjs-abi';
declare module 'chai-bignumber'; declare module 'chai-bignumber';
declare module 'dirty-chai'; declare module 'dirty-chai';
declare module 'yargs';
// HACK: In order to merge the bignumber declaration added by chai-bignumber to the chai Assertion // HACK: In order to merge the bignumber declaration added by chai-bignumber to the chai Assertion
// interface we must use `namespace` as the Chai definitelyTyped definition does. Since we otherwise // interface we must use `namespace` as the Chai definitelyTyped definition does. Since we otherwise

View File

@ -36,7 +36,7 @@
"@types/lodash": "^4.14.86", "@types/lodash": "^4.14.86",
"@types/node": "^8.0.53", "@types/node": "^8.0.53",
"@types/request-promise-native": "^1.0.2", "@types/request-promise-native": "^1.0.2",
"@types/yargs": "^8.0.2", "@types/yargs": "^10.0.0",
"chai": "^4.0.1", "chai": "^4.0.1",
"chai-as-promised": "^7.1.0", "chai-as-promised": "^7.1.0",
"chai-as-promised-typescript-typings": "^0.0.3", "chai-as-promised-typescript-typings": "^0.0.3",

View File

@ -266,6 +266,10 @@
dependencies: dependencies:
"@types/node" "*" "@types/node" "*"
"@types/yargs@^10.0.0":
version "10.0.0"
resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-10.0.0.tgz#b93aa88155fe5106cddf3f934517411ca2a45939"
"@types/yargs@^8.0.2": "@types/yargs@^8.0.2":
version "8.0.2" version "8.0.2"
resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-8.0.2.tgz#0f9c7b236e2d78cd8f4b6502de15d0728aa29385" resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-8.0.2.tgz#0f9c7b236e2d78cd8f4b6502de15d0728aa29385"