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

Function createPublishArchive

packages/cli/src/utils/publishProject.ts:342–366  ·  view source on GitHub ↗
(projectDir: string)

Source from the content-addressed store, hash-verified

340}
341
342export function createPublishArchive(projectDir: string): PublishArchiveResult {
343 const absProjectDir = resolve(projectDir);
344 const filePaths: string[] = [];
345 collectProjectFiles(absProjectDir, absProjectDir, filePaths);
346 if (!filePaths.includes("index.html")) {
347 throw new Error("Project must include an index.html file at the root before publish.");
348 }
349
350 const fileContents = new Map<string, Buffer>();
351 for (const filePath of filePaths) {
352 fileContents.set(filePath, readFileSync(join(absProjectDir, filePath)));
353 }
354
355 localizeExternalAssets(absProjectDir, fileContents);
356
357 const archive = new AdmZip();
358 for (const [filePath, content] of fileContents) {
359 archive.addFile(filePath, content);
360 }
361
362 return {
363 buffer: archive.toBuffer(),
364 fileCount: fileContents.size,
365 };
366}
367
368export function getPublishApiBaseUrl(): string {
369 return (

Callers 3

publishProjectArchiveFunction · 0.85
maybeUploadProjectFunction · 0.85

Calls 4

resolveFunction · 0.85
collectProjectFilesFunction · 0.85
localizeExternalAssetsFunction · 0.85
setMethod · 0.65

Tested by

no test coverage detected