修复pnpm版本兼容

This commit is contained in:
whyour 2022-05-29 01:50:05 +08:00
parent 8892e8833e
commit a5e8d5cb80
2 changed files with 14 additions and 10 deletions

View File

@ -13,6 +13,7 @@ import _ from 'lodash';
import { spawn } from 'child_process'; import { spawn } from 'child_process';
import SockService from './sock'; import SockService from './sock';
import { Op } from 'sequelize'; import { Op } from 'sequelize';
import { concurrentRun } from '../config/util';
@Service() @Service()
export default class DependenceService { export default class DependenceService {
@ -27,7 +28,7 @@ export default class DependenceService {
return tab; return tab;
}); });
const docs = await this.insert(tabs); const docs = await this.insert(tabs);
await this.installDependenceOneByOne(docs); this.installDependenceOneByOne(docs);
return docs; return docs;
} }
@ -47,7 +48,7 @@ export default class DependenceService {
status: DependenceStatus.installing, status: DependenceStatus.installing,
}); });
const newDoc = await this.updateDb(tab); const newDoc = await this.updateDb(tab);
await this.installDependenceOneByOne([newDoc]); this.installDependenceOneByOne([newDoc]);
return newDoc; return newDoc;
} }
@ -62,7 +63,7 @@ export default class DependenceService {
{ where: { id: ids } }, { where: { id: ids } },
); );
const docs = await DependenceModel.findAll({ where: { id: ids } }); const docs = await DependenceModel.findAll({ where: { id: ids } });
await this.installDependenceOneByOne(docs, false, force); this.installDependenceOneByOne(docs, false, force);
return docs; return docs;
} }
@ -98,16 +99,18 @@ export default class DependenceService {
} }
} }
private async installDependenceOneByOne( private installDependenceOneByOne(
docs: Dependence[], docs: Dependence[],
isInstall: boolean = true, isInstall: boolean = true,
force: boolean = false, force: boolean = false,
) { ) {
for (const dep of docs) { concurrentRun(
if (dep) { docs.map(
await this.installOrUninstallDependencies([dep], isInstall, force); (dep) => async () =>
} await this.installOrUninstallDependencies([dep], isInstall, force),
} ),
1,
);
} }
public async reInstall(ids: number[]): Promise<Dependence[]> { public async reInstall(ids: number[]): Promise<Dependence[]> {
@ -117,7 +120,7 @@ export default class DependenceService {
); );
const docs = await DependenceModel.findAll({ where: { id: ids } }); const docs = await DependenceModel.findAll({ where: { id: ids } });
await this.installDependenceOneByOne(docs); this.installDependenceOneByOne(docs);
return docs; return docs;
} }

View File

@ -305,6 +305,7 @@ patch_version() {
fi fi
# 兼容pnpm@7 # 兼容pnpm@7
npm i -g pnpm
pnpm setup pnpm setup
source ~/.bashrc source ~/.bashrc