I'm experimenting with Angular schematics, and have encountered the function branchAndMerge() in various places. No one explains what it does, however.
Places I have seen it:
- Generating Custom Code With The Angular CLI And Schematics
- amcdnl/material-schematics
- how to overwrite file with angular schematics
- angular/devkit
A clarification of how it differs from merge/mergeWith, and how to use it correctly would be appreciated.
P.S: Merge is explained at @angular-devkit/schematics as follows:
Merge the input tree with the other Tree.
Btw I assume that merge() is now mergeWith, though I'm not 100% sure on that.
Code example
const rule =
// Creates a new rule that is a concatenation of other rules.
chain([
// Everyone uses it, but no one explains what it does...
branchAndMerge(
chain([
// Merges the project tree with the virtual tree
mergeWith(virtualTree)
]))
]);