Skip to content

Commit

Permalink
Merge pull request #75 from foundry-rs/develop
Browse files Browse the repository at this point in the history
feat: configurable runSuper (#73)
  • Loading branch information
tynes authored Jul 5, 2022
2 parents 629892f + 68a4772 commit 8373dd8
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/popular-humans-greet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@foundry-rs/hardhat-forge": patch
---

Allow user configured `runSuper` to be called in the build task
4 changes: 3 additions & 1 deletion packages/hardhat-forge/src/forge/build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ registerProjectPathArgs(registerCompilerArgs(task("compile")))
const input = { ...args, ...(hre.config.foundry || {}) };
const buildArgs = await getCheckedArgs(input);
await spawnBuild(buildArgs);
await runSuper(args);
if (hre.config.foundry?.runSuper!) {
await runSuper(args);
}
});

async function getCheckedArgs(args: any): Promise<ForgeBuildArgs> {
Expand Down
4 changes: 3 additions & 1 deletion packages/hardhat-forge/src/forge/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import { ForgeBuildArgs } from "./build/build";

export interface FoundryHardhatConfig
extends Partial<ForgeEvmArgs>,
Partial<ForgeBuildArgs> {}
Partial<ForgeBuildArgs> {
runSuper?: boolean;
}

declare module "hardhat/types/config" {
interface HardhatConfig {
Expand Down
6 changes: 5 additions & 1 deletion packages/hardhat-forge/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ extendEnvironment((hre: HardhatRuntimeEnvironment) => {
extendConfig(
(config: HardhatConfig, userConfig: Readonly<HardhatUserConfig>) => {
config.foundry = lazyObject(() => {
return userConfig.foundry || {};
// Set default values then merge user defined values
return {
runSuper: false,
...userConfig.foundry,
};
});
}
);

0 comments on commit 8373dd8

Please sign in to comment.