-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved import of open to top to make clear 3rd-party dependency
- Loading branch information
Showing
1 changed file
with
10 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,12 @@ | ||
#!/usr/bin/env node | ||
|
||
require('child_process').exec('http-server').stdout.on('data', async data => { | ||
console.log(data) | ||
if (data.includes('Starting up http-server')) // preview once (on 1st stdout msg) | ||
(await import('open')).default(`http://localhost:8080${ process.argv.includes('--debug') ? '?debug=all' : '' }`) | ||
}) | ||
(async () => { | ||
const open = (await import('open')).default | ||
|
||
require('child_process').exec('http-server').stdout.on('data', async data => { | ||
console.log(data) | ||
if (data.includes('Starting up http-server')) // preview once (on 1st stdout msg) | ||
open(`http://localhost:8080${process.argv.includes('--debug') ? '?debug=all' : ''}`) | ||
}) | ||
|
||
})() |