mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 12:00:44 +00:00
build: stabilize a2ui bundle inputs
This commit is contained in:
@@ -5,7 +5,6 @@ import {
|
||||
getBundleHashInputPaths,
|
||||
getBundleHashRepoInputPaths,
|
||||
getLocalRolldownCliCandidates,
|
||||
getResolvedBundleDependencyPackageJsonPaths,
|
||||
isBundleHashInputPath,
|
||||
} from "../../scripts/bundle-a2ui.mjs";
|
||||
|
||||
@@ -52,34 +51,24 @@ describe("scripts/bundle-a2ui.mjs", () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it("keeps repo-root package churn out of bundle hash inputs", () => {
|
||||
it("tracks repo dependency manifests through lockfile inputs", () => {
|
||||
const repoRoot = path.resolve("repo-root");
|
||||
const inputPaths = getBundleHashRepoInputPaths(repoRoot);
|
||||
|
||||
expect(inputPaths).toContain(path.join(repoRoot, "package.json"));
|
||||
expect(inputPaths).toContain(path.join(repoRoot, "pnpm-lock.yaml"));
|
||||
expect(inputPaths).toContain(path.join(repoRoot, "ui", "package.json"));
|
||||
expect(inputPaths).not.toContain(path.join(repoRoot, "package.json"));
|
||||
expect(inputPaths).not.toContain(path.join(repoRoot, "pnpm-lock.yaml"));
|
||||
});
|
||||
|
||||
it("tracks only the resolved bundle dependency manifests from node_modules", () => {
|
||||
it("keeps local node_modules state out of bundle hash inputs", () => {
|
||||
const repoRoot = process.cwd();
|
||||
const dependencyPaths = getResolvedBundleDependencyPackageJsonPaths(repoRoot);
|
||||
const relativeDependencyPaths = dependencyPaths.map((dependencyPath) =>
|
||||
path.relative(repoRoot, dependencyPath).replaceAll(path.sep, "/"),
|
||||
);
|
||||
const inputPaths = getBundleHashInputPaths(repoRoot);
|
||||
|
||||
expect(
|
||||
relativeDependencyPaths.map((relativePath) => relativePath.replace(/^ui\//u, "")),
|
||||
).toEqual([
|
||||
path.posix.join("node_modules", "lit", "package.json"),
|
||||
path.posix.join("node_modules", "@lit/context", "package.json"),
|
||||
path.posix.join("node_modules", "@lit-labs/signals", "package.json"),
|
||||
path.posix.join("node_modules", "signal-utils", "package.json"),
|
||||
]);
|
||||
expect(
|
||||
relativeDependencyPaths.every((relativePath) => /^(ui\/)?node_modules\//u.test(relativePath)),
|
||||
).toBe(true);
|
||||
expect(getBundleHashInputPaths(repoRoot)).not.toContain(path.join(repoRoot, "package.json"));
|
||||
expect(getBundleHashInputPaths(repoRoot)).not.toContain(path.join(repoRoot, "pnpm-lock.yaml"));
|
||||
expect(inputPaths).toContain(path.join(repoRoot, "package.json"));
|
||||
expect(inputPaths).toContain(path.join(repoRoot, "pnpm-lock.yaml"));
|
||||
expect(inputPaths).not.toContain(path.join(repoRoot, "node_modules", "lit", "package.json"));
|
||||
expect(inputPaths).not.toContain(
|
||||
path.join(repoRoot, "ui", "node_modules", "lit", "package.json"),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user