-
Notifications
You must be signed in to change notification settings - Fork 254
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
Add hooks #221
Add hooks #221
Conversation
@techninja1008 I'm pretty happy to see this as I was just hacking on the WASM plugin system and was trying to think of use cases which did not involve simply moving some of our current plugins into WASM modules. I'll give this PR a review ASAP and see if I can comment on the design a bit. |
@thedodd I've tried to keep it purposefully simple but with scope to expand if needed. In particular, I've only added one point that hooks are called currently, but more can be easily added. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, I think this is put together quite nicely. I think this is an excellent precursor to the plugin system.
Design Thoughts
Firstly, the simplicity of the design is great. Just provide the name of a target (like sh
in this case), and arguments to be supplied.
- Env vars which can be used in the hooks section, I like it, let's just pin down what they should be, and if we should add some additional env vars. Let's add docs for them as well.
- Stages, I'm thinking that we actually have 3 stages:
pre-build
,build
&post-build
. The example in this PR would land in thepost-build
stage. - Long-term, we could add a
custom
stage which would have aname
& allow for a list ofbefore
strings, where eachbefore
value would be a built-in or custom stage which must be executed prior to this custom stage being executed. - Maybe we should change the name of
HookStage
toPipelineStage
so that we can use it for the plugin system as well when that lands (or maybe just add a comment about that:)
).
Items To Do
- We should add documentation on how this system should work.
- The docs should probably be added to the
Assets
page of the site. - Perhaps some of the stage-related changes mentioned above and inline.
Long Term
We can probably have the plugin system work exactly the same way in terms of stages & when they are spawned.
Really excellent work here! I'm stoked to see how this evolves.
examples/yew-tailwindcss/Cargo.toml
Outdated
name = "yew-example" | ||
version = "0.1.0" | ||
authors = ["Anthony Dodd <dodd.anthonyjosiah@gmail.com>"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably need to update the name here to yew-tailwindcss
, and feel free to use your name as the author :)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm updating the name to be in line with the other examples (ie. yew-tailwindcss-example
). I'm just wondering if it's worth removing the authors field altogether as that's the direction convention seems to be moving in? (see rust-lang/cargo#9282) I've changed it to my name for now.
I've just pushed a load of changes. I've tried to address every point here, including adding more env vars, modifying the hook (now called pipeline) stages, and documenting everything. Not yet added changelog entries, will do that when you're happy with it! |
0427851
to
9ad78e2
Compare
@thedodd just rebased to master & added changelog. Ready for review & merge if you're happy. |
@thedodd just resolved the outstanding merge conflicts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well crafted PR! Thanks again @techninja1008. I'm going to merge this, and then fix the two small typo items & the CI linting issue from CI.
@@ -231,6 +232,20 @@ pub struct HashedFileOutput { | |||
file_name: String, | |||
} | |||
|
|||
/// A stage stage in the build process. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll de-dupe this stage stage
after merge.
- `TRUNK_STAGING_DIR`: the full path of the Trunk staging directory. | ||
- `TRUNK_DIST_DIR`: the full path of the Trunk dist directory. | ||
- `TRUNK_PUBLIC_URL`: the configured public URL for Trunk. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Top-notch docs right here. Thank you!
Hi all. Put this together as I felt trunk lacks a good way to extend the build process with extra steps. I'm aware #104 includes a longer-term vision for a plugins system, but simple command-line hooks should provide for many use cases (including mine) for now.
Currently, this PR only includes the feature as-is and an extra example (yew-tailwindcss) that showcases it in order to produce a custom tailwindcss build that is pruned to only include classes used by the example. I'd like a bit of feedback on the design before completing the checklist below.
Checklist
site
content with pertinent info (may not always apply).