Does anyone know if there are hooks for builders? I’d love to define a command in pre-build step for a certain library.
I don’t believe there is, but you could just use run commands, make a custom “build” command, that runs your pre build stuff first then runs the build after.
Right, that’s probably the next best thing
I guess the danger with adding support for things like hooks is that it will start to become a complex build tool. But we already have make/gulp/bazel/whatever for that
Yup and there is no need to when run commands exist
Yep, fair point
Would you recommend taking a similar approach as Brandon took at the nx office hours youtube stream? He basically created a new schematic that ran an existing one adding a step, in this use case you could do the opposite, run your own code before running the regular build script
that works if it’s something ‘shared’ that you’d want to share between workspaces. Wrap another builder and distribute that. Similar to how @nrwl/nest:lib extends @nrwl/node:lib
However, in my case it’s workspace-specific, so extending a schematic would be overkill.
But couldn’t you do it within that workspace’s tools folder? and there for your code is specific to that workspace. Or perhaps I’m missing something, sorry new to nx, only been playing around with it for a few weeks :slightly_smiling_face:
yeah for more advanced scripts that’s a great place, I just needed to combine 2 commands so I ended up using the run-commands as Jay suggested. :slightly_smiling_face:
One of the things I used to build a lot in the tools folder are scripts for doing releases to npm or cloud providers