mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-03 04:38:33 +00:00
fix(studio): surface gesture recording controls (#1390)
This commit is contained in:
@@ -19,7 +19,7 @@ function createProjectDir(): string {
|
||||
}
|
||||
|
||||
describe("walkDir", () => {
|
||||
it("hides internal HyperFrames files from project listings", () => {
|
||||
it("hides internal HyperFrames backup files from project listings", () => {
|
||||
const projectDir = createProjectDir();
|
||||
mkdirSync(join(projectDir, ".hyperframes", "backup"), { recursive: true });
|
||||
mkdirSync(join(projectDir, ".hyperframes", "examples"), { recursive: true });
|
||||
@@ -32,8 +32,8 @@ describe("walkDir", () => {
|
||||
|
||||
const files = walkDir(projectDir);
|
||||
expect(files).toContain(".cache/examples/preset.html");
|
||||
expect(files).toContain(".hyperframes/examples/preset.html");
|
||||
expect(files).toContain("compositions/scene.html");
|
||||
expect(files).not.toContain(".hyperframes/backup/snapshot.html");
|
||||
expect(files).not.toContain(".hyperframes/examples/preset.html");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -6,7 +6,11 @@ import { readdirSync } from "node:fs";
|
||||
// Re-exported here for back-compat with existing `../helpers/safePath.js` imports.
|
||||
export { isSafePath } from "../../safePath.js";
|
||||
|
||||
const IGNORE_DIRS = new Set([".thumbnails", ".hyperframes", "node_modules", ".git"]);
|
||||
const IGNORE_DIRS = new Set([".thumbnails", "node_modules", ".git"]);
|
||||
|
||||
function shouldIgnoreDir(rel: string): boolean {
|
||||
return rel === ".hyperframes/backup";
|
||||
}
|
||||
|
||||
/**
|
||||
* True when any directory segment of a relative path is a dot-directory or
|
||||
@@ -25,7 +29,7 @@ export function walkDir(dir: string, prefix = ""): string[] {
|
||||
const files: string[] = [];
|
||||
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
||||
const rel = prefix ? `${prefix}/${entry.name}` : entry.name;
|
||||
if (IGNORE_DIRS.has(entry.name)) continue;
|
||||
if (IGNORE_DIRS.has(entry.name) || shouldIgnoreDir(rel)) continue;
|
||||
if (entry.isDirectory()) {
|
||||
files.push(...walkDir(join(dir, entry.name), rel));
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user