Skip to content

Commit 341084f

Browse files
colatkinsonaciccarello
authored andcommitted
Allow exclusion of directories starting with a dot (#711)
* Create test for desired behavior * Pass dot: true option to Minimatch
1 parent 8384a95 commit 341084f

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

src/lib/application.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ export class Application extends ChildableComponent<Application, AbstractCompone
248248
*/
249249
public expandInputFiles(inputFiles?: string[]): string[] {
250250
let files: string[] = [];
251-
const exclude: Array<IMinimatch> = this.exclude ? this.exclude.map(pattern => new Minimatch(pattern)) : [];
251+
const exclude: Array<IMinimatch> = this.exclude ? this.exclude.map(pattern => new Minimatch(pattern, {dot: true})) : [];
252252

253253
function isExcluded(fileName: string): boolean {
254254
return exclude.some(mm => mm.match(fileName));

src/test/.dot/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default {};

src/test/typedoc.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Application } from '..';
22
import * as Path from 'path';
33
import Assert = require('assert');
4+
import './.dot';
45

56
describe('TypeDoc', function() {
67
let application: Application;
@@ -55,5 +56,13 @@ describe('TypeDoc', function() {
5556
Assert.equal(expanded.indexOf(Path.join(inputFiles, 'access', 'access.ts')), -1);
5657
Assert.equal(expanded.indexOf(inputFiles), -1);
5758
});
59+
it('supports excluding directories beginning with dots', function() {
60+
const inputFiles = __dirname;
61+
application.options.setValue('exclude', '**/+(.dot)/**');
62+
const expanded = application.expandInputFiles([inputFiles]);
63+
64+
Assert.equal(expanded.indexOf(Path.join(inputFiles, '.dot', 'index.d.ts')), -1);
65+
Assert.equal(expanded.indexOf(inputFiles), -1);
66+
});
5867
});
5968
});

0 commit comments

Comments
 (0)