foundry-rs / foundry-rs/foundry

feat(forge): new config option for filtering the contract artifacts which get generated

Open
#4,979 5 comments 0 reactions 0 assignees View on GitHub
A-config C-forge T-feature
Dominant language
Rust
Stars
10.6k
Forks
2.6k
Avg merge
18h 20m
Merged PRs (30d)
510

Description

### Component

Forge

### Describe the feature you would like

The idea is to introduce a new config option called `filter` (or `sift`) that accepts a list of whitelisted contracts:

```toml
[profile.artifacts]
filter = [
"Foo",
"Bar",
]
```

When it sees this config, Forge generates artifacts only for the members listed under `filter`, regardless of whatever other members may be present in the repository. Note that by "members" in this context, I mean any of the following:

- contract
- interface
- abstract
- library

The primary use case is shipping a Node.js package that should include only the production contracts' artifacts - though there may be more use cases than just that. Anything related to artifact generation may benefit from such a feature.

### Additional context

In our project, we wrote a [Bash script](https://gist.github.com/PaulRBerg/6cdca9662bb51474b2580fddf4c03c0c) because we couldn't find a way to filter contracts with Foundry itself.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.