Memospot Help

Contributing

Memospot contributor's guide.

The recommended code editor is Visual Studio Code. The project has a pre-configured workspace, which will prompt you to install the recommended extensions.

Pre-requisites

  • Task

  • A package manager: Homebrew, Chocolatey, winget or Scoop.

  • A system WebView (Edge WebView2, Safari, or WebkitGTK), for Tauri to work.

  • A modern computer, with at least 8 GB of RAM and a decent CPU. Rust compilation is very CPU-intensive. Also, rust-analyzer (language server) utilizes circa 2GB of RAM.

  • 20 GB of free disk space on the repository drive, for Rust artifacts and sccache.

Toolchain setup

After fulfilling the basic pre-requisites, open a terminal, cd into the project directory and run task setup to try to set up the project toolchain.

task setup

If some step fails, you can follow the manual setup guide to install the tools by yourself.

Manual setup

OS-specific dependencies

See also: Tauri Prerequisites

Linux
sudo apt update -y && sudo apt install -y \ build-essential \ curl \ wget \ file \ libgtk-3-dev \ librsvg2-dev \ libssl-dev \ libwebkit2gtk-4.0-dev \ patchelf \ libayatana-appindicator3-dev
macOS
xcode-select --install
Windows

Build Tools for Visual Studio 2022

winget install --id=Microsoft.VisualStudio.2022.BuildTools -e

Edge WebView2

winget install --id=Microsoft.EdgeWebView2Runtime -e

Project dependencies

Bun

Bun is a fast JavaScript/TypeScript runtime, bundler, test runner, and package manager. It's used to bundle the front end and to run build scripts.

Rust

Rust is used to build the Tauri app.

Run rustup default stable to install the latest stable toolchain.

Extra Rust tools
  • clippy: A collection of lints to catch common mistakes and improve Rust code.

  • sccache: Used to speed up Rust builds.

  • dprint: A pluggable code formatter.

  • cargo-binstall: Binary installations for Rust projects.

  • cargo-cache: Utility to manage cargo cache.

  • cargo-edit: Utility to manage cargo dependencies.

All of these tools can be installed from source via cargo install, though it will take a while to compile them. It's recommended that you install just cargo-binstall from source and use it to download the other tools binaries.

rustup component add clippy cargo install cargo-binstall --locked cargo binstall tauri-cli@1.5.11 --locked -y cargo binstall cargo-edit@0.12.2 --locked -y cargo binstall cargo-cache@0.8.3 --locked -y cargo binstall dprint@0.45.1 --locked -y cargo binstall sccache@0.8.0 --locked -y

Memos server build

The Memos server is built separately on the repository memos-builds.

A pre-build hook will automatically download the latest release from the repository and put it in the server-dist folder. Downloaded files will be reused on subsequent builds.

Sample valid server binary names:

  • Windows: memos-x86_64-pc-windows-msvc.exe

  • Linux: memos-x86_64-unknown-linux-gnu

  • macOS: memos-x86_64-apple-darwin/memos-aarch64-apple-darwin

Using Task

After installing Task and cloning the project repository, you can open a terminal, cd into the project directory and run task --list-all to see all available tasks.

task --list-all

Common tasks

  • task dev: Run the app in development mode.

  • task build: Build the app.

  • task fmt: Run all code formatters in parallel.

  • task lint: Run all code checkers/linters in parallel.

  • task test: Run all available tests.

  • task clean: Remove ALL build artifacts and caches.

Coding style

Use a consistent coding style. Run task lint, task fmt and task test on the repository before submitting a pull request.

License

By contributing, you agree that all your contributions will be licensed under the MIT License.

In short, when you submit code changes, your submissions are understood to be under the same MIT License that covers the project. Feel free to contact the maintainer if that's a concern.

Last modified: 18 May 2024