Skip to content

Commit

Permalink
fix(resolve): takes 'workspaces' field into account when merging pack…
Browse files Browse the repository at this point in the history
…age manifests
  • Loading branch information
sverweij committed Nov 15, 2023
1 parent 8b37fe3 commit fe0a831
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/extract/resolve/merge-manifests.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ function mergeDependencyArray(pClosestDependencyKey, pFurtherDependencyKey) {
return uniq(pClosestDependencyKey.concat(pFurtherDependencyKey));
}

function isDependencyKey(pKey) {
return pKey.endsWith("ependencies");
function isInterestingKey(pKey) {
return pKey.endsWith("ependencies") || pKey === "workspaces";
}

function getDependencyKeys(pPackage) {
return Object.keys(pPackage).filter(isDependencyKey);
return Object.keys(pPackage).filter(isInterestingKey);
}

function getJointUniqueDependencyKeys(pClosestPackage, pFurtherPackage) {
Expand All @@ -40,6 +40,10 @@ function getJointUniqueDependencyKeys(pClosestPackage, pFurtherPackage) {
);
}

function isAnArrayKey(pKey) {
return pKey.startsWith("bundle") || pKey === "workspaces";
}

/**
* returns an object with
* - the *dependencies keys from both passed packages
Expand All @@ -63,7 +67,7 @@ export default function mergeManifests(pClosestManifest, pFurtherManifest) {
)
.map((pKey) => ({
key: pKey,
value: pKey.startsWith("bundle")
value: isAnArrayKey(pKey)
? mergeDependencyArray(
pClosestManifest?.[pKey] ?? [],
pFurtherManifest?.[pKey] ?? [],
Expand Down

0 comments on commit fe0a831

Please sign in to comment.