Skip to content

Commit

Permalink
fix(cli): cannot build on Cannon network with --dry-run
Browse files Browse the repository at this point in the history
  • Loading branch information
saeta-eth committed Nov 7, 2024
1 parent 5372ff0 commit dcb3ce0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/cli/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { spawn } from 'node:child_process';
import path from 'node:path';
import {
CANNON_CHAIN_ID,
CannonStorage,
ChainBuilderRuntime,
ChainDefinition,
Expand Down Expand Up @@ -160,6 +161,12 @@ applyCommandsConfig(program.command('build'), commandsConfig.build)
// ensure foundry compatibility
await ensureFoundryCompatibility();

// throw an error if chain id is undefined and dry run is true
// chain id undefined means the user wants to use Cannon Network
if (options.chainId === undefined && options.dryRun) {
throw new Error('Cannot build on Cannon Network with --dry-run flag.');
}

// backwards compatibility for --port flag
if (options.port !== ANVIL_PORT_DEFAULT_VALUE) {
deprecatedWarn('--port', '--anvil.port');
Expand Down

0 comments on commit dcb3ce0

Please sign in to comment.