@@ -63,7 +63,12 @@ export async function handleMultiPackage(
6363) : Promise < void > {
6464 const graph = buildGraphFromPackages ( packageInfos ) ;
6565 const currentVersions = new Map ( packageInfos . map ( ( p ) => [ p . path , p . version ] ) ) ;
66- const pathToKey = new Map ( packageInfos . map ( ( p ) => [ p . path , packageKey ( p ) ] ) ) ;
66+ const pathToKeys = new Map < string , string [ ] > ( ) ;
67+ for ( const p of packageInfos ) {
68+ const existing = pathToKeys . get ( p . path ) ?? [ ] ;
69+ existing . push ( packageKey ( p ) ) ;
70+ pathToKeys . set ( p . path , existing ) ;
71+ }
6772 const recommendations = await analyzeAllSources ( ctx ) ;
6873
6974 // CI mode: auto-accept
@@ -74,17 +79,19 @@ export async function handleMultiPackage(
7479 if ( ! current ) continue ;
7580 const newVer = semver . inc ( current , rec . bumpType ) ;
7681 if ( newVer ) {
77- const key = pathToKey . get ( rec . packagePath ) ?? rec . packagePath ;
78- packages . set ( key , newVer ) ;
82+ const keys = pathToKeys . get ( rec . packagePath ) ?? [ rec . packagePath ] ;
83+ for ( const key of keys ) {
84+ packages . set ( key , newVer ) ;
85+ }
7986 }
8087 }
8188 ctx . runtime . versionPlan = buildVersionPlan (
8289 ctx . config . versioning ?? "independent" ,
8390 packages ,
8491 ) ;
8592 ctx . runtime . changesetConsumed = recommendations . some ( ( r ) => {
86- const key = pathToKey . get ( r . packagePath ) ?? r . packagePath ;
87- return r . source === "changeset" && packages . has ( key ) ;
93+ const keys = pathToKeys . get ( r . packagePath ) ?? [ r . packagePath ] ;
94+ return r . source === "changeset" && keys . some ( ( k ) => packages . has ( k ) ) ;
8895 } ) ;
8996 return ;
9097 }
@@ -127,8 +134,10 @@ export async function handleMultiPackage(
127134 if ( ! current ) continue ;
128135 const newVer = semver . inc ( current , rec . bumpType ) ;
129136 if ( newVer ) {
130- const key = pathToKey . get ( rec . packagePath ) ?? rec . packagePath ;
131- selectedVersions . set ( key , newVer ) ;
137+ const keys = pathToKeys . get ( rec . packagePath ) ?? [ rec . packagePath ] ;
138+ for ( const key of keys ) {
139+ selectedVersions . set ( key , newVer ) ;
140+ }
132141 }
133142 }
134143 } else {
@@ -178,8 +187,8 @@ export async function handleMultiPackage(
178187 ctx . runtime . changesetConsumed = recommendations . some ( ( r ) => {
179188 if ( r . source !== "changeset" || ! plan || ! ( "packages" in plan ) )
180189 return false ;
181- const key = pathToKey . get ( r . packagePath ) ?? r . packagePath ;
182- return plan . packages . has ( key ) ;
190+ const keys = pathToKeys . get ( r . packagePath ) ?? [ r . packagePath ] ;
191+ return keys . some ( ( k ) => plan . packages . has ( k ) ) ;
183192 } ) ;
184193 return ;
185194 }
@@ -191,8 +200,8 @@ export async function handleMultiPackage(
191200 selectedVersions ,
192201 ) ;
193202 ctx . runtime . changesetConsumed = recommendations . some ( ( r ) => {
194- const key = pathToKey . get ( r . packagePath ) ?? r . packagePath ;
195- return r . source === "changeset" && selectedVersions . has ( key ) ;
203+ const keys = pathToKeys . get ( r . packagePath ) ?? [ r . packagePath ] ;
204+ return r . source === "changeset" && keys . some ( ( k ) => selectedVersions . has ( k ) ) ;
196205 } ) ;
197206}
198207
@@ -330,8 +339,8 @@ export async function handleIndependentMode(
330339 currentVersions . get ( pkgPath ) ??
331340 ( packageVersionByPath . get ( pkgPath ) as string ) ;
332341 const patchVersion = new SemVer ( currentVersion ) . inc ( "patch" ) . toString ( ) ;
333- const pkg = packageInfos . find ( ( p ) => p . path === pkgPath ) ;
334- if ( pkg ) {
342+ const pkgs = packageInfos . filter ( ( p ) => p . path === pkgPath ) ;
343+ for ( const pkg of pkgs ) {
335344 versions . set ( packageKey ( pkg ) , patchVersion ) ;
336345 }
337346 }
0 commit comments