Skip to content

Commit

Permalink
feat: Add the includeVersion flag
Browse files Browse the repository at this point in the history
Closes #1175
  • Loading branch information
Gerrit0 committed Jan 15, 2020
1 parent 33be747 commit 8025e64
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/lib/converter/plugins/PackagePlugin.ts
Expand Up @@ -21,6 +21,9 @@ export class PackagePlugin extends ConverterComponent {
@BindOption('readme')
readme!: string;

@BindOption('includeVersion')
includeVersion!: boolean;

/**
* The file name of the found readme.md file.
*/
Expand Down Expand Up @@ -121,7 +124,10 @@ export class PackagePlugin extends ConverterComponent {
if (this.packageFile) {
project.packageInfo = JSON.parse(FS.readFileSync(this.packageFile, 'utf-8'));
if (!project.name) {
project.name = `${project.packageInfo.name} - v${project.packageInfo.version}`;
project.name = String(project.packageInfo.name);
}
if (this.includeVersion) {
project.name = `${project.name} - v${project.packageInfo.version}`;
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/lib/utils/options/declaration.ts
Expand Up @@ -61,6 +61,7 @@ export interface TypeDocOptionMap {

theme: string;
name: string;
includeVersion: boolean;
readme: string;
defaultCategory: string;
categoryOrder: string[];
Expand Down
5 changes: 5 additions & 0 deletions src/lib/utils/options/sources/typedoc.ts
Expand Up @@ -108,6 +108,11 @@ export function addTypeDocOptions(options: Options) {
name: 'name',
help: 'Set the name of the project that will be used in the header of the template.'
});
options.addDeclaration({
name: 'includeVersion',
help: 'Add the package version to the project name',
type: ParameterType.Boolean
});
options.addDeclaration({
name: 'readme',
help: 'Path to the readme file that should be displayed on the index page. Pass `none` to disable the index page and start the documentation on the globals page.'
Expand Down

0 comments on commit 8025e64

Please sign in to comment.