Skip to content

refactor(@angular/cli): remove usage of npm-pick-manifest dependency #30784

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
Jul 25, 2025
Merged
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion packages/angular/cli/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ ts_project(
":node_modules/ini",
":node_modules/jsonc-parser",
":node_modules/npm-package-arg",
":node_modules/npm-pick-manifest",
":node_modules/pacote",
":node_modules/resolve",
":node_modules/yargs",
Expand Down
1 change: 0 additions & 1 deletion packages/angular/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
"jsonc-parser": "3.3.1",
"listr2": "9.0.1",
"npm-package-arg": "12.0.2",
"npm-pick-manifest": "10.0.0",
"pacote": "21.0.0",
"resolve": "1.22.10",
"semver": "7.7.2",
Expand Down
70 changes: 40 additions & 30 deletions packages/angular/cli/src/commands/update/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import { createRequire } from 'node:module';
import * as path from 'node:path';
import { join, resolve } from 'node:path';
import npa from 'npm-package-arg';
import pickManifest from 'npm-pick-manifest';
import * as semver from 'semver';
import { Argv } from 'yargs';
import { PackageManager } from '../../../lib/config/workspace-schema';
Expand Down Expand Up @@ -231,9 +230,11 @@ export default class UpdateCommandModule extends CommandModule<UpdateCommandArgs
logger.warn('Package specifier has no effect when using "migrate-only" option.');
}

// If next option is used and no specifier supplied, use next tag
if (options.next && packageIdentifier.rawSpec === '*') {
packageIdentifier.fetchSpec = 'next';
// Wildcard uses the next tag if next option is used otherwise use latest tag.
// Wildcard is present if no selector is provided on the command line.
if (packageIdentifier.rawSpec === '*') {
packageIdentifier.fetchSpec = options.next ? 'next' : 'latest';
packageIdentifier.type = 'tag';
}

packages.push(packageIdentifier as PackageIdentifier);
Expand Down Expand Up @@ -665,36 +666,45 @@ export default class UpdateCommandModule extends CommandModule<UpdateCommandArgs
// Try to find a package version based on the user requested package specifier
// registry specifier types are either version, range, or tag
let manifest: PackageManifest | undefined;
if (
requestIdentifier.type === 'version' ||
requestIdentifier.type === 'range' ||
requestIdentifier.type === 'tag'
) {
try {
manifest = pickManifest(metadata, requestIdentifier.fetchSpec);
} catch (e) {
assertIsError(e);
if (e.code === 'ETARGET') {
// If not found and next was used and user did not provide a specifier, try latest.
// Package may not have a next tag.
switch (requestIdentifier.type) {
case 'tag':
manifest = metadata.tags[requestIdentifier.fetchSpec];
// If not found and next option was used and user did not provide a specifier, try latest.
// Package may not have a next tag.
if (
!manifest &&
requestIdentifier.fetchSpec === 'next' &&
requestIdentifier.rawSpec === '*'
) {
manifest = metadata.tags['latest'];
}
break;
case 'version':
manifest = metadata.versions[requestIdentifier.fetchSpec];
break;
case 'range':
for (const potentialManifest of Object.values(metadata.versions)) {
// Ignore deprecated package versions
if (potentialManifest.deprecated) {
continue;
}
// Only consider versions that are within the range
if (
requestIdentifier.type === 'tag' &&
requestIdentifier.fetchSpec === 'next' &&
!requestIdentifier.rawSpec
!semver.satisfies(potentialManifest.version, requestIdentifier.fetchSpec, {
loose: true,
})
) {
try {
manifest = pickManifest(metadata, 'latest');
} catch (e) {
assertIsError(e);
if (e.code !== 'ETARGET' && e.code !== 'ENOVERSIONS') {
throw e;
}
}
continue;
}
// Update the used manifest if current potential is newer than existing or there is not one yet
if (
!manifest ||
semver.gt(potentialManifest.version, manifest.version, { loose: true })
) {
manifest = potentialManifest;
}
} else if (e.code !== 'ENOVERSIONS') {
throw e;
}
}
break;
}

if (!manifest) {
Expand Down
15 changes: 0 additions & 15 deletions packages/angular/cli/src/typings.d.ts

This file was deleted.

3 changes: 0 additions & 3 deletions pnpm-lock.yaml

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

Loading