chore(devguide-tooling): node_modules symlinks caused globbing problems for harp

closes #466
This commit is contained in:
Jay Traband 2015-12-09 23:56:24 -08:00 committed by Ward Bell
parent f7b6d83422
commit acb2dab91e
2 changed files with 22 additions and 5 deletions

View File

@ -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'];

View File

@ -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,6 +83,12 @@ 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 ,
@ -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