Open robertmassaioli opened 3 years ago
If you want to have a crack at doing this yourself, you can use the getChangedPackagesSinceRef
function exported from @changesets/git
, which gives you the parsed package.json of every directly changed package since the specified git ref.
This won't get you very far, though. You need to resolve your internal dependencies before you can build, lint or test your changed packages. The only way you can do this is by building them. Fortunately, Bolt comes with a function called getDependencyGraph
which does exactly as its name implies. You'll need to build your upstream packages in dependency order, which you can do by recursively walking the graph.
If you think you're done at this point, you're wrong. Your green build can easily be a false negative if you don't also build, test and lint your monorepo's downstream packages. Remember that the build status (green or red) is the status of the entire monorepo. You can use Bolt's getDependentsGraph
function to get these dependencies.
But what about the dependents' other upstream packages? They'll also need to be built!
I think you can see where this is going. You might as well just build, test and lint everything.
It would be great, for CI/CD and pre-commit hooks, if I could run
bolt ws --only-modified
such that, only if there were changes in the workspaces subdirectory, would the command run on that particular workspaces.This would be useful especially for doing things like running a
lint
command only on the packages that need it.