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/demoffmpeg and ffprobe must be on PATH:
brew install ffmpeg # macOS
sudo apt-get install ffmpeg # Debian/Ubuntu
choco install ffmpeg # WindowsWhen editing packages/enhanced-video/src/:
pnpm --filter enhanced-video-sveltekit dev # tsc --watchThe 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.
- Create an npm automation access token: https://www.npmjs.com/settings/~/tokens → "Generate New Token" → Automation type.
- Add it as a repo secret: GitHub repo → Settings → Secrets and variables → Actions → New repository secret → name
NPM_TOKEN, value the token. - Make sure the package name in
packages/enhanced-video/package.jsonis still available on npm (npm view enhanced-video-sveltekit). If taken, rename it.
- Bump the version in
packages/enhanced-video/package.json. - Commit + push to
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-runon every push and PR.- On push to
mainwith a new version:npm publishwith provenance, thengit-cliffregeneratespackages/enhanced-video/CHANGELOG.mdfrom commits since the previous tag, commits it back aschore(changelog): release vX.Y.Z [skip ci], pushes avX.Y.Zgit 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` firstMIT. See packages/enhanced-video/LICENSE.