mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-12 20:18:41 -09:00
Merge branch 'master' into v2
This commit is contained in:
commit
d6fc99e1d6
3 changed files with 31 additions and 987 deletions
|
|
@ -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,19 +14,32 @@ const _watch = function() {
|
|||
return _watcher;
|
||||
}
|
||||
|
||||
_watcher = chokidar.watch(cfgPath, watchCfg);
|
||||
|
||||
_watcher.on('change', () => {
|
||||
const onChange = () => {
|
||||
cfg = _import();
|
||||
notify('Configuration updated', 'Hyper configuration reloaded!');
|
||||
watchers.forEach(fn => fn());
|
||||
checkDeprecatedConfig();
|
||||
});
|
||||
};
|
||||
|
||||
_watcher.on('error', error => {
|
||||
//eslint-disable-next-line no-console
|
||||
console.error('error watching config', error);
|
||||
});
|
||||
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}, (curr, prev) => {
|
||||
if (curr.mtime === 0) {
|
||||
//eslint-disable-next-line no-console
|
||||
console.error('error watching config');
|
||||
} else if (curr.mtime !== prev.mtime) {
|
||||
onChange();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
_watcher = fs.watch(cfgPath);
|
||||
_watcher.on('change', onChange);
|
||||
_watcher.on('error', error => {
|
||||
//eslint-disable-next-line no-console
|
||||
console.error('error watching config', error);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
exports.subscribe = fn => {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"name": "hyper",
|
||||
"productName": "Hyper",
|
||||
"description": "A terminal built on web technologies",
|
||||
"version": "1.4.4",
|
||||
"version": "1.4.6",
|
||||
"license": "MIT",
|
||||
"author": {
|
||||
"name": "Zeit, Inc.",
|
||||
|
|
@ -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",
|
||||
|
|
|
|||
980
app/yarn.lock
980
app/yarn.lock
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue