anchor
anchor copied to clipboard
Add Anchor hooks
Problem
I have to repeatedly copy pasta the IDL json/types like an idiot while developing my programs.
Proposed solution
Recognize a special "post_build" script from Anchor.toml which triggers automatically after build, so that I can stick to using the simple and beautiful anchor build with no particular option.
I can make a companion PR to the book if this PR seems useful to you.
this is definitely something that would be nice to have and we have a more general issue to add hooks https://github.com/project-serum/anchor/issues/219
Id like to accept a PR that adds support for all the hooks. Would you be interested in doing the other hooks too? Or just adding the hooks setting and then I add the other hooks? let me know!
the following hooks would be a good start: pre-build, post-build, pre-test, post-test, pre-deploy, post-deploy
@paul-schaaf I can do it all, nw. Just want to make sure I get it, you want a separate hooks entry in Anchor.toml, separate from scripts and throwing error for unsupported hooks? Or the current approach with "reserved" script names is fine?
you want a separate hooks entry in Anchor.toml, separate from scripts and throwing error for unsupported hooks?
yes
Ok I did not exactly add an error when providing an invalid hook, as it is not immediately apparent to me how to do that cleanly.
Current behaviour is that unsupported entries to the [hooks] map are simply ignored (I'm guessing discarded during toml deserialization), which does not shock me more than that.
Lmk what you think.
Needs an entry in CHANGELOG.md
@armaniferrante Could you help with this?
yeh, i feel unqualified to review this. Not sure what hooks are or what they're used for yet 🤷
@acheroncrypto can you review this one please?