This repository was archived by the owner on Jan 24, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -19,9 +19,9 @@ export const cli = () => {
1919 await commands . build ( args )
2020 process . exit ( )
2121 } )
22- . command ( 'serve' , 'serve dir as static site' , setArgs , async ( ) => {
22+ . command ( 'serve' , 'serve dir as static site' , setArgs , async args => {
2323 setEnv ( 'production' )
24- await commands . serve ( )
24+ await commands . serve ( args )
2525 process . exit ( )
2626 } )
2727 . demandCommand ( )
Original file line number Diff line number Diff line change 11import sh from 'shelljs'
2+ import { Arguments } from 'yargs'
23
34import * as paths from '../config/paths'
45import { spawnSync } from '../utils/spawn'
6+ import { parseConfig } from '../config/docz'
57
6- export const serve = async ( ) => {
8+ export const serve = async ( args : Arguments < any > ) => {
9+ const config = await parseConfig ( args )
710 const cliArgs = [ 'run' , 'serve' ]
11+
12+ if ( config . port ) {
13+ cliArgs . push ( '--' )
14+ // Append gatsby option `port`to CLI args
15+ // https://www.gatsbyjs.org/docs/cheat-sheet/#cheat_sheet-text
16+ cliArgs . push ( '--port' )
17+ cliArgs . push ( String ( config . port ) )
18+ }
19+
820 sh . cd ( paths . docz )
921 spawnSync ( 'npm' , cliArgs )
1022}
You can’t perform that action at this time.
0 commit comments