There are a few current and upcoming ways to improve the situation.
- if your package is made with typst-package-template, it includes a command
just install-previewthat will install the package in the right location (this requires the just command runner, and the script implementing this may require Linux – I plan to migrate the scripts to one of the tools below) - if you plan to have many packages that users need installed locally (e.g. because you don’t plan to release them on Universe), then Maintaining a private package namespace as a git repo may be interesting to you. (this requires your users to be somewhat technical as they need to manage a git repo, and is also bash-based)
- using typship, you can
typship download -n preview <package-repo>to install a package locally from a git repo - utpm is another, well, unofficial Typst package manager, that has relevant commands in its dev branch which should be merged fairly soon:
utpm pkg install -n preview <package-repo>like above;utpm prj link --no-copy previewsymlinks a local project (the--no-copyoption will probably become the default)
All that said, I personally think your proposed --local-package option is not the solution. I don’t think it scales well to packages with dependencies on their own (imagine you had to specify five --local-package options due to transitive dependencies). Your goal is for your users to 1) not have to go through complicated installation steps and 2) not having to hack around a local (not installed) template; the solution is to make installation easier – see above for that.
“Snap doesn’t configure XDG_DATA_HOME” honestly sounds like a snap bug/limitation (it wouldn’t be the first one); that Typst follows the XDG base directory specification is a plus in my view, Snap should make it easier/the default to properly integrate into the system. I don’t know what other packaged versions of the Typst compiler there are, but for your Windows users, Scoop may be a nice solution. Looking at GitHub - typst-community/scoop-bucket: A scoop bucket for various unofficial typst tools., it seems that you can get your users set up with something similar to this (untested, mind you):
scoop bucket add main
scoop bucket add typst-community https://github.com/typst-community/scoop-bucket
scoop install main/typst
scoop install typst-community/typship
typship download -n preview https://github.com/SnpM/tonguetoquill-usaf-memo