Skip to content

Commit

Permalink
feat: add support for exclude all nested files when a directory is sp…
Browse files Browse the repository at this point in the history
…ecified and ends with a slash
  • Loading branch information
jackton1 committed Jan 18, 2024
1 parent cbd5907 commit 9b523e6
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,14 @@ async function* lineOfFileGenerator({
input: fileStream,
crlfDelay: Infinity
})
for await (const line of rl) {
for await (let line of rl) {
if (!line.startsWith('#') && line !== '') {
if (excludedFiles) {
if (line.startsWith('!')) {
yield line
} else {
yield `!${line}`
line = line.startsWith('!') ? line : `!${line}`
if (line.endsWith(path.sep)) {
line = `${line}${path.sep}**`
}
yield line
} else {
yield line
}
Expand Down Expand Up @@ -1032,6 +1032,9 @@ export const getFilePatterns = async ({
if (!p.startsWith('!')) {
p = `!${p}`
}
if (p.endsWith(path.sep)) {
p = `${p}${path.sep}**`
}
return p
})

Expand Down

0 comments on commit 9b523e6

Please sign in to comment.