From 1f7706d9b4b20b4a85550275d6bc94caa97ac634 Mon Sep 17 00:00:00 2001 From: Mohamed Akram Date: Tue, 26 Dec 2023 13:16:13 +0400 Subject: [PATCH] fix: handling of directory glob --- lib/index.js | 5 +++-- test/package-json-directory-glob.js | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/index.js b/lib/index.js index 8445925..b8409d4 100644 --- a/lib/index.js +++ b/lib/index.js @@ -310,8 +310,9 @@ class PackWalker extends IgnoreWalker { // invert the rule because these are things we want to include if (file.startsWith('./')) { file = file.slice(1) - } else if (file.endsWith('/*')) { - file = file.slice(0, -1) + } + if (file.endsWith('/*')) { + file += '*' } const inverse = `!${file}` diff --git a/test/package-json-directory-glob.js b/test/package-json-directory-glob.js index 48b228d..ab68428 100644 --- a/test/package-json-directory-glob.js +++ b/test/package-json-directory-glob.js @@ -24,6 +24,8 @@ t.test('package json directory glob', async (t) => { 'folder/', 'folder/*', 'folder/**', + 'folder/**/*', + './folder/*', ] for (const files of pkgFiles) {