Skip to content

Commit

Permalink
fix(docz-core): add ignore md files by args
Browse files Browse the repository at this point in the history
  • Loading branch information
pedronauck committed Nov 15, 2018
1 parent a637c10 commit d8c8045
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
13 changes: 1 addition & 12 deletions packages/docz-core/src/Entries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,6 @@ import { Plugin } from './Plugin'
import { Config } from './commands/args'
import { getRepoEditUrl } from './utils/repo-info'

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

const ignoreFiles = (arr: string[]) =>
['!**/node_modules/**'].concat(arr.length > 0 ? arr : DEFAULT_IGNORE)

export const fromTemplates = (file: string) => path.join(paths.templates, file)

const matchFilesWithSrc = (config: Config) => (files: string[]) => {
Expand Down Expand Up @@ -85,7 +74,7 @@ export class Entries {
const toMatch = matchFilesWithSrc(config)

const files = await glob<string>(toMatch(arr), {
ignore: ignoreFiles(ignore),
ignore: ['**/node_modules/**'].concat(ignore),
onlyFiles: true,
unique: true,
nocase: true,
Expand Down
8 changes: 7 additions & 1 deletion packages/docz-core/src/utils/load-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { omit } from './helpers'
import { BabelRC } from './babel-config'

const toOmit = ['_', '$0', 'version', 'help']

const defaultHtmlContext = {
lang: 'en',
}
Expand All @@ -25,6 +24,13 @@ export const loadConfig = async (args: Config): Promise<Config> => {
themeConfig: {},
htmlContext: defaultHtmlContext,
menu: [],
ignore: [
'readme.md',
'changelog.md',
'code_of_conduct.md',
'contributing.md',
'license.md',
],
modifyBundlerConfig: (config: any) => config,
modifyBabelRc: (babelrc: BabelRC) => babelrc,
}
Expand Down

0 comments on commit d8c8045

Please sign in to comment.