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) {
|
||||
//eslint-disable-next-line no-console
|
||||
console.error(err.stack);
|
||||
notify('Error updating plugins.', err.message);
|
||||
notify('Error updating plugins.', err);
|
||||
} else {
|
||||
// flag successful plugin update
|
||||
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');
|
||||
setTimeout(() => {
|
||||
updatePlugins();
|
||||
}, 5000);
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
// otherwise update plugins every 5 hours
|
||||
|
|
@ -243,9 +242,14 @@ function requirePlugins() {
|
|||
|
||||
return mod;
|
||||
} catch (err) {
|
||||
//eslint-disable-next-line no-console
|
||||
console.error(err);
|
||||
notify('Plugin error!', `Plugin "${basename(path_)}" failed to load (${err.message})`);
|
||||
if (err.code === 'MODULE_NOT_FOUND') {
|
||||
//eslint-disable-next-line no-console
|
||||
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'),
|
||||
maxBuffer: 1024 * 1024
|
||||
},
|
||||
err => {
|
||||
(err, stdout, stderr) => {
|
||||
if (err) {
|
||||
cb(err);
|
||||
cb(stderr);
|
||||
} else {
|
||||
cb(null);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -123,8 +123,10 @@ const loadModules = () => {
|
|||
reduceTermGroups: termGroupsReducers
|
||||
};
|
||||
|
||||
const loadedPlugins = plugins.getLoadedPluginVersions().map(plugin => plugin.name);
|
||||
modules = paths.plugins
|
||||
.concat(paths.localPlugins)
|
||||
.filter(plugin => loadedPlugins.indexOf(plugin) !== -1)
|
||||
.map(path => {
|
||||
let mod;
|
||||
const pluginName = getPluginName(path);
|
||||
|
|
|
|||
Loading…
Reference in a new issue