feat(core): a folder with index.html is one a step can work on, apart from finding projects (#7734)

* feat(core): a folder with index.html is one a step can work on, apart from finding projects

isHyperframesProject needs index.html and a marker file, which is right for finding projects on a computer (a
website's folder must not be listed) but not for what a step works on. isCompositionFolder says that: any folder
whose index.html is the composition.

* build(core): raise core's unpacked size budget for the step folder rule
This commit is contained in:
Miguel Ángel
2026-11-14 14:02:28 +00:00
committed by GitHub
parent c31e7dd08c
commit 32f562bbd0
5 changed files with 22 additions and 5 deletions
+1 -1
View File
@@ -355,7 +355,7 @@ export {
realProjectRoot,
resolveWithinProject,
} from "./safePath";
export { isHyperframesProject, PROJECT_MARKER_FILES } from "./projectRule";
export { isCompositionFolder, isHyperframesProject, PROJECT_MARKER_FILES } from "./projectRule";
export type {
HyperframePickerApi,
HyperframePickerBoundingBox,
+14 -1
View File
@@ -1,5 +1,5 @@
import { describe, expect, it } from "vitest";
import { isHyperframesProject } from "./projectRule";
import { isCompositionFolder, isHyperframesProject } from "./projectRule";
describe("isHyperframesProject", () => {
it.each(["hyperframes.json", "meta.json", "project.json"])(
@@ -14,3 +14,16 @@ describe("isHyperframesProject", () => {
expect(isHyperframesProject(["hyperframes.json", "README.md"])).toBe(false);
});
});
// fails without the fix: a step had only the discovery rule, so a folder holding a composition but no marker file was
// refused by `open` though `snapshot` and `check` worked on it.
describe("isCompositionFolder", () => {
it("counts any folder with index.html, marker or not", () => {
expect(isCompositionFolder(["index.html"])).toBe(true);
expect(isCompositionFolder(["index.html", "hyperframes.json"])).toBe(true);
});
it("does not count a folder without index.html", () => {
expect(isCompositionFolder(["hyperframes.json", "assets"])).toBe(false);
});
});
+4
View File
@@ -5,3 +5,7 @@ export function isHyperframesProject(fileNames: Iterable<string>): boolean {
const names = new Set(fileNames);
return names.has("index.html") && PROJECT_MARKER_FILES.some((name) => names.has(name));
}
export function isCompositionFolder(fileNames: Iterable<string>): boolean {
return new Set(fileNames).has("index.html");
}
+2 -2
View File
@@ -3,9 +3,9 @@ import type { Dirent } from "node:fs";
import { readFile, readdir, realpath, stat } from "node:fs/promises";
import { homedir } from "node:os";
import { basename, dirname, isAbsolute, join, relative, sep } from "node:path";
import { isHyperframesProject, PROJECT_MARKER_FILES } from "./projectRule";
import { isCompositionFolder, isHyperframesProject, PROJECT_MARKER_FILES } from "./projectRule";
export { isHyperframesProject, PROJECT_MARKER_FILES };
export { isCompositionFolder, isHyperframesProject, PROJECT_MARKER_FILES };
export interface FoundProject {
path: string;