mirror of
https://github.com/apple/pkl.git
synced 2026-01-13 23:23:37 +01:00
Package aliases #118
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ericzbeard on GitHub (Mar 21, 2024).
It would be nice if we could alias package imports.
What I do now:
What I would like to do:
@bioball commented on GitHub (Mar 21, 2024):
You can do this by declaring them as project dependencies. See docs here: https://pkl-lang.org/main/current/language-reference/index.html#project-dependencies
By the way: package URIs should only have the version once in their path, after the last
@. This is because Pkl uses the base path to determine what the name of the package is. It then uses the package name to resolve dependencies.If you are publishing packages as GitHub releases, a path you can take is:
<name>@<version>to hold the package assetspackage://pkg.pkl-lang.org/github.com/<org>/<repo>/<name>@<version>as the package URI. This is a redirect server that redirects back to github.com.For example, here's how we manage the releases for pkl-go: https://github.com/apple/pkl-go/releases. We create two GitHub releases for every release; one as the Go release, and one as the Pkl package release.
@ericzbeard commented on GitHub (Mar 21, 2024):
I struggled with figuring out the right format for the PklProject file. I think I'm complicating the issue by releasing this package as a part of a larger repo, so it's not the only thing being released. See the assets in this release. Maybe it would be better to put this in a repo by itself, but it makes development a bit easier having it all together.
@ericzbeard commented on GitHub (Mar 21, 2024):
And thank you, the code is much cleaner now!
@bioball commented on GitHub (Mar 22, 2024):
Something else you can do here is to deploy these assets elsewhere, e.g. to an S3 bucket (and then maybe CNAME'd so the url is shorter). Pkl doesn't actually care where these packages come from, only that they are accessible via HTTPS.
Some notes about the
PklProject:readit in. This lets you avoid doing some string replacing before you do your packaging.sourceCodeandsourceCodeUrlScheme.nameshould be the last segment of the base uri.