Skip to content

Commit

Permalink
fix(inspect): debug info (#1352)
Browse files Browse the repository at this point in the history
  • Loading branch information
mjlescano authored Sep 5, 2024
1 parent f0b1d47 commit 68ab768
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"lint:fix:sol": "prettier --write '{packages,examples}/*/{contracts,src}/**/*.sol'",
"lint:fix": "pnpm run '/^lint:fix:(js|sol)/'",
"build": "pnpm -r --filter @usecannon/builder --filter @usecannon/cli --filter hardhat-cannon --filter @usecannon/api run build",
"watch": "pnpm -r --parallel --filter @usecannon/builder --filter @usecannon/cli run watch",
"version-alpha": "lerna version prerelease --no-private",
"version-patch": "lerna version patch --no-private",
"version-minor": "lerna version minor --no-private",
Expand Down
29 changes: 23 additions & 6 deletions packages/cli/src/commands/inspect.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
import {
ChainArtifacts,
ChainDefinition,
ContractData,
DeploymentState,
fetchIPFSAvailability,
PackageReference,
} from '@usecannon/builder';
import { bold, cyan, green, yellow } from 'chalk';
import Debug from 'debug';
import fs from 'fs-extra';
import _ from 'lodash';
import path from 'path';
import fs from 'fs-extra';
import { bold, cyan, green, yellow } from 'chalk';
import { PackageReference } from '@usecannon/builder';
import { fetchIPFSAvailability } from '@usecannon/builder';
import { ContractData, ChainArtifacts, ChainDefinition, DeploymentState } from '@usecannon/builder';
import { getContractsAndDetails, getSourceFromRegistry } from '../helpers';
import { getMainLoader } from '../loader';
import { createDefaultReadRegistry } from '../registry';
import { CliSettings } from '../settings';
import { log, warn } from '../util/console';
import { getContractsAndDetails, getSourceFromRegistry } from '../helpers';

const debug = Debug('cannon:cli:inspect');

export async function inspect(
packageRef: string,
Expand Down Expand Up @@ -53,6 +61,15 @@ export async function inspect(
);
}

// Mute all build outputs when printing the result to json, this is so it
// doesn't break the result.
if (json) {
// eslint-disable-next-line no-console
console.log = debug;
// eslint-disable-next-line no-console
console.debug = debug;
}

const deployData = await loader[deployUrl.split(':')[0] as 'ipfs'].read(deployUrl);

if (!deployData) {
Expand Down

0 comments on commit 68ab768

Please sign in to comment.