Skip to main content

Development Guide

QuickJS-ng is an open-source JavaScript engine that welcomes contributions from the community. This guide will help you get started with contributing to the project.

Getting Started

Prerequisites

  • Git
  • CMake 3.x or higher
  • A C compiler (GCC, Clang, MSVC, or TCC)
  • Make (on Unix-like systems)

Cloning the Repository

git clone https://github.com/quickjs-ng/quickjs.git
cd quickjs

Building QuickJS-ng

Quick Build

The simplest way to build QuickJS-ng is using the helper Makefile:
make
This will build the qjs and qjsc executables and other test tools.

Debug Build

For development, you’ll want to create a debug build without optimizations:
make debug

Manual CMake Build

If you prefer to use CMake directly (required on Windows):
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build
For a debug build:
cmake -B build -DCMAKE_BUILD_TYPE=Debug
cmake --build build

Contribution Workflow

1
Fork and Clone
2
Fork the repository on GitHub and clone your fork locally:
3
git clone https://github.com/YOUR_USERNAME/quickjs.git
cd quickjs
git remote add upstream https://github.com/quickjs-ng/quickjs.git
4
Create a Branch
5
Create a new branch for your changes:
6
git checkout -b my-feature-branch
7
Make Your Changes
8
Edit the code, add tests, and ensure your changes follow the project’s coding style.
9
Build and Test
10
Build the project and run the test suite:
11
make
make test
12
Commit Your Changes
13
Write clear, descriptive commit messages:
14
git add .
git commit -m "Add feature: description of your changes"
15
Push and Create a Pull Request
16
Push your branch to your fork:
17
git push origin my-feature-branch
18
Then create a pull request on GitHub from your branch to the main QuickJS-ng repository.

Development Tools

Code Generation

If you modify bytecode or built-in modules, regenerate the generated code:
make codegen

Syntax Checking

Verify that generated C code compiles correctly:
make jscheck

C++ Compatibility

Test that the codebase compiles as C++:
make cxxtest

Statistics

View engine statistics and memory usage:
make stats

Build Options

Amalgamated Build

Create a single-file amalgamated build:
make amalgam
This generates quickjs-amalgam.zip containing a single quickjs-amalgam.c file.

Shared Libraries

Build shared libraries instead of static:
make BUILD_SHARED_LIBS=ON

Examples

Build with examples enabled:
make QJS_BUILD_EXAMPLES=ON

Sanitizers

Address Sanitizer (ASan) and Undefined Behavior Sanitizer (UBSan)

cmake -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo -DQJS_ENABLE_ASAN=ON -DQJS_ENABLE_UBSAN=ON
cmake --build build

Memory Sanitizer (MSan)

export CC=clang
cmake -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo -DQJS_ENABLE_MSAN=ON
cmake --build build

CI/CD

QuickJS-ng uses GitHub Actions for continuous integration. The CI pipeline tests:
  • Multiple platforms: Linux, macOS, Windows, FreeBSD, OpenBSD
  • Multiple compilers: GCC, Clang, MSVC, TCC, MinGW
  • Multiple architectures: x86, x64, ARM64, RISC-V, s390x
  • Sanitizers: ASan, UBSan, MSan
  • Special builds: Emscripten, WASI, Android, iOS
  • Test262 compliance suite
All pull requests must pass CI checks before being merged.

Coding Guidelines

  • Follow the existing code style and conventions
  • Write clear, self-documenting code with comments where necessary
  • Add tests for new features and bug fixes
  • Ensure all tests pass before submitting a pull request
  • Keep commits focused and atomic
  • Write descriptive commit messages

Getting Help

If you need help or have questions:
  • Check the project documentation
  • Open an issue on GitHub for bugs or feature requests
  • Review existing issues and pull requests for similar topics

Authors

QuickJS-ng is maintained by @bnoordhuis, @saghul, and many contributors. The original QuickJS engine was created by Fabrice Bellard and Charlie Gordon.

Build docs developers (and LLMs) love