Skip to content

Latest commit

 

History

History
72 lines (49 loc) · 2.18 KB

README.md

File metadata and controls

72 lines (49 loc) · 2.18 KB

The Motoko base library

This repository contains the Motoko base library. It is intended to be used with the moc compiler (and tools that wrap it, like dfx).

Usage

If you are installing Motoko through the DFINITY SDK releases, then this base library is already included.

If you build your project using the Vessel package manager your package-set most likely already includes base, but if it doesn't or you want to override its version, add an entry like so to your package-set.dhall:

  {
    name = "base",
    repo = "https://github.com/dfinity/motoko-base",
    version = "master",
    dependencies = [] : List Text
  }

The package name "base" appears when importing its modules in Motoko (e.g., import "mo:base/Nat"). The repo may either be your local clone path, or this public repository url, as above. The version can be any git branch or tag name (such as version = "moc-0.8.4"). There are no dependencies. See the Vessel package manager docs for more details.

Building & Testing

Run the following commands to configure your local development branch:

# First-time setup
git clone https://github.com/dfinity/motoko-base
cd motoko-base
npm install

# Run tests
npm test

# Run formatter
npm run prettier:format

The test runner will automatically detect the moc compiler from your system path or dfx installation.

Running the tests locally also requires Wasmtime and Vessel to be installed on your system.

Documentation

The documentation can be generated in doc/ by running

./make_docs.sh

which creates _out/html/index.html.

The next-moc branch

The next-moc branch contains changes that make base compatible with the in-development version of moc. This repository's public CI does not run on that branch.

External contributions are best made against master.

Contributing

Please read the Interface Design Guide for Motoko Base Library before making a pull request.