Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(forge build): prettify compiled contract JSON artifacts #210

Open
gnapoli23 opened this issue Oct 11, 2024 · 2 comments
Open

feat(forge build): prettify compiled contract JSON artifacts #210

gnapoli23 opened this issue Oct 11, 2024 · 2 comments

Comments

@gnapoli23
Copy link

gnapoli23 commented Oct 11, 2024

Component

Forge

Describe the feature you would like

It would be easier to read JSON artifacts by having them compiled in a pretty way, maybe using a setting in the foundry.toml file allowing you to specify tabs and spaces for the output.
Using an external tool to do so it's only a temporary workaround, 'cause the contract would be always compiled in a non-pretty form if you make some changes and have the need of rebuilding it.

Additional context

No response

@zerosnacks
Copy link
Member

zerosnacks commented Oct 11, 2024

Hi @gnapoli23 thanks for your suggestion

I think this is relevant to the foundry/compilers repo, moving it there

utils::write_json_file(&self.artifact, &self.file, 64 * 1024)

A downside would be that pretty formatted artifacts have a larger filesize and it could be a breaking change if users are currently parsing by line as we expect in some other cases of JSON output

@zerosnacks zerosnacks transferred this issue from foundry-rs/foundry Oct 11, 2024
@gnapoli23
Copy link
Author

gnapoli23 commented Oct 11, 2024

Would be worth considering it as an optional feature which can be enabled on demand?
Eg in foundry.toml:

...
[output.fmt]
pretty = true
tabs = 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants