typedoc-plugins icon indicating copy to clipboard operation
typedoc-plugins copied to clipboard

[Bug]: rootDir assumes --options is used and config file is in project root

Open pjeby opened this issue 1 year ago • 1 comments
trafficstars

Plugin

@knodes/typedoc-pluginutils

Typedoc plugin(s) version(s)

@knodes/[email protected], @knodes/[email protected]

Typedoc version

0.25.4

Describe the problem

The rootDir calculation in ABasePlugin makes two invalid assumptions that result in errors in some projects.

First, if --options has been specified, but the options file is in a subdirectory of the project, the selected root directory is incorrect.

Second, if --options has not been specified as a command-line argument, it tries to statSync(undefined) (in rootDir from utils/misc.js).

What did you expected ?

The rootDir to be calculated independently of --options and without throwing an error.

pjeby avatar Dec 25 '23 09:12 pjeby

A workaround for anyone experiencing this issue: you can add "options": "package.json", (or some other file in your project root) to your config file. Typedoc will ignore it since it'll have already loaded the options when it sees it, but pluginutils and the pages plugin will see what they're looking for.

pjeby avatar Dec 26 '23 00:12 pjeby