Skip to content

Conversation

kadikraman
Copy link
Collaborator

@kadikraman kadikraman commented Mar 28, 2025

Why

Resolves #103
Supersedes #126

The font packages should allow importing individual fonts to avoid including all fonts in your application bundle.

How

The diff is large here because I had to regenerate packages with the new folder structure.
The first 5 commits do the actual work, the last commit updates packages.

  1. Update generated package.json formatting ea0c7e3
  2. Rename master -> main to reflect the new base branch of the repo 9298625
  3. the main change ✨ Split font variants into separate folders and update the package code to support importing them individually d0c19c3
  4. Use the correct font path in the gallery generator 240af93
  5. Update version in the main package to 0.3.0 to prepare for release 0f8b877
Before After
Screenshot 2025-03-28 at 13 20 08 Screenshot 2025-03-28 at 13 18 58

Testing

The main thing to verify that this change allows importing individual packages but is also backwards compatible.

I tested using yalc, so in my case:

  1. Choose any package, e.g. cd font-packages/zain
  2. Publish it to yalc store with yalc publish
  3. Create a new expo app yarn create expo-app --template blank-typescript test-fonts
  4. Add the package yalc add @expo-google-fonts/zain
  5. Replace the App.tsx with the code example from the README - ensure it works ✅
  6. Change the imports so all fonts are imported from the main package (like in the currently published version) - ensure it works

The other thing to verify that all other generated files where we're linking to font assets from the repo will include the new variant folder. I updated the packaged themselves and the gallery, but I might have missed some places.

@kadikraman kadikraman requested a review from jakex7 March 28, 2025 12:54
@kadikraman kadikraman force-pushed the @kadikraman/split-exports branch from 9660ad8 to 15316f0 Compare March 28, 2025 13:01
@jakex7
Copy link
Member

jakex7 commented Mar 28, 2025

Making a review as a comment because GH can't handle so many changes 😅


Just a small one - can we use the same header as index for consistency?

packages/generator/templates/package/variant/index.js.ejs
packages/generator/templates/package/variant/index.d.ts.ejs

- /// Generated by expo-google-fonts/generator
- /// Do not edit by hand unless you know what you are doing
- ///
+ // This file is generated by @expo-google-fonts/generator
+ // If you want to modify it, go to packages/generator/templates

@kadikraman kadikraman merged commit 07b069c into main Mar 28, 2025
2 checks passed
@kadikraman kadikraman deleted the @kadikraman/split-exports branch March 28, 2025 16:16
@kadikraman kadikraman mentioned this pull request Mar 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Each font variant as a separate module
2 participants