docs(contributing): add dependencies overriding section

Refs: <https://github.com/pimalaya/core/issues/32>
This commit is contained in:
Clément DOUIN
2025-01-11 08:53:13 +01:00
parent c79cabc168
commit 9d773e947b
+56 -9
View File
@@ -4,19 +4,66 @@ Thank you for investing your time in contributing to Himalaya CLI!
## Development
The development environment is managed by [Nix](https://nixos.org/download.html). Running `nix-shell` will spawn a shell with everything you need to get started with the lib: `cargo`, `cargo-watch`, `rust-bin`, `rust-analyzer`, `notmuch`
The development environment is managed by [Nix](https://nixos.org/download.html).
Running `nix-shell` will spawn a shell with everything you need to get started with the lib.
```sh
# Start a Nix shell
$ nix-shell
If you do not want to use Nix, you can either use [rustup](https://rust-lang.github.io/rustup/index.html):
# then build the CLI
$ cargo build
# run the CLI
$ cargo run --feature pgp-gpg -- envelope list
```text
rustup update
```
or install manually the following dependencies:
- [cargo](https://doc.rust-lang.org/cargo/) (`v1.82`)
- [rustc](https://doc.rust-lang.org/stable/rustc/platform-support.html) (`v1.82`)
## Build
```text
cargo build
```
You can disable default [features](https://doc.rust-lang.org/cargo/reference/features.html) with `--no-default-features` and enable features with `--features feat1,feat2,feat3`.
Finally, you can build a release with `--release`:
```text
cargo build --no-default-features --features imap,smtp,keyring --release
```
## Override dependencies
If you want to build Himalaya CLI with a dependency installed locally (for example `email-lib`), then you can [override it](https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html) by adding the following lines at the end of `Cargo.toml`:
```toml
[patch.crates-io]
email-lib = { path = "/path/to/email-lib" }
```
If you get the following error:
```text
note: perhaps two different versions of crate email are being used?
```
then you may need to override more Pimalaya's sub-dependencies:
```toml
[patch.crates-io]
email-lib.path = "/path/to/core/email"
imap-client.path = "/path/to/imap-client"
keyring-lib.path = "/path/to/core/keyring"
mml-lib.path = "/path/to/core/mml"
oauth-lib.path = "/path/to/core/oauth"
pgp-lib.path = "/path/to/core/pgp"
pimalaya-tui.path = "/path/to/tui"
process-lib.path = "/path/to/core/process"
secret-lib.path = "/path/to/core/secret"
```
*See [pimalaya/core#32](https://github.com/pimalaya/core/issues/32) for more information.*
## Commit style
Starting from the `v1.0.0`, Himalaya CLI tries to adopt the [conventional commits specification](https://github.com/conventional-commits/conventionalcommits.org).