Skip to content

Commit

Permalink
chore(docz-core): add modifyBabelRc method as option on project confi…
Browse files Browse the repository at this point in the history
…guration
  • Loading branch information
pedronauck committed Jun 20, 2018
1 parent d2f92b7 commit b20c484
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions packages/docz-core/src/commands/args.ts
@@ -1,4 +1,5 @@
import { Plugin } from '../Plugin'
import { BabelRC } from '../utils/babelrc'

export interface Argv {
/* io args */
Expand Down Expand Up @@ -34,6 +35,7 @@ export interface Config extends Argv {
hastPlugins: any[]
themeConfig: ThemeConfig
modifyBundlerConfig<C>(config: C, dev: boolean): C
modifyBabelRc(babelrc: BabelRC): BabelRC
}

export const args = (yargs: any) => {
Expand Down
3 changes: 1 addition & 2 deletions packages/docz-core/src/utils/babelrc.ts
Expand Up @@ -23,6 +23,5 @@ export const babelrc = (args: Config): BabelRC => {
})

const reduce = Plugin.reduceFromPlugins<BabelRC>(args.plugins)

return reduce('modifyBabelRc', config)
return reduce('modifyBabelRc', args.modifyBabelRc(config))
}
2 changes: 2 additions & 0 deletions packages/docz-core/src/utils/load-config.ts
Expand Up @@ -4,6 +4,7 @@ import * as paths from '../config/paths'
import { Config } from '../commands/args'
import { Plugin } from '../Plugin'
import { omit } from './helpers'
import { BabelRC } from './babelrc'

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

Expand All @@ -17,6 +18,7 @@ export const loadConfig = (args: Config): Config => {
hastPlugins: [],
themeConfig: {},
modifyBundlerConfig: (config: any) => config,
modifyBabelRc: (babelrc: BabelRC) => babelrc,
})

const reduce = Plugin.reduceFromPlugins<Config>(config.plugins)
Expand Down

0 comments on commit b20c484

Please sign in to comment.