Skip to content

Commit 0306a59

Browse files
committed
Fix missing edge case in PackagePlugin, sort contributors
1 parent bacefb6 commit 0306a59

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

CHANGELOG.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88

99
### Bug Fixes
1010

11-
- TypeDoc will now warn if a project name/version cannot be inferred from a package.json file, #1907.
11+
- TypeDoc will now warn if a project name/version cannot be inferred from a package.json file rather than using `undefined`, #1907.
1212

1313
### Thanks!
1414

1515
- @ejuda
16-
- @schlusslicht
1716
- @matteobruni
17+
- @schlusslicht
1818

1919
## v0.22.14 (2022-04-07)
2020

src/lib/converter/plugins/PackagePlugin.ts

+9-3
Original file line numberDiff line numberDiff line change
@@ -106,20 +106,26 @@ export class PackagePlugin extends ConverterComponent {
106106
if (!project.name) {
107107
if (!project.packageInfo.name) {
108108
context.logger.warn(
109-
'The --name option was not specified, and package.json does not have a name field. Defaulting project name to "Documentation"'
109+
'The --name option was not specified, and package.json does not have a name field. Defaulting project name to "Documentation".'
110110
);
111111
project.name = "Documentation";
112112
} else {
113113
project.name = String(project.packageInfo.name);
114114
}
115115
}
116116
if (this.includeVersion) {
117-
project.name = `${project.name} - v${project.packageInfo.version}`;
117+
if (project.packageInfo.version) {
118+
project.name = `${project.name} - v${project.packageInfo.version}`;
119+
} else {
120+
context.logger.warn(
121+
"--includeVersion was specified, but package.json does not specify a version."
122+
);
123+
}
118124
}
119125
} else {
120126
if (!project.name) {
121127
context.logger.warn(
122-
'The --name option was not specified, and no package.json was found. Defaulting project name to "Documentation"'
128+
'The --name option was not specified, and no package.json was found. Defaulting project name to "Documentation".'
123129
);
124130
project.name = "Documentation";
125131
}

0 commit comments

Comments
 (0)