How to update packages on universe?

I wrote a handful of template packages at the start of this year and would like to fix a few issues in them, but to be honest I’ve been putting it off because I don’t understand the monorepo organisation of typst universe and how one is meant to submit packages to it / update submissions later on.

Is there a simple guide to submit a PR for a package on typst universe, that does not require making a fresh fork of the entire repo each time? (That’s what I resorted to – a new copy of the entire thing every time).

Ideally I’d want to have one repo for each of my packages and submit changes from those, one at a time independently.
I remember seeing a guide automating this with GH actions etc. but it had a lot of steps and was overkill for me (I don’t need to automate releases from a tag etc. – just make a PR manually from my own repos). Is there a simple guide somewhere?

1 Like

Updating should not be very difficult. Here is how I do it on a package (templates follow the same process as far as I know.)
You should have initially forked the package repo from typst. You can update your fork with the “sync fork” button on GH. Then you clone your fork locally (or git pull if you already have it) and make all the changes you want to the template (directly on the main branch or on a separate branch that you then merge to main). When you are ready, push all your changes and open a PR to merge your fork to the main repo.
You probably have to do that for each template separately because you should have one fork for each, but I might be wrong.
There might be much better processes, but this is simple enough for me with good git experience but limited GH experience.

Having one fork for each package seems a really big hurdle, considering the size of Typst universe. That’s why I’m hoping for a better workflow somehow.

One fork with multiple branches suffices. You can also do a --depth 1 clone to skip the history (though it’s of course still a bit of a heavy repo).

We’re aware that the package submission process is not the simplest and we want to have a more direct way in the future. But that would require a whole lot of engineering which we can’t prioritize at the moment. Using GitHub as an stopgap solution gives us a lot of things for free (e.g. review tooling).

1 Like

Thanks – oh, I see, so if I understand correctly I should make a separate branch for each package I want to do a PR on.
I still wonder if/how it possible to use one’s own repo (with just the one package) and somehow make a PR to add it to the whole package repo. I think I once saw a tutorial some months ago that was describing it, but I can’t find it again (it was probably linked on Discord).

You can reduce the size of the repo further with a sparse-checkout.

Something like

git clone --depth 1 --no-checkout --filter="tree:0" git@github.com:typst/packages
... // cd into the folder
git sparse-checkout init
git sparse-checkout set packages/preview/[your-package-name]
git checkout main

Then you have something like (this is for glossarium), all in all the repo is 7MB on disk.

❯ git count-objects -v
count: 0
size: 0
in-pack: 3638
packs: 4
size-pack: 1745
prune-packable: 0
garbage: 0
size-garbage: 0

To answer the original question:

  1. I have a repository for the package, e.g., GitHub - typst-community/glossarium: Glossarium is a simple typst glossary.
  2. I publish a release on GitHub on the package’s repository
  3. I archive every file that is needed for the package, removing examples and docs, etc. (glossarium/package.sh at master · typst-community/glossarium · GitHub)
  4. I extract the archive on my fork of typst/packages (up-to-date if possible) and commit the new version.
  5. Open a PR for the new release
4 Likes