typst local package (tlp) manager
at dev 32 lines 2.1 kB view raw view rendered
1# Typst local package (tlp) manager 2This is a small tool that automates my development workflow for local typst packages. 3 4In particular, it keeps a git repository symlinked to (the equivalent of) `~/.local/share/typst/packages/local/<name>`, 5with one `git worktree` for each version, named as the version so that typst can pick it up, 6as well as a symlink with the latest version as its name that points back to the directory, 7so that you always get the latest development version when writing `#import "@local/<name>:<latest>"` in typst. 8 9## Commands 10- `tlp new <name>`: Creates a new local package with the given name in the current directory and links it. 11- `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. 12- `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) 13- `tlp bump <name> [--major|--patch]`: Increase the version of the local package with the given name. 14 This will create a new git tag for the latest version, 15 then increase said version by modifying the `typst.toml` and renaming the latest-version symlink, 16 and finally add a new `git worktree` for the previously latest version. 17- `tlp rm <name>`: Removes the local package with the given name. 18 19All commands support the `--package-path` option (also available via the `TYPST_PACKAGE_PATH` env variable), 20which works exactly like it does in `typst` to specify where to look instead of (the equivalent of) `~/.local/share/typst/packages`. 21 22## Git 23By default, this program will invoke the `git` binary on your system. 24If `git` isn't found for some reason, you can use the `--git` option to specify where it is. 25 26Alternatively, you can compile this program with the `git2` feature; 27Then, it will use `libgit2` instead of invoking `git`, so the `--git` option will have no effect. 28 29 30## ToDo 31- [ ] `tlp init`: Populate a version for each tag 32- [ ] `tlp init`: Check if there are any `@local/` in the whole code, check if they are available, if not print warnings.