aboutsummaryrefslogtreecommitdiffstats
path: root/packages/deployer/src/cli.ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-02-16 11:09:53 +0800
committerFabio Berger <me@fabioberger.com>2018-02-16 11:09:53 +0800
commite2b51c5dc46b30b21e0561689de1f9a3d0127554 (patch)
treec8f93b5700961a46b16e49e52d159c989c11102d /packages/deployer/src/cli.ts
parentb610b7c1923dcc56883c5167393122ceaed26708 (diff)
parentb75fdd6b66a30196d53331827733b863bed770f0 (diff)
downloaddexon-sol-tools-e2b51c5dc46b30b21e0561689de1f9a3d0127554.tar
dexon-sol-tools-e2b51c5dc46b30b21e0561689de1f9a3d0127554.tar.gz
dexon-sol-tools-e2b51c5dc46b30b21e0561689de1f9a3d0127554.tar.bz2
dexon-sol-tools-e2b51c5dc46b30b21e0561689de1f9a3d0127554.tar.lz
dexon-sol-tools-e2b51c5dc46b30b21e0561689de1f9a3d0127554.tar.xz
dexon-sol-tools-e2b51c5dc46b30b21e0561689de1f9a3d0127554.tar.zst
dexon-sol-tools-e2b51c5dc46b30b21e0561689de1f9a3d0127554.zip
Merge branch 'development' of github.com:0xProject/0x.js into development
* 'development' of github.com:0xProject/0x.js: (24 commits) Rename variables Update CHANGELOG Add npm config for contracts list Run prettier Fix checks, add contract list to compile script in package.json Add contracts to compiler options Add missing public types from connect docs Change imports order Change default page params in connect to page 1 and perPage 100 Add docs staging to 0x.js package Fix a typo Add an assertion Add PR numbers Fix entry points Add tests for dev-utils package Move subproviders from dev-utils to subproviders Add missing CHANGELOG entry Add support for intersection types in docs Add stagedocs script to connect package web3 typings fix - web3.net.peerCount returns number ...
Diffstat (limited to 'packages/deployer/src/cli.ts')
-rw-r--r--packages/deployer/src/cli.ts21
1 files changed, 21 insertions, 0 deletions
diff --git a/packages/deployer/src/cli.ts b/packages/deployer/src/cli.ts
index 0fe412bdf..3c6d042c0 100644
--- a/packages/deployer/src/cli.ts
+++ b/packages/deployer/src/cli.ts
@@ -14,6 +14,7 @@ const DEFAULT_ARTIFACTS_DIR = path.resolve('artifacts');
const DEFAULT_NETWORK_ID = 50;
const DEFAULT_JSONRPC_PORT = 8545;
const DEFAULT_GAS_PRICE = (10 ** 9 * 2).toString();
+const DEFAULT_CONTRACTS_LIST = '*';
/**
* Compiles all contracts with options passed in through CLI.
@@ -25,6 +26,7 @@ async function onCompileCommand(argv: CliOptions): Promise<void> {
networkId: argv.networkId,
optimizerEnabled: argv.shouldOptimize ? 1 : 0,
artifactsDir: argv.artifactsDir,
+ specifiedContracts: getContractsSetFromList(argv.contracts),
};
await commands.compileAsync(opts);
}
@@ -43,6 +45,7 @@ async function onMigrateCommand(argv: CliOptions): Promise<void> {
networkId,
optimizerEnabled: argv.shouldOptimize ? 1 : 0,
artifactsDir: argv.artifactsDir,
+ specifiedContracts: getContractsSetFromList(argv.contracts),
};
await commands.compileAsync(compilerOpts);
@@ -72,6 +75,7 @@ async function onDeployCommand(argv: CliOptions): Promise<void> {
networkId,
optimizerEnabled: argv.shouldOptimize ? 1 : 0,
artifactsDir: argv.artifactsDir,
+ specifiedContracts: getContractsSetFromList(argv.contracts),
};
await commands.compileAsync(compilerOpts);
@@ -90,6 +94,18 @@ async function onDeployCommand(argv: CliOptions): Promise<void> {
await commands.deployAsync(argv.contract, deployerArgs, deployerOpts);
}
/**
+ * Creates a set of contracts to compile.
+ * @param contracts Comma separated list of contracts to compile
+ */
+function getContractsSetFromList(contracts: string): Set<string> {
+ const specifiedContracts = new Set();
+ const contractsArray = contracts.split(',');
+ _.forEach(contractsArray, contractName => {
+ specifiedContracts.add(contractName);
+ });
+ return specifiedContracts;
+}
+/**
* Provides extra required options for deploy command.
* @param yargsInstance yargs instance provided in builder function callback.
*/
@@ -144,6 +160,11 @@ function deployCommandBuilder(yargsInstance: any) {
type: 'string',
description: 'account to use for deploying contracts',
})
+ .option('contracts', {
+ type: 'string',
+ default: DEFAULT_CONTRACTS_LIST,
+ description: 'comma separated list of contracts to compile',
+ })
.command('compile', 'compile contracts', identityCommandBuilder, onCompileCommand)
.command(
'migrate',