aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/plugins/yarn.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/plugins/yarn.ts')
-rw-r--r--server/lib/plugins/yarn.ts13
1 files changed, 8 insertions, 5 deletions
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 @@
1import { outputJSON, pathExists } from 'fs-extra'
2import { join } from 'path'
1import { execShell } from '../../helpers/core-utils' 3import { execShell } from '../../helpers/core-utils'
2import { logger } from '../../helpers/logger'
3import { isNpmPluginNameValid, isPluginVersionValid } from '../../helpers/custom-validators/plugins' 4import { isNpmPluginNameValid, isPluginVersionValid } from '../../helpers/custom-validators/plugins'
5import { logger } from '../../helpers/logger'
4import { CONFIG } from '../../initializers/config' 6import { CONFIG } from '../../initializers/config'
5import { outputJSON, pathExists } from 'fs-extra' 7import { getLatestPluginVersion } from './plugin-index'
6import { join } from 'path'
7 8
8async function installNpmPlugin (npmName: string, version?: string) { 9async function installNpmPlugin (npmName: string, versionArg?: string) {
9 // Security check 10 // Security check
10 checkNpmPluginNameOrThrow(npmName) 11 checkNpmPluginNameOrThrow(npmName)
11 if (version) checkPluginVersionOrThrow(version) 12 if (versionArg) checkPluginVersionOrThrow(versionArg)
13
14 const version = versionArg || await getLatestPluginVersion(npmName)
12 15
13 let toInstall = npmName 16 let toInstall = npmName
14 if (version) toInstall += `@${version}` 17 if (version) toInstall += `@${version}`