-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(docz-core): parse port when running serve
- Loading branch information
1 parent
2e6e7aa
commit 29d0edd
Showing
2 changed files
with
15 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,22 @@ | ||
import sh from 'shelljs' | ||
import { Arguments } from 'yargs' | ||
|
||
import * as paths from '../config/paths' | ||
import { spawnSync } from '../utils/spawn' | ||
import { parseConfig } from '../config/docz' | ||
|
||
export const serve = async () => { | ||
export const serve = async (args: Arguments<any>) => { | ||
const config = await parseConfig(args) | ||
const cliArgs = ['run', 'serve'] | ||
|
||
if (config.port) { | ||
cliArgs.push('--') | ||
// Append gatsby option `port`to CLI args | ||
// https://www.gatsbyjs.org/docs/cheat-sheet/#cheat_sheet-text | ||
cliArgs.push('--port') | ||
cliArgs.push(String(config.port)) | ||
} | ||
|
||
sh.cd(paths.docz) | ||
spawnSync('npm', cliArgs) | ||
} |