1
1
import type { ChangeDescription } from "../change/types.js" ;
2
2
import { getDependentsGraph } from "../dependency-graph/index.js" ;
3
+ import { isPackageIncluded } from "../utils/misc-utils.js" ;
3
4
import type { ChronusWorkspace } from "../workspace/types.js" ;
4
5
import { applyDependents } from "./determine-dependents.js" ;
5
6
import { incrementVersion } from "./increment-version.js" ;
@@ -18,7 +19,10 @@ export function assembleReleasePlan(
18
19
options ?: AssembleReleasePlanOptions ,
19
20
) : ReleasePlan {
20
21
const packagesByName = new Map ( workspace . allPackages . map ( ( pkg ) => [ pkg . name , pkg ] ) ) ;
21
- const { changeApplications, actions : requested } = reduceChanges ( changes , workspace , options ?. only ) ;
22
+ const { changeApplications, actions : requested } = reduceChanges ( changes , workspace , {
23
+ only : options ?. only ,
24
+ exclude : options ?. exclude ,
25
+ } ) ;
22
26
23
27
const dependentsGraph = getDependentsGraph ( workspace . packages ) ;
24
28
const internalActions = new Map < string , InternalReleaseAction > ( ) ;
@@ -46,6 +50,7 @@ export function assembleReleasePlan(
46
50
internalActions . set ( request . packageName , request ) ;
47
51
}
48
52
}
53
+
49
54
// The map passed in to determineDependents will be mutated
50
55
applyDependents ( {
51
56
actions : internalActions ,
@@ -76,7 +81,7 @@ export function assembleReleasePlan(
76
81
function reduceChanges (
77
82
changes : ChangeDescription [ ] ,
78
83
workspace : ChronusWorkspace ,
79
- only ?: string [ ] ,
84
+ filters : { only ?: string [ ] ; exclude ?: string [ ] } = { } ,
80
85
) : { changeApplications : ReleasePlanChangeApplication [ ] ; actions : Map < string , InternalReleaseAction > } {
81
86
const actions : Map < string , InternalReleaseAction > = new Map ( ) ;
82
87
const changeApplications : ReleasePlanChangeApplication [ ] = [ ] ;
@@ -85,8 +90,8 @@ function reduceChanges(
85
90
// Filter out ignored packages because they should not trigger a release
86
91
// If their dependencies need updates, they will be added to releases by `determineDependents()` with release type `none`
87
92
const packages = change . packages
88
- . filter ( ( name ) => ! only || only . includes ( name ) )
89
93
. map ( ( name ) => workspace . getPackage ( name ) )
94
+ . filter ( ( pkg ) => isPackageIncluded ( pkg , filters ) )
90
95
. filter ( ( pkg ) => pkg . state === "versioned" || pkg . state === "standalone" ) ;
91
96
92
97
changeApplications . push ( {
0 commit comments