diff --git a/core/docz-core/src/bundler/machine/actions.ts b/core/docz-core/src/bundler/machine/actions.ts index 4e814db5b..03cd98b47 100644 --- a/core/docz-core/src/bundler/machine/actions.ts +++ b/core/docz-core/src/bundler/machine/actions.ts @@ -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, }) diff --git a/core/docz-core/src/bundler/machine/services/watch-files.ts b/core/docz-core/src/bundler/machine/services/watch-files.ts index a5dbbcc18..8725a8bc4 100644 --- a/core/docz-core/src/bundler/machine/services/watch-files.ts +++ b/core/docz-core/src/bundler/machine/services/watch-files.ts @@ -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) diff --git a/core/docz-core/src/config/argv.ts b/core/docz-core/src/config/argv.ts index 7a524371b..9e4aeab07 100644 --- a/core/docz-core/src/config/argv.ts +++ b/core/docz-core/src/config/argv.ts @@ -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[] } diff --git a/core/docz-core/src/config/docz.ts b/core/docz-core/src/config/docz.ts index 40fc784cc..75b310779 100644 --- a/core/docz-core/src/config/docz.ts +++ b/core/docz-core/src/config/docz.ts @@ -12,6 +12,7 @@ import { Plugin } from '../lib/Plugin' const toOmit = ['_', '$0', 'version', 'help'] export const doczRcBaseConfig = { themeConfig: {}, + themesDir: 'src', docgenConfig: {}, menu: [], plugins: [],