Some checks failed
ClawSweeper Dispatch / dispatch (push) Has been cancelled
CodeQL / Security High (actions) (push) Has been cancelled
CodeQL / Security High (channel-runtime-boundary) (push) Has been cancelled
CodeQL / Security High (core-auth-secrets) (push) Has been cancelled
CodeQL / Security High (mcp-process-tool-boundary) (push) Has been cancelled
CodeQL / Security High (network-ssrf-boundary) (push) Has been cancelled
CodeQL / Security High (plugin-trust-boundary) (push) Has been cancelled
CodeQL / Security High (process-exec-boundary) (push) Has been cancelled
Docs Sync Publish Repo / sync-publish-repo (push) Has been cancelled
Docs / docs (push) Has been cancelled
OpenClaw Stable Main Closeout / Resolve stable release closeout inputs (push) Has been cancelled
OpenClaw Stable Main Closeout / Verify stable main closeout (push) Has been cancelled
Workflow Sanity / no-tabs (push) Has been cancelled
Workflow Sanity / actionlint (push) Has been cancelled
Workflow Sanity / generated-doc-baselines (push) Has been cancelled
CI / runner-admission (push) Has been cancelled
CI / preflight (push) Has been cancelled
CI / security-fast (push) Has been cancelled
CI / pnpm-store-warmup (push) Has been cancelled
CI / build-artifacts (push) Has been cancelled
CI / native-i18n (push) Has been cancelled
CI / ${{ matrix.check_name }} (push) Has been cancelled
CI / ${{ matrix.checkName }} (push) Has been cancelled
CI / checks-node-compat-node22 (push) Has been cancelled
CI / check-bundled-channel-config-metadata (push) Has been cancelled
CI / check-dependencies (push) Has been cancelled
CI / check-guards (push) Has been cancelled
CI / check-lint (push) Has been cancelled
CI / check-prod-types (push) Has been cancelled
CI / check-shrinkwrap (push) Has been cancelled
CI / check-test-types (push) Has been cancelled
CI / check-additional-boundaries-a (push) Has been cancelled
CI / check-additional-boundaries-bcd (push) Has been cancelled
CI / check-additional-extension-bundled (push) Has been cancelled
CI / check-additional-extension-channels (push) Has been cancelled
CI / check-additional-extension-package-boundary (push) Has been cancelled
CI / check-additional-runtime-topology-architecture (push) Has been cancelled
CI / check-session-accessor-boundary (push) Has been cancelled
CI / check-session-transcript-reader-boundary (push) Has been cancelled
CI / check-docs (push) Has been cancelled
CI / skills-python (push) Has been cancelled
CI / macos-swift (push) Has been cancelled
CI / ios-build (push) Has been cancelled
CI / ci-timings-summary (push) Has been cancelled
Native App Locale Refresh / Refresh native fa (push) Has been cancelled
Native App Locale Refresh / Refresh native fr (push) Has been cancelled
Native App Locale Refresh / Refresh native hi (push) Has been cancelled
Native App Locale Refresh / Refresh native id (push) Has been cancelled
Native App Locale Refresh / Refresh native it (push) Has been cancelled
Native App Locale Refresh / Refresh native ja-JP (push) Has been cancelled
Control UI Locale Refresh / plan (push) Has been cancelled
Control UI Locale Refresh / Refresh ${{ matrix.locale }} (push) Has been cancelled
Control UI Locale Refresh / Commit control UI locale refresh (push) Has been cancelled
Live Media Runner Image / Build live media runner image (push) Has been cancelled
Native App Locale Refresh / Refresh native ar (push) Has been cancelled
Native App Locale Refresh / Refresh native de (push) Has been cancelled
Native App Locale Refresh / Refresh native es (push) Has been cancelled
Native App Locale Refresh / Refresh native ko (push) Has been cancelled
Native App Locale Refresh / Refresh native nl (push) Has been cancelled
Native App Locale Refresh / Refresh native pl (push) Has been cancelled
Native App Locale Refresh / Refresh native pt-BR (push) Has been cancelled
Native App Locale Refresh / Refresh native ru (push) Has been cancelled
Native App Locale Refresh / Refresh native sv (push) Has been cancelled
Native App Locale Refresh / Refresh native th (push) Has been cancelled
Native App Locale Refresh / Refresh native tr (push) Has been cancelled
Native App Locale Refresh / Refresh native uk (push) Has been cancelled
Native App Locale Refresh / Refresh native vi (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-CN (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-TW (push) Has been cancelled
Native App Locale Refresh / Commit native locale refresh (push) Has been cancelled
Plugin Init Scaffold Validation / Validate provider scaffold (push) Has been cancelled
Plugin NPM Release / preview_plugins_npm (push) Has been cancelled
Plugin NPM Release / Validate release publish approval (push) Has been cancelled
Plugin NPM Release / preview_plugin_pack (push) Has been cancelled
Plugin NPM Release / publish_plugins_npm (push) Has been cancelled
Sandbox Common Smoke / sandbox-common-smoke (push) Has been cancelled
Website Installer Sync / static (push) Has been cancelled
Website Installer Sync / linux-docker (push) Has been cancelled
Website Installer Sync / macos-installer (push) Has been cancelled
Website Installer Sync / windows-installer (push) Has been cancelled
Website Installer Sync / sync-website (push) Has been cancelled
Adolf is a fork/vendored clone of github.com/openclaw/openclaw (v2026.6.11), free to diverge. Tree copied sans upstream .git; upstream remote added for future syncs. Node pinned to 24 (.nvmrc); engines already require >=22.19. Preserves docs/ARCHITECTURE.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LeqyaxJF2nbRXJtae2kNB2
312 lines
9.5 KiB
TypeScript
312 lines
9.5 KiB
TypeScript
// List Prod Store Packages tests cover list prod store packages script behavior.
|
|
import { spawnSync } from "node:child_process";
|
|
import { mkdirSync, writeFileSync } from "node:fs";
|
|
import { join, resolve } from "node:path";
|
|
import { afterEach, describe, expect, it } from "vitest";
|
|
import { cleanupTempDirs, makeTempRepoRoot } from "../helpers/temp-repo.js";
|
|
|
|
const scriptPath = resolve("scripts/list-prod-store-packages.mjs");
|
|
const tempDirs: string[] = [];
|
|
|
|
function runListProdStorePackages(input: unknown, cwd = process.cwd()) {
|
|
return spawnSync(process.execPath, [scriptPath], {
|
|
cwd,
|
|
encoding: "utf8",
|
|
input: JSON.stringify(input),
|
|
});
|
|
}
|
|
|
|
function runListProdStorePackagesRaw(input: string, cwd = process.cwd()) {
|
|
return spawnSync(process.execPath, [scriptPath], {
|
|
cwd,
|
|
encoding: "utf8",
|
|
input,
|
|
});
|
|
}
|
|
|
|
describe("list-prod-store-packages", () => {
|
|
afterEach(() => {
|
|
cleanupTempDirs(tempDirs);
|
|
});
|
|
|
|
it("accepts pnpm list array output", () => {
|
|
const cwd = makeTempRepoRoot(tempDirs, "openclaw-prod-store-packages-");
|
|
const result = runListProdStorePackages(
|
|
[
|
|
{
|
|
dependencies: {
|
|
sourceMap: {
|
|
from: "source-map",
|
|
resolved: "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
|
version: "0.6.1",
|
|
},
|
|
},
|
|
},
|
|
],
|
|
cwd,
|
|
);
|
|
|
|
expect(result.status).toBe(0);
|
|
expect(result.stdout).toBe("source-map@0.6.1");
|
|
});
|
|
|
|
it("accepts pnpm list object output", () => {
|
|
const cwd = makeTempRepoRoot(tempDirs, "openclaw-prod-store-packages-");
|
|
const result = runListProdStorePackages(
|
|
{
|
|
dependencies: {
|
|
litSignals: {
|
|
from: "@lit-labs/signals",
|
|
resolved: "https://registry.npmjs.org/@lit-labs/signals/-/signals-0.1.3.tgz",
|
|
version: "0.1.3",
|
|
},
|
|
},
|
|
},
|
|
cwd,
|
|
);
|
|
|
|
expect(result.status).toBe(0);
|
|
expect(result.stdout).toBe("@lit-labs/signals@0.1.3");
|
|
});
|
|
|
|
it("adds lockfile snapshot dependencies missing from pnpm list output", () => {
|
|
const cwd = makeTempRepoRoot(tempDirs, "openclaw-prod-store-packages-");
|
|
mkdirSync(join(cwd, "scripts"));
|
|
writeFileSync(
|
|
join(cwd, "pnpm-lock.yaml"),
|
|
[
|
|
"lockfileVersion: '10.0'",
|
|
"",
|
|
"packages:",
|
|
" source-map-support@0.5.21:",
|
|
" resolution: {integrity: sha512-test}",
|
|
" source-map@0.6.1:",
|
|
" resolution: {integrity: sha512-test}",
|
|
"",
|
|
"snapshots:",
|
|
" source-map-support@0.5.21:",
|
|
" dependencies:",
|
|
" source-map: 0.6.1",
|
|
" source-map@0.6.1: {}",
|
|
"",
|
|
].join("\n"),
|
|
);
|
|
const result = runListProdStorePackages(
|
|
{
|
|
dependencies: {
|
|
sourceMapSupport: {
|
|
from: "source-map-support",
|
|
resolved:
|
|
"https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz",
|
|
version: "0.5.21",
|
|
},
|
|
},
|
|
},
|
|
cwd,
|
|
);
|
|
|
|
expect(result.status).toBe(0);
|
|
expect(result.stdout).toBe("source-map-support@0.5.21\nsource-map@0.6.1");
|
|
});
|
|
|
|
it("adds production importer dependency closures without pnpm list input", () => {
|
|
const cwd = makeTempRepoRoot(tempDirs, "openclaw-prod-store-packages-");
|
|
writeFileSync(
|
|
join(cwd, "pnpm-lock.yaml"),
|
|
[
|
|
"lockfileVersion: '10.0'",
|
|
"",
|
|
"importers:",
|
|
" .:",
|
|
" dependencies:",
|
|
" '@homebridge/ciao':",
|
|
" specifier: 1.3.9",
|
|
" version: 1.3.9",
|
|
" fetch-blob:",
|
|
" specifier: 3.2.0",
|
|
" version: 3.2.0",
|
|
"",
|
|
"packages:",
|
|
" '@homebridge/ciao@1.3.9':",
|
|
" resolution: {integrity: sha512-test}",
|
|
" source-map-support@0.5.21:",
|
|
" resolution: {integrity: sha512-test}",
|
|
" source-map@0.6.1:",
|
|
" resolution: {integrity: sha512-test}",
|
|
" fetch-blob@3.2.0:",
|
|
" resolution: {integrity: sha512-test}",
|
|
" '@nolyfill/domexception@1.0.28':",
|
|
" resolution: {integrity: sha512-test}",
|
|
"",
|
|
"snapshots:",
|
|
" '@homebridge/ciao@1.3.9':",
|
|
" dependencies:",
|
|
" source-map-support: 0.5.21",
|
|
" source-map-support@0.5.21:",
|
|
" dependencies:",
|
|
" source-map: 0.6.1",
|
|
" source-map@0.6.1: {}",
|
|
" fetch-blob@3.2.0:",
|
|
" dependencies:",
|
|
" node-domexception: '@nolyfill/domexception@1.0.28'",
|
|
" '@nolyfill/domexception@1.0.28': {}",
|
|
"",
|
|
].join("\n"),
|
|
);
|
|
const result = runListProdStorePackagesRaw("", cwd);
|
|
|
|
expect(result.status).toBe(0);
|
|
expect(result.stdout.split("\n")).toEqual(
|
|
[
|
|
"@homebridge/ciao@1.3.9",
|
|
"fetch-blob@3.2.0",
|
|
"@nolyfill/domexception@1.0.28",
|
|
"source-map-support@0.5.21",
|
|
"source-map@0.6.1",
|
|
].toSorted((a, b) => a.localeCompare(b)),
|
|
);
|
|
});
|
|
|
|
it("adds target optional dependencies from peer-resolved lockfile snapshots", () => {
|
|
const cwd = makeTempRepoRoot(tempDirs, "openclaw-prod-store-packages-");
|
|
const platformPackages = [
|
|
["darwin", "arm64"],
|
|
["darwin", "x64"],
|
|
["linux", "arm64"],
|
|
["linux", "x64"],
|
|
["win32", "arm64"],
|
|
["win32", "x64"],
|
|
] as const;
|
|
writeFileSync(
|
|
join(cwd, "pnpm-lock.yaml"),
|
|
[
|
|
"lockfileVersion: '10.0'",
|
|
"",
|
|
"packages:",
|
|
" native-wrapper@1.0.0:",
|
|
" resolution: {integrity: sha512-test}",
|
|
...platformPackages.flatMap(([os, cpu]) => [
|
|
` native-wrapper-${os}-${cpu}@1.0.0:`,
|
|
" resolution: {integrity: sha512-test}",
|
|
` cpu: [${cpu}]`,
|
|
` os: [${os}]`,
|
|
]),
|
|
"",
|
|
"snapshots:",
|
|
" native-wrapper@1.0.0(peer@1.0.0):",
|
|
" optionalDependencies:",
|
|
...platformPackages.map(([os, cpu]) => ` native-wrapper-${os}-${cpu}: 1.0.0`),
|
|
...platformPackages.flatMap(([os, cpu]) => [
|
|
` native-wrapper-${os}-${cpu}@1.0.0:`,
|
|
" optional: true",
|
|
]),
|
|
"",
|
|
].join("\n"),
|
|
);
|
|
const result = runListProdStorePackages(
|
|
{
|
|
dependencies: {
|
|
nativeWrapper: {
|
|
from: "native-wrapper",
|
|
resolved: "https://registry.npmjs.org/native-wrapper/-/native-wrapper-1.0.0.tgz",
|
|
version: "1.0.0(peer@1.0.0)",
|
|
},
|
|
},
|
|
},
|
|
cwd,
|
|
);
|
|
|
|
expect(result.status).toBe(0);
|
|
const expectedPlatformPackage = [`native-wrapper-${process.platform}-${process.arch}@1.0.0`];
|
|
const supportedPlatformPackage = ["linux", "darwin", "win32"].includes(process.platform)
|
|
? expectedPlatformPackage
|
|
: [];
|
|
expect(result.stdout.split("\n").filter(Boolean)).toEqual(
|
|
["native-wrapper@1.0.0", ...supportedPlatformPackage].toSorted((a, b) => a.localeCompare(b)),
|
|
);
|
|
});
|
|
|
|
it("does not add unrelated lockfile packages missing from pnpm list output", () => {
|
|
const cwd = makeTempRepoRoot(tempDirs, "openclaw-prod-store-packages-");
|
|
writeFileSync(
|
|
join(cwd, "pnpm-lock.yaml"),
|
|
[
|
|
"lockfileVersion: '10.0'",
|
|
"",
|
|
"packages:",
|
|
" recma-jsx@1.0.1(acorn@8.16.0):",
|
|
" resolution: {integrity: sha512-test}",
|
|
"",
|
|
"snapshots: {}",
|
|
"",
|
|
].join("\n"),
|
|
);
|
|
const result = runListProdStorePackages({ dependencies: {} }, cwd);
|
|
|
|
expect(result.status).toBe(0);
|
|
expect(result.stdout).toBe("");
|
|
});
|
|
|
|
it("only adds optional platform packages matching the current target", () => {
|
|
const cwd = makeTempRepoRoot(tempDirs, "openclaw-prod-store-packages-");
|
|
const platformPackages = [
|
|
["darwin", "arm64"],
|
|
["darwin", "x64"],
|
|
["linux", "arm64"],
|
|
["linux", "x64"],
|
|
["win32", "arm64"],
|
|
["win32", "x64"],
|
|
] as const;
|
|
const expectedPlatformPackage = platformPackages
|
|
.map(([os, cpu]) => `@zed-industries/codex-acp-${os}-${cpu}@0.15.0`)
|
|
.find(
|
|
(spec) => spec === `@zed-industries/codex-acp-${process.platform}-${process.arch}@0.15.0`,
|
|
);
|
|
writeFileSync(
|
|
join(cwd, "pnpm-lock.yaml"),
|
|
[
|
|
"lockfileVersion: '10.0'",
|
|
"",
|
|
"packages:",
|
|
" '@zed-industries/codex-acp@0.15.0':",
|
|
" resolution: {integrity: sha512-test}",
|
|
...platformPackages.flatMap(([os, cpu]) => [
|
|
` '@zed-industries/codex-acp-${os}-${cpu}@0.15.0':`,
|
|
" resolution: {integrity: sha512-test}",
|
|
` cpu: [${cpu}]`,
|
|
` os: [${os}]`,
|
|
]),
|
|
"",
|
|
"snapshots:",
|
|
" '@zed-industries/codex-acp@0.15.0':",
|
|
" optionalDependencies:",
|
|
...platformPackages.map(
|
|
([os, cpu]) => ` '@zed-industries/codex-acp-${os}-${cpu}': 0.15.0`,
|
|
),
|
|
...platformPackages.flatMap(([os, cpu]) => [
|
|
` '@zed-industries/codex-acp-${os}-${cpu}@0.15.0':`,
|
|
" optional: true",
|
|
]),
|
|
"",
|
|
].join("\n"),
|
|
);
|
|
const result = runListProdStorePackages(
|
|
{
|
|
dependencies: {
|
|
codexAcp: {
|
|
from: "@zed-industries/codex-acp",
|
|
resolved: "https://registry.npmjs.org/@zed-industries/codex-acp/-/codex-acp-0.15.0.tgz",
|
|
version: "0.15.0",
|
|
},
|
|
},
|
|
},
|
|
cwd,
|
|
);
|
|
|
|
expect(result.status).toBe(0);
|
|
expect(result.stdout.split("\n").filter(Boolean)).toEqual(
|
|
[expectedPlatformPackage, "@zed-industries/codex-acp@0.15.0"].filter(Boolean),
|
|
);
|
|
});
|
|
});
|