diff options
author | Fabio Berger <me@fabioberger.com> | 2018-03-16 02:44:10 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-03-16 02:44:10 +0800 |
commit | 8d1e27a1a53f4c88ec9fefb5fd37b30c652782a6 (patch) | |
tree | 831b8d07c48d3700ec5662c7948ebab5e903b1b9 /packages/abi-gen/src/index.ts | |
parent | f9ad97b978ae4017adca032168ae7963c94e4157 (diff) | |
parent | 8137d41ce54b582032770c9b168016ce379711bf (diff) | |
download | dexon-sol-tools-8d1e27a1a53f4c88ec9fefb5fd37b30c652782a6.tar dexon-sol-tools-8d1e27a1a53f4c88ec9fefb5fd37b30c652782a6.tar.gz dexon-sol-tools-8d1e27a1a53f4c88ec9fefb5fd37b30c652782a6.tar.bz2 dexon-sol-tools-8d1e27a1a53f4c88ec9fefb5fd37b30c652782a6.tar.lz dexon-sol-tools-8d1e27a1a53f4c88ec9fefb5fd37b30c652782a6.tar.xz dexon-sol-tools-8d1e27a1a53f4c88ec9fefb5fd37b30c652782a6.tar.zst dexon-sol-tools-8d1e27a1a53f4c88ec9fefb5fd37b30c652782a6.zip |
Merge branch 'development' into addExtraDocs
* development:
Add changelog entry about pragma addition
Add pragma above command-line script
Keep console.log in monorepo-scripts
Enable coverage for all other packages with tests
Fix parallel coverage results reporting
Fix linter issuesx
Update CHANGELOGs
Consolidate all console.log into the @0xproject/utils package
# Conflicts:
# packages/deployer/package.json
Diffstat (limited to 'packages/abi-gen/src/index.ts')
-rw-r--r-- | packages/abi-gen/src/index.ts | 17 |
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); |