Skip to content

feat(motoko): migrate templates to @dfinity/motoko@v5.0.0 and bump moc to 1.9.0#28

Merged
marc0olo merged 3 commits into
mainfrom
feat/motoko-v5-mops-canisters
Jun 11, 2026
Merged

feat(motoko): migrate templates to @dfinity/motoko@v5.0.0 and bump moc to 1.9.0#28
marc0olo merged 3 commits into
mainfrom
feat/motoko-v5-mops-canisters

Conversation

@marc0olo

@marc0olo marc0olo commented May 26, 2026

Copy link
Copy Markdown
Member

Summary

Migrates all three Motoko templates to @dfinity/motoko@v5.0.0, which delegates compilation to mops build and requires canister definitions to live in mops.toml. Also bumps the moc toolchain to 1.9.0 across all templates.

Templates updated:

  • motoko/ — upgrades recipe to v5.0.0; adds [canisters] in mops.toml; removes main/candid from icp.yaml
  • hello-world/motoko-backend/ — upgrades recipe to v5.0.0; adds [canisters.backend] in mops.toml; removes main/candid from canister.yaml
  • bitcoin-starter/motoko-backend/ — same as hello-world; preserves existing [dependencies] section

Closes #27

Migration guide (before/after)

Before (icp.yaml / canister.yaml) After (mops.toml)
main: src/main.mo [canisters.backend] main = "src/main.mo"
candid: backend.did [canisters.backend] candid = "backend.did"
args: --incremental-gc [canisters.backend] args = ["--incremental-gc"]

The canister name in icp.yaml is used automatically — no name: param needed in the recipe configuration.

Testing

Verified with icp new --branch feat/motoko-v5-mops-canisters for all three templates:

Template Build Deploy
motoko
hello-world (motoko backend + react frontend)
bitcoin-starter (motoko backend) — (requires Bitcoin daemon; mops build confirmed)

🤖 Generated with Claude Code

marc0olo added a commit to dfinity/icp-cli-recipes that referenced this pull request Jun 9, 2026
## Summary

- Replaces direct `moc` invocation with `mops build`, aligning the
Motoko recipe with how the Rust recipe delegates to `cargo build`
- Toolchain, dependencies, compiler flags, candid, and per-canister args
all move to `mops.toml` — the recipe retains only icp-specific concerns
(output path, `moc:version`/`template:type` metadata, shrink, compress)
- Removes `main`, `candid`, and `args` recipe params — no replacement
needed, the canister name is injected automatically via
`{{_.canister.name}}`

## Breaking change

| Removed from `icp.yaml` | Moves to `mops.toml` |

|--------------------------|---------------------------------------------------|
| `main: src/main.mo` | `[canisters.backend] main = "src/main.mo"` |
| `candid: backend.did` | `[canisters.backend] candid = "backend.did"` |
| `args: --default-persistent-actors` | `[canisters.backend] args =
["--default-persistent-actors"]` |

New `icp.yaml` — no `configuration:` block needed:
```yaml
canisters:
  - name: backend
    recipe:
      type: "@dfinity/motoko@<version>"
```

New `mops.toml` — canister name must match `icp.yaml`:
```toml
[toolchain]
moc = "1.9.0"

[canisters.backend]
main = "src/main.mo"
candid = "backend.did"
```

## Test plan

- [ ] Build a canister using `mops build` with a matching `[canisters]`
entry in `mops.toml`
- [ ] Confirm `moc:version` and `template:type` metadata are present in
the output WASM
- [ ] Confirm `[moc] args` from `mops.toml` are respected (e.g.
`--default-persistent-actors`)
- [ ] Confirm `shrink` and `compress` options still work
- [ ] Confirm a clear error is shown when the `[canisters]` entry is
missing

> **Note:** `icp-cli-templates` needs a follow-up update to add
`[canisters]` to all Motoko `mops.toml` files. Tracked in
dfinity/icp-cli-templates#27 / dfinity/icp-cli-templates#28.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
@marc0olo marc0olo marked this pull request as ready for review June 9, 2026 16:56
@marc0olo marc0olo requested a review from a team as a code owner June 9, 2026 16:56
marc0olo and others added 3 commits June 11, 2026 21:21
…recipe

Move canister definitions (main, candid) from icp.yaml/canister.yaml into
mops.toml [canisters] sections and replace main/candid recipe params with
a single `name` param, as required by the new mops build-based recipe.
Bumps moc toolchain to 1.8.2 across all three Motoko templates.

Closes #27

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
With _.canister.name now injected automatically by icp-cli (see
dfinity/icp-cli#567), the `name` configuration param is no longer
needed in recipe configs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@marc0olo marc0olo force-pushed the feat/motoko-v5-mops-canisters branch from b78f22c to f061873 Compare June 11, 2026 19:21
@marc0olo marc0olo changed the title feat(motoko): migrate templates to @dfinity/motoko@v5.0.0 mops-build recipe feat(motoko): migrate templates to @dfinity/motoko@v5.0.0 and bump moc to 1.9.0 Jun 11, 2026
@marc0olo marc0olo merged commit 984e654 into main Jun 11, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update Motoko templates for new mops build-based recipe

2 participants