esdoc / esdoc-plugins

MIT License
139 stars 74 forks source link

Publish-html-plugin template not working with standard-plugin #68

Open Lenophie opened 6 years ago

Lenophie commented 6 years ago

Hello ! esdoc-standard-plugin isn't taking the template option into account the way the stand-alone esdoc-publish-html-plugin does. In fact, we can see in plugin.js that no option is passed to the plugin when using esdoc-standard-plugin :

class Plugin {
  onHandlePlugins(ev) {
    const option = ev.data.option || {};
    const plugins = [
      {name: 'esdoc-lint-plugin', option: option.lint},
      {name: 'esdoc-coverage-plugin', option: option.coverage},
      {name: 'esdoc-accessor-plugin', option: option.accessor},
      {name: 'esdoc-type-inference-plugin', option: option.typeInference},
      {name: 'esdoc-external-ecmascript-plugin'},
      {name: 'esdoc-brand-plugin', option: option.brand},
      {name: 'esdoc-undocumented-identifier-plugin', option: option.undocumentIdentifier},
      {name: 'esdoc-unexported-identifier-plugin', option: option.unexportedIdentifier},
      {name: 'esdoc-integrate-manual-plugin', option: option.manual},
      {name: 'esdoc-integrate-test-plugin', option: option.test},
      {name: 'esdoc-publish-html-plugin'}
    ];

    const existPluginNames = ev.data.plugins.map(plugin => plugin.name);
    for (const plugin of plugins) {
      if (existPluginNames.includes(plugin.name)) continue;
      if (plugin.option === undefined) delete plugin.option;
      ev.data.plugins.push(plugin);
    }
  }
}

module.exports = new Plugin();

I tried replacing the faulty line with {name: 'esdoc-publish-html-plugin', option: option.template} as a potential trivial fix that it didn't do the trick. (template isn't used)

Currently, I have to import the esdoc-publish-html-plugin separately but this implies minor incompatibility issues between the plugins (coverage rates not showing up in the Source page when using a template).

Thanks for helping !