chore(repo): remove accidental Bun lockfile (#7589)

This commit is contained in:
nettee
2026-08-29 14:17:38 +00:00
committed by GitHub
parent 7d81aa9f8a
commit 60be43c132
3 changed files with 51 additions and 3638 deletions
-3636
View File
File diff suppressed because it is too large Load Diff
+38 -2
View File
@@ -1,6 +1,18 @@
import { describe, expect, test } from "vitest";
import { mkdtemp, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import path from "node:path";
import { isScriptTestFile } from "../../../scripts/guard.ts";
import { afterEach, describe, expect, test, vi } from "vitest";
import { checkRootPackageManagerLockfiles, isScriptTestFile } from "../../../scripts/guard.ts";
const temporaryDirectories: string[] = [];
async function temporaryRepository(): Promise<string> {
const directory = await mkdtemp(path.join(tmpdir(), "open-design-guard-"));
temporaryDirectories.push(directory);
return directory;
}
describe("scripts test-free boundary", () => {
test.each(["scripts/example.test.ts", "scripts/example.test.mts"])("recognizes %s as a test file", (file) => {
@@ -11,3 +23,27 @@ describe("scripts test-free boundary", () => {
expect(isScriptTestFile("scripts/example.ts")).toBe(false);
});
});
describe("root package-manager lockfile boundary", () => {
afterEach(async () => {
vi.restoreAllMocks();
await Promise.all(
temporaryDirectories.splice(0).map((directory) => rm(directory, { force: true, recursive: true })),
);
});
test("accepts a repository without a Bun lockfile", async () => {
const repository = await temporaryRepository();
vi.spyOn(console, "log").mockImplementation(() => undefined);
await expect(checkRootPackageManagerLockfiles(repository)).resolves.toBe(true);
});
test("rejects a root bun.lock", async () => {
const repository = await temporaryRepository();
await writeFile(path.join(repository, "bun.lock"), "");
vi.spyOn(console, "error").mockImplementation(() => undefined);
await expect(checkRootPackageManagerLockfiles(repository)).resolves.toBe(false);
});
});
+13
View File
@@ -267,6 +267,18 @@ async function checkResidualJavaScript(): Promise<boolean> {
return true;
}
export async function checkRootPackageManagerLockfiles(root: string = repoRoot): Promise<boolean> {
const entries = await readdir(root);
if (entries.includes("bun.lock")) {
console.error("Unexpected root bun.lock found.");
console.error("pnpm-lock.yaml is the repository's only dependency lockfile; remove bun.lock.");
return false;
}
console.log("Root package-manager lockfile check passed: no bun.lock found.");
return true;
}
const sourcePackageManifestRootPaths = ["package.json", "e2e/package.json"];
const sourcePackageManifestScopedDirectories = ["apps", "packages", "tools"];
const packageDependencySections = [
@@ -1479,6 +1491,7 @@ async function checkRunStartChokePoint(): Promise<boolean> {
const checks: GuardCheck[] = [
{ name: "residual JavaScript", run: checkResidualJavaScript },
{ name: "root package-manager lockfile", run: ({ repoRoot: root }) => checkRootPackageManagerLockfiles(root) },
{ name: "package dependency specs", run: checkPackageDependencySpecs },
{ name: "product neutrality", run: checkProductNeutrality },
{ name: "cross-app imports", run: checkCrossAppImportsOnce },