Skip to content

Commit

Permalink
feat(docz-core): pass down cli args to Gatsby + fix open flag
Browse files Browse the repository at this point in the history
  • Loading branch information
rakannimer committed Feb 7, 2020
1 parent 84bdae4 commit 385b006
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ export const execDevCommand = async ({ args }: ServerMachineCtx) => {
// For monorepos that install dependencies higher in the fs tree
const repoRootPath = get(args, 'repoRootPath', await findRootPath())
const gatsbyPath = path.join(repoRootPath, 'node_modules/.bin/gatsby')
const cliArgs = process.argv.slice(3)
spawn(
gatsbyPath,
['develop', '--host', `${args.host}`, '--port', `${args.port}`],
['develop', '--host', `${args.host}`, '--port', `${args.port}`, ...cliArgs],
{
stdio: 'inherit',
cwd: paths.docz,
Expand All @@ -52,5 +53,8 @@ export const execDevCommand = async ({ args }: ServerMachineCtx) => {
})
console.log()
console.log('App ready on ' + url)
if (args.open !== null && Boolean(args.open) === false) {
return
}
openBrowser(url)
}
4 changes: 2 additions & 2 deletions core/docz-core/src/config/argv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export interface Argv {
port: number
native: boolean
notUseSpecifiers: boolean
openBrowser: boolean
open: null | boolean
/* template args */
title: string
description: string
Expand Down Expand Up @@ -169,6 +169,6 @@ export const setArgs = (yargs: Yargs) => {
alias: ['o', 'open'],
describe: 'auto open browser in dev mode',
type: 'boolean',
default: false,
default: null,
})
}

0 comments on commit 385b006

Please sign in to comment.