Files
hyperframes/docs/contributing/testing-local-changes.mdx
T
Miguel Ángel dac304ed9f refactor(studio): code quality — 22 findings, dead code removal, App.tsx split (#144)
## Summary

Full code quality review of the studio package, fixing 22 of 25 findings. Removes dead code, extracts modules from App.tsx, fixes accessibility and performance issues.

## Critical fixes (3)

- **`aria-valuenow`** on seek bar now updates imperatively via `liveTime.subscribe` — screen readers previously always reported position 0
- **Speed menu** closes on outside click (was permanently stuck open)
- **RenderQueue auto-scroll** moved from render phase to `useEffect` (was violating React render purity via `queueMicrotask` during render)

## Dead code removed (-331 lines)

| File | Lines | Why dead |
|---|---|---|
| `PreviewPanel.tsx` | 180 | Replaced by NLELayout + NLEPreview |
| `useCodeEditor.ts` | 80 | Exported but never imported |
| `formatTick` alias | 2 | Deprecated, unused |
| `onClipChange` prop | 5 | Declared, never used |
| `trackH` prop | 5 | Declared, never used |
| `editRange*` + updaters in store | 60 | Never read or written |

## App.tsx extraction

| Extracted to | Lines | What |
|---|---|---|
| `components/LintModal.tsx` | 130 | Lint results modal + LintFinding type |
| `components/MediaPreview.tsx` | 75 | Image/video/audio/font file previewer |
| `utils/mediaTypes.ts` | 15 | Shared regex constants (App.tsx and AssetsTab.tsx had diverged copies) |

## Performance fixes

- `useMemo` for `compositions`/`assets` derivation from `fileTree`
- `useMemo` for `buildTree(files)` in FileTree
- Debounced `handleContentChange` PUT (600ms — was firing on every keystroke)
- CompositionsTab iframe hover debounced (300ms — was mounting immediately)
- `VideoFrameThumbnail` re-extracts frame when `src` prop changes

## Not addressed (3 — low priority)

- #6: SystemIcons consolidation (large refactor across many files)
- #16-17: Overlay dismiss pattern standardization
- #18: Inline SVG → Phosphor replacement (gradual, per-PR)

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2026-03-31 04:21:12 +02:00

137 lines
4.4 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: Testing Local CLI Changes
description: How to test unreleased CLI changes outside the monorepo using your local build.
---
When you modify the CLI or any package it bundles (core, engine, producer, studio), you need to test those changes against real projects _outside_ the monorepo — the same way an end user would run `hyperframes dev`.
## Prerequisites
Build the monorepo first. Every time you change source files, rebuild before testing.
```bash
# From the monorepo root
pnpm build
```
## Option 1: pnpm link (recommended)
`pnpm link --global` makes the `hyperframes` binary in your `$PATH` point at your local build. It survives across terminal sessions and auto-picks up new builds without re-linking.
```bash
# If you previously installed hyperframes globally, remove it first —
# a global install takes priority over pnpm link and shadows your local build.
pnpm remove -g hyperframes 2>/dev/null || npm uninstall -g hyperframes 2>/dev/null
# Link your local build
cd packages/cli
pnpm link --global
# Verify — should print your local version AND point to the monorepo
hyperframes --version
which hyperframes
# The path should contain your monorepo, NOT pnpm/global/.pnpm/hyperframes@...
```
Now use `hyperframes` normally in any directory:
```bash
cd ~/my-video-project
hyperframes dev .
```
**After every `pnpm build`** the linked binary is already up to date — no re-linking needed.
To restore the published release when you're done:
```bash
pnpm unlink --global hyperframes
npm install -g hyperframes@latest
```
## Option 2: node alias (no PATH changes)
If you don't want to touch your global `$PATH`, add a shell alias or call `node` directly:
```bash
# Temporary alias for your current shell session
alias hyperframes="node /path/to/hyperframes-oss/packages/cli/dist/cli.js"
# Or invoke directly
node /path/to/hyperframes-oss/packages/cli/dist/cli.js dev .
```
Replace `/path/to/hyperframes-oss` with your actual monorepo path.
## Option 3: npm pack (test the exact published artifact)
Use this when you want to verify what would actually ship in a release, including the bundled studio and templates.
```bash
cd packages/cli
npm pack
# Creates: hyperframes-<version>.tgz
# Test it in an isolated directory
mkdir /tmp/pack-test && cd /tmp/pack-test
npx /path/to/hyperframes-oss/packages/cli/hyperframes-<version>.tgz init my-video
cd my-video
npx /path/to/hyperframes-oss/packages/cli/hyperframes-<version>.tgz dev .
```
## Testing the fix branches
When validating a specific bug fix, extract one of the test project archives and run through the scenario:
```bash
# Example: testing audio-after-seek fix
unzip golden-lyric-video.zip && cd golden-lyric-video
hyperframes dev .
# 1. Press Play — confirm audio plays
# 2. Drag the timeline scrubber to a different position
# 3. Press Play again — audio should resume from the seeked position
```
Common test scenarios:
| Bug | Project | Steps |
|---|---|---|
| Audio silent after seek | `golden-lyric-video` | Play → seek → play again, verify audio |
| Render stuck at 0% | any | Renders tab → Export → watch progress bar |
| Download 404 after restart | any | Complete a render → `Ctrl+C` → restart → Download |
| Timeline stops early | `intro-vid` | Play → should reach `0:05`, not stop at `0:03` |
| Lottie missing | `hyperframe-build-up-demo` | Play → rocket visible during 02 s |
| Blank thumbnails | any | Compositions sidebar should show previews |
## Troubleshooting
**Changes not reflected after `pnpm build`**
The CLI binary is a single bundled file at `packages/cli/dist/cli.js`. If your change is in `@hyperframes/core` or another workspace package, make sure `pnpm build` rebuilt _all_ packages — the CLI bundles its dependencies at build time.
**`hyperframes` still shows the old version / old UI**
A globally installed `hyperframes` package shadows `pnpm link`. Check which binary is active:
```bash
which hyperframes
# BAD: /Users/you/Library/pnpm/hyperframes → pnpm/global/.pnpm/hyperframes@0.x.x/...
# GOOD: /Users/you/Library/pnpm/hyperframes → your-monorepo/packages/cli/dist/cli.js
```
If it points to the global store, remove the global install and re-link:
```bash
pnpm remove -g hyperframes
npm uninstall -g hyperframes # in case it was installed via npm
cd packages/cli && pnpm link --global
```
**Port already in use**
`hyperframes dev` defaults to port 3002 and auto-increments if it's taken. Pass `--port` to use a specific port:
```bash
hyperframes dev . --port 4000
```