CLI

Use @wvb/cli to package frontend build output, inspect bundles, publish updates, and prepare builtin bundles for native apps. This page describes each command, its options, and its output. For an end-to-end publishing workflow, see Releasing.

Install and run

Use Node.js 20.19 or later in the 20.x line, or Node.js 22.12 or later. Install the CLI in the project where you manage bundles:

npm install --save-dev @wvb/cli

Commands

Choose a command by the result you need:

CommandResult
packCreates a .wvb archive from a directory.
unpackLists archive entries and extracts their files.
serveServes an archive over HTTP for local inspection.
uploadUploads a bundle version through a configured uploader.
deployPublishes an uploaded version in an update.
downloadDownloads a bundle from the current update.
remote currentDisplays metadata for one deployed bundle.
remote listPrints the current update's bundle list as JSON.
remote localStarts a local remote server for development.
builtinInstalls bundles and a manifest for packaging with a native app.

Configuration and shared options

Commands that load configuration search the working directory for a wvb.config.* or webview-bundle.config.* file. JavaScript and TypeScript variants are supported, as are wvb.config.json and wvb.config.jsonc. For example, configure the directory to package and the archive path:

wvb.config.ts
import { defineConfig } from '@wvb/cli';

export default defineConfig({
  pack: {
    srcDir: './dist',
    outFile: './out/app.wvb',
  },
});

The following options control paths and configuration:

OptionApplies toBehavior
--cwd DIRAll except remote localSets the working directory for relative paths. Defaults to the process working directory.
--config FILE, -C FILEAll except unpack and remote localLoads a specific configuration file, relative to the working directory or absolute.

Replace DIR, FILE, and other uppercase placeholders in the option tables with your values. Boolean options support negation, such as --no-write. Only commands whose tables list an option accept it.

All commands accept these output options:

OptionBehavior
--color MODEUses auto, on, or off. Defaults to auto; also reads COLOR.
--log-level LEVELUses debug, info, warning, or error. Defaults to info; also reads LOG_LEVEL.
--log-verboseAdds timestamps, log categories, and error details. Defaults to false.
-h, --helpDisplays help for the specified command.

Command execution returns exit code 0 on success and 1 on failure.

pack

Creates a .wvb archive from the files in a directory. Usage:

wvb pack [SRC_DIR] [OPTIONS]

SRC_DIR defaults to pack.srcDir, then ./dist. The output path defaults to pack.outFile, then .wvb/NAME.wvb, where NAME is the nearest package.json name without its npm scope. Supply --outfile if neither is available.

Options:

OptionBehavior
--outfile FILE, --out-file FILE, -O FILESets the archive path. Appends .wvb if omitted.
--ignore GLOBExcludes matching files. Repeat to add patterns alongside pack.ignore.
--header GLOB NAME VALUE, -H GLOB NAME VALUEAdds a response header to matching entries. Repeat to add headers; CLI values override matching configured headers.
--writeWrites the archive. Defaults to true; --no-write builds it in memory and lists the files.
--overwriteReplaces an existing archive. Defaults to pack.overwrite, then true.

Package dist, excluding source maps, and add a cache header to HTML entries:

yarn wvb pack ./dist --outfile ./out/app.wvb \
  --ignore '**/*.map' --header '**/*.html' cache-control no-cache

The command prints the included files, output path, and archive size. It fails if there are no files to package.

unpack

Displays an archive's format version, entry paths, sizes, content types, and headers, then extracts its files. Usage:

wvb unpack FILE [OPTIONS]

FILE is required. The output directory defaults to .wvb/NAME, where NAME is the archive filename without .wvb.

Options:

OptionBehavior
--outdir DIR, -O DIRSets the extraction directory.
--writeExtracts files. Defaults to true; --no-write only displays archive information.
--cleanDeletes an existing output directory before extraction. Defaults to false; an existing directory otherwise causes an error.

Inspect an archive without extracting files:

wvb unpack ./out/app.wvb --no-write

serve

Starts an HTTP server that reads resources from one archive. Usage:

wvb serve [FILE] [OPTIONS]

FILE defaults to serve.file, then the output path resolved by pack.

Options:

OptionBehavior
--hostname HOST, -H HOSTSets the listening address; also reads HOSTNAME. Use 127.0.0.1 to restrict access to the local machine.
--port PORT, -P PORTSets the port. Reads PORT, then defaults to 4312.
--silentDisables request logs. Defaults to serve.silent, then false.
--path-resolver MODEUses exact, directory_index, or html_extension. Defaults to serve.pathResolver, then directory_index.

exact uses the requested path. For extensionless paths, directory_index maps /about to /about/index.html, and html_extension maps it to /about.html. Both of the latter modes map / to /index.html. A missing entry returns 404.

Serve the archive on the local machine:

wvb serve ./out/app.wvb --hostname 127.0.0.1 --port 4312

Open http://127.0.0.1:4312/ to inspect the content. Press Ctrl+C to stop the server. Set the port with --port or PORT; the CLI's default takes precedence over serve.port in the configuration file.

upload

Uploads one bundle version through remote.uploader. Configure a remote provider before running this command. Usage:

wvb upload [BUNDLE] [OPTIONS]

BUNDLE defaults to remote.bundleName, then the unscoped package name, then the archive filename. The version defaults to remote.version, then the package version. Both configuration fields also accept resolver functions.

Options:

OptionBehavior
--version VERSION, -V VERSIONSets the bundle version.
--file FILE, -F FILESets the archive path. Defaults to the output path resolved by pack.
--pack, -PPackages the source directory before uploading. Defaults to remote.packBeforeUpload, then true.
--skip-integritySkips hash generation. Otherwise, uses remote.integrity, which defaults to SHA-256.
--channel CHANNELAccepted, but has no effect on upload. Choose the channel with deploy.

Upload an existing archive without repackaging it:

wvb upload app --version 1.2.0 --file ./out/app.wvb --no-pack

The command prints the uploaded name, version, size, and integrity hash. Uploading does not change the version served to clients; run deploy to publish it.

The automatic packaging step uses pack.srcDir, pack.outFile, and pack.overwrite, but does not apply pack.ignore or pack.headers. To apply those settings, run pack first, then upload with --no-pack.

deploy

Publishes an uploaded bundle version through remote.deployer. Usage:

wvb deploy [BUNDLE] [OPTIONS]

BUNDLE defaults to remote.bundleName, then the unscoped package name. The version defaults to remote.version, then the package version. The configured deployer receives one bundle name/version pair and the selected channel.

Options:

OptionBehavior
--version VERSION, -V VERSIONSelects the uploaded version to publish.
--channel CHANNELSelects the release channel. Omit to use the default channel.

Deploy the uploaded version to the beta channel:

wvb deploy app --version 1.2.0 --channel beta
wvb remote current app --channel beta

The inspection command requires remote.baseUrl or --base-url. Deployment prints the bundle name, version, and channel. The CLI does not forward remote.signature to the deployer; see Signatures if clients require signed updates.

download

Downloads a bundle listed in the selected channel's current update. Usage:

wvb download [BUNDLE] VERSION [OPTIONS]

VERSION is a required positional argument. BUNDLE defaults to remote.bundleName, then the unscoped package name. The requested version must match the bundle in the current update; this command does not retrieve arbitrary historical versions.

Options:

OptionBehavior
--base-url URLSets the remote base URL. Defaults to remote.baseUrl; one is required.
--channel CHANNELSelects the update channel. Omit to use the default channel.
--out FILE, -O FILESets the destination. Defaults to BUNDLE.wvb in the working directory.
--writeSaves the bundle. Defaults to true; --no-write only checks that a matching entry exists in the current update.
--overwriteReplaces an existing destination file. Defaults to false.
--progressShows download progress. Defaults to true; use --no-progress to disable it.

For example:

wvb download app 1.2.0 --base-url https://updates.example.com \
  --channel beta --out ./downloads/app.wvb

Replace the example base URL with your remote's URL. The command prints the output path and file size. A missing bundle or mismatched version causes an error. The destination-file check also applies when using --no-write.

remote current

Displays metadata for one bundle in the current update without downloading the archive. Usage:

wvb remote current [BUNDLE] [OPTIONS]

BUNDLE defaults to remote.bundleName, then the unscoped package name.

Options:

OptionBehavior
--base-url URLSets the remote base URL. Defaults to remote.baseUrl; one is required.
--channel CHANNELSelects the update channel. Omit to use the default channel.

Check the deployed version using your configured base URL:

wvb remote current app --channel beta

The output includes the version, update ETag, integrity hash, and download URL. The command fails if the current update does not contain the bundle. Displaying an integrity hash does not verify the archive's bytes.

remote list

Prints the bundle entries in the current update as a JSON array. remote ls is an alias. Usage:

remote list [OPTIONS]

Options:

OptionBehavior
--base-url URLSets the remote base URL. Defaults to remote.baseUrl; one is required.
--channel CHANNELSelects the update channel. Omit to use the default channel.

remote local

Starts a remote server backed by a local directory for development and update testing. Usage:

wvb remote local [OPTIONS]

Options:

OptionBehavior
--base-dir DIRSets the storage directory. Defaults to ~/.wvb/local.
--hostname HOST, -H HOSTSets the listening address; also reads HOSTNAME.
--port PORT, -P PORTSets the port. Reads PORT, then defaults to 4313.

For example:

wvb remote local --base-dir ./.wvb/local \
  --hostname 127.0.0.1 --port 4313

The command prints the listening URL; press Ctrl+C to stop it. It does not load wvb.config.* or accept --config or --cwd.

To publish into this server's storage directory, install the local provider:

npm install --save-dev @wvb/remote-local

Add the provider and base URL to your configuration, keeping the storage directory the same as the server's --base-dir:

wvb.config.ts
import { defineConfig } from '@wvb/cli';
import { localRemote } from '@wvb/remote-local';

export default defineConfig({
  remote: {
    ...localRemote({ baseDir: './.wvb/local' }),
    baseUrl: 'http://127.0.0.1:4313',
  },
});

builtin

Installs bundles into a directory for inclusion in a native app. Usage:

wvb builtin [OPTIONS]

builtin.target selects the source:

  • remote (default): downloads bundles from the current update.
  • local: packages existing build output in the configured workspaces.

Options:

OptionBehavior
--out DIR, -O DIRSets the destination. Defaults to the platform preset, builtin.outDir, or .wvb/builtin/bundles, in that order.
--base-url URLSupplies the remote URL when builtin.target.baseUrl is unset. Falls back to remote.baseUrl. Remote targets only.
--channel CHANNELSelects the current update's channel. Remote targets only.
--include GLOBIncludes bundle names matching a pattern. Repeat to add patterns alongside builtin.include.
--exclude GLOBExcludes bundle names matching a pattern. Repeat to add patterns alongside builtin.exclude. Exclusions take precedence.
--writeWrites bundles and the manifest. Defaults to true; --no-write skips installation but can still download remote bundles to temporary files.
--cleanDeletes the destination before installation. Defaults to builtin.clean, then true.
--concurrency COUNTSets concurrent remote downloads. Defaults to available CPU parallelism, capped at eight; the minimum is one.
--progressShows remote download progress. Defaults to true.
--android[=DIR]Detects an Android application module or uses the specified module. Defaults the destination to src/main/assets/bundles in that module and checks its .wvb compression setting.
--ios[=DIR]Detects an iOS project or uses the specified project. Defaults the destination to its bundles directory and attempts to add a folder reference to Project.swift.

Use only one platform preset. --android checks Gradle configuration without editing it. --ios can edit a Tuist Project.swift; Xcode projects require you to add the resources yourself.

For example:

wvb builtin --out ./bundles --include app --channel beta

For local build output, configure the native project's target instead:

wvb.config.ts
import { defineConfig } from '@wvb/cli';

export default defineConfig({
  builtin: {
    outDir: './bundles',
    target: { type: 'local', workspaces: ['./web'] },
  },
});

Each workspace needs a bundle configuration file. Bundle names and versions come from the target's bundleName and version resolvers, or the workspace's package.json. After building web, run:

wvb builtin

The destination contains manifest.json and BUNDLE/VERSION.wvb files. For example, bundle app at version 1.2.0 produces app/1.2.0.wvb. Include the entire directory in the native app as described in your platform guide.

On this page