The original package manager for the Motoko programming language.
- Download a copy of the
vesselbinary from the release page or build one yourself-
For Ubuntu in
$HOME/binRUNwget https://github.com/dfinity/vessel/releases/download/v0.8.0/vessel-linux64For macOS in
/usr/local/binRUN:wget https://github.com/dfinity/vessel/releases/download/v0.8.0/vessel-macos -
Rename vessel-linux64 to vessel eg: RUN
mv vessel-linux64 vessel -
Change permissions,
chmod +x vessel
-
- Run
vessel initin your project root. - Edit
vessel.dhallto include your dependencies (potentially also editpackage-set.dhallto include additional package sources) - In a dfx project: Edit
dfx.jsonunder defaults->build->packtool to say"vessel sources"like so:Then run... "defaults": { "build": { "packtool": "vessel sources" } } ...dfx build - In a non-dfx project: Run
$(vessel bin)/moc $(vessel sources) -wasi-system-api main.moto compile themain.mofile with the installed packages in scope and using thewasiAPI to let you run the generated WASM with tools like wasmtime.
Vessel is inspired by the spago package
manager for PureScript. Any git repository with a src/ directory is a valid
package to Vessel, which is a flexible and lightweight approach to package
management, that is easily extended with more guarantees and features as our
community grows. The two concepts you need to understand to work with Vessel
are package sets and the manifest file.
Vessel uses the idea of a package set to manage where it pulls dependencies
from. A package set is a collection of packages at certain versions that are
known to compile together. The package set also specifies the dependencies
between these packages, so that Vessel can find all the transitively needed
packages to build your project. There will be a community maintained package set of
publicly available, open source packages. You can then base your projects
package set on the public one and extend it with your private and local
packages. The package set your project uses is stored in the package-set.dhall
file by default.
Your vessel.dhall file contains the list of packages you need for your project
to build. Vessel will look at this file, and figure out all the transitive
packages you need using the package set file. Optionally it also contains a
compiler version that Vessel uses to download the compiler binaries for you.
Any change to this file requires a reload of the language service so your
packages can be picked up by your editor for now.
After Vessel has installed all required packages through cloning or
downloading tarballs, it puts them in a project local location (the .vessel
directory).
Remove the .vessel directory in your project
The "version" field in the package set format refers to any git ref so you can
put a branch name, a commit hash or a tag in there.
CAREFUL: Vessel has no way of invalidating "moving" references like a
branch name. If you push a new commit to the branch you'll need to run vessel install --force to bypass your local cache.
Make sure your local package is a git repository, then add an entry like so to
your additions in the package-set.dhall file:
let additions = [
{ name = "mypackage"
, repo = "file:///home/path/to/mypackage"
, version = "v1.0.0"
, dependencies = ["base"]
}
]Now you can depend on this package by adding mypackage to your vessel.dhall file.
Running vessel sources will return flags in a format you can pass directly to
the various compiler tools. Running vessel bin returns the path containing the
compiler binaries. Use like so: $(vessel bin)/mo-doc.
vessel verify will verify that the given package set compiles successfully.
vessel verify --version 0.15.1 will compile the package set with version 0.15.1 of the Motoko compiler
vessel verify --compile will compile the given package set and validate the wasm output using wasm-validate.
vessel verify --package <package_name> will restrict the verification to the given package.
vessel verify --moc <path_to_moc> will use the given moc binary to verify the package.
Skipping the --moc flag will use the moc binary in the PATH.
vessel verify --moc-args="--legacy-persistence --legacy-actors" will pass the given arguments to the moc binary.
In this example, the --legacy-persistence and --legacy-actors flags are passed to verify packages that were not migrated to the new persistence standard.
Vessel is distributed under the terms of the Apache License (Version 2.0).
See LICENSE for details.