修复设置 nodejs 镜像源

This commit is contained in:
whyour 2024-02-13 15:19:44 +08:00
parent b31eab02d7
commit 74916670eb

View File

@ -29,6 +29,7 @@ import tar from 'tar';
import path from 'path';
import fs from 'fs';
import sum from 'lodash/sum';
import { DependenceModel, DependenceStatus, DependenceTypes } from '../data/dependence';
@Service()
export default class SystemService {
@ -136,7 +137,13 @@ export default class SystemService {
if (info.nodeMirror) {
cmd = `pnpm config set registry ${info.nodeMirror}`;
}
const command = `cd && ${cmd} && pnpm i -g`;
let command = `cd && ${cmd}`;
const docs = await DependenceModel.findAll({
where: { type: DependenceTypes.nodejs, status: DependenceStatus.installed },
});
if (docs.length > 0) {
command += ` && pnpm i -g`;
}
this.scheduleService.runTask(
command,
{