Skip to content

Commit 598a690

Browse files
committed
fix(@angular/cli): conditionally quote package names when adding dependencies based on host requirements
Complex range specifiers that include shell special characters (e.g., '>', '<') can be misinterpreted when not quoted. This change ensures that version ranges are enclosed in quotes when needed to prevent such issues.
1 parent b5fb457 commit 598a690

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/angular/cli/src/package-managers/package-manager.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,9 @@ export class PackageManager {
323323
ignoreScripts ? this.descriptor.ignoreScriptsFlag : '',
324324
].filter((flag) => flag);
325325

326-
const args = [this.descriptor.addCommand, packageName, ...flags];
326+
const specifier = this.host.requiresQuoting ? `"${packageName}"` : packageName;
327+
const args = [this.descriptor.addCommand, specifier, ...flags];
328+
327329
await this.#run(args, options);
328330

329331
this.#dependencyCache = null;

0 commit comments

Comments
 (0)