mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-18 07:50:13 +00:00
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:
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
},
|
||||
"@hyperframes/core": {
|
||||
"packed": 1762752,
|
||||
"unpacked": 4330000
|
||||
"unpacked": 4374000
|
||||
},
|
||||
"@hyperframes/engine": {
|
||||
"packed": 490452,
|
||||
|
||||
Reference in New Issue
Block a user