From 7587474ca41a1ae377e3031749eeca24ecc3509f Mon Sep 17 00:00:00 2001 From: David Zwart Date: Wed, 31 Jan 2024 22:10:59 +0100 Subject: [PATCH] fix: try to adapt to yarn v3 --- src/workspace.ts | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/workspace.ts b/src/workspace.ts index f60df3d..1a25daa 100644 --- a/src/workspace.ts +++ b/src/workspace.ts @@ -56,9 +56,24 @@ export function fetchPackageVersions(workspace: string, packageName: string, use latest: response["dist-tags"]?.latest, }; } else { - return { - versions: response.data.versions, - latest: response.data["dist-tags"]?.latest, - }; + if (response.data) { + return { + versions: response.data.versions, + latest: response.data["dist-tags"]?.latest, + }; + } else { + if (response.children) { + const versions = response.children.map((c: any) => c["Version"]); + return { + versions: versions, + latest: versions?.length ? versions[0] : null, + }; + } else { + return { + versions: response.data?.versions, + latest: response.data["dist-tags"]?.latest, + }; + } + } } }