Files
frames/packages/cli/scripts/build-beat-analyzer.mjs
zooqueen 75094e0d60 frames: publish the toolchain as @hanzo/frames
@hanzo/frame is taken by the hero video primitive — one full-bleed video
element — which has held that name on npm since it shipped. This repo is the
video toolchain: a CLI, a renderer, a studio, a player. Plural is what it is,
so the CLI publishes as @hanzo/frames and the workspace packages follow it
(@hanzo/frames-core, @hanzo/frames-engine, and the rest).

The binary stays `frames`, and now actually ships. The manifest mapped it to
bin/frames.mjs while the file on disk was bin/hyperframes.mjs, so a global
install produced no working command.

The paths that name a package to fetch were pointing elsewhere. The update
check read registry.npmjs.org/frames, a different author's package, and the
npm, bun and pnpm installers would have pulled it over the CLI; the render
image installed the upstream hyperframes; scaffolded projects and the docs
pinned the unscoped name. All of them now name @hanzo/frames.
2026-08-13 18:10:14 -07:00

29 lines
975 B
JavaScript

// Prebuild the beat-detection browser bundle into dist so `frames beats`
// works in the published CLI (which ships only dist, not source). Mirrors how
// the runtime IIFE is shipped. headlessAnalyzer.ts loads this at runtime and
// injects it into a headless page.
import { build } from "esbuild";
import { createRequire } from "node:module";
import { dirname, join } from "node:path";
const require = createRequire(import.meta.url);
const coreRoot = dirname(require.resolve("@hanzo/frames-core/package.json"));
const entry = join(coreRoot, "src/beats/beatDetection.ts");
await build({
stdin: {
contents:
`import { analyzeMusicFromBuffer } from ${JSON.stringify(entry)};\n` +
`globalThis.__hfAnalyze = analyzeMusicFromBuffer;`,
resolveDir: coreRoot,
loader: "ts",
},
bundle: true,
format: "iife",
platform: "browser",
target: "es2020",
outfile: "dist/beat-analyzer.global.js",
});
console.log("built dist/beat-analyzer.global.js");