Skip to content

Using wkg to source latest WITs #21

@kate-goldenring

Description

@kate-goldenring

I was walking through how to pull down the WITs to reproduce this sample from scratch and I thought i would share by steps using wkg in case it is helpful to add to CI:

  1. Create a wkg config that points to the WebAssembly OCI registry for WASI packages
cat > ~/.config/wasm-pkg/config.toml <<EOL
#wkg.toml
default_registry = "ghcr.io"

[namespace_registries]
wasi = { registry = "wasi",  metadata = { preferredProtocol = "oci", "oci" = {registry = "ghcr.io", namespacePrefix = "webassembly/" } } }

[package_registry_overrides]

[registry]
EOL
  1. Use wkg to get the dependency packages
mkdir -p wit/deps/http wit/deps/cli wit/deps/clocks/ wit/deps/filesystem/ wit/deps/io/ wit/deps/random/ wit/deps/sockets/
wkg get  --format wit wasi:http@0.2.3 -o wit/deps/http/
wkg get  --format wit wasi:cli@0.2.3 -o wit/deps/cli/
wkg get  --format wit wasi:clocks@0.2.3 -o wit/deps/clocks/
wkg get  --format wit wasi:filesystem@0.2.3 -o wit/deps/filesystem/
wkg get  --format wit wasi:io@0.2.3 -o wit/deps/io/
wkg get  --format wit wasi:random@0.2.3 -o wit/deps/random/
wkg get  --format wit wasi:sockets@0.2.3 -o wit/deps/sockets/
  1. Add the world for the component
cat > wit/world.wit <<EOL
package sunfishcode:hello-wasi-http;

world target-world {
  include wasi:http/proxy@0.2.3;
}
EOL

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions