A monorepo for font optimization packages that generate @font-face CSS with scaled fallback fonts to reduce CLS. Uses the same algorithm as @next/font via Capsize.
| Package | Description |
|---|---|
| @gamesome/astro-font | Astro integration for optimized font loading with preloading and locale support |
| @gamesome/style-dictionary-font | Style Dictionary v4 format and action for generating font CSS from design tokens |
| @gamesome/core-font | Shared core logic for CSS generation and fallback font scaling (used by the above) |
| Example | Description |
|---|---|
| astro-basic | Astro app showcasing three fonts (Rubik, Sora, Lora) with the astro-font integration |
| style-dictionary-basic | React + Vite app using Style Dictionary tokens for the same three fonts |
git clone https://github.com/Gamesome-ab/astro-font.git
cd astro-font
pnpm install
pnpm build
pnpm test# Astro example
pnpm --filter example-astro-basic dev
# Style Dictionary example
pnpm --filter example-style-dictionary-basic devThis repo uses Changesets to manage versioning, changelogs, and publishing. All three packages are published to npm under the @gamesome scope.
The release process has three steps:
- Add changesets — declare what changed and how it should be versioned
- Version packages — consume changesets to bump versions and generate changelogs
- Publish — build, test, and publish to npm with git tags
After making changes to any package, run:
pnpm changesetThis prompts you to:
- Select which packages are affected
- Choose a semver bump type for each (patch / minor / major)
- Write a summary of the change
A markdown file is created in .changeset/ — commit this file with your PR. You can add multiple changesets per PR if there are unrelated changes.
Make sure to either squash changes, or add this changeset in the same commit as your code changes. version-packages will reference the commit that the changeset file is in!
$ pnpm changeset
🦋 Which packages would you like to include? @gamesome/astro-font
🦋 Which packages should have a major bump? No packages
🦋 Which packages should have a minor bump? @gamesome/astro-font
🦋 Summary: Add locale-based font loading support
🦋
🦋 === Summary of changesets ===
🦋 minor: @gamesome/astro-font
🦋
🦋 Created .changeset/brave-dogs-learn.md
If @gamesome/core-font is bumped, changesets automatically bumps @gamesome/astro-font and @gamesome/style-dictionary-font too (configured via updateInternalDependencies: "patch" in .changeset/config.json).
When you're ready to release (typically after merging PRs that contain changesets):
pnpm version-packagesThis:
- Reads all pending
.changeset/*.mdfiles - Bumps
versionin each affectedpackage.json - Updates (or creates)
CHANGELOG.mdin each affected package - Deletes the consumed changeset files
Review the changes, then commit:
git add .
git commit -m "chore: version packages"Create a PR for this version bump and merge it.
After the version bump is merged to main:
pnpm releaseThis runs build → test → changeset publish. Changeset publish will:
- Publish each package whose version isn't already on npm
- Create a git tag per published package (e.g.
@gamesome/core-font@0.1.0) - Push tags to the remote
pnpm automatically replaces
workspace:*references with the actual version of@gamesome/core-fontwhen publishing.
| Command | What it does |
|---|---|
pnpm changeset |
Add a changeset (do this in your PR) |
pnpm version-packages |
Bump versions + generate changelogs |
pnpm release |
Build, test, publish to npm, create git tags |
- Multiple changesets per PR are fine — if a PR fixes a bug in core-font and adds a feature to astro-font, add two separate changesets
- Empty changesets — if a PR doesn't need a version bump (docs, CI, examples), skip
pnpm changesetor runpnpm changeset --emptyto explicitly mark it as not needing a release - Pre-releases — changesets supports pre-release mode via
pnpm changeset pre enter <tag>(e.g.alpha,beta). See changesets pre-release docs
MIT