chore(gulpfile): ignore `node_modules` folders in examples

This should speed up watching as it is unusual to update files in these
folders during normal development.

If you do change files in an example `node_modules` folder then you must
restart the gulp task to trigger the shredder and reload.
This commit is contained in:
Peter Bacon Darwin 2015-11-13 09:37:43 +00:00 committed by Ward Bell
parent aa5767d38c
commit eb7533a6ef
1 changed files with 17 additions and 16 deletions

View File

@ -214,7 +214,7 @@ function watchAndSync(options, cb) {
apiSourceWatch(browserSync.reload);
}
if (options.apiExamples) {
apiExampleWatch(browserSync.reload);
apiExamplesWatch(browserSync.reload);
}
if (options.localFiles) {
gulp.watch(NOT_API_DOCS_GLOB, browserSync.reload);
@ -255,12 +255,13 @@ function apiSourceWatch(postBuildAction) {
gutil.log('Event type: ' + event.event); // added, changed, or deleted
gutil.log('Event path: ' + event.path); // The path of the modified file
Q.all([buildApiDocs('ts'), buildApiDocs('js')]).then(postBuildAction);
return Q.all([buildApiDocs('ts'), buildApiDocs('js')]).then(postBuildAction);
});
}
function apiExampleWatch(postShredAction) {
var examplesPattern = [path.join(ANGULAR_PROJECT_PATH, 'modules/angular2/examples/**/*.*')];
function apiExamplesWatch(postShredAction) {
var examplesPattern =
path.join(ANGULAR_PROJECT_PATH, 'modules/angular2/examples/**/!(node_modules)/*.*');
var cleanPath = [path.join(_apiShredOptions.fragmentsDir, '**/*.*'), '!**/*.ovr.*'];
watch(examplesPattern, {readDelay: 500}, function (event, done) {
@ -274,6 +275,18 @@ function apiExampleWatch(postShredAction) {
});
}
function devGuideExamplesWatch(shredOptions, postShredAction) {
var pattern = path.join(shredOptions.examplesDir, "**/!(node_modules)/**/*");
watch(pattern, { readDelay: 500 }, function (event, done) {
gutil.log('Dev Guide example changed')
gutil.log('Event type: ' + event.event); // added, changed, or deleted
gutil.log('Event path: ' + event.path); // The path of the modified file
return docShredder.shredSingleDir(shredOptions, event.path).then(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'];
@ -304,18 +317,6 @@ function buildApiDocs(targetLanguage) {
}
}
function devGuideExamplesWatch(shredOptions, postShredAction) {
var pattern = path.join(shredOptions.examplesDir, "**/*.*");
watch([pattern], { readDelay: 500 }, function (event, done) {
gutil.log('Event type: ' + event.event); // added, changed, or deleted
gutil.log('Event path: ' + event.path); // The path of the modified file
docShredder.shredSingleDir(shredOptions, event.path).then(function () {
postShredAction && postShredAction();
});
});
}
function buildShredMaps(shouldWrite) {
var options = {
devguideExamplesDir: _devguideShredOptions.examplesDir,