From 079ce552e3fce754152d399e6b501bcedc5916ac Mon Sep 17 00:00:00 2001 From: Tim Perry Date: Tue, 12 Dec 2017 17:28:18 +0100 Subject: [PATCH] *BREAKING*: Remove support for plugins entirely There are very few plugins in real-world use, we're not actively working on this at all, and the current approach won't work once we move to standalone node-less binary installation anyway. Change-Type: major --- README.md | 7 ------- lib/actions/help.coffee | 6 ------ lib/app.coffee | 18 +++++++----------- lib/utils/plugins.ts | 36 ------------------------------------ package.json | 1 - 5 files changed, 7 insertions(+), 61 deletions(-) delete mode 100644 lib/utils/plugins.ts diff --git a/README.md b/README.md index 002d6c89..156533b4 100644 --- a/README.md +++ b/README.md @@ -81,13 +81,6 @@ _(Typically useful, but not strictly required for all commands)_ Take a look at the full command documentation at [https://docs.resin.io/tools/cli/](https://docs.resin.io/tools/cli/#table-of-contents ), or by running `resin help`. ---- - -Plugins -------- - -The Resin CLI can be extended with plugins to automate laborious tasks and overall provide a better experience when working with Resin.io. Check the [plugin development tutorial](https://github.com/resin-io/resin-plugin-hello) to learn how to build your own! - FAQ --- diff --git a/lib/actions/help.coffee b/lib/actions/help.coffee index 45b69788..7a252909 100644 --- a/lib/actions/help.coffee +++ b/lib/actions/help.coffee @@ -55,8 +55,6 @@ general = (params, options, done) -> return command.hidden or command.isWildcard() groupedCommands = _.groupBy commands, (command) -> - if command.plugin - return 'plugins' if command.primary return 'primary' return 'secondary' @@ -64,10 +62,6 @@ general = (params, options, done) -> print(parse(groupedCommands.primary)) if options.verbose - if not _.isEmpty(groupedCommands.plugins) - console.log('\nInstalled plugins:\n') - print(parse(groupedCommands.plugins)) - console.log('\nAdditional commands:\n') print(parse(groupedCommands.secondary)) else diff --git a/lib/app.coffee b/lib/app.coffee index 66ae36ba..2ceb6421 100644 --- a/lib/app.coffee +++ b/lib/app.coffee @@ -74,7 +74,6 @@ resin = require('resin-sdk-preconfigured') actions = require('./actions') errors = require('./errors') events = require('./events') -plugins = require('./utils/plugins') update = require('./utils/update') # Assign bluebird as the global promise library @@ -209,15 +208,12 @@ capitano.command(actions.deploy) update.notify() -plugins.register(/^resin-plugin-(.+)$/).then -> - cli = capitano.parse(process.argv) - - runCommand = -> - if cli.global?.help - capitanoExecuteAsync(command: "help #{cli.command ? ''}") - else - capitanoExecuteAsync(cli) - - Promise.all([events.trackCommand(cli), runCommand()]) +cli = capitano.parse(process.argv) +runCommand = -> + if cli.global?.help + capitanoExecuteAsync(command: "help #{cli.command ? ''}") + else + capitanoExecuteAsync(cli) +Promise.all([events.trackCommand(cli), runCommand()]) .catch(errors.handle) diff --git a/lib/utils/plugins.ts b/lib/utils/plugins.ts deleted file mode 100644 index 2f981bbf..00000000 --- a/lib/utils/plugins.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* -Copyright 2016-2017 Resin.io - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -import nplugm = require('nplugm'); -import _ = require('lodash'); -import capitano = require('capitano'); -import patterns = require('./patterns'); - -export function register(regex: RegExp): Promise { - return nplugm - .list(regex) - .map(async function(plugin: any) { - const command = await import(plugin); - command.plugin = true; - if (!_.isArray(command)) { - return capitano.command(command); - } - return _.each(command, capitano.command); - }) - .catch((error: Error) => { - return patterns.printErrorMessage(error.message); - }); -} diff --git a/package.json b/package.json index f1e892d3..4fbccb4b 100644 --- a/package.json +++ b/package.json @@ -114,7 +114,6 @@ "moment": "^2.12.0", "mz": "^2.6.0", "node-cleanup": "^2.1.2", - "nplugm": "^3.0.0", "opn": "^5.1.0", "president": "^2.0.1", "prettyjson": "^1.1.3",