rlsbl v0.40.1 /rlsbl.snapshot
On this page

Monorepo snapshot generator: produces a JSON summary of all packages, versions, deps, and graph structure.

#rlsbl.snapshot

#rlsbl.snapshot

Monorepo snapshot generator: produces a JSON summary of all packages, versions, deps, and graph structure.

#generate_snapshot

python
def generate_snapshot(root, projects, graph)

Build the snapshot dict from workspace data.

Args:

  • root: absolute path to the monorepo root.
  • projects: list of project dicts from load_workspace().
  • graph: WorkspaceGraph instance.

Returns a dict matching the snapshot schema.

#_compute_max_depth

python
def _compute_max_depth(packages, graph, topo_order)

Compute the longest path in the DAG using topological order.

Leaf nodes (no deps) have depth 0. Each node's depth is max(depth of all deps) + 1. Returns the maximum across all nodes.

#write_snapshot

python
def write_snapshot(root, snapshot)

Write the snapshot dict to .rlsbl-monorepo/snapshot.json.

Args:

  • root: monorepo root path.
  • snapshot: the snapshot dict.

Returns the relative path to the written file.

#check_snapshot

python
def check_snapshot(root, projects, graph)

Check whether the on-disk snapshot is up-to-date.

Compares the existing snapshot.json against a freshly generated one, ignoring the generated_at timestamp. Returns True if they match.