Typst local package (tlp) manager#
This is a small tool that automates my development workflow for local typst packages.
In particular, it keeps a git repository symlinked to (the equivalent of) ~/.local/share/typst/packages/local/<name>,
with one git worktree for each version, named as the version so that typst can pick it up,
as well as a symlink with the latest version as its name that points back to the directory,
so that you always get the latest development version when writing #import "@local/<name>:<latest>" in typst.
Commands#
tlp new <name>: Creates a new local package with the given name in the current directory and links it.tlp init: Creates a new local package with the name from typst.toml in the current directory. Also initializes a git repository, if not one already.tlp path <name>: Get the full path to the local package with the given name (in case you forgot, or need it for other automation)tlp bump <name> [--major|--patch]: Increase the version of the local package with the given name. This will create a new git tag for the latest version, then increase said version by modifying thetypst.tomland renaming the latest-version symlink, and finally add a newgit worktreefor the previously latest version.tlp rm <name>: Removes the local package with the given name.
All commands support the --package-path option (also available via the TYPST_PACKAGE_PATH env variable),
which works exactly like it does in typst to specify where to look instead of (the equivalent of) ~/.local/share/typst/packages.
Git#
By default, this program will invoke the git binary on your system.
If git isn't found for some reason, you can use the --git option to specify where it is.
Alternatively, you can compile this program with the git2 feature;
Then, it will use libgit2 instead of invoking git, so the --git option will have no effect.
ToDo#
-
tlp init: Populate a version for each tag -
tlp init: Check if there are any@local/in the whole code, check if they are available, if not print warnings.