unlock icon indicating copy to clipboard operation
unlock copied to clipboard

rebuild all package deps on yarn build

Open clemsos opened this issue 3 years ago • 5 comments

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

clemsos avatar Feb 01 '22 20:02 clemsos

can you give some context to solve this ?

RishiKumarRay avatar Feb 01 '22 20:02 RishiKumarRay

@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.

julien51 avatar Feb 01 '22 22:02 julien51

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

clemsos avatar Jul 25 '22 12:07 clemsos

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

julien51 avatar Jul 26 '22 06:07 julien51

@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.

searchableguy avatar Jul 26 '22 11:07 searchableguy

I just run across this tool and looks worth investigating to speed up builds and deps

https://turbo.build/repo/docs/handbook/workspaces

clemsos avatar Nov 19 '22 11:11 clemsos