Skip to content

Commit

Permalink
fix(devkit): don't visit files that are ignored by nxignore
Browse files Browse the repository at this point in the history
  • Loading branch information
AgentEnder committed Apr 25, 2023
1 parent 6c613ce commit ee19e44
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/devkit/src/generators/visit-not-ignored-files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@ export function visitNotIgnoredFiles(
dirPath: string = tree.root,
visitor: (path: string) => void
): void {
// TODO (v17): use packages/nx/src/utils/ignore.ts
let ig: Ignore;
if (tree.exists('.gitignore')) {
ig = ignore();
ig.add('.git');
ig.add(tree.read('.gitignore', 'utf-8'));
}
if (tree.exists('.nxignore')) {
ig.add(tree.read('.nxignore', 'utf-8'));
}
dirPath = normalizePathRelativeToRoot(dirPath, tree.root);
if (dirPath !== '' && ig?.ignores(dirPath)) {
return;
Expand Down

0 comments on commit ee19e44

Please sign in to comment.