Skip to content

Commit 728d68a

Browse files
authored
fix: handling of directory glob (#214)
## References Fixes #212
1 parent 837af58 commit 728d68a

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

lib/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,9 @@ class PackWalker extends IgnoreWalker {
298298
// invert the rule because these are things we want to include
299299
if (file.startsWith('./')) {
300300
file = file.slice(1)
301-
} else if (file.endsWith('/*')) {
302-
file = file.slice(0, -1)
301+
}
302+
if (file.endsWith('/*')) {
303+
file += '*'
303304
}
304305
const inverse = `!${file}`
305306
try {

test/package-json-directory-glob.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ t.test('package json directory glob', async (t) => {
2424
'folder/',
2525
'folder/*',
2626
'folder/**',
27+
'folder/**/*',
28+
'./folder/*',
2729
]
2830

2931
for (const files of pkgFiles) {

0 commit comments

Comments
 (0)