Publish your first package
This page will guide you through installing Wasmer, and publishing a package to the Wasmer Registry.
Install Wasmer
Click here for instructions on how to install Wasmer if you haven't done it already!
Create an account
You can create an account directly via wasmer login
or via the Wasmer website:
wasmer.io/signup (opens in a new tab)
Create a package
To create your first Wasmer pacakge simply run wasmer init
.
This should have created a wasmer.toml
file with contents similar to:
[package]
name = '<your-user>/<package>'
version = '0.1.0'
description = 'Description for package'
[[module]]
name = '<your-module>'
source = 'target/release/<your-module>.wasm'
[[command]]
runner = 'wasi'
name = '<your-module>'
module = '<your-module>'
You can check the manifest format here: Wasmer Package Manifest.
Once you have a wasmer.toml
manifest, you can simply execute wasmer run
in the CLI to run your package locally.
wasmer run . --command=<your-module>
Build your package
Now, create your WebAssembly modules:
cargo install cargo-wasix
cargo wasix build --release
Modify the wasmer.toml
to point the module to the wasm file location target/release/<your-module>.wasm
.
Publish your package
Now, simply run:
wasmer publish
This command will publish your package to the Wasmer Registry (opens in a new tab), so it can be used anywhere.