Skip to content

[Bug]: Crash "Error: Could not set option "pluginPages:pages": Every root pages should set moduleRoot to true, or none" when pages is empty array #165

Closed

Description

@dzek69

Plugin

@knodes/typedoc-plugin-pages

Typedoc plugin(s) version(s)

@knodes/typedoc-plugin-pages@0.23.1

Typedoc version

0.23.10 (happens on 0.23.8 too)

Describe the problem

I'm running typedoc like that:
typedoc src/index.ts --out docs --includeVersion --pluginPages ./pagesconfig.json

and when pages property in my pages.config is empty, like that:

{
    "pages": [],
    "source": "tutorials"
}

This plugin crashes typedoc like that:

$ typedoc src/index.ts --out docs --includeVersion --pluginPages ./pagesconfig.json
Loaded plugin @knodes/typedoc-plugin-pages
TypeDoc exiting with unexpected error:
Error: Could not set option "pluginPages:pages": Every root pages should set `moduleRoot` to true, or none
    at /Projects/bottom-line/node_modules/@knodes/typedoc-pluginutils/dist/options/option-group.js:144:31
    at /Projects/bottom-line/node_modules/@knodes/typedoc-pluginutils/dist/options/option-group.js:160:34
    ... 2 lines matching cause stack trace ...
    at OptionGroup._setValue (/Projects/bottom-line/node_modules/@knodes/typedoc-pluginutils/dist/options/option-group.js:137:34)
    at OptionGroup._setValueFromFile (/Projects/bottom-line/node_modules/@knodes/typedoc-pluginutils/dist/options/option-group.js:118:18)
    at OptionGroup._setValue (/Projects/bottom-line/node_modules/@knodes/typedoc-pluginutils/dist/options/option-group.js:133:22)
    at /Projects/bottom-line/node_modules/@knodes/typedoc-pluginutils/dist/options/option-group.js:37:22
    at /Projects/bottom-line/node_modules/@knodes/typedoc-pluginutils/dist/events-extra.js:69:13
    at Options.instance.<computed> (/Projects/bottom-line/node_modules/@knodes/typedoc-pluginutils/dist/events-extra.js:102:29) {
  [cause]: AssertionError [ERR_ASSERTION]: Every root pages should set `moduleRoot` to true, or none
      at Object.validate (/Projects/bottom-line/node_modules/@knodes/typedoc-plugin-pages/dist/options/build.js:82:30)
      at Object.5 (/Projects/bottom-line/node_modules/typedoc/dist/lib/utils/options/declaration.js:146:26)
      at convert (/Projects/bottom-line/node_modules/typedoc/dist/lib/utils/options/declaration.js:184:60)
      at Options.setValue (/Projects/bottom-line/node_modules/typedoc/dist/lib/utils/options/options.js:167:53)
      at Option.setValue (/Projects/bottom-line/node_modules/@knodes/typedoc-pluginutils/dist/options/option.js:56:41)
      at /Projects/bottom-line/node_modules/@knodes/typedoc-pluginutils/dist/options/option-group.js:141:27
      at /Projects/bottom-line/node_modules/@knodes/typedoc-pluginutils/dist/options/option-group.js:160:34
      at Array.map (<anonymous>)
      at OptionGroup._mapOptions (/Projects/bottom-line/node_modules/@knodes/typedoc-pluginutils/dist/options/option-group.js:160:14)
      at OptionGroup._setValue (/Projects/bottom-line/node_modules/@knodes/typedoc-pluginutils/dist/options/option-group.js:137:34) {
    generatedMessage: false,
    code: 'ERR_ASSERTION',
    actual: 0,
    expected: 1,
    operator: '=='
  }
}
error Command failed with exit code 6.

What did you expected ?

I use a template for my libraries, I'm having empty pages array by default, with a plan to add some pages when they are ready (which usually don't happen too early in the stage of creating somthing).

I'd like this plugin just not to inject anything as a page when there is nothing defined and just silently continue the process of building the docs.

Activity

  1. GerkinDev commented on Aug 22, 2022

    @GerkinDev
    Member

    This issue has been spotted and is fixed in pending next version. Still working on it.

    In the meantime, I suggest you add a placeholder page.

  2. self-assigned this
    on Aug 22, 2022
  3. felix-hoc commented on Sep 28, 2022

    @felix-hoc

    Any update on this? 🙏🏼
    I'm running into the same issue, and due to a more complex typedoc setup it's not easily possible to add placeholder pages.

  4. GerkinDev commented on Oct 21, 2022

    @GerkinDev
    Member

    Unfortunately no. I'm still working on the next release, and I don't have the bandwidth to checkout and do a hotfix update. When I have time I prefer focus on new features that need to be finished and that will fix this by the way.

  5. added 3 commits that reference this issue on Apr 6, 2023
    9c3637c
    4b2d5ba
    dbd48be
  6. added a commit that references this issue on Apr 7, 2023
    582c2b9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions