aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sol-compiler/src/cli.ts
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-05-08 21:42:07 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-05-10 23:47:38 +0800
commita6f72de09d7b2c9738b78d2097baa9906838fbe9 (patch)
tree17126a5b45dabf2c7410d25668c68ce3d78284f0 /packages/sol-compiler/src/cli.ts
parent96037aed5231aa9344e5037aa6cff3d01f4abdae (diff)
downloaddexon-sol-tools-a6f72de09d7b2c9738b78d2097baa9906838fbe9.tar
dexon-sol-tools-a6f72de09d7b2c9738b78d2097baa9906838fbe9.tar.gz
dexon-sol-tools-a6f72de09d7b2c9738b78d2097baa9906838fbe9.tar.bz2
dexon-sol-tools-a6f72de09d7b2c9738b78d2097baa9906838fbe9.tar.lz
dexon-sol-tools-a6f72de09d7b2c9738b78d2097baa9906838fbe9.tar.xz
dexon-sol-tools-a6f72de09d7b2c9738b78d2097baa9906838fbe9.tar.zst
dexon-sol-tools-a6f72de09d7b2c9738b78d2097baa9906838fbe9.zip
Rename deployer to sol-compiler
Diffstat (limited to 'packages/sol-compiler/src/cli.ts')
-rw-r--r--packages/sol-compiler/src/cli.ts41
1 files changed, 41 insertions, 0 deletions
diff --git a/packages/sol-compiler/src/cli.ts b/packages/sol-compiler/src/cli.ts
new file mode 100644
index 000000000..2412b8d34
--- /dev/null
+++ b/packages/sol-compiler/src/cli.ts
@@ -0,0 +1,41 @@
+#!/usr/bin/env node
+// We need the above pragma since this script will be run as a command-line tool.
+
+import { BigNumber } from '@0xproject/utils';
+import { Web3Wrapper } from '@0xproject/web3-wrapper';
+import * as _ from 'lodash';
+import * as path from 'path';
+import * as Web3 from 'web3';
+import * as yargs from 'yargs';
+
+import { Compiler } from './compiler';
+import { constants } from './utils/constants';
+import { CompilerOptions } from './utils/types';
+
+const DEFAULT_CONTRACTS_LIST = '*';
+const SEPARATOR = ',';
+
+(async () => {
+ const argv = yargs
+ .option('contracts-dir', {
+ type: 'string',
+ description: 'path of contracts directory to compile',
+ })
+ .option('artifacts-dir', {
+ type: 'string',
+ description: 'path to write contracts artifacts to',
+ })
+ .option('contracts', {
+ type: 'string',
+ default: DEFAULT_CONTRACTS_LIST,
+ description: 'comma separated list of contracts to compile',
+ })
+ .help().argv;
+ const opts: CompilerOptions = {
+ contractsDir: argv.contractsDir,
+ artifactsDir: argv.artifactsDir,
+ contracts: argv.contracts === DEFAULT_CONTRACTS_LIST ? DEFAULT_CONTRACTS_LIST : argv.contracts.split(SEPARATOR),
+ };
+ const compiler = new Compiler(opts);
+ await compiler.compileAsync();
+})();