Mariusz Nowak 2294a4b4cb refactor(CLI): Move lifecycles definition to commands schema
It's needed to be able to process commands as introduced by plugins without a need of processing Serverless instance
2021-03-24 11:50:24 +01:00

37 lines
749 B
JavaScript

'use strict';
const BbPromise = require('bluebird');
const cliCommandsSchema = require('../../cli/commands-schema');
const pluginUtils = require('./lib/utils');
class PluginList {
constructor(serverless, options) {
this.serverless = serverless;
this.options = options;
Object.assign(this, pluginUtils);
this.commands = {
plugin: {
commands: {
list: {
...cliCommandsSchema.get('plugin list'),
},
},
},
};
this.hooks = {
'plugin:list:list': () => BbPromise.bind(this).then(this.list),
};
}
list() {
return BbPromise.bind(this)
.then(this.getPlugins)
.then((plugins) => this.display(plugins));
}
}
module.exports = PluginList;