Skip to content

Commit

Permalink
Document Snaps CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandratran committed Feb 12, 2023
1 parent 7dc8bc9 commit 202ab52
Show file tree
Hide file tree
Showing 8 changed files with 721 additions and 17 deletions.
5 changes: 0 additions & 5 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,6 @@ const config = {
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
docs: {
sidebar: {
hideable: true,
},
},
navbar: {
title: "MetaMask docs",
hideOnScroll: true,
Expand Down
14 changes: 13 additions & 1 deletion snaps-sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,19 @@ const sidebar = {
items: [
"reference/rpc-api",
"reference/exports",
"reference/options",
{
type: "category",
label: "Snaps CLI",
collapsed: true,
link: {
type: "doc",
id: "reference/cli/index",
},
items: [
"reference/cli/options",
"reference/cli/subcommands",
],
},
],
},
],
Expand Down
9 changes: 4 additions & 5 deletions snaps/concepts/anatomy.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const hello = await ethereum.request({
console.log(hello); // 'world!'
```

The snap's RPC API is completely up to you, so long as it's a valid
The snap's RPC API is completely up to you, as long as it's a valid
[JSON-RPC](https://www.jsonrpc.org/specification) API.

:::tip Does my snap need to have an RPC API?
Expand Down Expand Up @@ -151,15 +151,14 @@ details the requirements of both `snap.manifest.json` and its relationship to `p
You might need to modify some manifest fields manually.
For example, if you change the location of the (optional) icon SVG file, you must update
`source.location.npm.iconPath` to match.
You can also use the [command line](../reference/options.md) to update some fields for you.
You can also use the [command line](../reference/cli/options.md) to update some fields for you.
For example, `mm-snap build` or `mm-snap manifest --fix` updates `source.shasum`.

## Configuration file

The snap configuration file, `snap.config.js`, should be placed in the project root directory.
You can override [CLI options](../reference/options.md) in the configuration file by specifying
string keys matching command arguments in the property `cliOptions`.
Values become argument defaults, which you can still override on the command line.
You can override the default values of the [Snaps CLI options](../reference/cli/options.md) by specifying
them in the `cliOptions` property of the configuration file.
For example:

```javascript
Expand Down
4 changes: 2 additions & 2 deletions snaps/get-started/install-snaps.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ You can then [get started quickly using the Snaps template](quickstart.md).
## Prerequisites

- Up-to-date Chromium or Firefox browser
- [Node.js](https://nodejs.org/)
- [Node.js](https://nodejs.org/) version 16 or later
- [npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) or [Yarn](https://yarnpkg.com/)

## Install MetaMask Flask
Expand All @@ -26,7 +26,7 @@ Running multiple instances of MetaMask in the same browser profile breaks dapp i

## Install the Snaps CLI

The [Snaps CLI](../reference/options.md) provides commands for initiating a snap project and building,
The [Snaps CLI](../reference/cli/index.md) provides commands for initiating a snap project and building,
executing, and serving your snap for local development.

In a terminal window, install the CLI globally using npm or Yarn:
Expand Down
14 changes: 14 additions & 0 deletions snaps/reference/cli/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Snaps command line interface

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

Make sure to [install the Snaps CLI](../../get-started/install-snaps.md#install-the-snaps-cli).

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

```bash
mm-snap [SUBCOMMAND] [OPTIONS]
```

You can also override the default values of the options by specifying them in the
[configuration file](../../concepts/anatomy.md#configuration-file).
Loading

0 comments on commit 202ab52

Please sign in to comment.