Let's say you have a WebAssembly application, and you would like to publish it to WAPM so more people can use it easily.
You might have a similar project structure:
Now, in the root of your project, you can simply run
And it will guide you the process of creating a new
wapm.toml file for your project. At the end, it should have generated a manifest like the following:
[package]name = "username/my_package"version = "0.1.0"description = "The description of the package"[[module]]name = "my_program_wasi"source = "my_program_wasi.wasm"[[module]]name = "my_other_program_wasi"source = "my_other_program_wasi.wasm"
Now, you will need to:
Creating an account in WAPM is very easy, just go to the following url and sign up!
Now that you are registered, you can just run the following command and it will ask for your credentials
Now that you have successfully created a
wapm.toml manifest file for your project and have logged in into WAPM, you just need to run one more command!
And you package should now be live in wapm.io 🎉
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_program_wasi"
wapm run my_cmd will execute the module defined with the name
my_program_wasi. Under the hood,
wasmer, the WebAssembly server runtime.
If you want to learn more about the manifest format, please jump into the next article!