Skip to content
This repository was archived by the owner on Jan 24, 2025. It is now read-only.

Commit 385b006

Browse files
committed
feat(docz-core): pass down cli args to Gatsby + fix open flag
1 parent 84bdae4 commit 385b006

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

core/docz-core/src/bundler/machine/services/exec-dev-command.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,10 @@ export const execDevCommand = async ({ args }: ServerMachineCtx) => {
3535
// For monorepos that install dependencies higher in the fs tree
3636
const repoRootPath = get(args, 'repoRootPath', await findRootPath())
3737
const gatsbyPath = path.join(repoRootPath, 'node_modules/.bin/gatsby')
38+
const cliArgs = process.argv.slice(3)
3839
spawn(
3940
gatsbyPath,
40-
['develop', '--host', `${args.host}`, '--port', `${args.port}`],
41+
['develop', '--host', `${args.host}`, '--port', `${args.port}`, ...cliArgs],
4142
{
4243
stdio: 'inherit',
4344
cwd: paths.docz,
@@ -52,5 +53,8 @@ export const execDevCommand = async ({ args }: ServerMachineCtx) => {
5253
})
5354
console.log()
5455
console.log('App ready on ' + url)
56+
if (args.open !== null && Boolean(args.open) === false) {
57+
return
58+
}
5559
openBrowser(url)
5660
}

core/docz-core/src/config/argv.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export interface Argv {
5959
port: number
6060
native: boolean
6161
notUseSpecifiers: boolean
62-
openBrowser: boolean
62+
open: null | boolean
6363
/* template args */
6464
title: string
6565
description: string
@@ -169,6 +169,6 @@ export const setArgs = (yargs: Yargs) => {
169169
alias: ['o', 'open'],
170170
describe: 'auto open browser in dev mode',
171171
type: 'boolean',
172-
default: false,
172+
default: null,
173173
})
174174
}

0 commit comments

Comments
 (0)