I used vessel to install a package and it created .vessel/ directory where I can import the dependency like:
import package "../.vessel/package/main/src/package";
Is this the advised way to do this?
One drawback seems that if I want to use a testing pipeline with:
moc --package base $(dfx cache show)/base --check src/main/main.mo
, it will fail unless I commit the entire .vessel directory, which doesn’t seem ideal.
No, the trick is to tell dfx
that you are using vessel and then you can use import M "mo:package/Module"
.
See step 4 of the README at GitHub - dfinity/vessel: Simple package management for Motoko.
2 Likes
Warning: the default vessel-package-set provided when you run vessel init
in your project will override the motoko-base you were using before.
Before installing vessel, you were using the motoko-base provided by your dfx installation in $(dfx cache show)
.
After installing vessel, you are using a (likely) older version of motoko-base specified in the default vessel-package-set, which is from dfx v0.8.1.
That may or may not be what you want.
Here are two solutions:
- Manually specify the latest motoko-base version (or some later version you want) in package-set.dhall using the git tag in the
overrides
array - Remove the default
base
andmatchers
dependencies from vessel.dhall, so your vessel.dhall file now looks like:
{
dependencies = [] : List Text,
compiler = None Text
}
1 Like