Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Package manager for the Motoko programming language

License

NotificationsYou must be signed in to change notification settings

ZenVoich/mops

Repository files navigation

Mops is a package manager for the Motoko programming language.

Setup

1. Check system requirements

2. Install CLI tool

curl -fsSL cli.mops.one/install.sh | sh

or

npm i -g ic-mops

Install Packages

1. Configure dfx.json

Addmops as a packtool to yourdfx.json

{"defaults": {"build": {"packtool":"mops sources"    }  }}

2. Initialize

Run this command in the root directory of your project (where isdfx.json placed)

mops init

3. Install Motoko Packages

Usemops add <package_name> to install a specific package and save it tomops.toml

mops add base

You can also add packages from GitHub like this

mops add https://github.com/dfinity/motoko-base

For GitHub-packages you can specify branch, tag, or commit hash by adding#<branch/tag/hash>

mops add https://github.com/dfinity/motoko-base#moc-0.9.1

You can also add local packages like this (put source files insidesrc directory)

mops add ./shared

Usemops install to install all packages specified inmops.toml

mops install

4. Import Package

Now you can import installed packages in your Motoko code

importPackageName"mo:<package_name>";

for example

importItertools"mo:itertools/Iter";

Publish a Package

1. Import Identity

Create new identity to publish packages

dfx identity new mops

Import identity intomops

mops user import -- "$(dfx identity export mops)"

2. Initialize

Run this command in your package root and select type "Package"

mops init

Editdescription andrepository fields inmops.toml file.

Write your package code in*.mo source files in thesrc/ directory.

CreateREADME.md file with information on how to use your package.

3. Publish

Publish package to the mops registry!

mops publish

Built for theSupernova Hackathon


[8]ページ先頭

©2009-2025 Movatter.jp