denoland / deno_doc

Documentation generator for Deno
MIT License
253 stars 54 forks source link

Doesn't work with multiple files like the example in the web docs. #587

Closed VentGrey closed 1 month ago

VentGrey commented 3 months ago

The website that shows basic usage for deno doc shows the following example:

$ deno doc --html --name="My library" ./sub1/mod.ts ./sub2/mod.ts

Which “supposedly” generates the HTML documentation for such two mod files. This doesn't happen when using the following command:

This is better shown using the --lint flag if your library is not 100% documented:

Single file usage

Task lint-docs deno doc --html --lint --name=SLSy --output=./docs ./lib/mod.ts
error[private-type-ref]: public type 'Slsy.prototype.slsy' references private type 'Request'
  --> ./lib/mod.ts:77:5
   | 
77 |     public slsy(request: Request, response: Response): Response {
   |     ^
   = hint: make the referenced type public or remove the reference
   | 
38 | export class Request {
   | - this is the referenced type

  info: to ensure documentation is complete all types that are exposed in the public API must be public

error[private-type-ref]: public type 'Slsy.prototype.slsy' references private type 'Response'
   --> ./lib/mod.ts:77:5
    | 
 77 |     public slsy(request: Request, response: Response): Response {
    |     ^
    = hint: make the referenced type public or remove the reference
    | 
113 | export class Response {
    | - this is the referenced type

  info: to ensure documentation is complete all types that are exposed in the public API must be public

error: Found 2 documentation lint errors.

Multi file usage

Here Deno just goes blind:

Task lint-docs deno doc --html --lint --name=SLSy --output=./docs ./lib/mod.ts ./types/mod.ts
Written 70 files to "./docs"

I also noticed running the command multiple times results in different results without touching code at all. Here's a screenshot for proof:

I modified my deno.json to print the time when the commands were excecuted:

Captura de pantalla de 2024-05-26 19-06-43-obfuscated

I checked this with the following variations:

System information

I read some issues here but couldn't find something similar. I did not read all issues though.

Any ideas on how to fix this? :thinking:

VentGrey commented 3 months ago

Update:

I suspected this was due to my library desing where lib/ and types/ were in the same level. After adjusting it to lib/ and lib/types/ the reproducibility error is still present.