fix(package): keep artifact duplicate diagnostics relative · openclaw/openclaw@7cda58c
vincentkoc
·
2026-06-21
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -421,8 +421,11 @@ async function findSingleTarball(dir) {
|
421 | 421 | if (entry.isFile() && /\.t(?:ar\.)?gz$/u.test(entry.name)) { |
422 | 422 | tarballs.push(absolute); |
423 | 423 | if (tarballs.length > 1) { |
| 424 | +const relativeTarballs = tarballs |
| 425 | +.map((tarball) => path.relative(root, tarball)) |
| 426 | +.toSorted((a, b) => a.localeCompare(b)); |
424 | 427 | throw new Error( |
425 | | -`source=artifact requires exactly one .tgz under ${dir}; found at least 2: ${tarballs.toSorted((a, b) => a.localeCompare(b)).join(", ")}`, |
| 428 | +`source=artifact requires exactly one .tgz under ${dir}; found at least 2: ${relativeTarballs.join(", ")}`, |
426 | 429 | ); |
427 | 430 | } |
428 | 431 | } |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -990,9 +990,14 @@ describe("resolve-openclaw-package-candidate", () => {
|
990 | 990 | await writeFile(path.join(dir, "openclaw-a.tgz"), "a"); |
991 | 991 | await writeFile(path.join(dir, "nested.tar.gz"), "b"); |
992 | 992 | |
993 | | -await expect(findSingleTarballForTest(dir)).rejects.toThrow( |
994 | | -"source=artifact requires exactly one .tgz", |
995 | | -); |
| 993 | +const error = await findSingleTarballForTest(dir).catch((caught: unknown) => caught); |
| 994 | +expect(error).toBeInstanceOf(Error); |
| 995 | +const message = (error as Error).message; |
| 996 | +expect(message).toContain("source=artifact requires exactly one .tgz"); |
| 997 | +expect(message).toContain("nested.tar.gz"); |
| 998 | +expect(message).toContain("openclaw-a.tgz"); |
| 999 | +expect(message).not.toContain(path.join(dir, "nested.tar.gz")); |
| 1000 | +expect(message).not.toContain(path.join(dir, "openclaw-a.tgz")); |
996 | 1001 | }); |
997 | 1002 | |
998 | 1003 | it("reads the source SHA from packed npm build metadata", async () => { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。