Skip to main content

Snaps subcommands

This reference describes the syntax of the Snaps command line interface (CLI) subcommands and subcommand options.

You can specify subcommands and their options using the yarn mm-snap command:

yarn mm-snap [SUBCOMMAND] [SUBCOMMAND OPTIONS]

b, build

yarn mm-snap build

Builds a Snap from source.

b is an alias for build.

analyze

yarn mm-snap build --analyze

Enables analyzing the Snap bundle. This uses webpack-bundle-analyzer under the hood, which creates an interactive visualization of the contents of your bundle. The visualization is located at the URL displayed in the command line output (for example, http://localhost:8888).

info

This option requires @metamask/snaps-cli version 6.7.0 or later.

c, config

yarn mm-snap build --config <FILE>

Path to the configuration file, which specifies options with which to the build the Snap.

-c is an alias for --config.

e, eval

yarn mm-snap eval

Attempts to evaluate the Snap bundle in Secure ECMAScript (SES).

e is an alias for eval.

m, manifest

yarn mm-snap manifest

Validates the Snap manifest file.

m is an alias for manifest.

fix

yarn mm-snap manifest --fix

Enables making any changes to fix the manifest file.

s, serve

yarn mm-snap serve

Locally serves Snap files for testing.

s is an alias for serve.

p, port

yarn mm-snap serve --port <PORT>

The local server port for testing. The default is 8081.

-p is an alias for --port.

w, watch

yarn mm-snap watch

Rebuilds a Snap from source upon changes.

w is an alias for watch.

p, port

yarn mm-snap watch --port <PORT>

The local server port for testing. The default is 8081.

-p is an alias for --port.

Global options

h, help

-h, --help

Displays the help message and exits. You can use this option with mm-snap or any subcommand.

-h is an alias for --help.

version

--version

Displays the version number and exits.