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

Trying to get README.md from monorepo in docz viewer #1549

Open eddysims opened 4 years ago

eddysims commented 4 years ago

Bug Report

I have a monorepo set up and I would like to have docz get mdx files from the packages inside of it.

doczrc

export default {
  ...,
  typescript: true,
  src: path.join(__dirname, "..", ".."),
  files: "{README.md,**/*.mdx}",
};

When running docz dev the build freezes and will not finish.

To Reproduce

This issue can be easily reproduced by using the monorepo example.

npx create-docz-app docz-app-monorepo-separate-docs --example monorepo-separate-docs

add to packages/docs/doczrc.js

export default {
    ...
    src: '../../',
}

the build freezes at:

```sh
⠦ source and transform nodes
⚠  warning   No cache was found with your props definitions
⚠  warning   We'll parse your components to get props from them
⠴ source and transform nodes
Fruitseller commented 4 years ago

Hey, our monorepo looks something like this

├── packages
│   ├── app
│   ├── components
│   ├── docz

And the doczrc.js file looks as follows

export default {
    ...,
    files: ['../components/src/**/*.{md,markdown,mdx}'],
    docgenConfig: {
        searchPatterns: ['../components/src/**/*.{ts,tsx,js}'],
    },

The docgenConfig entry is for the <Props/> Components so it finds the corresponding files.

eddysims commented 4 years ago

@Fruitseller if your monorepo looked like this

├── packages
│   ├── app
│   ├── components
│   ├── docz-theme
│   ├── docz
README.md

Are you able to get the README.md working? That is the issue im having. When i do something like this

files: ['../../README.md']

docz just continues to build over and over.

jasongaare commented 4 years ago

also using a monorepo...

docz just continues to build over and over.

this is the issue I am trying to solve. when running docz dev I get a continual build that loops over this about every 3 seconds:

[docz] success Checking for changed pages - 0.000s
[docz] success update schema - 0.014s
[docz] success onPreExtractQueries - 0.001s
[docz] success extract queries from components - 0.012s
[docz] success write out requires - 0.001s
[docz] success building schema - 0.127s
[docz] success createPages - 0.001s
eddysims commented 4 years ago

@jasongaare something that i think worked. I haven't fully tested it yet is moving my .md files into a docs directory at the root. My repo now looks something like this

├── packages
│   ├── app
│   ├── components
│   ├── docz-theme
│   ├── docz
├── docs
│   ├──README.md

and my doczrc.js looks something like this

{
...,
files: [
    ...,
    '../../docs/**/*.{md,mdx}'
]
}

Github will also allow this.

jasongaare commented 4 years ago

I think my issue is re: docgenConfig.searchPaths

// doczrc.js
export default {
  docgenConfig: {
    searchPatterns: [
      "../src/{mobile,shared}/**/*.{js,jsx}",
      "!**/node_modules",
      "!**/doczrc.js",
    ],
  },
};

when I comment out the searchPatterns then gatsby does not continually build, but as was mentioned about without that then the component doesn't render any types/props for components

The docgenConfig entry is for the Components so it finds the corresponding files.

sheedy commented 4 years ago

I have the same issue as @jasongaare.

This just loops and never stops

success building schema - 0.324s
success createPages - 0.033s
success Checking for changed pages - 0.009s
success update schema - 0.035s
success onPreExtractQueries - 0.005s
success extract queries from components - 0.038s
success write out requires - 0.006s

Using Docz 2.3.1 and NOT using TypeScript for any files. The docs kinda give the impression the props display only works if you're using TypeScript but not sure that is the case.

eddysims commented 4 years ago

@sheedy Im still getting the same issue, have you found any solution to this yet?

Fruitseller commented 4 years ago

@Fruitseller if your monorepo looked like this

├── packages
│   ├── app
│   ├── components
│   ├── docz-theme
│   ├── docz
README.md

Are you able to get the README.md working? That is the issue im having. When i do something like this

files: ['../../README.md']

docz just continues to build over and over.

Sorry for not responding. We do not have a root level README file so I can't help you with that.