Skip to content

Allow exclusion of directories starting with a dot #711

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lib/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ export class Application extends ChildableComponent<Application, AbstractCompone
*/
public expandInputFiles(inputFiles?: string[]): string[] {
let files: string[] = [];
const exclude: Array<IMinimatch> = this.exclude ? this.exclude.map(pattern => new Minimatch(pattern)) : [];
const exclude: Array<IMinimatch> = this.exclude ? this.exclude.map(pattern => new Minimatch(pattern, {dot: true})) : [];

function isExcluded(fileName: string): boolean {
return exclude.some(mm => mm.match(fileName));
Expand Down
1 change: 1 addition & 0 deletions src/test/.dot/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default {};
9 changes: 9 additions & 0 deletions src/test/typedoc.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Application } from '..';
import * as Path from 'path';
import Assert = require('assert');
import './.dot';

describe('TypeDoc', function() {
let application: Application;
Expand Down Expand Up @@ -55,5 +56,13 @@ describe('TypeDoc', function() {
Assert.equal(expanded.indexOf(Path.join(inputFiles, 'access', 'access.ts')), -1);
Assert.equal(expanded.indexOf(inputFiles), -1);
});
it('supports excluding directories beginning with dots', function() {
const inputFiles = __dirname;
application.options.setValue('exclude', '**/+(.dot)/**');
const expanded = application.expandInputFiles([inputFiles]);

Assert.equal(expanded.indexOf(Path.join(inputFiles, '.dot', 'index.d.ts')), -1);
Assert.equal(expanded.indexOf(inputFiles), -1);
});
});
});