On this page
Package Manager
Note: This feature is planned but not yet implemented. This page describes the intended design.
Halyard will include a built-in package manager for dependency management.
Adding Dependencies
Add packages with halyard add:
halyard add json # Latest version
halyard add http@2.0 # Specific version
halyard add --dev test # Development dependency
This updates halyard.toml:
[dependencies]
json = "1.2"
http = "2.0"
[dev-dependencies]
test = "1.0"
Version Syntax
| Syntax | Meaning |
|---|---|
1.2.3 | Exact version |
^1.2 | Compatible (1.2.0 <= v < 2.0.0) |
~1.2 | Patch updates (1.2.0 <= v < 1.3.0) |
>=1.0 | Minimum version |
* | Any version |
Lock File
halyard.lock records exact resolved versions:
[[package]]
name = "json"
version = "1.2.3"
checksum = "sha256:abc123..."
[[package]]
name = "http"
version = "2.0.1"
checksum = "sha256:def456..."
dependencies = ["json"]
Commit halyard.lock for reproducible builds.
Updating Dependencies
halyard update # Update all packages
halyard update json # Update specific package
halyard update --major # Allow major version bumps
Removing Dependencies
halyard remove json
Viewing Dependencies
halyard deps # List direct dependencies
halyard deps --tree # Show dependency tree
halyard deps --outdated # Show available updates
Private Registries
Configure in ~/.hly/config.toml:
[[registries]]
name = "company"
url = "https://packages.company.com"
token = "..."
Use in halyard.toml:
[dependencies]
internal-lib = { version = "1.0", registry = "company" }
Git Dependencies
Reference packages directly from git:
[dependencies]
my-lib = { git = "https://github.com/user/repo", branch = "main" }
my-lib = { git = "https://github.com/user/repo", tag = "v1.0" }
my-lib = { git = "https://github.com/user/repo", rev = "abc123" }
Local Dependencies
For development:
[dependencies]
my-lib = { path = "../my-lib" }
Publishing Packages
- Update version in
halyard.toml - Run
halyard publish --dry-runto verify - Run
halyard publishto publish
Requirements:
- Valid
halyard.tomlwith name, version, license - README.md in project root
- Authenticated with registry (
halyard login)
Creating a Library
halyard new my-lib --lib
Structure:
my-lib/
├── halyard.toml
├── src/
│ └── lib.hly # Library entry point
└── tests/
└── lib_test.hly
Export public API in src/lib.hly:
module MyLib
export (parse, format, Config)
-- Public functions and types