| sidebar_label | sidebar_position | toc_max_heading_level | description |
|---|---|---|---|
Snaps CLI |
3 |
4 |
See the Snaps CLI subcommands reference. |
import Tabs from "@theme/Tabs"; import TabItem from "@theme/TabItem";
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]:::note
This documentation assumes you created your Snap using the @metamask/create-snap starter kit, which includes the Snaps CLI.
You can also install the CLI directly using the @metamask/snaps-cli package.
:::
yarn mm-snap buildBuilds a Snap from source.
b is an alias for build.
yarn mm-snap build --analyzeEnables 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.
:::
yarn mm-snap build --config <FILE>yarn mm-snap build --config ./snap.config.build.tsPath to the configuration file, which specifies options with which to the build the Snap.
-c is an alias for --config.
yarn mm-snap evalAttempts to evaluate the Snap bundle in Secure ECMAScript (SES).
e is an alias for eval.
yarn mm-snap manifestValidates the Snap manifest file.
m is an alias for manifest.
yarn mm-snap manifest --fixEnables making any changes to fix the manifest file.
yarn mm-snap sandboxStarts a Snaps sandbox server, where you can interact with and test a Snap.
:::info
This option requires @metamask/snaps-cli version 7.1.0 or later.
:::
yarn mm-snap serveLocally serves Snap files for testing.
s is an alias for serve.
yarn mm-snap serve --port <PORT>yarn mm-snap serve --port 9000The local server port for testing.
The default is 8081.
-p is an alias for --port.
yarn mm-snap watchRebuilds a Snap from source upon changes.
w is an alias for watch.
yarn mm-snap watch --port <PORT>yarn mm-snap watch --port 9000The local server port for testing.
The default is 8081.
-p is an alias for --port.
-h, --helpDisplays the help message and exits.
You can use this option with mm-snap or any subcommand.
-h is an alias for --help.
--versionDisplays the version number and exits.