-
-
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): wait for app to be ready before opening the browser
- Loading branch information
1 parent
777a396
commit c5cd14d
Showing
3 changed files
with
2,953 additions
and
202 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
13 changes: 11 additions & 2 deletions
13
core/docz-core/src/bundler/machine/services/exec-dev-command.ts
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,12 +1,21 @@ | ||
import spawn from 'cross-spawn' | ||
import sh from 'shelljs' | ||
|
||
import waitOn from 'wait-on' | ||
import { ServerMachineCtx } from '../context' | ||
import { openBrowser } from '../../../utils/open-browser' | ||
import * as paths from '../../../config/paths' | ||
|
||
export const execDevCommand = async ({ args }: ServerMachineCtx) => { | ||
sh.cd(paths.docz) | ||
spawn('yarn', ['dev', '--port', `${args.port}`], { stdio: 'inherit' }) | ||
openBrowser(`http://${args.host}:${args.port}`) | ||
const url = `http://${args.host}:${args.port}` | ||
console.log() | ||
console.log('Buiding app') | ||
await waitOn({ | ||
resources: [url], | ||
timeout: 30000, | ||
}) | ||
console.log() | ||
console.log('App ready on ' + url) | ||
openBrowser(url) | ||
} |
Oops, something went wrong.