Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/Aquaticat/Monochromatic. TypeScript and Rust monorepo: Claude Code and Pi coding-agent plugins, a m
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240/** The `planDependentBumps` scenarios of `dependent-version-bump.unit.test.ts`, as differential cases. */// The bin scripts sit outside the package tsconfig's include list; this reference loads the Node types./// <reference types="node" />
/** @typedef {import('./dependent-version-types.mjs').DifferentialCase} DifferentialCase *//** @typedef {import('./dependent-version-types.mjs').GraphNode} GraphNode *//** @typedef {DifferentialCase & { expected: Record<string, unknown>, whole: boolean }} UnitCase */
/** A graph node whose directory follows from its name, as in the incumbent's fixture.
@param {{ name: string, version: string | null, edgeNames?: string[] }} node - name, version and edges @returns {GraphNode} node */function node({ name, version, edgeNames = []}) { return { name, directory: `package/module/${name}`, version, edgeNames, };}
/** A planned bump of the graph cases.
@param {{ name: string, from: string, to: string }} bump - name and versions @returns {{ name: string, directory: string, from: string, to: string }} bump */function graphBump({ name, from, to}) { return { name, directory: `package/module/${name}`, from, to, };}
/** The `planDependentBumps` cases of `dependent-version-bump.unit.test.ts`.
@returns {UnitCase[]} cases */export function graphCases() { /** @type {[string, GraphNode[], string[], string[], Record<string, unknown>][]} */ const table = [ [ 'bumps direct and transitive publishable dependents in name order', [ node({ name: 'z-app', version: '2.0.0', edgeNames: ['mid'] }), node({ name: 'mid', version: '1.0.0', edgeNames: ['base'] }), node({ name: 'base', version: '1.1.0' }), node({ name: 'a-tool', version: '0.1.0', edgeNames: ['base'] }), ], ['base'], [ 'z-app', 'mid', 'base', 'a-tool' ], { value: [ graphBump({ name: 'a-tool', from: '0.1.0', to: '0.1.1' }), graphBump({ name: 'mid', from: '1.0.0', to: '1.0.1' }), graphBump({ name: 'z-app', from: '2.0.0', to: '2.0.1' }) ] }, ], [ 'walks through unpublishable packages but bumps only publishable ones', [ node({ name: 'app', version: '1.0.0', edgeNames: ['internal'] }), node({ name: 'internal', version: '1.0.0', edgeNames: ['base'] }), node({ name: 'base', version: '1.0.0' }) ], ['base'], [ 'app', 'base' ], { value: [graphBump({ name: 'app', from: '1.0.0', to: '1.0.1' })] }, ], [ 'skips already bumped and versionless dependents', [ node({ name: 'bumped-dependent', version: '3.0.0', edgeNames: ['base'] }), node({ name: 'versionless', version: null, edgeNames: ['base'] }), node({ name: 'base', version: '1.0.0' }) ], [ 'base', 'bumped-dependent' ], [ 'bumped-dependent', 'versionless', 'base' ], { value: [] }, ], [ 'ignores external and self edges and terminates on cycles', [ node({ name: 'left', version: '1.0.0', edgeNames: [ 'right', 'left', 'external' ] }), node({ name: 'right', version: '1.0.0', edgeNames: ['left'] }) ], ['left'], [ 'left', 'right' ], { value: [graphBump({ name: 'right', from: '1.0.0', to: '1.0.1' })] }, ], [ 'returns nothing when no package was bumped', [node({ name: 'a', version: '1.0.0', edgeNames: ['b'] })], [], ['a'], { value: [] } ], [ 'throws when a dependent needing a bump has a prerelease version', [ node({ name: 'a', version: '1.0.0-rc.1', edgeNames: ['b'] }), node({ name: 'b', version: '1.0.0' }) ], ['b'], [ 'a', 'b' ], { kind: 'unsupported' }, ], ]; return table.map(function toCase([title, manifests, bumpedNames, publishableNames, expected]) { return /** @type {UnitCase} */ ({ name: `planDependentBumps ${title}`, kind: 'planDependentBumps', input: { manifests, bumpedNames, publishableNames, }, expected, whole: false, }); });}
/** The formatting case of `replaceManifestVersion`. */