aboutsummaryrefslogtreecommitdiffstats
path: root/packages/abi-gen/src
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-07-03 20:32:38 +0800
committerGitHub <noreply@github.com>2018-07-03 20:32:38 +0800
commit0e690608d39c010740d9fdb9d8e6c12d7e6c4e80 (patch)
treee03b85876abc0de57755575287b89a79e7824296 /packages/abi-gen/src
parent518a2da0275632a5dd61f99a105163ff5a074927 (diff)
parent09e921a562bea4fa80ec19ce7a9061bbcffbd580 (diff)
downloaddexon-sol-tools-0e690608d39c010740d9fdb9d8e6c12d7e6c4e80.tar
dexon-sol-tools-0e690608d39c010740d9fdb9d8e6c12d7e6c4e80.tar.gz
dexon-sol-tools-0e690608d39c010740d9fdb9d8e6c12d7e6c4e80.tar.bz2
dexon-sol-tools-0e690608d39c010740d9fdb9d8e6c12d7e6c4e80.tar.lz
dexon-sol-tools-0e690608d39c010740d9fdb9d8e6c12d7e6c4e80.tar.xz
dexon-sol-tools-0e690608d39c010740d9fdb9d8e6c12d7e6c4e80.tar.zst
dexon-sol-tools-0e690608d39c010740d9fdb9d8e6c12d7e6c4e80.zip
Merge pull request #782 from 0xProject/feature/contract-wrappers-v2
@0xproject/contract-wrappers V2 refactor. Part 1
Diffstat (limited to 'packages/abi-gen/src')
-rw-r--r--packages/abi-gen/src/index.ts8
1 files changed, 5 insertions, 3 deletions
diff --git a/packages/abi-gen/src/index.ts b/packages/abi-gen/src/index.ts
index 0d053cdd1..47f2c404b 100644
--- a/packages/abi-gen/src/index.ts
+++ b/packages/abi-gen/src/index.ts
@@ -8,6 +8,7 @@ import { sync as globSync } from 'glob';
import * as Handlebars from 'handlebars';
import * as _ from 'lodash';
import * as mkdirp from 'mkdirp';
+import * as rimraf from 'rimraf';
import * as yargs from 'yargs';
import toSnakeCase = require('to-snake-case');
@@ -72,9 +73,9 @@ function registerPartials(partialsGlob: string): void {
function writeOutputFile(name: string, renderedTsCode: string): void {
let fileName = toSnakeCase(name);
- if (fileName === 'z_r_x_token') {
- fileName = 'zrx_token';
- }
+ // HACK: Snake case doesn't make a lot of sense for abbreviated names but we can't reliably detect abbreviations
+ // so we special-case the abbreviations we use.
+ fileName = fileName.replace('z_r_x', 'zrx').replace('e_r_c', 'erc');
const filePath = `${args.output}/${fileName}.ts`;
fs.writeFileSync(filePath, renderedTsCode);
logUtils.log(`Created: ${chalk.bold(filePath)}`);
@@ -96,6 +97,7 @@ if (_.isEmpty(abiFileNames)) {
process.exit(1);
} else {
logUtils.log(`Found ${chalk.green(`${abiFileNames.length}`)} ${chalk.bold('ABI')} files`);
+ rimraf.sync(args.output);
mkdirp.sync(args.output);
}
for (const abiFileName of abiFileNames) {