aboutsummaryrefslogtreecommitdiffstats
path: root/packages/abi-gen
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-06-27 15:50:05 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-06-29 22:52:51 +0800
commiteafdd4d42d1cab2e579ca8ed1423d285acf78850 (patch)
treecac834a809c210261c48d8e2f08b43fa3630b980 /packages/abi-gen
parent1a2c58494fa8ddd430c9f20829d0007e77b7d6c3 (diff)
downloaddexon-sol-tools-eafdd4d42d1cab2e579ca8ed1423d285acf78850.tar
dexon-sol-tools-eafdd4d42d1cab2e579ca8ed1423d285acf78850.tar.gz
dexon-sol-tools-eafdd4d42d1cab2e579ca8ed1423d285acf78850.tar.bz2
dexon-sol-tools-eafdd4d42d1cab2e579ca8ed1423d285acf78850.tar.lz
dexon-sol-tools-eafdd4d42d1cab2e579ca8ed1423d285acf78850.tar.xz
dexon-sol-tools-eafdd4d42d1cab2e579ca8ed1423d285acf78850.tar.zst
dexon-sol-tools-eafdd4d42d1cab2e579ca8ed1423d285acf78850.zip
Remove generated contract directory before writing new contracts and replace z_r_x and e_r_c with zrx and erc accordingly
Diffstat (limited to 'packages/abi-gen')
-rw-r--r--packages/abi-gen/package.json2
-rw-r--r--packages/abi-gen/src/index.ts6
2 files changed, 5 insertions, 3 deletions
diff --git a/packages/abi-gen/package.json b/packages/abi-gen/package.json
index 9d3c6d00d..e71b0ec47 100644
--- a/packages/abi-gen/package.json
+++ b/packages/abi-gen/package.json
@@ -34,6 +34,7 @@
"glob": "^7.1.2",
"handlebars": "^4.0.11",
"lodash": "^4.17.4",
+ "rimraf": "^2.6.2",
"mkdirp": "^0.5.1",
"to-snake-case": "^1.0.0",
"yargs": "^10.0.3"
@@ -42,6 +43,7 @@
"@0xproject/monorepo-scripts": "^0.2.1",
"@0xproject/tslint-config": "^0.4.20",
"@types/glob": "^5.0.33",
+ "@types/rimraf": "^2.0.2",
"@types/handlebars": "^4.0.36",
"@types/mkdirp": "^0.5.1",
"@types/node": "^8.0.53",
diff --git a/packages/abi-gen/src/index.ts b/packages/abi-gen/src/index.ts
index 0d053cdd1..c49f9dfa7 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,7 @@ 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';
- }
+ 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 +95,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) {