Skip to main content

inspectExtends

How a distribution stands against the one it extends.

inspectExtends(root: string): ExtendsReport
const report = inspectExtends('/repos/acme')
if (report.violations.length > 0) {
  console.error(describeViolations(report))
}

Returns

Field
distributionwhat this ships, from readDistribution
parentwhat it extends, read from node_modules
violationsmodules shipped older than the parent, or not at all
unresolvedset when a parent is declared but could not be read

A distribution that extends nothing comes back with no parent and no violations, which is not a failure.

unresolved is worth handling separately: a parent that is declared but not installed means nothing could be compared, which is different from comparing and finding nothing wrong. check treats it as a failure for that reason.

assertExtends(root) throws when there are violations, which is what withMonolith calls. describeViolations(report) formats them.

For comparing two distributions you already have, use findFloorViolations.