Replace chokidar by fs.watch (#2217)

This commit is contained in:
CHaBou 2017-09-16 13:49:10 +02:00 committed by Guillermo Rauch
parent 97d1ae33d3
commit bd5b16c7da
3 changed files with 16 additions and 979 deletions

View file

@ -1,4 +1,4 @@
const chokidar = require('chokidar');
const fs = require('fs');
const notify = require('./notify');
const _import = require('./config/import');
const _openConfig = require('./config/open');
@ -6,9 +6,6 @@ const win = require('./config/windows');
const {cfgPath, cfgDir} = require('./config/paths');
const watchers = [];
// watch for changes on config every 2s on windows
// https://github.com/zeit/hyper/pull/1772
const watchCfg = process.platform === 'win32' ? {interval: 2000} : {};
let cfg = {};
let _watcher;
@ -17,7 +14,13 @@ const _watch = function () {
return _watcher;
}
_watcher = chokidar.watch(cfgPath, watchCfg);
if (process.platform === 'win32') {
// watch for changes on config every 2s on windows
// https://github.com/zeit/hyper/pull/1772
_watcher = fs.watchFile(cfgPath, {interval: 2000});
} else {
_watcher = fs.watch(cfgPath);
}
_watcher.on('change', () => {
cfg = _import();

View file

@ -12,7 +12,6 @@
"xo": false,
"dependencies": {
"async-retry": "1.1.3",
"chokidar": "1.7.0",
"color": "2.0.0",
"convert-css-color-name-to-hex": "0.1.1",
"default-shell": "1.0.1",
@ -21,6 +20,7 @@
"electron-squirrel-startup": "1.0.0",
"file-uri-to-path": "1.0.0",
"git-describe": "4.0.2",
"lodash": "4.17.4",
"mkdirp": "0.5.1",
"ms": "2.0.0",
"node-fetch": "1.7.2",

File diff suppressed because it is too large Load diff