From 7ba24b732074c1b0a94737b39de5efdff0af2515 Mon Sep 17 00:00:00 2001 From: Jon Edvald Date: Sat, 12 May 2018 00:43:57 +0200 Subject: [PATCH] feat: add support for .gardenignore file Useful to exclude directories in project directory when scanning --- src/util.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/util.ts b/src/util.ts index 2ba749b90b..19e0150af7 100644 --- a/src/util.ts +++ b/src/util.ts @@ -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")