Skip to content
This repository has been archived by the owner on May 3, 2022. It is now read-only.

Commit

Permalink
Merge branch 'gjuchault-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Apr 24, 2018
2 parents a15e72f + b586d46 commit c9123e5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ $ svr -i .cache -i public

## Tips

### Development Server
### Main file

This could be a good start point for a HTTP server:

Expand Down
12 changes: 8 additions & 4 deletions bin/watch/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const doRestart = ({
ignored,
sockets,
server,
filename,
filepath,
pkg,
pwd,
Expand All @@ -32,7 +33,6 @@ const doRestart = ({
watcher,
port
}) => {
const filename = path.basename(filepath)
const spinner = logRestart({ filename, forcing })
destroySockets(sockets)
server.close(
Expand Down Expand Up @@ -69,12 +69,13 @@ module.exports = ({
const toWatch = [].concat(watchFiles, pwd)
const watcher = watch(toWatch, watchConfig)

const restart = ({ forcing }) =>
const restart = ({ forcing, filename }) =>
doRestart({
watchFiles,
ignored,
sockets,
server,
filename,
filepath,
pwd,
pkg,
Expand All @@ -85,8 +86,11 @@ module.exports = ({

watcher.once(
'all',
debounce((event, filename) => restart({ forcing: false })),
10
debounce(
(event, filename) =>
restart({ forcing: false, filename: path.relative(pwd, filename) }),
10
)
)

if (!firsTime) {
Expand Down

0 comments on commit c9123e5

Please sign in to comment.