projects
/
oweals
/
peertube.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Litte SQL optimzation in videos list
[oweals/peertube.git]
/
server
/
lib
/
plugins
/
yarn.ts
diff --git
a/server/lib/plugins/yarn.ts
b/server/lib/plugins/yarn.ts
index 35fe1625f4808001f628456759f05d6c8225d751..e40351b6e3751cb20c40d086cd798ee1c098111a 100644
(file)
--- a/
server/lib/plugins/yarn.ts
+++ b/
server/lib/plugins/yarn.ts
@@
-5,13
+5,17
@@
import { CONFIG } from '../../initializers/config'
import { outputJSON, pathExists } from 'fs-extra'
import { join } from 'path'
import { outputJSON, pathExists } from 'fs-extra'
import { join } from 'path'
-async function installNpmPlugin (n
ame: string, version
: string) {
+async function installNpmPlugin (n
pmName: string, version?
: string) {
// Security check
// Security check
- checkNpmPluginNameOrThrow(name)
- checkPluginVersionOrThrow(version)
+ checkNpmPluginNameOrThrow(npmName)
+ if (version) checkPluginVersionOrThrow(version)
+
+ let toInstall = npmName
+ if (version) toInstall += `@${version}`
+
+ const { stdout } = await execYarn('add ' + toInstall)
- const toInstall = `${name}@${version}`
- await execYarn('add ' + toInstall)
+ logger.debug('Added a yarn package.', { yarnStdout: stdout })
}
async function installNpmPluginFromDisk (path: string) {
}
async function installNpmPluginFromDisk (path: string) {
@@
-44,7
+48,7
@@
async function execYarn (command: string) {
await outputJSON(pluginPackageJSON, {})
}
await outputJSON(pluginPackageJSON, {})
}
-
await
execShell(`yarn ${command}`, { cwd: pluginDirectory })
+
return
execShell(`yarn ${command}`, { cwd: pluginDirectory })
} catch (result) {
logger.error('Cannot exec yarn.', { command, err: result.err, stderr: result.stderr })
} catch (result) {
logger.error('Cannot exec yarn.', { command, err: result.err, stderr: result.stderr })