Publish a Package
A package is a git repository, and publishing it is pushing it to GitHub. There is no registry and
no publish command: gh:user/repo is https://github.com/user/repo.git.
Make a code package
Section titled “Make a code package”resonon new my-lib --libWrite what you want to share into src/lib.non. Every top-level fn, let and class is exported;
mark one private to keep it inside. /// comments are shown by resonon pkg inspect, and the
file’s //! comment is the package’s description:
//! my-lib — helpers for generative rhythms.
private let lib_name = "my-lib";
/// Scale a value and round it to a whole number.fn scaled(value, factor) { round(value * factor)}
/// Default tempo for performance templates.let default_bpm = 120;Make a kit package
Section titled “Make a kit package”resonon new my-drums --kitPut each kit in its own folder under kits/:
my-drums/ kits/ 808/ bd.wav sd.wav hh.wavFiles named like General MIDI drums (bd, sd, hh, …) get their notes without any setup. To set
notes, velocity layers or root notes yourself, add a kit.toml and move the samples into a
samples/ folder next to it — every key is in kit.toml.
A package can have code and kits: resonon new my-pkg --lib --kit.
Make a native package
Section titled “Make a native package”resonon new my-ext --nativeThis adds a Rust crate in native/. Installing the package builds it from source. For machines
without a Rust toolchain, also commit a prebuilt binary for each platform you support:
resonon build --distShip a Native Extension covers writing, building and publishing the extension.
Push it to GitHub
Section titled “Push it to GitHub”cd my-libgit add .git commit -m "First version"gh repo create my-lib --public --source=. --pushresonon new already made the git repository. Anyone can now install the package:
resonon install gh:yourname/my-libTag a version
Section titled “Tag a version”Tag a commit and push the tag:
git tag v1.0git push origin v1.0Others pin it with resonon install gh:yourname/my-lib@v1.0, or with version = "v1.0" in their
resonon.toml.
Related
Section titled “Related”- Install a Package — use one
- Share a Project — send a piece, not a library
- Modules —
use, exports andprivate