chore(devguide-tooling): node_modules symlinks caused globbing problems for harp
closes #466
This commit is contained in:
parent
f7b6d83422
commit
acb2dab91e
@ -322,7 +322,10 @@ function apiExamplesWatch(postShredAction) {
|
|||||||
function devGuideExamplesWatch(shredOptions, postShredAction) {
|
function devGuideExamplesWatch(shredOptions, postShredAction) {
|
||||||
var includePattern = path.join(shredOptions.examplesDir, '**/*.*');
|
var includePattern = path.join(shredOptions.examplesDir, '**/*.*');
|
||||||
var excludePattern = '!' + path.join(shredOptions.examplesDir, '**/node_modules/**/*.*');
|
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('Dev Guide example changed')
|
||||||
gutil.log('Event type: ' + event.type); // added, changed, or deleted
|
gutil.log('Event type: ' + event.type); // added, changed, or deleted
|
||||||
gutil.log('Event path: ' + event.path); // The path of the modified file
|
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
|
// Generate the API docs for the specified language, if not specified then it defaults to ts
|
||||||
function buildApiDocs(targetLanguage) {
|
function buildApiDocs(targetLanguage) {
|
||||||
var ALLOWED_LANGUAGES = ['ts', 'js', 'dart'];
|
var ALLOWED_LANGUAGES = ['ts', 'js', 'dart'];
|
||||||
|
@ -6,6 +6,7 @@ var del = require('del');
|
|||||||
var delPromise = Q.denodeify(del);
|
var delPromise = Q.denodeify(del);
|
||||||
var Dgeni = require('dgeni');
|
var Dgeni = require('dgeni');
|
||||||
var _ = require('lodash');
|
var _ = require('lodash');
|
||||||
|
var globby = require('globby');
|
||||||
|
|
||||||
var shred = function(shredOptions) {
|
var shred = function(shredOptions) {
|
||||||
try {
|
try {
|
||||||
@ -74,7 +75,7 @@ function createShredPackage(shredOptions) {
|
|||||||
readFilesProcessor.basePath = "/";
|
readFilesProcessor.basePath = "/";
|
||||||
|
|
||||||
// Specify collections of source files that should contain the documentation to extract
|
// 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) {
|
var includeFiles = extns.map(function(extn) {
|
||||||
if (options.includeSubdirs) {
|
if (options.includeSubdirs) {
|
||||||
return path.join(options.examplesDir, '**', extn);
|
return path.join(options.examplesDir, '**', extn);
|
||||||
@ -82,10 +83,16 @@ function createShredPackage(shredOptions) {
|
|||||||
return path.join(options.examplesDir, extn);
|
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 = [ {
|
readFilesProcessor.sourceFiles = [ {
|
||||||
// Process all candidate files in `src` and its subfolders ...
|
// Process all candidate files in `src` and its subfolders ...
|
||||||
include: includeFiles,
|
include: includeFiles ,
|
||||||
exclude: ['**/node_modules/**', '**/typings/**', '**/packages/**', '**/build/**'],
|
exclude: [ '**/node_modules/**', '**/typings/**', '**/packages/**', '**/build/**'],
|
||||||
// When calculating the relative path to these files use this as the base path.
|
// 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`
|
// So `src/foo/bar.js` will have relative path of `foo/bar.js`
|
||||||
basePath: options.examplesDir
|
basePath: options.examplesDir
|
||||||
@ -128,9 +135,17 @@ var createShredMapPackage = function(mapOptions) {
|
|||||||
return path.join(options.jadeDir, extn);
|
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 = [ {
|
readFilesProcessor.sourceFiles = [ {
|
||||||
// Process all candidate files in `src` and its subfolders ...
|
// Process all candidate files in `src` and its subfolders ...
|
||||||
include: includeFiles,
|
include: includeFiles,
|
||||||
|
exclude: ['**/node_modules/**', '**/typings/**', '**/packages/**', '**/build/**'],
|
||||||
// When calculating the relative path to these files use this as the base path.
|
// 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`
|
// So `src/foo/bar.js` will have relative path of `foo/bar.js`
|
||||||
basePath: options.jadeDir
|
basePath: options.jadeDir
|
||||||
|
Loading…
x
Reference in New Issue
Block a user