mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-12 20:18:41 -09:00
Enhance plugin installation (#2440)
This commit is contained in:
parent
97308bd8e5
commit
3a3ee013f7
3 changed files with 14 additions and 8 deletions
|
|
@ -57,8 +57,7 @@ function updatePlugins({force = false} = {}) {
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
//eslint-disable-next-line no-console
|
//eslint-disable-next-line no-console
|
||||||
console.error(err.stack);
|
notify('Error updating plugins.', err);
|
||||||
notify('Error updating plugins.', err.message);
|
|
||||||
} else {
|
} else {
|
||||||
// flag successful plugin update
|
// flag successful plugin update
|
||||||
cache.set('hyper.plugins', id_);
|
cache.set('hyper.plugins', id_);
|
||||||
|
|
@ -135,7 +134,7 @@ if (cache.get('hyper.plugins') !== id || process.env.HYPER_FORCE_UPDATE) {
|
||||||
console.log('plugins have changed / not init, scheduling plugins installation');
|
console.log('plugins have changed / not init, scheduling plugins installation');
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
updatePlugins();
|
updatePlugins();
|
||||||
}, 5000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
// otherwise update plugins every 5 hours
|
// otherwise update plugins every 5 hours
|
||||||
|
|
@ -243,9 +242,14 @@ function requirePlugins() {
|
||||||
|
|
||||||
return mod;
|
return mod;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
//eslint-disable-next-line no-console
|
if (err.code === 'MODULE_NOT_FOUND') {
|
||||||
console.error(err);
|
//eslint-disable-next-line no-console
|
||||||
notify('Plugin error!', `Plugin "${basename(path_)}" failed to load (${err.message})`);
|
console.warn(`Plugin "${basename(path_)}" not found: ${path_}`);
|
||||||
|
} else {
|
||||||
|
//eslint-disable-next-line no-console
|
||||||
|
console.error(err);
|
||||||
|
notify('Plugin error!', `Plugin "${basename(path_)}" failed to load (${err.message})`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,9 +25,9 @@ module.exports = {
|
||||||
timeout: ms('5m'),
|
timeout: ms('5m'),
|
||||||
maxBuffer: 1024 * 1024
|
maxBuffer: 1024 * 1024
|
||||||
},
|
},
|
||||||
err => {
|
(err, stdout, stderr) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
cb(err);
|
cb(stderr);
|
||||||
} else {
|
} else {
|
||||||
cb(null);
|
cb(null);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -123,8 +123,10 @@ const loadModules = () => {
|
||||||
reduceTermGroups: termGroupsReducers
|
reduceTermGroups: termGroupsReducers
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const loadedPlugins = plugins.getLoadedPluginVersions().map(plugin => plugin.name);
|
||||||
modules = paths.plugins
|
modules = paths.plugins
|
||||||
.concat(paths.localPlugins)
|
.concat(paths.localPlugins)
|
||||||
|
.filter(plugin => loadedPlugins.indexOf(plugin) !== -1)
|
||||||
.map(path => {
|
.map(path => {
|
||||||
let mod;
|
let mod;
|
||||||
const pluginName = getPluginName(path);
|
const pluginName = getPluginName(path);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue