From e2f35adc7acd719234f1e2d7beb40a19f7b5710a Mon Sep 17 00:00:00 2001 From: Ainhoa Larumbe Date: Mon, 20 Dec 2021 16:03:06 +0100 Subject: [PATCH] clearer code in install command Signed-off-by: Ainhoa Larumbe --- packages/cli/src/commands/install/install.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/cli/src/commands/install/install.ts b/packages/cli/src/commands/install/install.ts index f60201a174..bd3a05ebc1 100644 --- a/packages/cli/src/commands/install/install.ts +++ b/packages/cli/src/commands/install/install.ts @@ -155,12 +155,13 @@ async function loadPeerPluginDeps( } export default async (pluginId?: string, cmd?: Command) => { + const from = pluginId || cmd?.from; // TODO(himanshu): If no plugin id is provided, it should list all plugins available. Maybe in some other command? - if (!pluginId && !cmd?.from) { + if (!from) { throw new Error( 'Missing both or a package.json file path in the --from flag.', ); } - const pkg = await loadPackageJson(pluginId || cmd?.from); + const pkg = await loadPackageJson(from); await installPluginAndPeerPlugins(pkg); };