Skip to content

Commit

Permalink
feat: adds theme path overrrite option
Browse files Browse the repository at this point in the history
  • Loading branch information
dangoo authored and rakannimer committed Sep 4, 2019
1 parent 9a0d2e5 commit bb62c6b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions core/docz-core/src/bundler/machine/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ const ensureFile = (filename: string, toDelete?: string) => {
}
}

export const ensureFiles = () => {
const themeDirs = glob.sync('src/gatsby-theme-**', {
export const ensureFiles = ({ args }: ServerMachineCtx) => {
const themeDirs = glob.sync(path.join(args.themesDir, '/gatsby-theme-**'), {
cwd: paths.docz,
onlyDirectories: true,
})
Expand Down
5 changes: 4 additions & 1 deletion core/docz-core/src/bundler/machine/services/watch-files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ import { createWatcher } from '../../../states/config'
import { ServerMachineCtx as Context } from '../context'

const watchGatsbyThemeFiles = (args: Config) => {
const watcher = createWatcher('src/gatsby-theme-**/**/*', args)
const watcher = createWatcher(
path.join(args.themesDir, 'gatsby-theme-**/**/*'),
args
)
const copy = (filepath: string) => {
const src = path.resolve(paths.root, filepath)
const dest = path.resolve(paths.docz, filepath)
Expand Down
9 changes: 5 additions & 4 deletions core/docz-core/src/config/argv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,14 @@ export interface Argv {
}

export interface Config extends Argv {
paths: paths.Paths
plugins: Plugin[]
mdPlugins: any[]
docgenConfig: DocgenConfig
hastPlugins: any[]
mdPlugins: any[]
menu: Menu[]
paths: paths.Paths
plugins: Plugin[]
themeConfig: ThemeConfig
docgenConfig: DocgenConfig
themesDir: string
filterComponents: (files: string[]) => string[]
}

Expand Down
1 change: 1 addition & 0 deletions core/docz-core/src/config/docz.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { Plugin } from '../lib/Plugin'
const toOmit = ['_', '$0', 'version', 'help']
export const doczRcBaseConfig = {
themeConfig: {},
themesDir: 'src',
docgenConfig: {},
menu: [],
plugins: [],
Expand Down

0 comments on commit bb62c6b

Please sign in to comment.