This guide will introduce the wapm-cli tool and show a few common workflows. The wapm client can install packages, manage WebAssembly dependencies, and expose WebAssembly behavior with commands.
The wapm ecosystem makes WebAssembly more accessible to developers. The system is enabled by a couple tools:
The name wapm is an abbreviation for WebAssembly Package Manager, but then name represents the ecosystem of packages and the tools.
With the tools installed, one can easily start using universal wasm binaries by using the
install command of wapm-cli:
$ wapm install cowsay
Installing a package creates a local package directory called
wapm_packages where all packages are installed. While
in a directory with wapm packages, one may execute them with the
$ wapm run cowsay hello wapm! _____________ < hello wapm! > ------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || ||
The manifest file enables one to publish a package to the wapm.io public registry.
Login is required for publishing. Signup for an account at wapm.io and login to the server with
The reference shows all the required fields for the manifest, but it's easy to get started with
$ wapm init my_package
This command generates a wapm manifest file:
[package] name = "username/my_package" version = "0.1.0" description = ""
All packages on wapm.io are namespaced by username. This is the minimum required data for a manifest file. A module is required for publishing. Add a module section:
[[module]] name = "my_app" source = "path/to/app.wasm"
Publish the project to wapm.io!
$ wapm publish
Commands (not to be confused with wapm-cli subcommands) are a feature that enables easily executing wasm code from a wapm package.
Commands are what allows one to call the
run subcommand, like above when running
wapm run cowsay hello wapm!.
A command requires a name and module to reference:
[[command]] name = "my_cmd" module = "my_app"
wapm run my_cmd will execute the module defined with the name
my_app. Under the hood, wapm-cli calls
wasmer, the WebAssembly server runtime.