提交 256066f9 编写于 作者: A Alex Ross

Fix preffered pm when pm can't be determined

上级 57ec1008
......@@ -51,7 +51,7 @@ const isNPMPreferred = (pkgPath: string) => {
};
export async function findPreferredPM(pkgPath: string): Promise<{ name: string, multiplePMDetected: boolean }> {
const detectedPackageManagers = [];
const detectedPackageManagers: string[] = [];
if (await isNPMPreferred(pkgPath)) {
detectedPackageManagers.push('npm');
......@@ -65,10 +65,10 @@ export async function findPreferredPM(pkgPath: string): Promise<{ name: string,
detectedPackageManagers.push('pnpm');
}
const { name: pmUsedForInstallation } = await whichPM(pkgPath);
const pmUsedForInstallation: { name: string } | null = await whichPM(pkgPath);
if (!detectedPackageManagers.includes(pmUsedForInstallation)) {
detectedPackageManagers.push(pmUsedForInstallation);
if (pmUsedForInstallation && !detectedPackageManagers.includes(pmUsedForInstallation.name)) {
detectedPackageManagers.push(pmUsedForInstallation.name);
}
const multiplePMDetected = detectedPackageManagers.length > 1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册