clearer code in install command

Signed-off-by: Ainhoa Larumbe <ainhoaL@users.noreply.github.com>
This commit is contained in:
Ainhoa Larumbe
2021-12-20 16:03:06 +01:00
parent dfc1110dc4
commit e2f35adc7a
+3 -2
View File
@@ -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 <plugin-id> 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);
};