Codetje docs

Publishing and versions

Publishing uploads a compiled component to the registry as namespace/name@version. The registry validates it, stores it by its sha256 digest, and from then on that version never changes.

rt publish build/app.wasm acme/[email protected] --source build/app.source.json --tag preview

Names

  • Namespaces are your username and the organizations you own. rt whoami lists them.
  • Package names use lowercase letters, digits and single dashes, up to 64 characters, and can't start or end with a dash. A package other namespaces will import needs every dash-separated word to start with a letter, as WIT requires.
  • Versions are exact semver, like 1.0.0 or 1.1.0-beta.1. Publishing a version that exists is refused: publish a new one instead.

Tags

Tags are the movable part. Each points at one exact version, and you can move it at any time.

  • stable is what a package's module host and /run/{ns}/{name} serve. Without a stable tag, they serve latest.
  • latest is reserved and moves by itself: it's the highest stable version, or the highest pre-release if there's no stable one.
  • Any other name works too, such as preview or beta. Tag names follow the rules for package names, but start with a letter.
rt publish build/app.wasm acme/[email protected] --tag preview   # publish and tag in one go
rt tag set acme/app stable preview                         # stable → whatever preview points at
rt tag set acme/app stable 1.0.0                           # roll back
rt tag rm acme/app preview
rt versions acme/app                                       # versions and tags

When you set a tag to another tag or to latest, it's resolved right away: stable points at the version preview had then, and doesn't follow it later. Moving a tag takes effect on the next request.

Previews

Every tag has its own host. https://{ns}--{name}--{tag}.codetje.app serves that tag (or latest), so the usual way to release is:

  1. Publish with --tag preview.
  2. Try it at https://acme--app--preview.codetje.app.
  3. Move stable with rt tag set acme/app stable preview.

Rolling back is moving stable to an older version. That doesn't depend on the new version working.

The console's editor works the same way: it publishes a new version as preview, and has a button to move stable.

Where a package runs

URL Serves
https://{ns}--{name}.codetje.app/... stable, else latest, on the package's own origin
https://{ns}--{name}--{tag}.codetje.app/... That tag, or latest
https://run.codetje.app/run/{ns}/{name}[@version]/... The default, or a version or tag. Shares one origin with every other package, so use module hosts for anything a browser opens

Each module host is its own browser origin, so storage and host-only cookies are separate per package, and per tag.

Source

--source stores the source a version was built from (the .source.json that codetje-as build writes), and rt source get reads it back. It can be set once per version. The registry doesn't build it, so it's a claim anyone can check by rebuilding: builds are reproducible, so the digests must match. Source is readable by anyone who can read the package.

Inspecting

rt info acme/app            # metadata of the latest version, as JSON
rt info acme/[email protected]      # digest, exports, manifest, dependencies, source
rt wit acme/app             # the WIT it exports for other packages