Skip to content

Commit 0309498

Browse files
committed
fix: findup until root from user cwd
1 parent 7c1919c commit 0309498

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/_utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export async function findup<T>(
1313
const segments = normalize(cwd).split("/");
1414

1515
while (segments.length > 0) {
16-
const path = segments.join("/");
16+
const path = segments.join("/") || "/";
1717
const result = await match(path);
1818

1919
if (result || !options.includeParentDirs) {

src/package-manager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export async function detectPackageManager(
7676
options: DetectPackageManagerOptions = {},
7777
): Promise<PackageManager | undefined> {
7878
const detected = await findup(
79-
cwd,
79+
resolve(cwd || "."),
8080
async (path) => {
8181
// 1. Use `packageManager` field from package.json
8282
if (!options.ignorePackageJSON) {

0 commit comments

Comments
 (0)