doczjs / docz

✍ It has never been so easy to document your things!
https://docz.site
MIT License
23.6k stars 1.46k forks source link

Switching git branches breaks docz dev process #1615

Open vimkin opened 3 years ago

vimkin commented 3 years ago

Bug Report

Describe the bug

Whenever I'm developing on the branch with different *.mdx files and then switch to another branch docz dev process fails because some .mdx files are missing.

To Reproduce

It can be reproduced in an easier way than creating git branches and switching between them. Try to do the following steps:

  1. create-docz-app my-docz-app && cd my-docz-app
  2. Add test.mdx with basic content:
    
    ---
    name: Test
    ---

Test

3. Execute `yarn docz:dev` or `npm run docz:dev` depending on the preferred package manager
4. Now remove `test.mdx` file created earlier
5. Open `localhost:3000` in your browser

It should result in the failing page as well as a similar error message in the terminal:

```text
 ERROR #85913  GRAPHQL

There was a problem reading the file: path_to_somewhere/**/test.mdx

File: path_to_somewhere/**/test.mdx

Error: ENOENT: no such file or directory, open 'path_to_somewhere/**/test.mdx'

failed extract queries from components - 0.051s

Expected behavior

I expect docz to properly rebuild the folder on file change without any manual interaction and restarting docz dev command.

Environment