Skip to content

TypeDuck-HK/TypeDuck-Web

Repository files navigation

TypeDuck Web

TypeDuck: Cantonese for everyone at your fingertips

This repository contains the source code for TypeDuck Web.

Visit typeduck.hk/web to give it a try!

Development

TypeDuck Web is a static single-paged application (SPA) built with TypeScript, React, Tailwind CSS and daisyUI.

The RIME Input Method Engine is the technology that powers TypeDuck Web. It is compiled to WebAssembly with Emscripten and runs right in your browser without any data being sent to the server.

Prerequisites

  • Bun

    Execute the command provided on the website to install Bun. Alternatively, you may install it with npm:

    npm i -g bun
  • CMake

  • Ninja

  • LLVM (Windows only)

    You may install the above prerequisites with the following commands:

    # Ubuntu
    sudo apt install -y cmake ninja-build
    # macOS
    brew install cmake ninja
    # Windows
    choco install -y cmake --ia "ADD_CMAKE_TO_PATH=System"
    choco install -y ninja llvm

    On Windows, you may skip the installation above and execute subsequent commands in Developer PowerShell for Visual Studio if you have Visual Studio installed.

  • Emscripten

    Follow the installation guide to install Emscripten.

Compilation

On Ubuntu, the following additional packages should be pre-installed:

sudo apt install -y \
    libboost-dev \
    libboost-regex-dev \
    libyaml-cpp-dev \
    libleveldb-dev \
    libmarisa-dev \
    libopencc-dev

Then, execute the following commands in order:

bun run boost
bun run native
bun run schema
bun run lib
bun run wasm

Building the Worker Script

bun run worker

Starting the Development Server

bun start

However, the above command is slow to start, at least on Windows. For a faster development experience, you may want to simply build the project.

Building the Project

bun run build

Previewing the Output

bun run preview