Skip to content

Commit

Permalink
Removed log indicator, typeGenerator shouldn't know if it's within …
Browse files Browse the repository at this point in the history
…a CLI process

Abstracted logging to parent function
  • Loading branch information
MitchPierias committed May 5, 2019
1 parent 0088872 commit c1d808d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/contracts/typeGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as fs from 'fs';
import * as path from 'path';
import { promisify } from 'util';
import mapTypes from './typeMap';
import * as spinner from './../cli/logIndicator';
import { ConfigManager } from '../configManager';

const glob = promisify(globWithCallbacks);

Expand Down Expand Up @@ -58,11 +58,12 @@ export const generateAllTypes = async () => {
* @param contractIdentifier Path to file without extension
*/
export const generateTypes = async (contractIdentifier: string) => {
// Notify generating has begun
spinner.create(`Generating type definitions`);
// Create contract details
const contractName = path.basename(contractIdentifier);
const abiPath = path.join('.lamington', 'compiled_contracts', `${contractIdentifier}.abi`);
const abiPath = path.join(ConfigManager.outDir, `${contractIdentifier}.abi`);
// Handle ABI file loading
if (!fs.existsSync(path.resolve(abiPath)))
throw new Error(`Missing ABI file at path '${path.resolve(abiPath)}'`);
const abi = JSON.parse(fs.readFileSync(path.resolve(abiPath), 'utf8'));
let contractActions = abi.actions;
let contractTables = abi.tables;
Expand Down Expand Up @@ -130,7 +131,6 @@ export const generateTypes = async (contractIdentifier: string) => {
result.push('');
// Save generated contract
await saveInterface(contractIdentifier, result);
spinner.end(`Generated type definitions`);
};

/**
Expand Down

0 comments on commit c1d808d

Please sign in to comment.