warning name version package.json
Pick the name & version from the project package.json
.
Tries to get the name and version from src/package.json
and fails, since in that file there is only a type: module
definition, (required by the dual CommonJS/ES6 module nature of the project).
Assuming the entry point is src/index.ts
, add a minimal src/package.json
like:
{
"type": "module"
}
This will confuse typedoc
, which will no longer be able to identify the name/version:
> typedoc --logLevel Verbose
Using TypeScript 4.9.5 from ./node_modules/typescript/lib
Converting with 1 programs 1 entry points
Finished getting entry points in 724ms
Begin readme.md/package.json search at ./src <---
warning The --name option was not specified, and package.json does not have a name field. Defaulting project name to "Documentation".
warning --includeVersion was specified, but package.json does not specify a version.
Finished conversion in 124ms
Validation took 1ms
Renderer: Loading highlighter took 374ms
Documentation generated at ./docs
HTML rendering took 664ms
I think that a better strategy would be to iterate to the parent folder and try to read the name/version from there, until the project root is reached.
As a partial workaround, I also added the project name to this short package.json
, but the version remained undefined.
Another solution would be to add a configuration option like --packageJson
to provide the path to the package.json
file.
This would be preferred and also consistent with --readme
Note: in my project there is also a src/README.md
file, and by default typedoc selects it, thus I have to explicitly specify "readme": "./README.md",
in typedoc.json
.
It would be natural to also specify "packageJson": "./package.json",
.
Owner Name | TypeStrong |
Repo Name | typedoc |
Full Name | TypeStrong/typedoc |
Language | TypeScript |
Created Date | 2014-05-24 |
Updated Date | 2023-03-19 |
Star Count | 6487 |
Watcher Count | 68 |
Fork Count | 639 |
Issue Count | 48 |
Issue Title | Created Date | Updated Date |
---|