diff --git a/packages/angular/cli/src/commands/update/cli.ts b/packages/angular/cli/src/commands/update/cli.ts index e652b708d52e..714ce827fb87 100644 --- a/packages/angular/cli/src/commands/update/cli.ts +++ b/packages/angular/cli/src/commands/update/cli.ts @@ -164,7 +164,8 @@ export class UpdateCommandModule extends CommandModule { packageManager.ensureCompatibility(); // Check if the current installed CLI version is older than the latest compatible version. - if (!disableVersionCheck) { + // Skip when running `ng update` without a package name as this will not trigger an actual update. + if (!disableVersionCheck && options.packages?.length) { const cliVersionToInstall = await this.checkCLIVersion( options.packages, options.verbose, @@ -880,7 +881,7 @@ export class UpdateCommandModule extends CommandModule { * @returns the version to install or null when there is no update to install. */ private async checkCLIVersion( - packagesToUpdate: string[] | undefined, + packagesToUpdate: string[], verbose = false, next = false, ): Promise { diff --git a/packages/angular/cli/src/utilities/package-metadata.ts b/packages/angular/cli/src/utilities/package-metadata.ts index 68916bd6b615..e7a448aa8d61 100644 --- a/packages/angular/cli/src/utilities/package-metadata.ts +++ b/packages/angular/cli/src/utilities/package-metadata.ts @@ -292,19 +292,12 @@ export async function getNpmPackageJson( const { usingYarn = false, verbose = false, registry } = options; ensureNpmrc(logger, usingYarn, verbose); const { packument } = await import('pacote'); - const resultPromise = packument(packageName, { + const response = packument(packageName, { fullMetadata: true, ...npmrc, ...(registry ? { registry } : {}), }); - // TODO: find some way to test this - const response = resultPromise.catch((err) => { - logger.warn(err.message || err); - - return { requestedName: packageName }; - }); - npmPackageJsonCache.set(packageName, response); return response;