Socket
Socket
Sign inDemoInstall

mo-dev

Package Overview
Dependencies
16
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    mo-dev

A live reload development server for Motoko smart contracts.


Version published
Weekly downloads
55
increased by66.67%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

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

Make sure that Node.js >= 16.x is installed on your system, and then run the following command:

npm i -g mo-dev

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

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

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.

Keywords

FAQs

Last updated on 17 May 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc