Skip to content

Commit

Permalink
feat: add native config for doczrc
Browse files Browse the repository at this point in the history
  • Loading branch information
pedronauck committed Sep 11, 2018
1 parent 7d7f557 commit 2580712
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/docz-core/src/commands/args.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export interface Argv {
websocketHost: string
hotPort: number
hotHost: string
native: boolean
/* template args */
title: string
description: string
Expand Down Expand Up @@ -172,4 +173,8 @@ export const args = (env: Env) => (yargs: any) => {
type: 'number',
default: getEnv('docz.websocket.port', 60505),
})
yargs.positional('native', {
type: 'boolean',
default: getEnv('docz.native', false),
})
}
2 changes: 2 additions & 0 deletions packages/docz-core/src/states/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ interface Payload {
themeConfig: ThemeConfig
version: string | null
repository: string | null
native: boolean
}

const getInitialConfig = (config: Config): Payload => {
Expand All @@ -29,6 +30,7 @@ const getInitialConfig = (config: Config): Payload => {
ordering: config.ordering,
version: get(pkg, 'version'),
repository: repoUrl,
native: config.native,
}
}

Expand Down
1 change: 1 addition & 0 deletions packages/docz-core/src/utils/load-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const loadConfig = (args: Config): Config => {
const config = load<Config>('docz', {
...args,
hashRouter: false,
native: false,
plugins: [],
mdPlugins: [],
hastPlugins: [],
Expand Down
1 change: 1 addition & 0 deletions packages/docz/src/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export interface Config {
themeConfig: ThemeConfig
version: string | null
repository: string | null
native: boolean
}

type Import = () => Promise<MSXImport>
Expand Down

0 comments on commit 2580712

Please sign in to comment.