Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip plugin installation if already installed #590

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/hooks/plugin-install.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const { logger } = require('@twilio/cli-core').services.logging;
const chalk = require('chalk');

const { isTwilioPlugin } = require('../services/plugins');
const { isTwilioPlugin, isPluginInstalled } = require('../services/plugins');

const AUTOCOMLETE_INSTALL_WARNING = `If you’re using autocomplete, you’ll need to run ${chalk.bold(
'twilio autocomplete',
Expand All @@ -10,6 +9,11 @@ const AUTOCOMLETE_INSTALL_WARNING = `If you’re using autocomplete, you’ll ne
module.exports = async function pluginInstall(options) {
logger.warn(chalk.yellowBright(`${AUTOCOMLETE_INSTALL_WARNING}`));

if (isPluginInstalled(this.config, options.plugin.name)) {
logger.info(`Plugin ${options.plugin.name} is already installed.`);
return;
}

if (!isTwilioPlugin(options.plugin.name)) {
logger.warn('WARNING!!! You are attempting to install a plugin from an untrusted source.');
logger.warn('It could contain malicious software or in other ways compromise your system.');
Expand Down