Skip to content

plugin option from option file not used. #1016

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 task done
GerkinDev opened this issue Apr 17, 2019 · 1 comment
Closed
1 task done

plugin option from option file not used. #1016

GerkinDev opened this issue Apr 17, 2019 · 1 comment

Comments

@GerkinDev
Copy link

GerkinDev commented Apr 17, 2019

I'm using a configuration file to store my TypeDoc settings. This configuration file contains the list of plugins to use, but they are not called at all. I don't want to rely on NPM auto-discovery.

This issue may be somehow related to #875.

Expected Behavior

Typedoc should use plugin array provided in the configuration file, and eventually merge it with the one provided by CLI arguments

Actual Behavior

Typedoc does not use the plugin option from the config file, and uses only NPM auto-discovery or the --plugin CLI argument

Steps to reproduce the bug

Install any typedoc plugin. From the installed plugin, remove the keyword typedocplugin from the keywords of the installed package.json, thus disabling npm auto-discovery.

Create a typedoc.json file

{
    "mode": "file",
    "out": "docs",
    "plugin": ["my-typedoc-plugin"]
}

Run typedoc:

npx typedoc --options typedoc.json

Environment

  • Typedoc version: 0.14.2
  • Node.js version: 11.3.0
  • OS: Win10 x64

What I've tried

As far as I've seen and experimented, the problem is here:

this.plugins.load();
return this.options.read(this.options.getRawValues(), OptionsReadMode.Fetch);

If I replace those lines with the following, the plugin is called correctly, but I didn't checked for side effects:

const optionsRead = this.options.read(this.options.getRawValues(), OptionsReadMode.Fetch);
this.plugins.load(); 
return optionsRead;

So is it intentional that options are parsed after plugins load ?


Edit : after further checks, I saw that options declared by the plugin are not provided to it if I apply the solution mentioned above. So, maybe options should be parsed once before plugins load, stored somewhere as raw options, then use those raw options when a plugin declares them.

@GerkinDev GerkinDev added the bug label Apr 17, 2019
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Jan 12, 2020

Thank you for the detailed report! It informed my solution to the problem.

So, maybe options should be parsed once before plugins load, stored somewhere as raw options, then use those raw options when a plugin declares them.

This doesn't quite work, because we'd have to guess what type the options should be stored as. What does work though is parsing options, loading plugins, throwing away the parsed options, and re-parsing options :)

Fixed in v0.16.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants