Skip to content

Commit

Permalink
Cli doc (#248)
Browse files Browse the repository at this point in the history
* doc: add cli docs in getting started

* fix(docs): fix docs link
  • Loading branch information
vivianjeng authored Oct 31, 2024
1 parent dc5609b commit 1bc288d
Show file tree
Hide file tree
Showing 20 changed files with 160 additions and 22 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ To learn more about mopro, please refer to the documentation at [zkmopro](https:
## Getting started

- Make sure you've installed the [prerequisites](https://zkmopro.org/docs/prerequisites).
- Getting started with this [tutorial](https://zkmopro.org/docs/getting-started/rust-setup).
- Getting started with this [tutorial](https://zkmopro.org/docs/getting-started).

## Run tests

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/adapters/circom.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Explore how the Circom adapter is implemented by checking out this sample projec

## Setup the rust project

You can follow the instructions in the [Rust Setup](/getting-started/rust-setup.md) guide to create a new Rust project that builds this library with Circom proofs.
You can follow the instructions in the [Rust Setup](/setup/rust-setup.md) guide to create a new Rust project that builds this library with Circom proofs.

In your `Cargo.toml` file, ensure the `circom` feature is activated for `mopro-ffi`:

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/adapters/halo2.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Explore how the Halo2 adapter is implemented by checking out this [Sample Mopro

## Setting Up the Rust Project

You can start by following the general instructions in the [Rust Setup Guide](/getting-started/rust-setup.md) to create a new Rust project for building libraries with Circom proofs. However, you will need to perform these specific adjustments for Halo2:
You can start by following the general instructions in the [Rust Setup Guide](/setup/rust-setup.md) to create a new Rust project for building libraries with Circom proofs. However, you will need to perform these specific adjustments for Halo2:

In your `Cargo.toml` file, ensure the `halo2` feature is activated for `mopro-ffi`:

Expand Down
64 changes: 64 additions & 0 deletions docs/docs/getting-started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Getting started

This tutorial guides you through building a static library with the Circom/Halo2 adapter for Android and iOS and creating example templates for mobile development.

## 0. Prerequisites

Make sure you've installed the [prerequisites](/docs/prerequisites).

## 1. Install CLI

Clone the `mopro` repository and install the `mopro` CLI tool.

```sh
git clone https://github.com/zkmopro/mopro
cd mopro/cli
cargo install --path .
cd ../..
```

## 2. Initialize adapters

Navigate to the folder where you want to build the app. Select the adapters using the `mopro` CLI.

```sh
mopro init
```

## 3. Build bindings

Navigate to your project directory. (e.g. `cd mopro-example-app`) <br/>
Build bindings for specific targets (iOS, Android).

```sh
mopro build
```

:::warning
The process of building bindings may take a few minutes.
:::

:::info
Running your project in `release` mode significantly enhances performance compared to `debug` mode. This is because the Rust compiler applies optimizations that improve runtime speed and reduce binary size, making your application more efficient.

:::

## 4. Create templates

Create templates for developing your mobile app.

```sh
mopro create
```

Follow the instructions to open development tools

For iOS:
```sh
open ios/MoproApp.xcodeproj
```

For Android
```sh
open android -a Android\ Studio
```
2 changes: 1 addition & 1 deletion docs/docs/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ How? Mopro connects different adapters with different platforms. You can think o

Note that above is a work in progress, and the dashed lines indicate things that are still experimental and/or in an an early stage.

If you just want to get started using mopro, see [getting started](getting-started/rust-setup).
If you just want to get started using mopro, see [getting started](getting-started).

## Overview

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Android Setup

After you've completed the [Rust setup](docs/getting-started/rust-setup.md) you should be able to run `cargo run --bin android`. This will create a new folder called `MoproAndroidBindings`. It should look like the structure
After you've completed the [Rust setup](docs/setup/rust-setup.md) you should be able to run `cargo run --bin android`. This will create a new folder called `MoproAndroidBindings`. It should look like the structure

```sh
MoproAndroidBindings
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# iOS Setup

Once you've completed the [Rust setup](docs/getting-started/rust-setup.md) you should be able to run `cargo run --bin ios`. This will create a new folder called `MoproiOSBindings`. Inside this folder there should be a file named `mopro.swift` and a folder named `MoproBindings.xcframework`.
Once you've completed the [Rust setup](docs/setup/rust-setup.md) you should be able to run `cargo run --bin ios`. This will create a new folder called `MoproiOSBindings`. Inside this folder there should be a file named `mopro.swift` and a folder named `MoproBindings.xcframework`.

## Demo video of this tutorial

Expand Down
File renamed without changes.
File renamed without changes.
15 changes: 10 additions & 5 deletions docs/sidebars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,18 @@ const sidebars: SidebarsConfig = {
id: 'prerequisites',
},
{
type: 'category',
type: 'doc',
label: 'Getting Started',
id: 'getting-started',
},
{
type: 'category',
label: 'Setup',
items: [
'getting-started/rust-setup',
'getting-started/ios-setup',
'getting-started/android-setup',
'getting-started/react-native-setup'
'setup/rust-setup',
'setup/ios-setup',
'setup/android-setup',
'setup/react-native-setup'
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion docs/versioned_docs/version-0.1.0/adapters/circom.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Explore how the Circom adapter is implemented by checking out this sample projec

## Setup the rust project

You can follow the instructions in the [Rust Setup](/getting-started/rust-setup.md) guide to create a new Rust project that builds this library with Circom proofs.
You can follow the instructions in the [Rust Setup](/setup/rust-setup.md) guide to create a new Rust project that builds this library with Circom proofs.

In your `Cargo.toml` file, ensure the `circom` feature is activated for `mopro-ffi`:

Expand Down
2 changes: 1 addition & 1 deletion docs/versioned_docs/version-0.1.0/adapters/halo2.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Explore how the Halo2 adapter is implemented by checking out this [Sample Mopro

## Setting Up the Rust Project

You can start by following the general instructions in the [Rust Setup Guide](/getting-started/rust-setup.md) to create a new Rust project for building libraries with Circom proofs. However, you will need to perform these specific adjustments for Halo2:
You can start by following the general instructions in the [Rust Setup Guide](/setup/rust-setup.md) to create a new Rust project for building libraries with Circom proofs. However, you will need to perform these specific adjustments for Halo2:

In your `Cargo.toml` file, ensure the `halo2` feature is activated for `mopro-ffi`:

Expand Down
64 changes: 64 additions & 0 deletions docs/versioned_docs/version-0.1.0/getting-started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Getting started

This tutorial guides you through building a static library with the Circom/Halo2 adapter for Android and iOS and creating example templates for mobile development.

## 0. Prerequisites

Make sure you've installed the [prerequisites](/docs/prerequisites).

## 1. Install CLI

Clone the `mopro` repository and install the `mopro` CLI tool.

```sh
git clone https://github.com/zkmopro/mopro
cd mopro/cli
cargo install --path .
cd ../..
```

## 2. Initialize adapters

Navigate to the folder where you want to build the app. Select the adapters using the `mopro` CLI.

```sh
mopro init
```

## 3. Build bindings

Navigate to your project directory. (e.g. `cd mopro-example-app`) <br/>
Build bindings for specific targets (iOS, Android).

```sh
mopro build
```

:::warning
The process of building bindings may take a few minutes.
:::

:::info
Running your project in `release` mode significantly enhances performance compared to `debug` mode. This is because the Rust compiler applies optimizations that improve runtime speed and reduce binary size, making your application more efficient.

:::

## 4. Create templates

Create templates for developing your mobile app.

```sh
mopro create
```

Follow the instructions to open development tools

For iOS:
```sh
open ios/MoproApp.xcodeproj
```

For Android
```sh
open android -a Android\ Studio
```
2 changes: 1 addition & 1 deletion docs/versioned_docs/version-0.1.0/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ How? Mopro connects different adapters with different platforms. You can think o

Note that above is a work in progress, and the dashed lines indicate things that are still experimental and/or in an an early stage.

If you just want to get started using mopro, see [getting started](getting-started/rust-setup).
If you just want to get started using mopro, see [getting started](getting-started).

## Overview

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Android Setup

After you've completed the [Rust setup](docs/getting-started/rust-setup.md) you should be able to run `cargo run --bin android`. This will create a new folder called `MoproAndroidBindings`. It should look like the structure
After you've completed the [Rust setup](docs/setup/rust-setup.md) you should be able to run `cargo run --bin android`. This will create a new folder called `MoproAndroidBindings`. It should look like the structure

```sh
MoproAndroidBindings
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# iOS Setup

Once you've completed the [Rust setup](docs/getting-started/rust-setup.md) you should be able to run `cargo run --bin ios`. This will create a new folder called `MoproiOSBindings`. Inside this folder there should be a file named `mopro.swift` and a folder named `MoproBindings.xcframework`.
Once you've completed the [Rust setup](docs/setup/rust-setup.md) you should be able to run `cargo run --bin ios`. This will create a new folder called `MoproiOSBindings`. Inside this folder there should be a file named `mopro.swift` and a folder named `MoproBindings.xcframework`.

## Demo video of this tutorial

Expand Down
15 changes: 10 additions & 5 deletions docs/versioned_sidebars/version-0.1.0-sidebars.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,18 @@
"id": "prerequisites"
},
{
"type": "category",
"type": "doc",
"label": "Getting Started",
"id": "getting-started"
},
{
"type": "category",
"label": "Setup",
"items": [
"getting-started/rust-setup",
"getting-started/ios-setup",
"getting-started/android-setup",
"getting-started/react-native-setup"
"setup/rust-setup",
"setup/ios-setup",
"setup/android-setup",
"setup/react-native-setup"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion mopro-ffi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Mopro is a toolkit for ZK app development on mobile. Mopro makes client-side pro
## Getting started

- Make sure you've installed the [prerequisites](https://zkmopro.org/docs/prerequisites).
- Getting started with this [tutorial](https://zkmopro.org/docs/getting-started/rust-setup).
- Getting started with this [tutorial](https://zkmopro.org/docs/getting-started).

## Run tests

Expand Down

0 comments on commit 1bc288d

Please sign in to comment.