From 25807120c7f29917f252687f6c1895c15f9c84c3 Mon Sep 17 00:00:00 2001 From: Pedro Nauck Date: Tue, 11 Sep 2018 02:33:31 -0300 Subject: [PATCH] feat: add native config for doczrc --- packages/docz-core/src/commands/args.ts | 5 +++++ packages/docz-core/src/states/config.ts | 2 ++ packages/docz-core/src/utils/load-config.ts | 1 + packages/docz/src/state.ts | 1 + 4 files changed, 9 insertions(+) diff --git a/packages/docz-core/src/commands/args.ts b/packages/docz-core/src/commands/args.ts index fc413487a..a84ec1afe 100644 --- a/packages/docz-core/src/commands/args.ts +++ b/packages/docz-core/src/commands/args.ts @@ -57,6 +57,7 @@ export interface Argv { websocketHost: string hotPort: number hotHost: string + native: boolean /* template args */ title: string description: string @@ -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), + }) } diff --git a/packages/docz-core/src/states/config.ts b/packages/docz-core/src/states/config.ts index d5fd29cf5..19746b5dc 100644 --- a/packages/docz-core/src/states/config.ts +++ b/packages/docz-core/src/states/config.ts @@ -16,6 +16,7 @@ interface Payload { themeConfig: ThemeConfig version: string | null repository: string | null + native: boolean } const getInitialConfig = (config: Config): Payload => { @@ -29,6 +30,7 @@ const getInitialConfig = (config: Config): Payload => { ordering: config.ordering, version: get(pkg, 'version'), repository: repoUrl, + native: config.native, } } diff --git a/packages/docz-core/src/utils/load-config.ts b/packages/docz-core/src/utils/load-config.ts index 3e396feab..18a39ba05 100644 --- a/packages/docz-core/src/utils/load-config.ts +++ b/packages/docz-core/src/utils/load-config.ts @@ -16,6 +16,7 @@ export const loadConfig = (args: Config): Config => { const config = load('docz', { ...args, hashRouter: false, + native: false, plugins: [], mdPlugins: [], hastPlugins: [], diff --git a/packages/docz/src/state.ts b/packages/docz/src/state.ts index ce8df65e6..73138486d 100644 --- a/packages/docz/src/state.ts +++ b/packages/docz/src/state.ts @@ -41,6 +41,7 @@ export interface Config { themeConfig: ThemeConfig version: string | null repository: string | null + native: boolean } type Import = () => Promise