Skip to content

Commit

Permalink
Fix npm package manager detection
Browse files Browse the repository at this point in the history
  • Loading branch information
egorio committed Oct 28, 2022
1 parent ae34a9c commit 6de3fea
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ async function detectPackageManager() {
return await Promise.all([
checkLockFile('yarn', 'yarn.lock'),
checkLockFile('pnpm', 'pnpm-lock.yaml'),
checkLockFile('npm', 'package-lock.yaml'),
checkLockFile('npm', 'package-lock.json'),
checkBinaryFile('yarn'),
checkBinaryFile('pnpm'),
]).then(([yarnLock, pnpmLock, npmLock, yarnBin, pnpmBin]) => {
Expand Down
4 changes: 2 additions & 2 deletions src/pm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export type PackageManager = 'npm' | 'pnpm' | 'yarn';
*/
export async function detectPackageManager(): Promise<PackageManager> {
const checkLockFile = async (binFileName: PackageManager, lockFileName: string): Promise<PackageManager | null> => {
return createGlobber(`**/${lockFileName}`)
return createGlobber(`${lockFileName}`)
.then((g) => g.glob())
.then((f) => (f ? binFileName : null));
};
Expand All @@ -23,7 +23,7 @@ export async function detectPackageManager(): Promise<PackageManager> {
return await Promise.all([
checkLockFile('yarn', 'yarn.lock'),
checkLockFile('pnpm', 'pnpm-lock.yaml'),
checkLockFile('npm', 'package-lock.yaml'),
checkLockFile('npm', 'package-lock.json'),
checkBinaryFile('yarn'),
checkBinaryFile('pnpm'),
]).then(([yarnLock, pnpmLock, npmLock, yarnBin, pnpmBin]) => {
Expand Down

0 comments on commit 6de3fea

Please sign in to comment.