Skip to content

Commit

Permalink
feat: add support for .gardenignore file
Browse files Browse the repository at this point in the history
Useful to exclude directories in project directory when scanning
  • Loading branch information
edvald authored and eysi09 committed May 14, 2018
1 parent 7f25653 commit 7ba24b7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,17 @@ export async function* scanDirectory(path: string, opts?: klaw.Options): AsyncIt
export function getIgnorer(rootPath: string) {
// TODO: this doesn't handle nested .gitignore files, we should revisit
const gitignorePath = join(rootPath, ".gitignore")
const gardenignorePath = join(rootPath, ".gardenignore")
const ig = ignore()

if (existsSync(gitignorePath)) {
ig.add(readFileSync(gitignorePath).toString())
}

if (existsSync(gardenignorePath)) {
ig.add(readFileSync(gardenignorePath).toString())
}

// should we be adding this (or more) by default?
ig.add("node_modules")
ig.add(".garden")
Expand Down

0 comments on commit 7ba24b7

Please sign in to comment.