mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-05 23:37:25 +00:00
add legacy-peer-deps flag on pi uninstall when using npm (#6604)
Some checks are pending
CI / build-check-test (push) Waiting to run
Some checks are pending
CI / build-check-test (push) Waiting to run
otherwise it would fail when there's conflicting peer dependencies in installed packages fixes: #6486
This commit is contained in:
parent
f8f75544b6
commit
b084d2fb39
2 changed files with 20 additions and 2 deletions
|
|
@ -1805,11 +1805,16 @@ export class DefaultPackageManager implements PackageManager {
|
|||
if (!existsSync(installRoot)) {
|
||||
return;
|
||||
}
|
||||
if (this.getPackageManagerName() === "bun") {
|
||||
const packageManagerName = this.getPackageManagerName();
|
||||
if (packageManagerName === "bun") {
|
||||
await this.runNpmCommand(["uninstall", source.name, "--cwd", installRoot]);
|
||||
return;
|
||||
}
|
||||
await this.runNpmCommand(["uninstall", source.name, "--prefix", installRoot]);
|
||||
const args = ["uninstall", source.name, "--prefix", installRoot];
|
||||
if (packageManagerName !== "pnpm") {
|
||||
args.push("--legacy-peer-deps");
|
||||
}
|
||||
await this.runNpmCommand(args);
|
||||
}
|
||||
|
||||
private async installGit(source: GitSource, scope: SourceScope): Promise<void> {
|
||||
|
|
|
|||
|
|
@ -722,6 +722,19 @@ Content`,
|
|||
);
|
||||
});
|
||||
|
||||
it("should pass legacy peer deps when uninstalling npm packages", async () => {
|
||||
mkdirSync(join(agentDir, "npm"), { recursive: true });
|
||||
const runCommandSpy = vi.spyOn(packageManager as any, "runCommand").mockResolvedValue(undefined);
|
||||
|
||||
await packageManager.remove("npm:@scope/pkg");
|
||||
|
||||
expect(runCommandSpy).toHaveBeenCalledWith(
|
||||
"npm",
|
||||
["uninstall", "@scope/pkg", "--prefix", join(agentDir, "npm"), "--legacy-peer-deps"],
|
||||
undefined,
|
||||
);
|
||||
});
|
||||
|
||||
it("should use bun --cwd for npm package installs", async () => {
|
||||
settingsManager = SettingsManager.inMemory({
|
||||
npmCommand: ["mise", "exec", "bun@1", "--", "bun"],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue