Skip to content

Commit a48db0a

Browse files
committed
refactor(@angular/cli): exclude Cnpm from LOCKFILE_NAMES type
The `LOCKFILE_NAMES` constant in `packages/angular/cli/src/utilities/package-manager.ts` is updated to explicitly exclude `PackageManager.Cnpm` from its type definition. This refactors the type to accurately reflect the package managers supported by the lockfile detection logic.
1 parent f6ad41c commit a48db0a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ import { memoize } from './memoize';
1818
/**
1919
* A map of package managers to their corresponding lockfile names.
2020
*/
21-
const LOCKFILE_NAMES: Readonly<Record<PackageManager, string | readonly string[]>> = {
21+
const LOCKFILE_NAMES: Readonly<
22+
Record<Exclude<PackageManager, PackageManager.Cnpm>, string | readonly string[]>
23+
> = {
2224
[PackageManager.Yarn]: 'yarn.lock',
2325
[PackageManager.Pnpm]: 'pnpm-lock.yaml',
2426
[PackageManager.Bun]: ['bun.lockb', 'bun.lock'],
@@ -289,7 +291,10 @@ export class PackageManagerUtils {
289291
* @param filesInRoot An array of file names in the root directory.
290292
* @returns True if the lockfile exists, false otherwise.
291293
*/
292-
private hasLockfile(packageManager: PackageManager, filesInRoot: string[]): boolean {
294+
private hasLockfile(
295+
packageManager: Exclude<PackageManager, PackageManager.Cnpm>,
296+
filesInRoot: string[],
297+
): boolean {
293298
const lockfiles = LOCKFILE_NAMES[packageManager];
294299

295300
return typeof lockfiles === 'string'

0 commit comments

Comments
 (0)