Skip to content

Commit

Permalink
[DFX] Upgrade dfx to 0.15, NextJS to 13.5
Browse files Browse the repository at this point in the history
* start using declaration node_compatibiltiy for canister UI declaration generation for better compatibility with NextJS usage
* update README
  • Loading branch information
kinwo committed Sep 20, 2023
1 parent cf7e12e commit b139db7
Show file tree
Hide file tree
Showing 6 changed files with 1,412 additions and 1,126 deletions.
14 changes: 3 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ This project provides a simple starter template for Dfinity Internet Computer us

**The Most Recent Updates**

- NextJS 13.3
- DFX 0.13.1
- NextJS 13.5
- DFX 0.15
- NodeJS 18.16

**Backend**
Expand Down Expand Up @@ -131,17 +131,9 @@ Update HELLO_CANISTER_ID to NEXT_PUBLIC_HELLO_CANISTER_ID:
export const canisterId = process.env.NEXT_PUBLIC_HELLO_CANISTER_ID
```

Also delete the export line at the bottom so that it won't create actor during NextJS server side compilation when you run in next dev mode.

```
export const hello = createActor(canisterId);
```

Repeat the same for ui/declarations/image/index.js.

To see the final code, check the original ui/declarations in the Git repo.

The generate UI declarations also support TypeScript if you prefer TypeScript.
The generated UI declarations also support TypeScript if you prefer TypeScript.

We use a service locator pattern through actor-locator.js that will handle the dfx agent host using env var NEXT_PUBLIC_IC_HOST.

Expand Down
14 changes: 11 additions & 3 deletions dfx.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
{
"canisters": {
"hello": {
"main": "backend/service/Hello.mo"
"main": "backend/service/Hello.mo",
"type": "motoko",
"declarations": {
"node_compatibility": true
}
},
"image": {
"main": "backend/service/Image.mo"
"main": "backend/service/Image.mo",
"type": "motoko",
"declarations": {
"node_compatibility": true
}
},
"hello_assets": {
"dependencies": ["hello"],
Expand All @@ -15,6 +23,6 @@
"type": "assets"
}
},
"dfx": "0.13.1",
"dfx": "0.15.0",
"version": 1
}
Loading

0 comments on commit b139db7

Please sign in to comment.