diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-04-10 19:44:15 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-04-12 18:50:38 +0800 |
commit | f2f9bd2e7ac1372073644a4e30a5d99e8c57fbb1 (patch) | |
tree | 98ff3c9137cdce1a44b65dc7dc89a7a72f70b9de /packages/deployer/src/cli.ts | |
parent | ed0c64fdcf5c180107f54ad916c11c4901a4c01c (diff) | |
download | dexon-sol-tools-f2f9bd2e7ac1372073644a4e30a5d99e8c57fbb1.tar.gz dexon-sol-tools-f2f9bd2e7ac1372073644a4e30a5d99e8c57fbb1.tar.zst dexon-sol-tools-f2f9bd2e7ac1372073644a4e30a5d99e8c57fbb1.zip |
Revert "Merge pull request #493 from hysz/features/deployer/multipleCodebaseSupport"
This reverts commit 70d403e6f8c56bc70e6d3471a770b9bbff5d72e7, reversing
changes made to 073bf738ddb271b6b4158798baf4cac3cb0608e9.
Diffstat (limited to 'packages/deployer/src/cli.ts')
-rw-r--r-- | packages/deployer/src/cli.ts | 37 |
1 files changed, 7 insertions, 30 deletions
diff --git a/packages/deployer/src/cli.ts b/packages/deployer/src/cli.ts index 7b32187c4..f1cf56416 100644 --- a/packages/deployer/src/cli.ts +++ b/packages/deployer/src/cli.ts @@ -11,7 +11,7 @@ import * as yargs from 'yargs'; import { commands } from './commands'; import { constants } from './utils/constants'; import { consoleReporter } from './utils/error_reporter'; -import { CliOptions, CompilerOptions, ContractDirectory, DeployerOptions } from './utils/types'; +import { CliOptions, CompilerOptions, DeployerOptions } from './utils/types'; const DEFAULT_OPTIMIZER_ENABLED = false; const DEFAULT_CONTRACTS_DIR = path.resolve('src/contracts'); @@ -27,7 +27,7 @@ const DEFAULT_CONTRACTS_LIST = '*'; */ async function onCompileCommandAsync(argv: CliOptions): Promise<void> { const opts: CompilerOptions = { - contractDirs: getContractDirectoriesFromList(argv.contractDirs), + contractsDir: argv.contractsDir, networkId: argv.networkId, optimizerEnabled: argv.shouldOptimize, artifactsDir: argv.artifactsDir, @@ -45,7 +45,7 @@ async function onDeployCommandAsync(argv: CliOptions): Promise<void> { const web3Wrapper = new Web3Wrapper(provider); const networkId = await web3Wrapper.getNetworkIdAsync(); const compilerOpts: CompilerOptions = { - contractDirs: getContractDirectoriesFromList(argv.contractDirs), + contractsDir: argv.contractsDir, networkId, optimizerEnabled: argv.shouldOptimize, artifactsDir: argv.artifactsDir, @@ -69,29 +69,6 @@ async function onDeployCommandAsync(argv: CliOptions): Promise<void> { } /** * Creates a set of contracts to compile. - * @param contractDirectoriesList Comma separated list of contract directories - * @return Set of contract directories - */ -function getContractDirectoriesFromList(contractDirectoriesList: string): Set<ContractDirectory> { - const directories = new Set(); - const possiblyNamespacedDirectories = contractDirectoriesList.split(','); - _.forEach(possiblyNamespacedDirectories, namespacedDirectory => { - const directoryComponents = namespacedDirectory.split(':'); - if (directoryComponents.length === 1) { - const directory = { namespace: '', path: directoryComponents[0] }; - directories.add(directory); - } else if (directoryComponents.length === 2) { - const directory = { namespace: directoryComponents[0], path: directoryComponents[1] }; - directories.add(directory); - } else { - throw new Error(`Unable to parse contracts directory: '${namespacedDirectory}'`); - } - }); - - return directories; -} -/** - * Creates a set of contracts to compile. * @param contracts Comma separated list of contracts to compile */ function getContractsSetFromList(contracts: string): Set<string> { @@ -101,7 +78,8 @@ function getContractsSetFromList(contracts: string): Set<string> { } const contractsArray = contracts.split(','); _.forEach(contractsArray, contractName => { - specifiedContracts.add(contractName); + const fileName = `${contractName}${constants.SOLIDITY_FILE_EXTENSION}`; + specifiedContracts.add(fileName); }); return specifiedContracts; } @@ -126,11 +104,10 @@ function deployCommandBuilder(yargsInstance: any) { (() => { const identityCommandBuilder = _.identity; return yargs - .option('contract-dirs', { + .option('contracts-dir', { type: 'string', default: DEFAULT_CONTRACTS_DIR, - description: - "comma separated list of contract directories.\nTo avoid filename clashes, directories should be prefixed with a namespace as follows: 'namespace:/path/to/dir'.", + description: 'path of contracts directory to compile', }) .option('network-id', { type: 'number', |