Skip to content

feat: add icp-cli support for motoko/hello_world#1308

Merged
marc0olo merged 3 commits intomasterfrom
marc0olo/icp-cli-motoko-hello-world
Feb 27, 2026
Merged

feat: add icp-cli support for motoko/hello_world#1308
marc0olo merged 3 commits intomasterfrom
marc0olo/icp-cli-motoko-hello-world

Conversation

@marc0olo
Copy link
Member

Summary

  • Add icp.yaml configuration for icp-cli alongside existing dfx.json
  • Migrate frontend from @dfinity/agent to @icp-sdk/core with @icp-sdk/bindgen for auto-generating TypeScript bindings from the Candid interface
  • Add backend/backend.did as a committed interface definition (used by bindgen at build time)
  • Frontend vite.config.js auto-detects icp-cli vs dfx for the dev server
  • Update README.md with overview, icp-cli instructions, and Candid regeneration guide
  • Replace 114-line BUILD.md with concise icp-cli version
  • Update mops.toml with [toolchain] section
  • Add **/frontend/src/bindings/ to .gitignore for bindgen output

Add icp.yaml configuration for icp-cli alongside existing dfx.json.
Migrate frontend from @dfinity/agent to @icp-sdk/core and use
@icp-sdk/bindgen for auto-generating TypeScript bindings from the
Candid interface. Update README.md and BUILD.md with icp-cli
instructions.
@marc0olo marc0olo requested review from a team as code owners February 26, 2026 13:22
- Remove HttpAgent import — createActor accepts agentOptions.rootKey directly
- Remove fetchRootKey() — asset canister (SDK ≥0.30.2) sets ic_env cookie
  with root key on all HTML responses, eliminating the need for runtime fetch
- Unify vite dev server: dfx path now also sets ic_env cookie (via dfx ping
  for root key + dfx canister id for backend canister ID)
- Keep process.env.CANISTER_ID_BACKEND fallback for dfx production builds
  (dfx does not inject PUBLIC_CANISTER_ID:* env vars into asset canister)
@marc0olo marc0olo requested a review from viviveevee February 27, 2026 10:05
Replace manual regex-based .env parsing and the unsafe
define: { "process.env": process.env } (which leaked all env vars into
the bundle) with Vite's built-in loadEnv scoped to CANISTER_* prefix.
Also remove unused DFX_NETWORK define (no longer referenced after
removing fetchRootKey).
@marc0olo marc0olo merged commit d7a6012 into master Feb 27, 2026
7 checks passed
@marc0olo marc0olo deleted the marc0olo/icp-cli-motoko-hello-world branch February 27, 2026 11:57
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.

2 participants