milesj / docusaurus-plugin-typedoc-api

Docusaurus plugin that provides source code API documentation powered by TypeDoc.
71 stars 26 forks source link

Multiple packages not working #15

Closed Brendonovich closed 3 years ago

Brendonovich commented 3 years ago

I've been trying to get this plugin working for my library simple-obs, and have only had moderate success. When specifying packages in the plugin's settings, putting only one of the two packages that are present in the monorepo will successfully generate API documentation for that package, but putting both packages results in no documentation being generated.

It appears that TypeDoc is analysing both packages successfully, since the generated JSON file contains information on both packages, but the plugin does not create the pages for the website. If you clone simple-obs, you should just be able to yarn and yarn start in the website directory and have the same results occur.

milesj commented 3 years ago

@Brendonovich I'm like 90% positive that you'll need to use TS project references for this to work correctly for monorepos/multiple packages.

But I'll clone it out and take a look.

Brendonovich commented 3 years ago

@milesj Oh interesting, can't say I'm familiar with TS project references but I'll check it out. Thanks for the heads up!

Brendonovich commented 3 years ago

I've spent some time integrating beemo and packemon & using TS project references like in boost, but it's still not working. Not sure what's going on.

milesj commented 3 years ago

@Brendonovich Well Beemo/Packemon aren't necessary for this. However, looking at your commit, the code is still not correct, since tsconfig.docs.json isnt setup to use project refs, and thats what docusaurus is referencing.

Brendonovich commented 3 years ago

I considered switching to Beemo before since GiraphQL uses it, but only did it now since I'm trying to make my repo similar to Boost's. I'm not quite sure how I would make tsconfig.docs.json use project refs, since its essentially identical to Boost's one, with the packages included rather than referenced. Adding the two packages to tsconfg.docs.json as references also doesn't fix it. I'm probably missing something crucial, but this seems quite weird

milesj commented 3 years ago

@Brendonovich Can the tsconfigName point to tsconfig.json now? Since that has the refs in it.

Brendonovich commented 3 years ago

Same issue, works when I specify one package but not both

milesj commented 3 years ago

Ok I know why it's not working, but I'm not sure of the cause. The problem is the "sources" path is different for your builds compared to mine. For example, mine includes "packages":

Screen Shot 2021-11-05 at 1 17 31 PM

While yours does not, which is causing the comparisons to fail:

Screen Shot 2021-11-05 at 1 17 38 PM

Let me dig further, but this seems to be on the TypeDoc side.

milesj commented 3 years ago

@Brendonovich I tried lot's of settings but nothing worked, so I went ahead and did this: https://github.com/milesj/docusaurus-plugin-typedoc-api/commit/88b29b5ca306d1da1f056d240ebab576b9d41465

This worked on your repo. Just update the dep and use tsconfig.json instead of tsconfig.docs.json.

Brendonovich commented 3 years ago

Works great now, thanks for all the work you've done to make this plugin!

milesj commented 3 years ago

No problem!