aboutsummaryrefslogtreecommitdiffstats
path: root/packages/abi-gen/src/index.ts
diff options
context:
space:
mode:
authorBrandon Millman <brandon.millman@gmail.com>2018-03-14 09:06:02 +0800
committerBrandon Millman <brandon.millman@gmail.com>2018-03-14 09:13:48 +0800
commitc8a8b851d8e0622559f71843a206a0e6e601cd83 (patch)
tree143e238a68005fdb0e0d82c6750ea890fec4021c /packages/abi-gen/src/index.ts
parentc2f8858aabad2355e09ba65e900202b7c4edec5e (diff)
downloaddexon-sol-tools-c8a8b851d8e0622559f71843a206a0e6e601cd83.tar
dexon-sol-tools-c8a8b851d8e0622559f71843a206a0e6e601cd83.tar.gz
dexon-sol-tools-c8a8b851d8e0622559f71843a206a0e6e601cd83.tar.bz2
dexon-sol-tools-c8a8b851d8e0622559f71843a206a0e6e601cd83.tar.lz
dexon-sol-tools-c8a8b851d8e0622559f71843a206a0e6e601cd83.tar.xz
dexon-sol-tools-c8a8b851d8e0622559f71843a206a0e6e601cd83.tar.zst
dexon-sol-tools-c8a8b851d8e0622559f71843a206a0e6e601cd83.zip
Consolidate all console.log into the @0xproject/utils package
Diffstat (limited to 'packages/abi-gen/src/index.ts')
-rw-r--r--packages/abi-gen/src/index.ts17
1 files changed, 9 insertions, 8 deletions
diff --git a/packages/abi-gen/src/index.ts b/packages/abi-gen/src/index.ts
index 7c29f7d1d..8932e4045 100644
--- a/packages/abi-gen/src/index.ts
+++ b/packages/abi-gen/src/index.ts
@@ -1,5 +1,6 @@
#!/usr/bin/env node
+import { logUtils } from '@0xproject/utils';
import chalk from 'chalk';
import * as fs from 'fs';
import { sync as globSync } from 'glob';
@@ -62,7 +63,7 @@ const args = yargs
function registerPartials(partialsGlob: string) {
const partialTemplateFileNames = globSync(partialsGlob);
- utils.log(`Found ${chalk.green(`${partialTemplateFileNames.length}`)} ${chalk.bold('partial')} templates`);
+ logUtils.log(`Found ${chalk.green(`${partialTemplateFileNames.length}`)} ${chalk.bold('partial')} templates`);
for (const partialTemplateFileName of partialTemplateFileNames) {
const namedContent = utils.getNamedContent(partialTemplateFileName);
Handlebars.registerPartial(namedContent.name, namedContent.content);
@@ -77,7 +78,7 @@ function writeOutputFile(name: string, renderedTsCode: string): void {
}
const filePath = `${args.output}/${fileName}.ts`;
fs.writeFileSync(filePath, renderedTsCode);
- utils.log(`Created: ${chalk.bold(filePath)}`);
+ logUtils.log(`Created: ${chalk.bold(filePath)}`);
}
Handlebars.registerHelper('parameterType', utils.solTypeToTsType.bind(utils, ParamKind.Input, args.backend));
@@ -91,17 +92,17 @@ const template = Handlebars.compile<ContextData>(mainTemplate.content);
const abiFileNames = globSync(args.abis);
if (_.isEmpty(abiFileNames)) {
- utils.log(`${chalk.red(`No ABI files found.`)}`);
- utils.log(`Please make sure you've passed the correct folder name and that the files have
+ logUtils.log(`${chalk.red(`No ABI files found.`)}`);
+ logUtils.log(`Please make sure you've passed the correct folder name and that the files have
${chalk.bold('*.json')} extensions`);
process.exit(1);
} else {
- utils.log(`Found ${chalk.green(`${abiFileNames.length}`)} ${chalk.bold('ABI')} files`);
+ logUtils.log(`Found ${chalk.green(`${abiFileNames.length}`)} ${chalk.bold('ABI')} files`);
mkdirp.sync(args.output);
}
for (const abiFileName of abiFileNames) {
const namedContent = utils.getNamedContent(abiFileName);
- utils.log(`Processing: ${chalk.bold(namedContent.name)}...`);
+ logUtils.log(`Processing: ${chalk.bold(namedContent.name)}...`);
const parsedContent = JSON.parse(namedContent.content);
let ABI;
if (_.isArray(parsedContent)) {
@@ -112,8 +113,8 @@ for (const abiFileName of abiFileNames) {
ABI = parsedContent.networks[args.networkId].abi; // 0x contracts package artifact
}
if (_.isUndefined(ABI)) {
- utils.log(`${chalk.red(`ABI not found in ${abiFileName}.`)}`);
- utils.log(
+ logUtils.log(`${chalk.red(`ABI not found in ${abiFileName}.`)}`);
+ logUtils.log(
`Please make sure your ABI file is either an array with ABI entries or a truffle artifact or 0x deployer artifact`,
);
process.exit(1);