Skip to content

Commit

Permalink
fix: handling of directory glob (#214)
Browse files Browse the repository at this point in the history
## References
Fixes #212
  • Loading branch information
mohd-akram authored Jan 3, 2024
1 parent 837af58 commit 728d68a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,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}`
try {
Expand Down
2 changes: 2 additions & 0 deletions test/package-json-directory-glob.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ t.test('package json directory glob', async (t) => {
'folder/',
'folder/*',
'folder/**',
'folder/**/*',
'./folder/*',
]

for (const files of pkgFiles) {
Expand Down

0 comments on commit 728d68a

Please sign in to comment.