You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+31-15Lines changed: 31 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -120,6 +120,20 @@ Install and activate the correct version of PNPM:
120
120
corepack enable
121
121
```
122
122
123
+
### Working on WASM crates
124
+
125
+
Until Cargo supports [per package targets](https://github.com/rust-lang/cargo/issues/9406), the WASM crates are excluded from the `default_members` array of the Cargo workspace.
126
+
Commands such as `cargo build` and `cargo check` will not include these crates, so they must be built separately with the corresponding `pnpm` command listed under [projects](#projects).
127
+
128
+
Since `rust-analyzer` will also apply the same target to all crates, these crates will show errors in the IDE. To workaround this, create a `.cargo/config.toml` file:
129
+
130
+
```toml
131
+
[build]
132
+
target = "wasm32-unknown-unknown"
133
+
```
134
+
135
+
While this file exists, some of the non-WASM crates will show errors instead. Delete the file to work on the non-WASM crates.
136
+
123
137
### Making a Commit
124
138
125
139
```shell
@@ -134,24 +148,26 @@ See [Conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) for m
134
148
- Add the package's package manager file to the `version_files` field in `.cz.yaml`.
135
149
-`package.json` for NPM packages
136
150
-`Cargo.toml` for Cargo crates
137
-
- Set the initial version of the package in its package manager file to match the current version in the `version` field in `.cz.yaml`.
138
-
- Add the package's package manager file(s) to the `add-paths` property in the `Create Pull Request` job of the `Create Release PR` workflow in `.github/workflows/create-release-pr.yml`.
151
+
- Set the initial version of the package in its package manager file to match the current version in the `version` field in `.cz.yaml`
152
+
- For `package.json`, set the version manually
153
+
- For `Cargo.toml`, use `version.workspace = true`
154
+
- Add the package's package manager file(s) to the `add-paths` property in the `Create Pull Request` job of the `Create Release PR` workflow in `.github/workflows/create-release-pr.yml`
139
155
-`package.json` for NPM packages
140
-
-`Cargo.toml` and `Cargo.lock` for Cargo crates that are compiled to WASM (they are excluded from the root workspace), non-WASM Cargo crates (they are part of the root workspace) only need `Cargo.toml`
156
+
-No files need to be added for Cargo crates
141
157
- If the package is a Rust crate:
142
-
- Add the package to the `members` section in `Cargo.toml`.
143
-
- If the package must be compiled to WASM then add it to the `exclude` section instead.
144
-
- Add a `Release ic-<package-name> Cargo crate` job to the `Release` workflow in `.github/workflows/release.yml`.
145
-
- Add `target/package/ic-<package-name>-${{ github.ref_name }}.crate` to the `artifacts` property in the `Create Github release` job of the `Create Release PR` workflow in `.github/workflows/create-release-pr.yml`.
146
-
- Make sure every entry except the last is comma delimited.
147
-
- If the crate has dependenencies in this repository, make sure it is published _after_ the dependencies.
148
-
- If the crate has dependent in this repository, make sure it is published _before_ the dependents.
158
+
- Add the package to the `members` section in `Cargo.toml` and the `default-members` section
159
+
- If the package must be compiled to WASM then do not add it to the `default-members` section
160
+
- Add a `Release ic-<package-name> Cargo crate` job to the `Release` workflow in `.github/workflows/release.yml`
161
+
- Add `target/package/ic-<package-name>-${{ github.ref_name }}.crate` to the `artifacts` property in the `Create Github release` job of the `Create Release PR` workflow in `.github/workflows/create-release-pr.yml`
162
+
- Make sure every entry except the last is comma delimited
163
+
- If the crate has dependenencies in this repository, make sure it is published _after_ the dependencies
164
+
- If the crate has a dependent in this repository, make sure it is published _before_ the dependents
149
165
- If the package is an NPM package:
150
-
- Add the package to `pnpm-workspace.yaml`.
151
-
- Add a `Pack @dfinity/<package-name> NPM package` job to the `Release` workflow in `.github/workflows/release.yml`.
152
-
- Add a `Release @dfinity/<package-name> NPM package` job to the `Release` workflow in `.github/workflows/release.yml`.
153
-
- Add `dfinity-<package-name>-${{ github.ref_name }}.tgz` to the `artifacts` property in the `Create Github release` job of the `Create Release PR` workflow in `.github/workflows/create-release-pr.yml`.
154
-
- Make sure every entry except the last is comma delimited.
166
+
- Add the package to `pnpm-workspace.yaml`
167
+
- Add a `Pack @dfinity/<package-name> NPM package` job to the `Release` workflow in `.github/workflows/release.yml`
168
+
- Add a `Release @dfinity/<package-name> NPM package` job to the `Release` workflow in `.github/workflows/release.yml`
169
+
- Add `dfinity-<package-name>-${{ github.ref_name }}.tgz` to the `artifacts` property in the `Create Github release` job of the `Create Release PR` workflow in `.github/workflows/create-release-pr.yml`
170
+
- Make sure every entry except the last is comma delimited
0 commit comments