feat: add option to autoinstall plugins on setup

This commit is contained in:
oplik0
2023-04-15 01:16:40 +02:00
committed by Julian Lam
parent ce05e743e0
commit 74cb224344
2 changed files with 14 additions and 2 deletions

View File

@@ -109,7 +109,7 @@ module.exports = function (Plugins) {
Plugins.isActive(id),
]);
const type = installed ? 'uninstall' : 'install';
if (active) {
if (active && !nconf.get('plugins:active')) {
await Plugins.toggleActive(id);
}
await runPackageManagerCommandAsync(type, id, version || 'latest');
@@ -121,7 +121,7 @@ module.exports = function (Plugins) {
function runPackageManagerCommand(command, pkgName, version, callback) {
cproc.execFile(packageManagerExecutable, [
packageManagerCommands[packageManager][command],
pkgName + (command === 'install' ? `@${version}` : ''),
pkgName + (command === 'install' && version ? `@${version}` : ''),
'--save',
], (err, stdout) => {
if (err) {