Skip to content

Commit bf9516e

Browse files
alan-agius4dgp1130
authored andcommitted
build: update dependency npm-package-arg to v10
This commit updates the npm-package-arg to v10 and applies the changes needed due to the breaking change in npm/npm-package-arg@d2b87c0
1 parent 0662a2e commit bf9516e

File tree

5 files changed

+42
-28
lines changed

5 files changed

+42
-28
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@
175175
"ng-packagr": "15.0.0-rc.0",
176176
"node-fetch": "^2.2.0",
177177
"npm": "^8.11.0",
178-
"npm-package-arg": "9.1.2",
178+
"npm-package-arg": "10.0.0",
179179
"open": "8.4.0",
180180
"ora": "5.4.1",
181181
"pacote": "15.0.6",

packages/angular/cli/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"ini": "3.0.1",
3232
"inquirer": "8.2.4",
3333
"jsonc-parser": "3.2.0",
34-
"npm-package-arg": "9.1.2",
34+
"npm-package-arg": "10.0.0",
3535
"npm-pick-manifest": "8.0.1",
3636
"open": "8.4.0",
3737
"ora": "5.4.1",

packages/angular/cli/src/commands/add/cli.ts

+27-13
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,11 @@ export class AddCommandModule
144144
const usingYarn = packageManager.name === PackageManager.Yarn;
145145
spinner.info(`Using package manager: ${colors.grey(packageManager.name)}`);
146146

147-
if (packageIdentifier.name && packageIdentifier.type === 'tag' && !packageIdentifier.rawSpec) {
147+
if (
148+
packageIdentifier.name &&
149+
packageIdentifier.type === 'range' &&
150+
packageIdentifier.rawSpec === '*'
151+
) {
148152
// only package name provided; search for viable version
149153
// plus special cases for packages that did not have peer deps setup
150154
spinner.start('Searching for compatible package version...');
@@ -316,21 +320,31 @@ export class AddCommandModule
316320
return false;
317321
}
318322

319-
let validVersion = false;
320323
const installedVersion = await this.findProjectVersion(packageIdentifier.name);
321-
if (installedVersion) {
322-
if (packageIdentifier.type === 'range' && packageIdentifier.fetchSpec) {
323-
validVersion = satisfies(installedVersion, packageIdentifier.fetchSpec);
324-
} else if (packageIdentifier.type === 'version') {
325-
const v1 = valid(packageIdentifier.fetchSpec);
326-
const v2 = valid(installedVersion);
327-
validVersion = v1 !== null && v1 === v2;
328-
} else if (!packageIdentifier.rawSpec) {
329-
validVersion = true;
330-
}
324+
if (!installedVersion) {
325+
return false;
326+
}
327+
328+
if (packageIdentifier.rawSpec === '*') {
329+
return true;
331330
}
332331

333-
return validVersion;
332+
if (
333+
packageIdentifier.type === 'range' &&
334+
packageIdentifier.fetchSpec &&
335+
packageIdentifier.fetchSpec !== '*'
336+
) {
337+
return satisfies(installedVersion, packageIdentifier.fetchSpec);
338+
}
339+
340+
if (packageIdentifier.type === 'version') {
341+
const v1 = valid(packageIdentifier.fetchSpec);
342+
const v2 = valid(installedVersion);
343+
344+
return v1 !== null && v1 === v2;
345+
}
346+
347+
return false;
334348
}
335349

336350
private async getCollectionName(): Promise<string> {

packages/angular/cli/src/commands/update/cli.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -201,12 +201,12 @@ export class UpdateCommandModule extends CommandModule<UpdateCommandArgs> {
201201
return 1;
202202
}
203203

204-
if (options.migrateOnly && packageIdentifier.rawSpec) {
204+
if (options.migrateOnly && packageIdentifier.rawSpec !== '*') {
205205
logger.warn('Package specifier has no effect when using "migrate-only" option.');
206206
}
207207

208208
// If next option is used and no specifier supplied, use next tag
209-
if (options.next && !packageIdentifier.rawSpec) {
209+
if (options.next && packageIdentifier.rawSpec === '*') {
210210
packageIdentifier.fetchSpec = 'next';
211211
}
212212

yarn.lock

+11-11
Original file line numberDiff line numberDiff line change
@@ -8065,17 +8065,7 @@ npm-normalize-package-bin@^3.0.0:
80658065
resolved "https://registry.yarnpkg.com/npm-normalize-package-bin/-/npm-normalize-package-bin-3.0.0.tgz#6097436adb4ef09e2628b59a7882576fe53ce485"
80668066
integrity sha512-g+DPQSkusnk7HYXr75NtzkIP4+N81i3RPsGFidF3DzHd9MT9wWngmqoeg/fnHFz5MNdtG4w03s+QnhewSLTT2Q==
80678067

8068-
[email protected], npm-package-arg@^9.0.0, npm-package-arg@^9.0.1, npm-package-arg@^9.1.0:
8069-
version "9.1.2"
8070-
resolved "https://registry.yarnpkg.com/npm-package-arg/-/npm-package-arg-9.1.2.tgz#fc8acecb00235f42270dda446f36926ddd9ac2bc"
8071-
integrity sha512-pzd9rLEx4TfNJkovvlBSLGhq31gGu2QDexFPWT19yCDh0JgnRhlBLNo5759N0AJmBk+kQ9Y/hXoLnlgFD+ukmg==
8072-
dependencies:
8073-
hosted-git-info "^5.0.0"
8074-
proc-log "^2.0.1"
8075-
semver "^7.3.5"
8076-
validate-npm-package-name "^4.0.0"
8077-
8078-
npm-package-arg@^10.0.0:
8068+
[email protected], npm-package-arg@^10.0.0:
80798069
version "10.0.0"
80808070
resolved "https://registry.yarnpkg.com/npm-package-arg/-/npm-package-arg-10.0.0.tgz#a34f4a4208a937074b1fff0943a684fbacc83977"
80818071
integrity sha512-7dkh8mRp7s0KwVHKIVJnFCJQ2B34gOGnzgBjDGyprycmARq/82SX/lhilQ95ZuacP/G/1gsS345iAkKmxWBQ2Q==
@@ -8085,6 +8075,16 @@ npm-package-arg@^10.0.0:
80858075
semver "^7.3.5"
80868076
validate-npm-package-name "^5.0.0"
80878077

8078+
npm-package-arg@^9.0.0, npm-package-arg@^9.0.1, npm-package-arg@^9.1.0:
8079+
version "9.1.2"
8080+
resolved "https://registry.yarnpkg.com/npm-package-arg/-/npm-package-arg-9.1.2.tgz#fc8acecb00235f42270dda446f36926ddd9ac2bc"
8081+
integrity sha512-pzd9rLEx4TfNJkovvlBSLGhq31gGu2QDexFPWT19yCDh0JgnRhlBLNo5759N0AJmBk+kQ9Y/hXoLnlgFD+ukmg==
8082+
dependencies:
8083+
hosted-git-info "^5.0.0"
8084+
proc-log "^2.0.1"
8085+
semver "^7.3.5"
8086+
validate-npm-package-name "^4.0.0"
8087+
80888088
npm-packlist@^5.1.0:
80898089
version "5.1.3"
80908090
resolved "https://registry.yarnpkg.com/npm-packlist/-/npm-packlist-5.1.3.tgz#69d253e6fd664b9058b85005905012e00e69274b"

0 commit comments

Comments
 (0)