Skip to content

Commit

Permalink
Enable VFS watch by default (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
andersevenrud committed Apr 30, 2019
1 parent 3079ccf commit 93f0599
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
6 changes: 5 additions & 1 deletion src/adapters/vfs/system.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,11 @@ module.exports = (core) => {
}
}, mount.attributes.root);

const watch = chokidar.watch(dest, mount.attributes.chokidar || {});
const chokioptions = Object.assign({
ignoreInitial: true
}, mount.attributes.chokidar || {});

const watch = chokidar.watch(dest, chokioptions);
const restr = dest.replace(/\*\*/g, '([^/]*)');
const re = new RegExp(restr + '/(.*)');
const seg = matchSegments(mount.attributes.root)
Expand Down
8 changes: 5 additions & 3 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,19 +104,21 @@ const defaultConfiguration = {
},

vfs: {
watch: false,
watch: true,
root: path.join(process.cwd(), 'vfs'),

mountpoints: [{
name: 'osjs',
attributes: {
root: '{root}/dist',
readOnly: true
readOnly: true,
watch: true
}
}, {
name: 'home',
attributes: {
root: '{vfs}/{username}'
root: '{vfs}/{username}',
watch: true
}
}]
}
Expand Down
2 changes: 1 addition & 1 deletion src/filesystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ class Filesystem {
*/
watch(mountpoint) {
if (
!mountpoint.attributes.watch ||
mountpoint.attributes.watch !== true ||
this.core.config('vfs.watch') === false ||
!mountpoint.attributes.root
) {
Expand Down

0 comments on commit 93f0599

Please sign in to comment.