mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-01-20 11:38:57 +00:00
a803d4f646
Since we're now forcing users to rely on `npm` directly for updates, we can also get rid of plugin commands that attempt to install/update/remove using npm programatically and require users to use `npm` directly as well. This commit removes the following commands: - `plugins` - `plugin install` - `plugin update` - `plugin remove` Despite plugin related commands being removed, *the functionality that scans for plugins and registers them remains intact*.
40 lines
880 B
JavaScript
40 lines
880 B
JavaScript
(function() {
|
|
var Nplugm, _, capitano, nplugm, registerPlugin;
|
|
|
|
Nplugm = require('nplugm');
|
|
|
|
_ = require('lodash');
|
|
|
|
capitano = require('capitano');
|
|
|
|
nplugm = null;
|
|
|
|
registerPlugin = function(plugin) {
|
|
if (!_.isArray(plugin)) {
|
|
return capitano.command(plugin);
|
|
}
|
|
return _.each(plugin, capitano.command);
|
|
};
|
|
|
|
exports.register = function(prefix, callback) {
|
|
nplugm = new Nplugm(prefix);
|
|
return nplugm.list(function(error, plugins) {
|
|
var i, len, plugin;
|
|
if (error != null) {
|
|
return callback(error);
|
|
}
|
|
for (i = 0, len = plugins.length; i < len; i++) {
|
|
plugin = plugins[i];
|
|
try {
|
|
registerPlugin(nplugm.require(plugin));
|
|
} catch (_error) {
|
|
error = _error;
|
|
console.error(error.message);
|
|
}
|
|
}
|
|
return callback();
|
|
});
|
|
};
|
|
|
|
}).call(this);
|