From 8280d0c22797c72978f698dc2deaa8ef569a9d15 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 12 Apr 2021 10:10:48 +0200 Subject: Ensure to install supported plugins --- server/lib/plugins/yarn.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'server/lib/plugins/yarn.ts') diff --git a/server/lib/plugins/yarn.ts b/server/lib/plugins/yarn.ts index e40351b6e..3f45681d3 100644 --- a/server/lib/plugins/yarn.ts +++ b/server/lib/plugins/yarn.ts @@ -1,14 +1,17 @@ +import { outputJSON, pathExists } from 'fs-extra' +import { join } from 'path' import { execShell } from '../../helpers/core-utils' -import { logger } from '../../helpers/logger' import { isNpmPluginNameValid, isPluginVersionValid } from '../../helpers/custom-validators/plugins' +import { logger } from '../../helpers/logger' import { CONFIG } from '../../initializers/config' -import { outputJSON, pathExists } from 'fs-extra' -import { join } from 'path' +import { getLatestPluginVersion } from './plugin-index' -async function installNpmPlugin (npmName: string, version?: string) { +async function installNpmPlugin (npmName: string, versionArg?: string) { // Security check checkNpmPluginNameOrThrow(npmName) - if (version) checkPluginVersionOrThrow(version) + if (versionArg) checkPluginVersionOrThrow(versionArg) + + const version = versionArg || await getLatestPluginVersion(npmName) let toInstall = npmName if (version) toInstall += `@${version}` -- cgit v1.2.3