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

Allow custom chokidar watcher configuration #4055

Closed
Tracked by #4085
vjpr opened this issue Jan 18, 2021 · 3 comments
Closed
Tracked by #4085

Allow custom chokidar watcher configuration #4055

vjpr opened this issue Jan 18, 2021 · 3 comments
Labels
feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future.

Comments

@vjpr
Copy link

vjpr commented Jan 18, 2021

🚀 Feature

I want to be able to ignore docs from a plugin-content-docs plugin. Currently there is include option, but I would also like to be abled to modify chokidar's ignored setting. I would also like this to work with dot files which sometimes have difficulty with globbing.

A good task to knock off at the same time as: #4050


I would like to be able to use the function form, e.g:

ignored: (path) => path.includes('.dev'),
@vjpr vjpr added feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future. status: needs triage This issue has not been triaged by maintainers labels Jan 18, 2021
@slorber
Copy link
Collaborator

slorber commented Jan 21, 2021

What is the motivation for ignoring some files?

What's the problem with dotfiles and globbing?

What's your API suggestion?
What value would you pass exactly to this new API for your concrete use-case?

Should this be a site global API or something plugin-specific?

How do we add this setting without a breaking change?
Plugins have "getPathsToWatch", and it's not very suitable to introduce a way to ignore some of those files.
https://v2.docusaurus.io/docs/next/lifecycle-apis#getpathstowatch

I'd rather go with a global option, maybe just add a "chokidarConfig" to the docusaurus config, but not sure how convenient it would be for your usecase.

@vjpr
Copy link
Author

vjpr commented Jan 21, 2021

What is the motivation for ignoring some files?

Supporting a monorepo with multiple docs plugins.

Below is an example of my setup:

- .git
- tmp/logs
- .tmp/more-logs
- readme.md
- package.json
- docs <- docs for the monorepo
  - sidebar.js
  - readme.md 
- packages
  - docs-app
    - package.json
    - docusaurus.config.js 
  - pkg1
    - docs
      - sidebar.js
      - readme.md
  - pkg2
    - docs 

There are 3 docs plugins in use here. One for the monorepo root package, and two others for other packages.

For the monorepo root docs plugin I set the path to be the root rather than the docs folder. This allows me to include the readme.md file in my docs. Why do I do this? To make internal documentation easily viewable as a rendered website.

The great thing about this setup is that when I am developing anything in the monorepo, I run a single command to view all my documentation whether it be public or internal, and it will update in real-time. I think its a really cool use case. When developers are using third-party libraries we usually refer to rendered docs - so why should it be any different when we are developing locally. And it also makes it easy to update internal docs.

What's the problem with dotfiles and globbing?

If I store my main docusaurus package in packages/docs-app then all pathsToWatch are relative to here.

So pathsToWatch looks something like this:

- ../../*.md
- *.md
- ../pkg1/*.md
- ../pkg2/*.md

If you add an ignore such as !**/.git/** it will get concatenated with its relative path resulting in:

- ../../!**/.git/**

Which doesn't work.

For my use case I'd actually like to have full control over pathsToWatch so I can make it efficient and handle the case where some docs plugins are nested within others.

What's your API suggestion?

I'd rather go with a global option, maybe just add a "chokidarConfig" to the docusaurus config, but not sure how convenient it would be for your usecase.

A global option would be great. getChokidarConfig(config) => { return config }.

@vjpr vjpr changed the title Allow ignoring watch files in chokidar Allow custom chokidar watcher configuration Jan 21, 2021
@Josh-Cena Josh-Cena removed the status: needs triage This issue has not been triaged by maintainers label Oct 30, 2021
@Josh-Cena
Copy link
Collaborator

Hi, for now you can import markdown that is outside the plugin's include option. The include should always include all files that are actually meant to be rendered—no more and no less, so I think the default chokidar options should always make sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future.
Projects
None yet
Development

No branches or pull requests

3 participants