diff options
Diffstat (limited to 'server/lib/plugins/yarn.ts')
-rw-r--r-- | server/lib/plugins/yarn.ts | 13 |
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 @@ | |||
1 | import { outputJSON, pathExists } from 'fs-extra' | ||
2 | import { join } from 'path' | ||
1 | import { execShell } from '../../helpers/core-utils' | 3 | import { execShell } from '../../helpers/core-utils' |
2 | import { logger } from '../../helpers/logger' | ||
3 | import { isNpmPluginNameValid, isPluginVersionValid } from '../../helpers/custom-validators/plugins' | 4 | import { isNpmPluginNameValid, isPluginVersionValid } from '../../helpers/custom-validators/plugins' |
5 | import { logger } from '../../helpers/logger' | ||
4 | import { CONFIG } from '../../initializers/config' | 6 | import { CONFIG } from '../../initializers/config' |
5 | import { outputJSON, pathExists } from 'fs-extra' | 7 | import { getLatestPluginVersion } from './plugin-index' |
6 | import { join } from 'path' | ||
7 | 8 | ||
8 | async function installNpmPlugin (npmName: string, version?: string) { | 9 | async 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}` |