fix(docker): accept single-object pnpm list output · openclaw/openclaw@5e97045
steipete
·
2026-05-23
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | import fs from "node:fs"; |
2 | 2 | |
3 | | -const roots = JSON.parse(fs.readFileSync(0, "utf8")); |
| 3 | +const parsed = JSON.parse(fs.readFileSync(0, "utf8")); |
| 4 | +const roots = Array.isArray(parsed) ? parsed : [parsed]; |
4 | 5 | const specs = new Set(); |
5 | 6 | |
6 | 7 | function visit(node) { |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +import { spawnSync } from "node:child_process"; |
| 2 | +import { resolve } from "node:path"; |
| 3 | +import { describe, expect, it } from "vitest"; |
| 4 | + |
| 5 | +const scriptPath = resolve("scripts/list-prod-store-packages.mjs"); |
| 6 | + |
| 7 | +function runListProdStorePackages(input: unknown) { |
| 8 | +return spawnSync(process.execPath, [scriptPath], { |
| 9 | +encoding: "utf8", |
| 10 | +input: JSON.stringify(input), |
| 11 | +}); |
| 12 | +} |
| 13 | + |
| 14 | +describe("list-prod-store-packages", () => { |
| 15 | +it("accepts pnpm list array output", () => { |
| 16 | +const result = runListProdStorePackages([ |
| 17 | +{ |
| 18 | +dependencies: { |
| 19 | +sourceMap: { |
| 20 | +from: "source-map", |
| 21 | +resolved: "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", |
| 22 | +version: "0.6.1", |
| 23 | +}, |
| 24 | +}, |
| 25 | +}, |
| 26 | +]); |
| 27 | + |
| 28 | +expect(result.status).toBe(0); |
| 29 | +expect(result.stdout).toBe("source-map@0.6.1"); |
| 30 | +}); |
| 31 | + |
| 32 | +it("accepts pnpm list object output", () => { |
| 33 | +const result = runListProdStorePackages({ |
| 34 | +dependencies: { |
| 35 | +litSignals: { |
| 36 | +from: "@lit-labs/signals", |
| 37 | +resolved: "https://registry.npmjs.org/@lit-labs/signals/-/signals-0.1.3.tgz", |
| 38 | +version: "0.1.3", |
| 39 | +}, |
| 40 | +}, |
| 41 | +}); |
| 42 | + |
| 43 | +expect(result.status).toBe(0); |
| 44 | +expect(result.stdout).toBe("@lit-labs/signals@0.1.3"); |
| 45 | +}); |
| 46 | +}); |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。