Skip to content

Commit 0b60377

Browse files
committed
fix(@angular/cli): force temporary directory for non-registry specifiers
When resolving package manifests from file, git, or remote URLs, the CLI relies on installing the package into an isolated temporary directory to identify the package's name. This change forces the 'acquireTempPackage' method to use the 'temporary-directory' strategy for these lookups, ensuring that the package identification logic remains correct even when the package manager (like Bun) defaults to a 'project-root' strategy.
1 parent f1c95a4 commit 0b60377

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,7 @@ export class PackageManager {
502502
const { workingDirectory, cleanup } = await this.acquireTempPackage(fetchSpec, {
503503
...options,
504504
ignoreScripts: true,
505+
forceDirectoryStrategy: 'temporary-directory',
505506
});
506507

507508
try {
@@ -542,9 +543,16 @@ export class PackageManager {
542543
*/
543544
async acquireTempPackage(
544545
specifier: string,
545-
options: { registry?: string; ignoreScripts?: boolean } = {},
546+
options: {
547+
registry?: string;
548+
ignoreScripts?: boolean;
549+
forceDirectoryStrategy?: 'temporary-directory';
550+
} = {},
546551
): Promise<{ workingDirectory: string; cleanup: () => Promise<void> }> {
547-
if (this.descriptor.tempPackageStrategy === 'project-root') {
552+
if (
553+
this.descriptor.tempPackageStrategy === 'project-root' &&
554+
options.forceDirectoryStrategy !== 'temporary-directory'
555+
) {
548556
const flags = [
549557
options.ignoreScripts ? this.descriptor.ignoreScriptsFlag : '',
550558
this.descriptor.noSaveFlag,

0 commit comments

Comments
 (0)