unlock
unlock copied to clipboard
rebuild all package deps on yarn build
it looks like when someone builds a library it does not rebuild all of its dependencies. For example I just (re)built unlock-js locally but it did not build the contracts package first. I had to go rebuild it manually myself for unlock-js to be using the right values. Is there a way to tell yarn to rebuild all of the deps?
We could leverage https://yarn.build for that
can you give some context to solve this ?
@RishiKumarRay ! Thanks for jumping in! We use a monorepo for our code. Right now one of the challenges is that when we build a piece of the code, and it has other pieces as dependencies, we do not necessarily trigger a build in the dependency which might lead to outdated dependencies.
The main idea is that without rebuilding the packages automatically, some part of the repo can become out of sync or go missing, therefore creating unexpected errors.
The best way to reproduce is to just clone the repo and run a build in one of the folders (e.g. unlock-app). That will fail as the networks or contracts packages are used but they donc get build automatically.
Not sure what is the best way to solve this. On one hand, having an automatic rebuild will be useful. On the other hand, adding a complete rebuild of the packages will slow down the repo workflow when developing locally
One approach that @searchableguy pointed at was to use https://yarn.build . I try to be very cautious when adding new tools to the workflow, to avoid lock-ins and possible debt in the future but that is an option worth exploring maybe
We could maybe have a Github action for this? It checks master out, rebuilds all the packages and opens a PR with changes. This could run as a cron once a day for example
@clemsos I'm gonna try yarn build on the new examples repo so will report how that turns out.
@julien51 no because we need this locally when someone clones and make changes.
I just run across this tool and looks worth investigating to speed up builds and deps
https://turbo.build/repo/docs/handbook/workspaces