mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-18 04:31:10 +00:00
fix(build): honor postinstall disable flag
This commit is contained in:
@@ -154,6 +154,9 @@ export function runBundledPluginPostinstall(params = {}) {
|
||||
const spawn = params.spawnSync ?? spawnSync;
|
||||
const pathExists = params.existsSync ?? existsSync;
|
||||
const log = params.log ?? console;
|
||||
if (env?.[DISABLE_POSTINSTALL_ENV]?.trim()) {
|
||||
return;
|
||||
}
|
||||
if (isSourceCheckoutRoot({ packageRoot, existsSync: pathExists })) {
|
||||
try {
|
||||
pruneBundledPluginSourceNodeModules({
|
||||
|
||||
@@ -157,6 +157,23 @@ describe("bundled plugin postinstall", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("honors disable env before source-checkout pruning", async () => {
|
||||
const packageRoot = await createTempDirAsync("openclaw-source-checkout-disabled-");
|
||||
const extensionsDir = path.join(packageRoot, "extensions");
|
||||
await fs.mkdir(path.join(packageRoot, ".git"), { recursive: true });
|
||||
await fs.mkdir(path.join(packageRoot, "src"), { recursive: true });
|
||||
await fs.mkdir(path.join(extensionsDir, "acpx", "node_modules"), { recursive: true });
|
||||
await fs.writeFile(path.join(extensionsDir, "acpx", "package.json"), "{}\n");
|
||||
|
||||
runBundledPluginPostinstall({
|
||||
env: { OPENCLAW_DISABLE_BUNDLED_PLUGIN_POSTINSTALL: "1" },
|
||||
packageRoot,
|
||||
log: { log: vi.fn(), warn: vi.fn() },
|
||||
});
|
||||
|
||||
await expect(fs.stat(path.join(extensionsDir, "acpx", "node_modules"))).resolves.toBeTruthy();
|
||||
});
|
||||
|
||||
it("runs nested local installs with sanitized env when the sentinel package is missing", async () => {
|
||||
const extensionsDir = await createExtensionsDir();
|
||||
const packageRoot = path.dirname(path.dirname(extensionsDir));
|
||||
|
||||
Reference in New Issue
Block a user