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

Function run

packages/cli/src/commands/publish.ts:39–98  ·  view source on GitHub ↗
({ args })

Source from the content-addressed store, hash-verified

37 },
38 },
39 async run({ args }) {
40 const rawArg = args.dir;
41 const dir = resolve(rawArg ?? ".");
42 const indexPath = join(dir, "index.html");
43 if (existsSync(indexPath)) {
44 const lintResult = await lintProject(dir);
45 if (lintResult.totalErrors > 0 || lintResult.totalWarnings > 0) {
46 console.log();
47 for (const line of formatLintFindings(lintResult)) console.log(line);
48 console.log();
49 }
50 }
51
52 if (args.yes !== true) {
53 console.log();
54 console.log(
55 ` ${c.bold("hyperframes publish uploads this project and creates a stable public URL.")}`,
56 );
57 console.log(
58 ` ${c.dim("Anyone with the URL can open the published project and claim it after authenticating.")}`,
59 );
60 console.log();
61 const approved = await clack.confirm({ message: "Publish this project?" });
62 if (clack.isCancel(approved) || approved !== true) {
63 console.log();
64 console.log(` ${c.dim("Aborted.")}`);
65 console.log();
66 return;
67 }
68 }
69
70 clack.intro(c.bold("hyperframes publish"));
71 const publishSpinner = clack.spinner();
72 publishSpinner.start("Uploading project...");
73
74 try {
75 const published = await publishProjectArchive(dir, { public: args.public === true });
76 const claimUrl = new URL(published.url);
77 claimUrl.searchParams.set("claim_token", published.claimToken);
78 publishSpinner.stop(c.success("Project published"));
79
80 console.log();
81 console.log(` ${c.dim("Project")} ${c.accent(published.title)}`);
82 console.log(` ${c.dim("Files")} ${String(published.fileCount)}`);
83 console.log(` ${c.dim("Public")} ${c.accent(claimUrl.toString())}`);
84 console.log();
85 console.log(
86 ` ${c.dim("Open the URL on hyperframes.dev to claim the project and continue editing.")}`,
87 );
88 console.log();
89 return;
90 } catch (err: unknown) {
91 publishSpinner.stop(c.error("Publish failed"));
92 console.error();
93 console.error(` ${(err as Error).message}`);
94 console.error();
95 process.exitCode = 1;
96 return;

Callers

nothing calls this directly

Calls 8

resolveFunction · 0.85
lintProjectFunction · 0.85
formatLintFindingsFunction · 0.85
publishProjectArchiveFunction · 0.85
errorMethod · 0.80
setMethod · 0.65
startMethod · 0.45
stopMethod · 0.45

Tested by

no test coverage detected