* Apply normalized cascade rules (used for both cascadeTo and cascadeFrom). * Keys in `rules` are target package name/glob patterns. * Returns true if any bump was applied.
(
rules: Record<string, Required<{ trigger: BumpType; bumpAs: BumpType | 'match' }>>,
sourceName: string,
sourceType: BumpType,
packages: Map<string, WorkspacePackage>,
planned: Map<string, PlannedBump>,
)
| 408 | * Returns true if any bump was applied. |
| 409 | */ |
| 410 | function applyCascadeRules( |
| 411 | rules: Record<string, Required<{ trigger: BumpType; bumpAs: BumpType | 'match' }>>, |
| 412 | sourceName: string, |
| 413 | sourceType: BumpType, |
| 414 | packages: Map<string, WorkspacePackage>, |
| 415 | planned: Map<string, PlannedBump>, |
| 416 | ): boolean { |
| 417 | let changed = false; |
| 418 | for (const [pattern, rule] of Object.entries(rules)) { |
| 419 | if (!shouldTrigger(sourceType, rule.trigger)) continue; |
| 420 | const cascadeBump = rule.bumpAs === 'match' ? sourceType : rule.bumpAs; |
| 421 | for (const [targetName] of packages) { |
| 422 | if (!matchGlob(targetName, pattern)) continue; |
| 423 | if (applyBump(planned, targetName, cascadeBump, false, true, sourceName)) { |
| 424 | changed = true; |
| 425 | } |
| 426 | } |
| 427 | } |
| 428 | return changed; |
| 429 | } |
| 430 | |
| 431 | /** |
| 432 | * Apply consumer-side cascadeFrom rules. |
no test coverage detected
searching dependent graphs…