Build-time video optimization for SvelteKit, modeled on @sveltejs/enhanced-img. Drop in an <enhanced:video> tag, get back AV1 + H.264 sources, an auto-extracted poster, and lazy loading.
<enhanced:video src="$lib/clip.mp4" autoplay muted loop playsinline />
This is a pnpm monorepo:
packages/enhanced-video — the published library. See its README for usage.apps/demo — SvelteKit app that consumes the library locally for development and verification.pnpm install # also builds packages/enhanced-video via its `prepare` script
pnpm dev # runs apps/demo on http://localhost:5173
pnpm build # production build of apps/demo
ffmpeg and ffprobe must be on PATH:
brew install ffmpeg # macOS
sudo apt-get install ffmpeg # Debian/Ubuntu
choco install ffmpeg # Windows
When editing packages/enhanced-video/src/:
pnpm --filter enhanced-video-sveltekit dev # tsc --watch
The demo picks up the rebuilt dist/ automatically; refresh the browser.
Conventional Commits are enforced via a husky commit-msg hook + commitlint (@commitlint/config-conventional). The hook is wired up automatically by the prepare script when you run pnpm install.
type(scope?): subject
feat: new feature
fix: bug fix
perf: performance improvement
refactor: internal restructure
docs: documentation
test: tests
build: build system / deps
ci: CI workflow
chore: anything else
revert: revert a previous commit
Bad commits are rejected by the hook before they land. The cliff.toml config groups these into the auto-generated CHANGELOG.md on release.
To preview the upcoming [Unreleased] section locally without releasing:
pnpm view:cliff
(Needs git-cliff on your PATH — brew install git-cliff once.)
There's a GitHub Actions workflow at .github/workflows/publish.yml that publishes automatically.
NPM_TOKEN, value the token.packages/enhanced-video/package.json is still available on npm (npm view enhanced-video-sveltekit). If taken, rename it.packages/enhanced-video/package.json.main (use Conventional Commit prefixes for everything that's gone in since the last tag — feat:, fix:, ci:, chore:, etc.).That's it. The workflow handles the rest:
tsc + npm pack --dry-run on every push and PR.main with a new version: npm publish with provenance, then git-cliff regenerates packages/enhanced-video/CHANGELOG.md from commits since the previous tag, commits it back as chore(changelog): release vX.Y.Z [skip ci], pushes a vX.Y.Z git tag, and creates a GitHub Release with the same notes.The CHANGELOG groups commits by Conventional type (feat: → Features, fix: → Bug Fixes, ci: → CI, etc.). Non-Conventional commits are skipped. Configuration lives in cliff.toml. Pushes to main without a version bump don't release — same package, same release.
cd packages/enhanced-video
npm pack --dry-run # inspect tarball contents
npm publish # `prepublishOnly` re-runs `rm -rf dist && tsc` first
MIT. See packages/enhanced-video/LICENSE.