Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions scripts/check-miner-package.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ import { fileURLToPath } from "node:url";

const ALLOWED = [
/^bin\/gittensory-miner\.js$/,
// One optional level of subdirectory (e.g. lib/calibration/index.js, #2332) alongside the original flat
// lib/<name>.js layout -- both forms ship real runtime/type files, never build tooling or config.
/^lib\/([a-z0-9-]+\/)?[a-z0-9-]+\.(js|d\.ts)$/,
/^lib\/[a-z0-9-]+\.(js|d\.ts)$/,
/^package\.json$/,
/^README\.md$/,
];
Expand Down
11 changes: 5 additions & 6 deletions test/unit/check-miner-package.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,20 @@ describe("check-miner-package script", () => {
expect(result.out).toContain("Unexpected file in miner package: scripts/extra.mjs");
});

it("REGRESSION (main was red after #3704): accepts a lib module split into a one-level subdirectory", () => {
it("REGRESSION (#3704 caused main to go red, fixed by flattening lib/ instead of widening this allowlist): rejects a lib module nested one level under a subdirectory", () => {
const result = runChecker({
CHECK_MINER_PACK_TEST_FILES: JSON.stringify([
"package.json",
"bin/gittensory-miner.js",
"lib/cli.js",
"lib/calibration/index.js",
"lib/calibration/index.d.ts",
]),
CHECK_MINER_PACK_TEST_CONTENT: "{}",
});
expect(result.status).toBe(0);
expect(result.out).toContain("lib/calibration/index.js");
expect(result.status).toBe(1);
expect(result.out).toContain("Unexpected file in miner package: lib/calibration/index.js");
});

it("still rejects a file nested two levels deep under lib/", () => {
it("rejects a file nested two levels deep under lib/", () => {
const result = runChecker({
CHECK_MINER_PACK_TEST_FILES: JSON.stringify([
"package.json",
Expand Down