mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 17:20:45 +00:00
fix: tolerate pnpm-backed runtime dependency installs
This commit is contained in:
@@ -2,6 +2,8 @@ import fs from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import {
|
||||
createBundledRuntimeDependencyInstallArgs,
|
||||
createBundledRuntimeDependencyInstallEnv,
|
||||
createNestedNpmInstallEnv,
|
||||
pruneInstalledPackageDist,
|
||||
discoverBundledPluginRuntimeDeps,
|
||||
@@ -47,14 +49,7 @@ async function writePluginPackage(
|
||||
|
||||
describe("bundled plugin postinstall", () => {
|
||||
function createNpmInstallArgs(...packages: string[]) {
|
||||
return [
|
||||
"install",
|
||||
"--omit=dev",
|
||||
"--no-save",
|
||||
"--package-lock=false",
|
||||
"--legacy-peer-deps",
|
||||
...packages,
|
||||
];
|
||||
return createBundledRuntimeDependencyInstallArgs(packages);
|
||||
}
|
||||
|
||||
function createBareNpmRunner(packages: string[]) {
|
||||
@@ -122,6 +117,25 @@ describe("bundled plugin postinstall", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("uses package-manager-neutral runtime install args with npm config env", () => {
|
||||
expect(createBundledRuntimeDependencyInstallArgs(["acpx@0.4.1"])).toEqual([
|
||||
"install",
|
||||
"--ignore-scripts",
|
||||
"acpx@0.4.1",
|
||||
]);
|
||||
expect(
|
||||
createBundledRuntimeDependencyInstallEnv({
|
||||
HOME: "/tmp/home",
|
||||
npm_config_prefix: "/opt/homebrew",
|
||||
}),
|
||||
).toEqual({
|
||||
HOME: "/tmp/home",
|
||||
npm_config_legacy_peer_deps: "true",
|
||||
npm_config_package_lock: "false",
|
||||
npm_config_save: "false",
|
||||
});
|
||||
});
|
||||
|
||||
it("does not install bundled plugin deps outside of source checkouts by default", async () => {
|
||||
const extensionsDir = await createExtensionsDir();
|
||||
const packageRoot = path.dirname(path.dirname(extensionsDir));
|
||||
|
||||
Reference in New Issue
Block a user