milesj / docusaurus-plugin-typedoc-api

Docusaurus plugin that provides source code API documentation powered by TypeDoc.
69 stars 25 forks source link

Weird issue with rendering categories (using `@category` tag) #122

Closed FC5570 closed 10 months ago

FC5570 commented 10 months ago

This is my config:

  plugins: [
    [
      'docusaurus-plugin-typedoc-api',
      {
        projectRoot: join(__dirname, '..', 'rewrite', 'src'),
        packages: [
          {
            path: '.',
            entry: 'index.ts'
          }
        ]
      },
    ],
  ],

The plugin with the above config works fine and logs that JSON is written to ./.docusaurus/api-typedoc-default.json.

However, when I visit /api I get a page not found error. After checking existing issues, I found that ./docusaurus/docusaurus-plugin-typedoc/packages-current.json is empty when entry is set to index.ts. If I change entry to / (and restart the server), the page is now created, and packages-current.json file is not empty, but there are no custom categories generated, only Classes & Interfaces.

However, if I change the entry to / while it was previously index.ts, while the server is running, everything renders fine, with custom categories being shown. This ofcourse changes when I restart the server (no custom categories displayed) Also, please note that custom categories are not shown in the sidebar, only Classes and Interfaces, while the main page shows custom categories (this is only when entry is changed to / when server is running with previous value as index.ts)

Apologies if you can't understand what I mean, as I am unable to describe this behavior properly.

milesj commented 10 months ago

@FC5570 What is in your index.ts file?

I've noticed that if the index is all re-exports, it doesn't work. If you add something like export type Test = true, and then the API works, then that's the problem.

FC5570 commented 10 months ago

That was it, thank you @milesj.

Also, any solution to the sidebar issue? #48 is closed as completed, but I still get this issue.

FC5570 commented 10 months ago

Categories are displayed in the sidebar with the @group tag. Thank you.