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 3cf90da commit d470c3e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
23 changes: 16 additions & 7 deletions lib/helpers/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2613,13 +2613,17 @@ export async function parsePnpmLock(
if (!depsWorkspaceRefs[dref]) {
depsWorkspaceRefs[dref] = [];
}
depsWorkspaceRefs[dref].push(wref);
if (!depsWorkspaceRefs[dref].includes(wref)) {
depsWorkspaceRefs[dref].push(wref);
}
if (dependenciesMap[dref]) {
for (const l2ref of dependenciesMap[dref]) {
if (!depsWorkspaceRefs[l2ref]) {
depsWorkspaceRefs[l2ref] = [];
}
depsWorkspaceRefs[l2ref].push(wref);
if (!depsWorkspaceRefs[l2ref].includes(wref)) {
depsWorkspaceRefs[l2ref].push(wref);
}
}
}
}
Expand Down Expand Up @@ -2701,7 +2705,7 @@ export async function parsePnpmLock(
}
if (depsWorkspaceRefs[apkg["bom-ref"]]?.length) {
const wsprops = apkg.properties.filter(
(p) => p.name === "interal:workspaceRef",
(p) => p.name === "internal:workspaceRef",
);
if (!wsprops.length) {
for (const wref of depsWorkspaceRefs[apkg["bom-ref"]]) {
Expand Down Expand Up @@ -4939,9 +4943,14 @@ export async function parsePyLockData(lockData, lockFile, pyProjectFile) {
) {
const dependentPkg = pkgBomRefMap[existingPkgMap[nameStr]];
dependentPkg.properties = dependentPkg.properties || [];
for (const pprop of pkg.properties) {
if (pprop.name.startsWith("internal:workspace")) {
dependentPkg.properties.push(pprop);
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);
}
}
}
}
Expand Down Expand Up @@ -4975,7 +4984,7 @@ export async function parsePyLockData(lockData, lockFile, pyProjectFile) {
dependentPkg.properties = dependentPkg.properties || [];
const hasWorkspaceProps =
dependentPkg.properties.filter((p) =>
p.name.startsWith("interal:workspace"),
p.name.startsWith("internal:workspace"),
).length > 0;
if (!hasWorkspaceProps) {
for (const pprop of parentPkg.properties) {
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 d470c3e

Please sign in to comment.