Skip to content

Latest commit

 

History

History
165 lines (107 loc) · 3.52 KB

DEVELOPMENT.md

File metadata and controls

165 lines (107 loc) · 3.52 KB

Development

Rust Development

Dependencies

rustup component add llvm-tools-preview
cargo install cargo-llvm-cov
cargo install cargo-nextest

Running Tests

cargo nextest run --workspace --all-features

# To test individual features
for i in {0..3}; do cargo test_$i || break; done

Coverage

Collect coverage and output as lcov.

./coverage.sh

Collect coverage and open html report.

./coverage.sh && cargo coverage_open

Releasing

  1. Update crate versions.

    sd -s 'version = "0.0.13"' 'version = "0.0.14"' $(fd -tf -F toml) README.md src/lib.rs
    
    # Make sure only `peace` crates are updated.
    git --no-pager diff | rg '^[+]' | rg -v '(peace)|(\+\+\+)|\+version'
  2. Update CHANGELOG.md with the version and today's date.

  3. If dependency versions have changed, update licenses.html:

    cargo about generate --workspace --all-features about.hbs > doc/src/licenses.html
  4. Push a tag to the repository.

    The publish GitHub workflow will automatically publish the crates to crates.io.

Note:

An alternative to cargo-release is cargo-workspaces, which may be used in case crates need to be published one by one -- if many new crates are being published, cargo-release gates the number of crates that can be published at one go.

cargo workspaces \
  publish \
  --from-git \
  --allow-branch main \
  --force '*' \
  --no-verify \
  --no-git-tag

Web Development

Set Up

These instructions are for Linux. They may work on OS X, but for Windows, please visit each linked site for specific instructions.

  1. Install nvm:

    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
  2. Install node and set the default version:

    nvm install 20
    nvm alias default 20
  3. Install and set up pnpm:

    npm install -g pnpm
    pnpm setup
  4. Install tailwindcss:

    pnpm install --global tailwindcss
  5. Install cargo-leptos:

    cargo install --git https://github.com/leptos-rs/cargo-leptos.git --locked cargo-leptos

Notes:

  • pnpm is used because it downloads each version of each library once, whereas npm downloads all dependencies recursively, even if the same dependency is already existent in the dependency tree.
  • This is installed as a global binary instead of as a dev dependency within the repository. This is more aligned with Rust's single-binary installation model.

Development

ℹ️ These commands assume you are running them from the repository root directory.

Build and serve the envman example. Either:

# Watch, build, and `envman` purely as a web server.
cargo leptos watch --project "envman" -v

Or:

# Build `envman` as a cli tool.
cargo +stable leptos build --project envman --bin-features "cli" \
  && test -d /tmp/demo \
  || mkdir /tmp/demo \
  && cp -R target/{debug/envman,web/envman/pkg} /tmp/demo

# In a separate terminal
cd /tmp/demo
./envman web

Uninstallation

To uninstall web tooling:

pnpm uninstall --global tailwindcss
nvm uninstall $version
rm -rf ~/.nvm