mirror of
https://github.com/morluto/rea.git
synced 2026-11-18 20:53:00 +00:00
fix(packaging): include the linked dinosaur notice (#11793)
This commit is contained in:
2 files changed
+42
No files matched your search
@@ -88,6 +88,7 @@
|
||||
"README.md",
|
||||
"DISCLAIMER.md",
|
||||
"THIRD_PARTY_NOTICES.md",
|
||||
"website/public/assets/licenses/dinosaur.txt",
|
||||
"LICENSE",
|
||||
"native/windows/build/manifest.json",
|
||||
"native/windows/build/rea-windows-x64.node",
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { posix } from "node:path";
|
||||
|
||||
import { expect } from "vitest";
|
||||
|
||||
import { npmInvocation } from "../../../scripts/lib/npm-invocation.mjs";
|
||||
import { processTest as test } from "../../support/process/processFixture.js";
|
||||
|
||||
test("packs the local license texts linked from the shipped notices", async ({
|
||||
processes,
|
||||
}) => {
|
||||
// Inspect npm's actual selection without running prepack or creating a tarball.
|
||||
const npm = npmInvocation(
|
||||
["pack", "--dry-run", "--ignore-scripts", "--json"],
|
||||
process.env,
|
||||
);
|
||||
const packed = await processes.run(npm.command, npm.arguments);
|
||||
expect(packed.exitCode, packed.stderr).toBe(0);
|
||||
const [{ files }] = JSON.parse(packed.stdout) as [
|
||||
{ files: { path: string }[] },
|
||||
];
|
||||
const paths = new Set(files.map(({ path }) => path));
|
||||
for (const document of ["THIRD_PARTY_NOTICES.md", "licenses/README.md"]) {
|
||||
expect(paths.has(document)).toBe(true);
|
||||
const text = await readFile(document, "utf8");
|
||||
const notices = [...text.matchAll(/\]\(([^)]+)\)/gu)]
|
||||
.map((match) => match[1]!)
|
||||
.filter(
|
||||
(link) =>
|
||||
!link.includes(":") && /(?:\.txt|LICENSE(?:\.md)?)$/u.test(link),
|
||||
);
|
||||
expect(notices.length).toBeGreaterThan(0);
|
||||
for (const link of notices) {
|
||||
const target = posix.normalize(posix.join(posix.dirname(document), link));
|
||||
expect(
|
||||
paths.has(target),
|
||||
`${document} links to unpacked notice ${target}`,
|
||||
).toBe(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user