Korr packages are Git repositories. korr add downloads one into
korr_modules/, records it in korr.json, pins the exact commit in korr.lock,
and import "name" uses it. There is no central registry: share a package by
pushing it to GitHub (or any Git host) and tagging versions.
korr init # creates korr.json in this folder
korr add github:ana/korr-slug@v1.2.0 # add + install (name: slug)
korr add https://git.example.com/tools.git # any HTTPS Git URL, latest commit
korr add github:ana/date-utils --name dates # choose the import name
korr add file:///home/me/code/mylib # a local repository
korr install # install everything (e.g. after git clone)
korr list # installed packages and commits
korr remove slug
// no-check
import "slug" // korr_modules/slug
import "date-utils" // alias: date_utils (a "-" becomes "_")
import "dates" as d // explicit alias
print(slug.make("Hello World"))
github:user/repo, https://..., or file:///..., optionally followed
by @version: a tag, branch or commit (@v1.2.0, @main, @3f2a9c1).- and _. The default name is the
repository name without a korr- prefix (korr-slug becomes slug).korr.lock stores the commit of every package.
korr install checks out exactly those commits, so commit korr.json and
korr.lock and let others run korr install. korr_modules/ is added to
.gitignore automatically.korr add again with the new version
(korr add github:ana/korr-slug@v1.3.0).korr_modules/ folder. If two packages need the same name from different
sources, korr install stops with an error naming both.import "name" looks for korr_modules/name in the importing file’s folder and
then in each parent folder, so it works from any file in the project.korr build puts the packages your program imports inside the executable;
the deployed program does not need korr_modules/.A package is a folder of .krr files in a Git repository. Add a korr.json:
{
"name": "slug",
"version": "1.2.0",
"main": "main.krr",
"dependencies": {
"unicode": "github:ana/korr-unicode@v0.4.0"
}
}
main is the file import "slug" loads (default main.krr). Its top-level
names are the package’s API; names starting with _ stay private.import "./util.krr") and other packages by name.git tag v1.2.0 && git push --tags.A package is code that runs with the same permissions as your program, the same
as npm, Composer or pip packages. Add packages you trust, pin versions with tags,
and review changes when you update. The lock file makes sure nobody silently gets
different code: a package changes only when you run korr add again.
Previous: CLI apps and the korr command |
Docs index | Next: Deployment |