Scouterdev / chemkers

🏁 Checkers engine built with Rust, WebAssembly & Preact

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Chemkers

A live version of the app can be found here: https://tomszir.github.io/chemkers

Description

TODO: Write a description

Development & project setup

Installing project requirements

  • Node.js: https://nodejs.org/en
  • The Rust programming language
    • The project heavily relies on Rust to handle all computationally intensive operations.
    • Recommended cross-platform installer: https://rustup.rs/
  • wasm-pack

The only tested versions of these are - node@v14.19.0, rustc@1.68.0, wasm-pack@0.10.3. I can't guarantee everything will work with any other version.

Setting up the project

Clone the project and navigate to it

git clone https://github.com/tomszir/chemkers
cd ./chemkers

If you don't have Yarn already installed, install it using this command

npm install -g yarn

Use the stable version of Yarn and install all the project's libraries

yarn set version stable
yarn install

Try running a test build of the project to see if everything works

You'll know if it works if you don't get a million errors in your face

yarn build

Running a development server

If you're going to be working with Rust installing cargo-watch is a must. It will automatically watch for changes within the Rust sub-projects and rebuild the WebAssembly for immediate availability on the development server.

cargo install cargo-watch

Within the root of the project run this command

yarn dev

A development server should open to something simliar to http://localhost:5173

Note: The port can change depending on if the port is already taken or not

Project structure

This project uses Turborepo for handling multiple interlinked codebases.

Turborepo workspaces

Name Description Type
preact-checkers Vite Preact front-end app
wasm-checkers Rust WebAssembly checkers engine library package

Additional good-to-know things

1. Making rust-analyzer discover Rust sub-projects in VSCode

To make the VSCode rust-analyzer extension discover the wasm-checkers package, please create an additional file - .vscode/settings.json and specify the path to the Rust Cargo.toml file of the package within it:

{
  "rust-analyzer.linkedProjects": [
    "${workspaceFolder}/packages/wasm-checkers/Cargo.toml"
  ]
}

Note: This will only make rust-analyzer work if VSCode is opened on the root directory of the project. (You can also open the Rust sub-project seperately and it should work automatically)

2. Turborepo development server hangs the terminal

When running Ctrl + C within a terminal with an active yarn dev development server running Turborepo sometimes doesn't gracefully shutdown and hangs the current active terminal session. To fix this I reccomend opening another terminal instance.

Acknowledgements and research sources

This project wouldn't be possible without these online resources and articles.

License

This project is licensed under the MIT license.

About

🏁 Checkers engine built with Rust, WebAssembly & Preact

License:MIT License


Languages

Language:Rust 43.9%Language:TypeScript 43.2%Language:SCSS 11.9%Language:HTML 0.7%Language:JavaScript 0.3%