diff --git a/gulpfile.js b/gulpfile.js index 390cf18e58..b72126e6e0 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -322,7 +322,10 @@ function apiExamplesWatch(postShredAction) { function devGuideExamplesWatch(shredOptions, postShredAction) { var includePattern = path.join(shredOptions.examplesDir, '**/*.*'); var excludePattern = '!' + path.join(shredOptions.examplesDir, '**/node_modules/**/*.*'); - gulp.watch([includePattern, excludePattern], {readDelay: 500}, function (event, done) { + // removed this version because gulp.watch has the same glob issue that dgeni has. + // gulp.watch([includePattern, excludePattern], {readDelay: 500}, function (event, done) { + var files = globby.sync( [includePattern], { ignore: [ '**/node_modules/**']}); + gulp.watch([files], {readDelay: 500}, function (event, done) { gutil.log('Dev Guide example changed') gutil.log('Event type: ' + event.type); // added, changed, or deleted gutil.log('Event path: ' + event.path); // The path of the modified file @@ -331,7 +334,6 @@ function devGuideExamplesWatch(shredOptions, postShredAction) { } - // Generate the API docs for the specified language, if not specified then it defaults to ts function buildApiDocs(targetLanguage) { var ALLOWED_LANGUAGES = ['ts', 'js', 'dart']; diff --git a/tools/doc-shredder/doc-shredder.js b/tools/doc-shredder/doc-shredder.js index 4f24c1cd77..1df060a3ea 100644 --- a/tools/doc-shredder/doc-shredder.js +++ b/tools/doc-shredder/doc-shredder.js @@ -6,6 +6,7 @@ var del = require('del'); var delPromise = Q.denodeify(del); var Dgeni = require('dgeni'); var _ = require('lodash'); +var globby = require('globby'); var shred = function(shredOptions) { try { @@ -74,7 +75,7 @@ function createShredPackage(shredOptions) { readFilesProcessor.basePath = "/"; // Specify collections of source files that should contain the documentation to extract - var extns = ['*.js', '*.html', '*.ts', '*.css', '*.json', '*.dart', '*.yaml' ]; + var extns = ['*.ts', '*.html', '*.js', '*.css', '*.json', '*.dart', '*.yaml' ]; var includeFiles = extns.map(function(extn) { if (options.includeSubdirs) { return path.join(options.examplesDir, '**', extn); @@ -82,10 +83,16 @@ function createShredPackage(shredOptions) { return path.join(options.examplesDir, extn); } }); + + // HACK ( next two lines) because the glob function that dgeni uses internally isn't good at removing 'node_modules' early + // this just uses globby to 'preglob' the include files ( and exclude the node_modules). + var nmPattern = '**/node_modules/**'; + var includeFiles = globby.sync( includeFiles, { ignore: [nmPattern] } ); + readFilesProcessor.sourceFiles = [ { // Process all candidate files in `src` and its subfolders ... - include: includeFiles, - exclude: ['**/node_modules/**', '**/typings/**', '**/packages/**', '**/build/**'], + include: includeFiles , + exclude: [ '**/node_modules/**', '**/typings/**', '**/packages/**', '**/build/**'], // When calculating the relative path to these files use this as the base path. // So `src/foo/bar.js` will have relative path of `foo/bar.js` basePath: options.examplesDir @@ -128,9 +135,17 @@ var createShredMapPackage = function(mapOptions) { return path.join(options.jadeDir, extn); } }); + + // HACK ( next two lines) because the glob function that dgeni uses internally isn't good at removing 'node_modules' early + // this just uses globby to 'preglob' the include files ( and exclude the node_modules). + var nmPattern = '**/node_modules/**'; + var includeFiles = globby.sync( includeFiles, { ignore: [nmPattern] } ); + + readFilesProcessor.sourceFiles = [ { // Process all candidate files in `src` and its subfolders ... include: includeFiles, + exclude: ['**/node_modules/**', '**/typings/**', '**/packages/**', '**/build/**'], // When calculating the relative path to these files use this as the base path. // So `src/foo/bar.js` will have relative path of `foo/bar.js` basePath: options.jadeDir