From 1c389983de16f73ce9f272f5d6e6ae4314ac9e17 Mon Sep 17 00:00:00 2001 From: James Russo Date: Wed, 24 Jun 2026 16:57:46 -0700 Subject: [PATCH] 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) --- packages/cli/scripts/build-copy.mjs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/packages/cli/scripts/build-copy.mjs b/packages/cli/scripts/build-copy.mjs index e08db8c0a..55f198e91 100644 --- a/packages/cli/scripts/build-copy.mjs +++ b/packages/cli/scripts/build-copy.mjs @@ -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/.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");