0.13.0 • Published 13 days ago

mo-dev v0.13.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
13 days ago

mo-dev  npm version GitHub license PRs Welcome

A live reload development server for Motoko smart contracts.


mo-dev is a flexible command-line tool for speeding up your Motoko development workflow.

Try Online

Get started with a full-stack Vite + React + Motoko project directly in your browser:

Open in Gitpod

Quick Start

Run the following command (requires Node.js ≥ 16):

npm i -g mo-dev

Note: standalone mo-dev binaries are also available as GitHub releases.

Once installed, view the available command-line options by passing the --help flag:

mo-dev --help

Check out the Vite + React + Motoko starter project for an example of how to integrate mo-dev into a modern full-stack webapp.

Basic Features

Regenerate type declarations on Motoko file change (--generate or -g):

mo-dev --generate

Deploy canisters on Motoko file change (--deploy or -d):

mo-dev --deploy

Automatically respond "yes" to reinstall prompts (--yes or -y; may clear canister state):

mo-dev --deploy -y

Run unit tests (*.test.mo) on Motoko file change (--test or -t):

mo-dev --test

Run an arbitrary command on Motoko file change (--exec or -x):

mo-dev --exec 'npm run my-reload-script'

Specify the working directory (--cwd or -C; should contain a dfx.json file):

mo-dev --cwd path/to/dfx_project

Only run the dev server for specific canisters (--canister or -c):

mo-dev --canister foo --canister bar --deploy

Pass an installation argument to dfx deploy (--argument or -a):

mo-dev --deploy --argument '()'

Advanced Features

Show additional debug output in the console (--verbose or -v):

mo-dev -v # more verbose
mo-dev -vv # extra verbose

Programmatically start mo-dev using JavaScript:

import devServer from 'mo-dev';

// Default settings
devServer();

// Custom settings
devServer({
    directory: '.',
    port: 7700,
    verbosity: 0,
    // ...
});

mo-test

The mo-dev npm package includes a mo-test command which can be used to run unit tests in CI workflows.

View all available options:

mo-test --help

Run all Motoko unit tests (*.test.mo):

mo-test

Run all Motoko unit tests using a WASI runtime by default (faster but requires installing Wasmtime on your system):

mo-test --testmode wasi

Configure the runtime of an individual unit test by including the following comment in a *.test.mo file:

// @testmode wasi

Run specific unit tests by passing a file name prefix (-f or --testfile):

mo-test -f Foo -f Bar # (only run tests for files starting with `Foo` or `Bar`)

These options may also be passed directly into the mo-dev command (e.g. mo-dev --testmode wasi -f SomeTest).


mo-dev is early in development. Please feel free to report a bug, ask a question, or request a feature on the project's GitHub issues page.

Contributions are welcome! Please check out the contributor guidelines for more information.

0.13.0

13 days ago

0.12.0

6 months ago

0.11.0

10 months ago

0.10.1

11 months ago

0.11.1

10 months ago

0.11.2

9 months ago

0.10.0

11 months ago

0.9.0

11 months ago

0.7.2

12 months ago

0.8.0

11 months ago

0.6.3

1 year ago

0.7.1

12 months ago

0.6.2

1 year ago

0.6.4

1 year ago

0.7.0

12 months ago

0.6.1

1 year ago

0.6.0

1 year ago

0.5.4

1 year ago

0.4.5

1 year ago

0.5.3

1 year ago

0.4.4

1 year ago

0.5.5

1 year ago

0.5.0

1 year ago

0.4.1

1 year ago

0.4.0

1 year ago

0.5.2

1 year ago

0.4.3

1 year ago

0.5.1

1 year ago

0.4.2

1 year ago

0.3.3

1 year ago

0.3.2

1 year ago

0.3.1

1 year ago

0.3.0

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago