Docz: Allow `src` option to accept globs and array of paths

Created on 8 Aug 2018  路  11Comments  路  Source: doczjs/docz

It'd be great if I could pass a glob here, I have a monorepo and would like to tell docz to look in packages/src/* and include my root README.md (to avoid having to have two files for gitlab and for docz)

```js
module.exports = {
src: ["packages/src/*", "README.md"],
};

Most helpful comment

I'll release a new version next Monday that allow you to do this @wldcordeiro 馃檹

All 11 comments

I'll release a new version next Monday that allow you to do this @wldcordeiro 馃檹

Yup, that would make my life easier as well. :)

Released on the new v0.10.0 馃殌

@pedronauck I'm not sure how I would get this to work for my suggested use case above? I want readme.md to be included (to use as my index) and then the src/files pattern to go for packages/src/*

You can set an alias for your README from root and import it inside mdx

import Readme from '@root/readme'

## My Document

<Readme />

That seems like an extra step, why couldn't the suggested syntax for the option above work? It'd let me avoid making a new file.

The files property already accepts an array of globs, but by default, we put the readme.md as an ignored file to avoid automatically parsing to include default markdown files (ie, contributing, readme). You can resolve your markdown files by default as we took on the v0.10.0 but to be able to make this works we need to ignore default markdown files. So, I think that you can't escape from have a file to import your readme 馃槙

@pedronauck I think you could make the ignored defaults a little different and use a config value to make this work sort of like this.

const DEFAULT_IGNORE = ['!**/node_modules/**']

const DEFAULT_COMMON_MD = [
  'readme.md',
  'changelog.md',
  'code_of_conduct.md',
  'contributing.md',
  'license.md',
]

// pseudo-code here...
    const files = await glob<string>(toMatch(arr), {
    )
      ignore: [ ...DEFAULT_IGNORE, config.ignoreCommonMd ? ...DEFAULT_COMMON_MD : [] ].concat(ignore),
      onlyFiles: true,
      unique: true,
      nocase: true,
      matchBase: true,
    })

I am currently running 0.10.3 and when defining src : ['packages/src/*', '../../app/src'], I get an error telling me that the path must be a string. It says this was shipped in 0.10.0. Am I missing something?

I am currently running 0.10.3 and when defining src : ['packages/src/*', '../../app/src'], I get an error telling me that the path must be a string. It says this was shipped in 0.10.0. Am I missing something?

Same on 0.12.17

Same on 0.13.5. This should be reopen.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

brunolemos picture brunolemos  路  3Comments

hayk94 picture hayk94  路  3Comments

kachkaev picture kachkaev  路  3Comments

YardWill picture YardWill  路  3Comments

ssylvia picture ssylvia  路  3Comments