build(aio): do not recurse node_modules when loading examples in doc-gen

This commit is contained in:
Peter Bacon Darwin 2017-06-21 14:16:56 +01:00 committed by Hans
parent bb804dd3e9
commit 3fb98fe4ea
1 changed files with 2 additions and 2 deletions

View File

@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
const Package = require('dgeni').Package;
const globby = require('globby');
const glob = require('glob');
const ignore = require('ignore');
const fs = require('fs');
const path = require('canonical-path');
@ -23,7 +23,7 @@ module.exports = new Package('angular-content', [basePackage, contentPackage])
const gitignoreFile = fs.readFileSync(path.resolve(GUIDE_EXAMPLES_PATH, '.gitignore'), 'utf8');
const gitignore = ignore().add(gitignoreFile);
const examplePaths = globby.sync('**/*', { cwd: GUIDE_EXAMPLES_PATH, mark: true, dot: true })
const examplePaths = glob.sync('**/*', { cwd: GUIDE_EXAMPLES_PATH, dot: true, ignore: '**/node_modules/**', mark: true })
.filter(filePath => filePath !== '.gitignore') // we are not interested in the .gitignore file itself
.filter(filePath => !/\/$/.test(filePath)); // this filter removes the folders, leaving only files
const filteredExamplePaths = gitignore.filter(examplePaths) // filter out files that match the .gitignore rules