Comparing version 1.2.1 to 1.2.2
// Native | ||
const path = require('path') | ||
const debounce = require('debounce') | ||
@@ -79,3 +80,2 @@ // Packages | ||
ignoreInitial: true, | ||
cwd: process.cwd(), | ||
ignored: [ | ||
@@ -106,17 +106,20 @@ /\.git|node_modules|\.nyc_output|\.sass-cache|coverage/, | ||
// Ensure that the server gets restarted if a file changes | ||
watcher.on('all', (event, filePath) => { | ||
const location = path.relative(process.cwd(), filePath) | ||
watcher.on( | ||
'all', | ||
debounce((event, filePath) => { | ||
const location = path.relative(process.cwd(), filePath) | ||
console.log( | ||
`\n${chalk.blue('File changed:')} ${location} - Restarting server...` | ||
) | ||
console.log( | ||
`\n${chalk.blue('File changed:')} ${location} - Restarting server...` | ||
) | ||
destroySockets(sockets) | ||
destroySockets(sockets) | ||
// Ensure the same port when restarting server | ||
flags.port = details.port | ||
// Ensure the same port when restarting server | ||
flags.port = details.port | ||
// Restart server | ||
server.close(restartServer.bind(this, file, flags, watcher)) | ||
}) | ||
// Restart server | ||
server.close(restartServer.bind(this, file, flags, watcher)) | ||
}, 10) | ||
) | ||
} | ||
@@ -123,0 +126,0 @@ |
{ | ||
"name": "micro-dev", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"files": [ | ||
@@ -46,2 +46,3 @@ "bin", | ||
"clipboardy": "1.1.4", | ||
"debounce": "1.0.2", | ||
"get-port": "3.1.0", | ||
@@ -48,0 +49,0 @@ "ip": "1.1.5", |
15903
386
13
+ Addeddebounce@1.0.2
+ Addeddebounce@1.0.2(transitive)