Skip to content

Commit

Permalink
Track workspaces for transitive dependencies for uv monorepos
Browse files Browse the repository at this point in the history
Signed-off-by: Prabhu Subramanian <[email protected]>
  • Loading branch information
prabhu committed Jan 20, 2025
1 parent d470c3e commit 0095b9b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 18 deletions.
38 changes: 21 additions & 17 deletions lib/helpers/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -4943,14 +4943,14 @@ export async function parsePyLockData(lockData, lockFile, pyProjectFile) {
) {
const dependentPkg = pkgBomRefMap[existingPkgMap[nameStr]];
dependentPkg.properties = dependentPkg.properties || [];
const wsprops = dependentPkg.properties.filter(
(p) => p.name === "internal:workspaceRef",
);
if (!wsprops.length) {
for (const pprop of pkg.properties) {
if (pprop.name.startsWith("internal:workspace")) {
dependentPkg.properties.push(pprop);
}
const addedValue = {};
for (const pprop of pkg.properties) {
if (
pprop.name.startsWith("internal:workspace") &&
!addedValue[pprop.value]
) {
dependentPkg.properties.push(pprop);
addedValue[pprop.value] = true;
}
}
}
Expand Down Expand Up @@ -4982,15 +4982,19 @@ export async function parsePyLockData(lockData, lockFile, pyProjectFile) {
// We need to propagate the workspace properties from the parent
const dependentPkg = pkgBomRefMap[depRef];
dependentPkg.properties = dependentPkg.properties || [];
const hasWorkspaceProps =
dependentPkg.properties.filter((p) =>
p.name.startsWith("internal:workspace"),
).length > 0;
if (!hasWorkspaceProps) {
for (const pprop of parentPkg.properties) {
if (pprop.name.startsWith("internal:workspace")) {
dependentPkg.properties.push(pprop);
}
const addedValue = {};
for (const p of dependentPkg.properties) {
if (p.name.startsWith("internal:workspace")) {
addedValue[p.value] = true;
}
}
for (const pprop of parentPkg.properties) {
if (
pprop.name.startsWith("internal:workspace") &&
!addedValue[pprop.value]
) {
dependentPkg.properties.push(pprop);
addedValue[pprop.value] = true;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion types/lib/helpers/utils.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0095b9b

Please sign in to comment.