Define a separator const

This commit is contained in:
Leonid Logvinov
2018-05-07 13:37:21 +02:00
parent 27262c4e56
commit 0f1589a43f
2 changed files with 5 additions and 4 deletions

View File

@@ -19,6 +19,7 @@ const DEFAULT_NETWORK_ID = 50;
const DEFAULT_JSONRPC_URL = 'http://localhost:8545';
const DEFAULT_GAS_PRICE = (10 ** 9 * 2).toString();
const DEFAULT_CONTRACTS_LIST = '*';
const SEPARATOR = ',';
/**
* Compiles all contracts with options passed in through CLI.
@@ -28,7 +29,7 @@ async function onCompileCommandAsync(argv: CliOptions): Promise<void> {
const opts: CompilerOptions = {
contractsDir: argv.contractsDir,
artifactsDir: argv.artifactsDir,
contracts: argv.contracts === '*' ? argv.contracts : argv.contracts.split(','),
contracts: argv.contracts === DEFAULT_CONTRACTS_LIST ? DEFAULT_CONTRACTS_LIST : argv.contracts.split(SEPARATOR),
};
await commands.compileAsync(opts);
}
@@ -44,7 +45,7 @@ async function onDeployCommandAsync(argv: CliOptions): Promise<void> {
const compilerOpts: CompilerOptions = {
contractsDir: argv.contractsDir,
artifactsDir: argv.artifactsDir,
contracts: argv.contracts === '*' ? argv.contracts : argv.contracts.split(','),
contracts: argv.contracts === DEFAULT_CONTRACTS_LIST ? DEFAULT_CONTRACTS_LIST : argv.contracts.split(SEPARATOR),
};
await commands.compileAsync(compilerOpts);
@@ -59,7 +60,7 @@ async function onDeployCommandAsync(argv: CliOptions): Promise<void> {
defaults,
};
const deployerArgsString = argv.args as string;
const deployerArgs = deployerArgsString.split(',');
const deployerArgs = deployerArgsString.split(SEPARATOR);
await commands.deployAsync(argv.contract as string, deployerArgs, deployerOpts);
}
/**

View File

@@ -53,7 +53,7 @@ const DEFAULT_COMPILER_SETTINGS: solc.CompilerSettings = {
},
outputSelection: {
'*': {
'*': ['abi', 'evm.bytecode.object'],
[ALL_CONTRACTS_IDENTIFIER]: ['abi', 'evm.bytecode.object'],
},
},
};