Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Watch Inclusions #2675

Open
Metaxona opened this issue Aug 19, 2024 · 6 comments
Open

Watch Inclusions #2675

Metaxona opened this issue Aug 19, 2024 · 6 comments
Labels
bug Functionality does not match expectation

Comments

@Metaxona
Copy link

Search terms

Watch

Expected Behavior

I expected watch to watch the files changes on

  • typedoc.json
  • config.projectDocuments files
  • readme -> when not none

Actual Behavior

changes made to the said files included above does not re-execute the build unless i quit watch mode and re-execute the command again

Steps to reproduce the bug

if this is not a normal behavior tag me on this issue so i can provide a repo that recreates this bug, if this is the normal behavior
converting this to a feature request would be the next choice

Environment

  • Typedoc version: ^0.26.5
  • TypeScript version: ^5.5.4
  • Node.js version: v20.11.0
  • OS: Ubuntu 22.04.4 LTS x86 (Specifics: Ubuntu Server)
@Metaxona Metaxona added the bug Functionality does not match expectation label Aug 19, 2024
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Aug 19, 2024

This is expected as watch mode just uses typescript's watch with a hook to generate docs, there isn't any support for watching other changes. This is essentially the same limitation as what is preventing #1772

@Metaxona
Copy link
Author

so currently there is no way to solve it?

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Aug 20, 2024

Correct, it isn't supported yet

@pjeby
Copy link

pjeby commented Dec 7, 2024

For anyone encountering this issue, you can work around it using the onchange package from npm, and a build script like this:

"watch-docs": "onchange --await-write-finish 3000 -i --kill \"*.md\"  \"guides/**/*.md\" \"typedoc.config.*\" \"typedoc/*\" -- typedoc --watch",

Of course you need to change the patterns and command line to something that makes sense for your project. (e.g. the typedoc/* part is to catch changes to my custom CSS, and you might not even have such a directory.)

The --await-write-finish bit says to wait 3 seconds after a change to these files to make sure you're not changing something else, to avoid continually killing and restarting the process (e.g. if you have a build step that writes to your .md files or custom.css.)

@shawninder
Copy link

If this isn't fixable, maybe a quick note about it in the docs would help?

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Dec 18, 2024

There is a note - https://typedoc.org/documents/Options.Other.html#watch

Note: This mode will only detect changes to files watched by the TypeScript compiler. Changes to other files (README.md, imported files with @include or @includeCode) will not cause a rebuild.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Functionality does not match expectation
Projects
None yet
Development

No branches or pull requests

4 participants