Allow pnpm source updates to build OpenClaw (#81294) · openclaw/openclaw@ce31fc9
fuller-stack
·
2026-05-13
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -69,6 +69,7 @@ Docs: https://docs.openclaw.ai
|
69 | 69 | - Agents: rewrite generic provider internal errors with support request IDs into user-friendly transient error copy. (#49401) Thanks @y471823206. |
70 | 70 | - WhatsApp: finish handling pending debounced inbound messages before closing the socket. (#81246) Thanks @mcaxtr. |
71 | 71 | - CLI/commitments: write `--json` output to stdout instead of diagnostic logs so automation can parse commitment list and dismiss results. (#81215) Thanks @giodl73-repo. |
| 72 | +- Update: allow pnpm GitHub-source OpenClaw updates to approve the OpenClaw package build, so source installs complete their prepare/prepack lifecycle. (#81294) Thanks @fuller-stack-dev. |
72 | 73 | |
73 | 74 | ### Changes |
74 | 75 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -570,6 +570,22 @@ describe("update global helpers", () => {
|
570 | 570 | "-g", |
571 | 571 | "openclaw@latest", |
572 | 572 | ]); |
| 573 | +expect(globalInstallArgs("pnpm", "github:openclaw/openclaw#release/2026.5.12")).toEqual([ |
| 574 | +"pnpm", |
| 575 | +"add", |
| 576 | +"-g", |
| 577 | +"--allow-build=openclaw", |
| 578 | +"github:openclaw/openclaw#release/2026.5.12", |
| 579 | +]); |
| 580 | +expect( |
| 581 | +globalInstallArgs("pnpm", "openclaw@git+https://github.com/openclaw/openclaw.git"), |
| 582 | +).toEqual([ |
| 583 | +"pnpm", |
| 584 | +"add", |
| 585 | +"-g", |
| 586 | +"--allow-build=openclaw", |
| 587 | +"openclaw@git+https://github.com/openclaw/openclaw.git", |
| 588 | +]); |
573 | 589 | expect(globalInstallArgs("bun", "openclaw@latest")).toEqual([ |
574 | 590 | "bun", |
575 | 591 | "add", |
@@ -599,6 +615,22 @@ describe("update global helpers", () => {
|
599 | 615 | "/opt/pnpm-global", |
600 | 616 | "openclaw@latest", |
601 | 617 | ]); |
| 618 | +expect( |
| 619 | +globalInstallArgs( |
| 620 | +"pnpm", |
| 621 | +"github:openclaw/openclaw#release/2026.5.12", |
| 622 | +null, |
| 623 | +"/opt/pnpm-global", |
| 624 | +), |
| 625 | +).toEqual([ |
| 626 | +"pnpm", |
| 627 | +"add", |
| 628 | +"-g", |
| 629 | +"--global-dir", |
| 630 | +"/opt/pnpm-global", |
| 631 | +"--allow-build=openclaw", |
| 632 | +"github:openclaw/openclaw#release/2026.5.12", |
| 633 | +]); |
602 | 634 | }); |
603 | 635 | |
604 | 636 | it("builds npm staged install argv with an explicit prefix", () => { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -46,6 +46,7 @@ const NPM_GLOBAL_INSTALL_OMIT_OPTIONAL_FLAGS = [
|
46 | 46 | "--omit=optional", |
47 | 47 | ...NPM_GLOBAL_INSTALL_QUIET_FLAGS, |
48 | 48 | ] as const; |
| 49 | +const PNPM_OPENCLAW_BUILD_ALLOWLIST_FLAG = `--allow-build=${PRIMARY_PACKAGE_NAME}`; |
49 | 50 | const FIRST_PACKAGED_DIST_INVENTORY_VERSION = { major: 2026, minor: 4, patch: 15 }; |
50 | 51 | const OMITTED_PRIVATE_QA_BUNDLED_PLUGIN_ROOTS = new Set([ |
51 | 52 | "dist/extensions/qa-channel", |
@@ -87,6 +88,21 @@ export function isExplicitPackageInstallSpec(value: string): boolean {
|
87 | 88 | ); |
88 | 89 | } |
89 | 90 | |
| 91 | +function stripPrimaryPackageAlias(spec: string): string { |
| 92 | +const normalized = normalizePackageTarget(spec); |
| 93 | +const prefix = `${PRIMARY_PACKAGE_NAME}@`; |
| 94 | +return normalized.startsWith(prefix) ? normalized.slice(prefix.length).trim() : normalized; |
| 95 | +} |
| 96 | + |
| 97 | +function isPnpmOpenClawSourceInstallSpec(spec: string): boolean { |
| 98 | +const target = stripPrimaryPackageAlias(spec); |
| 99 | +return ( |
| 100 | +/^github:/i.test(target) || |
| 101 | +/^git\+(?:ssh|https|http|file):/i.test(target) || |
| 102 | +/^git:/i.test(target) |
| 103 | +); |
| 104 | +} |
| 105 | + |
90 | 106 | export function resolveExpectedInstalledVersionFromSpec( |
91 | 107 | packageName: string, |
92 | 108 | spec: string, |
@@ -715,6 +731,7 @@ export function globalInstallArgs(
|
715 | 731 | "add", |
716 | 732 | "-g", |
717 | 733 | ...(installPrefix ? ["--global-dir", installPrefix] : []), |
| 734 | + ...(isPnpmOpenClawSourceInstallSpec(spec) ? [PNPM_OPENCLAW_BUILD_ALLOWLIST_FLAG] : []), |
718 | 735 | spec, |
719 | 736 | ]; |
720 | 737 | } |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。