fix(cli): ship player + slideshow bundles so present/play work from npm (#1706)

`present` and `play` render compositions in the standalone browser player,
resolving the player/slideshow IIFE bundles via resolvePlayerPath /
resolveSlideshowPath. Those resolvers look for the bundles alongside the built
CLI (dist/hyperframes-player.global.js, dist/hyperframes-slideshow.global.js),
but build-copy.mjs never staged them into dist/. The remaining candidate paths
are monorepo-dev only, so an npm install has nothing to resolve.

Result: `npx hyperframes present` always failed with
"@hyperframes/player not found", forcing users to run the presenter from a
monorepo checkout.

Copy both player globals from packages/player/dist into the CLI dist during
build:copy (existsSync-guarded + warn, matching the surrounding pattern). The
runtime bundle is already handled by build:runtime. Verified: the globals now
appear in `npm pack`, and `node dist/cli.js present` starts without the
player-not-found error.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
James Russo
2026-06-24 16:57:46 -07:00
committed by GitHub
co-authored by Claude Opus 4.8
parent 89ff299a11
commit 1c389983de
+21
View File
@@ -109,6 +109,27 @@ async function main() {
cpSync(motionSampleScript, join(DIST, "commands", "motion-sample.browser.js"));
}
// Player bundles for the standalone browser player used by `present` and
// `play`. resolvePlayerPath/resolveSlideshowPath look for these alongside the
// built CLI (dist/<name>.global.js), so they must ship in the package — the
// monorepo-dev fallback paths don't exist once installed from npm. Without
// this, `npx hyperframes present` fails with "@hyperframes/player not found".
const playerDist = join(REPO_ROOT, "packages", "player", "dist");
const playerGlobals = [
[join(playerDist, "hyperframes-player.global.js"), join(DIST, "hyperframes-player.global.js")],
[
join(playerDist, "slideshow", "hyperframes-slideshow.global.js"),
join(DIST, "hyperframes-slideshow.global.js"),
],
];
for (const [src, dest] of playerGlobals) {
if (existsSync(src)) {
cpSync(src, dest);
} else {
console.warn(`[build-copy] player bundle not found, skipping: ${src}`);
}
}
copyMdFiles(join(CLI_ROOT, "src", "docs"), join(DIST, "docs"));
console.log("[build-copy] done");