Skip to content

fix(@angular/cli): handle packages with no version #26364

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions packages/angular/cli/src/utilities/package-metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,11 @@ export async function fetchPackageMetadata(
...(registry ? { registry } : {}),
});

if (!response.versions) {
// While pacote type declares that versions cannot be undefined this is not the case.
response.versions = {};
}

// Normalize the response
const metadata: PackageMetadata = {
...response,
Expand Down Expand Up @@ -312,6 +317,13 @@ export async function getNpmPackageJson(
fullMetadata: true,
...npmrc,
...(registry ? { registry } : {}),
}).then((response) => {
// While pacote type declares that versions cannot be undefined this is not the case.
if (!response.versions) {
response.versions = {};
}

return response;
});

npmPackageJsonCache.set(packageName, response);
Expand Down