Documentation
¶
Overview ¶
Command customgraph fans a step out over a unit graph that senro does not ship, written entirely against senro's published API: nothing here imports internal/, nothing is registered, and the graph below is an ordinary type with the right methods. Copy it into your own repository and it works.
The graph reads a components.json at the root of the tree:
{
"components": [
{ "name": "shared", "dir": "libs/shared" },
{ "name": "billing", "dir": "services/billing", "needs": ["shared"] },
{ "name": "checkout", "dir": "services/checkout", "needs": ["billing"] }
]
}
A made-up format, which is the point: a repository whose layout only it knows about is exactly the case senro cannot ship a graph for.
Run it from the repository root. With no --changed, every component runs:
go run ./examples/customgraph # 3 steps: libs/shared, services/billing, services/checkout
With one, only what the change reaches:
go run ./examples/customgraph --changed services/checkout/checkout.txt # 1 step: services/checkout. Nothing depends on it. go run ./examples/customgraph --changed libs/shared/shared.txt # 3 steps: everything. checkout does not depend on shared, but it depends # on billing, which does. That hop is the whole point. go run ./examples/customgraph --changed Makefile # 3 steps, for a different reason: the Makefile belongs to no component, # so nothing can be concluded about it and everything runs.
See https://senro.dev/docs/unit-graphs/ for the walkthrough this file is the worked example of.