I am sorry to disappoint you guys, but I did not build another typst editor instead I have been working on my package manager.
You can now use gotpm to declare dependencies, that are not part of the typst Universe, and use them in your project. Basically any repository on GitHub, Gitlab or another Host can be regarded as a package, that you can use in your project.
Let’s assume you want to use the foobar package that can be found on github.com/foo/bar. You then want to run
gotpm add github.com/foo/bar -t v0.1.2
The package then will be installed for you and the import statement will be noted in the typst.toml file.
[tool.gotpm]
dependencies = [
"@gotpm/foobar:0.1.2",
]
You can import the package from GitHub in your typst files like so:
#import "@gotpm/foobar:0.1.2": *
The exact sources, from where you added a dependency will be in a lock file.
If another person then wants to compile your Typst project the lock file will be used to install all dependencies for that person. The sync command will do exactly that.
gotpm sync
If you want to install a package just for yourself, without declaring a typst.toml file you might want to use:
gotpm install -r github.com/foo/bar
If your goal is to contribute packages and templates to typst/packages the publish command might make your life easier. For me it was always a struggle to keep the repo of a template I was maintaining in sync with my fork of typst/packages , because in my case Github Actions would commit on my behalf to the fork. Therefore it was a mess when I needed to change something during the review process.
Now I am using the following workflow. I would first set the url to my fork of typst/packages once per machine like so.
gotpm config set fork.url git@github.com:user/typst-packages
And whenever I now want to release a new version of a template I would run the following from the root of the project I want to put onto the typst universe.
gotpm publish
This would then
- clone the fork onto the machine
- do a sparse checkout to my package
- checkout the correct branch
- package all relevant files, that are not ignored or excluded, into the correct directory
- commit the changes
- and finally push to the remote
If you then need to change files during the review process simply commit them in your repo, and run publish again. The last commit message will be preserved.
Maybe this makes your life easier. If so I would love to hear your feedback, and how we/I could improve the tool.