Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handling of directory glob #214

Merged
merged 1 commit into from Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/index.js
Expand Up @@ -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}`

Expand Down
2 changes: 2 additions & 0 deletions test/package-json-directory-glob.js
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