MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / resolveProjectOrThrow

Function resolveProjectOrThrow

packages/cli/src/utils/project.ts:26–52  ·  view source on GitHub ↗
(dirArg: string | undefined)

Source from the content-addressed store, hash-verified

24}
25
26export function resolveProjectOrThrow(dirArg: string | undefined): ProjectDir {
27 const trimmed = dirArg?.trim();
28 if (trimmed === "#") {
29 throw new InvalidProjectError(
30 "Invalid project directory: #",
31 "# is a URL fragment, not a project path.",
32 "Run hyperframes preview . from your project directory.",
33 );
34 }
35
36 const dir = resolve(dirArg ?? ".");
37 const name = basename(dir);
38 const indexPath = resolve(dir, "index.html");
39
40 if (!existsSync(dir) || !statSync(dir).isDirectory()) {
41 throw new InvalidProjectError("Not a directory: " + dir);
42 }
43 if (!existsSync(indexPath)) {
44 throw new InvalidProjectError(
45 "No composition found in " + dir,
46 "No index.html file found.",
47 "Run npx hyperframes init to create a new composition.",
48 );
49 }
50
51 return { dir, name, indexPath };
52}
53
54export function resolveProject(dirArg: string | undefined): ProjectDir {
55 try {

Callers 2

project.test.tsFile · 0.85
resolveProjectFunction · 0.85

Calls 2

resolveFunction · 0.85
basenameFunction · 0.85

Tested by

no test coverage detected