mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-13 04:28: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 notify = require('./notify');
|
||||||
const _import = require('./config/import');
|
const _import = require('./config/import');
|
||||||
const _openConfig = require('./config/open');
|
const _openConfig = require('./config/open');
|
||||||
|
|
@ -6,9 +6,6 @@ const win = require('./config/windows');
|
||||||
const {cfgPath, cfgDir} = require('./config/paths');
|
const {cfgPath, cfgDir} = require('./config/paths');
|
||||||
|
|
||||||
const watchers = [];
|
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 cfg = {};
|
||||||
let _watcher;
|
let _watcher;
|
||||||
|
|
||||||
|
|
@ -17,19 +14,32 @@ const _watch = function() {
|
||||||
return _watcher;
|
return _watcher;
|
||||||
}
|
}
|
||||||
|
|
||||||
_watcher = chokidar.watch(cfgPath, watchCfg);
|
const onChange = () => {
|
||||||
|
|
||||||
_watcher.on('change', () => {
|
|
||||||
cfg = _import();
|
cfg = _import();
|
||||||
notify('Configuration updated', 'Hyper configuration reloaded!');
|
notify('Configuration updated', 'Hyper configuration reloaded!');
|
||||||
watchers.forEach(fn => fn());
|
watchers.forEach(fn => fn());
|
||||||
checkDeprecatedConfig();
|
checkDeprecatedConfig();
|
||||||
});
|
};
|
||||||
|
|
||||||
_watcher.on('error', error => {
|
if (process.platform === 'win32') {
|
||||||
//eslint-disable-next-line no-console
|
// watch for changes on config every 2s on windows
|
||||||
console.error('error watching config', error);
|
// 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 => {
|
exports.subscribe = fn => {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
"name": "hyper",
|
"name": "hyper",
|
||||||
"productName": "Hyper",
|
"productName": "Hyper",
|
||||||
"description": "A terminal built on web technologies",
|
"description": "A terminal built on web technologies",
|
||||||
"version": "1.4.4",
|
"version": "1.4.6",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Zeit, Inc.",
|
"name": "Zeit, Inc.",
|
||||||
|
|
@ -12,7 +12,6 @@
|
||||||
"xo": false,
|
"xo": false,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"async-retry": "1.1.3",
|
"async-retry": "1.1.3",
|
||||||
"chokidar": "1.7.0",
|
|
||||||
"color": "2.0.0",
|
"color": "2.0.0",
|
||||||
"convert-css-color-name-to-hex": "0.1.1",
|
"convert-css-color-name-to-hex": "0.1.1",
|
||||||
"default-shell": "1.0.1",
|
"default-shell": "1.0.1",
|
||||||
|
|
@ -21,6 +20,7 @@
|
||||||
"electron-squirrel-startup": "1.0.0",
|
"electron-squirrel-startup": "1.0.0",
|
||||||
"file-uri-to-path": "1.0.0",
|
"file-uri-to-path": "1.0.0",
|
||||||
"git-describe": "4.0.2",
|
"git-describe": "4.0.2",
|
||||||
|
"lodash": "4.17.4",
|
||||||
"mkdirp": "0.5.1",
|
"mkdirp": "0.5.1",
|
||||||
"ms": "2.0.0",
|
"ms": "2.0.0",
|
||||||
"node-fetch": "1.7.2",
|
"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