Skip to content

Commit 8025e64

Browse files
committed
feat: Add the includeVersion flag
Closes #1175
1 parent 33be747 commit 8025e64

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

src/lib/converter/plugins/PackagePlugin.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ export class PackagePlugin extends ConverterComponent {
2121
@BindOption('readme')
2222
readme!: string;
2323

24+
@BindOption('includeVersion')
25+
includeVersion!: boolean;
26+
2427
/**
2528
* The file name of the found readme.md file.
2629
*/
@@ -121,7 +124,10 @@ export class PackagePlugin extends ConverterComponent {
121124
if (this.packageFile) {
122125
project.packageInfo = JSON.parse(FS.readFileSync(this.packageFile, 'utf-8'));
123126
if (!project.name) {
124-
project.name = `${project.packageInfo.name} - v${project.packageInfo.version}`;
127+
project.name = String(project.packageInfo.name);
128+
}
129+
if (this.includeVersion) {
130+
project.name = `${project.name} - v${project.packageInfo.version}`;
125131
}
126132
}
127133
}

src/lib/utils/options/declaration.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ export interface TypeDocOptionMap {
6161

6262
theme: string;
6363
name: string;
64+
includeVersion: boolean;
6465
readme: string;
6566
defaultCategory: string;
6667
categoryOrder: string[];

src/lib/utils/options/sources/typedoc.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,11 @@ export function addTypeDocOptions(options: Options) {
108108
name: 'name',
109109
help: 'Set the name of the project that will be used in the header of the template.'
110110
});
111+
options.addDeclaration({
112+
name: 'includeVersion',
113+
help: 'Add the package version to the project name',
114+
type: ParameterType.Boolean
115+
});
111116
options.addDeclaration({
112117
name: 'readme',
113118
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.'

0 commit comments

Comments
 (0)