Skip to content

Commit

Permalink
feat: Support disabling sources
Browse files Browse the repository at this point in the history
Closes #808
  • Loading branch information
Gerrit0 committed Mar 15, 2020
1 parent 802c408 commit 3dadcde
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/lib/converter/plugins/SourcePlugin.ts
Expand Up @@ -8,12 +8,16 @@ import { Component, ConverterComponent } from '../components';
import { BasePath } from '../utils/base-path';
import { Converter } from '../converter';
import { Context } from '../context';
import { BindOption } from '../../utils';

/**
* A handler that attaches source file information to reflections.
*/
@Component({name: 'source'})
export class SourcePlugin extends ConverterComponent {
@BindOption('disableSources')
readonly disableSources!: boolean;

/**
* Helper for resolving the base path of all source files.
*/
Expand Down Expand Up @@ -87,7 +91,7 @@ export class SourcePlugin extends ConverterComponent {
* @param node The node that is currently processed if available.
*/
private onDeclaration(context: Context, reflection: Reflection, node?: ts.Node) {
if (!node) {
if (!node || this.disableSources) {
return;
}
const sourceFile = node.getSourceFile();
Expand Down
1 change: 1 addition & 0 deletions src/lib/utils/options/declaration.ts
Expand Up @@ -53,6 +53,7 @@ export interface TypeDocOptionMap {
excludePrivate: boolean;
excludeProtected: boolean;
ignoreCompilerErrors: boolean;
disableSources: boolean;
includes: string;
media: string;

Expand Down
7 changes: 6 additions & 1 deletion src/lib/utils/options/sources/typedoc.ts
Expand Up @@ -78,7 +78,12 @@ export function addTypeDocOptions(options: Options) {
});
options.addDeclaration({
name: 'ignoreCompilerErrors',
help: 'Should TypeDoc generate documentation pages even after the compiler has returned errors?',
help: 'Skips checking for TypeScript compilation errors if set.',
type: ParameterType.Boolean
});
options.addDeclaration({
name: 'disableSources',
help: 'Disables setting the source of a reflection when documenting it.',
type: ParameterType.Boolean
});
options.addDeclaration({
Expand Down

0 comments on commit 3dadcde

Please sign in to comment.