Skip to content

Latest commit

 

History

History
71 lines (51 loc) · 3.25 KB

DEVELOPER.md

File metadata and controls

71 lines (51 loc) · 3.25 KB

Developer Guide

This document describes how to set up your development environment to build and test the GLIDE for Redis Node wrapper.

Development Overview

The GLIDE Node wrapper consists of both TypeScript and Rust code. Rust bindings for Node.js are implemented using napi-rs. The Node and Rust components communicate using the protobuf protocol.

Build

  • Follow the building instructions for the Node wrapper in the Build from source section to clone the code and build the wrapper.
  • For a fast build, execute npm run build. This will perform a full, unoptimized build, which is suitable for developing tests. Keep in mind that performance is significantly affected in an unoptimized build, so it's required to build with the build:release or build:benchmark option when measuring performance.
  • If your modifications are limited to the TypeScript code, run npm run build-external to build the external package without rebuilding the internal package.
  • If your modifications are limited to the Rust code, execute npm run build-internal to build the internal package and generate TypeScript code.
  • To generate Node's protobuf files, execute npm run build-protobuf. Keep in mind that protobuf files are generated as part of full builds (e.g., build, build:release, etc.).

Note: Once building completed, you'll find the compiled JavaScript code in the node/build-ts folder.

Test

To run tests, use the following command:

npm test

Submodules

After pulling new changes, ensure that you update the submodules by running the following command:

git submodule update

Linters

Development on the Node wrapper may involve changes in either the TypeScript or Rust code. Each language has distinct linter tests that must be passed before committing changes.

Language-specific Linters

TypeScript:

  • ESLint
  • Prettier

Rust:

  • clippy
  • fmt

Running the linters

  1. TypeScript
    # Run from the `node` folder
    npm install eslint-plugin-import@latest  @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-tsdoc eslint typescript eslint-plugin-import@latest eslint-config-prettier
    npm i
    npx eslint . --max-warnings=0
  2. Rust
    # Run from the `node/rust-client` folder
    rustup component add clippy rustfmt
    cargo clippy --all-features --all-targets -- -D warnings
    cargo fmt --manifest-path ./Cargo.toml --all

Recommended extensions for VS Code