This repository builds the combined PlayCanvas API Reference. The API reference is a collection of documentation from multiple PlayCanvas repositories.
Ensure you have Node.js 18+ installed.
Repository configuration is stored in repos-config.json. This file defines the repositories to be cloned, their URLs, and default branches:
{
"repositories": [
{
"name": "engine",
"url": "https://github.com/playcanvas/engine.git",
"branch": "main"
},
...
]
}You can modify this file to change default branches, add new repositories, or remove existing ones.
To build the combined API reference, run:
npm run buildThis cross-platform script will:
- Load the repository configuration from
repos-config.json - Clone the configured PlayCanvas repositories
- Install dependencies for each repository
- Build the TypeDoc documentation for each repository
- Copy the documentation to a central
docsfolder - Merge the per-product TypeDoc search indexes into a combined
docs/assets/search.jsthat powers the landing page's global search - Create a main index.html file that allows navigation between the different API references
- Generate a combined sitemap.xml that includes URLs from all repositories for better SEO
The landing page provides a search across all products. It reuses TypeDoc's own
search client (main.js, copied from the engine build) pointed at a combined
index that build.mjs produces by decoding each product's
docs/<product>/assets/search.js (window.searchData = base64, deflate-compressed
JSON), prefixing row URLs with the product folder, tagging rows with a
product-<folder> class (styled as a badge by assets/landing.css), and
rebuilding a single lunr index in the same format.
Per-repository search behavior is configured in repos-config.json:
searchExclude: omit the product from the combined index (used for the legacyengine-v1)searchBoost: relevance multiplier for all of the product's resultssearchKindBoosts: per-reflection-kind multipliers (e.g.{ "128": 2 }boosts classes, mirroring the engine's TypeDocsearchGroupBoosts)
Important
The merge step depends on TypeDoc 0.28 internals: the window.searchData
wrapper, deflate encoding, and a serialized lunr 2.3.9 index (the lunr
devDependency in package.json is pinned to match the version bundled in
TypeDoc's client). The build validates each product's index and skips it with
a warning if the format changes — revisit mergeSearchIndexes() in build.mjs
when upgrading TypeDoc.
Note
The build script automatically cleans and recreates the repos directory each time it's run, ensuring you always get a fresh build with the latest code from the configured branches.
The default branches for all repositories are defined in the repos-config.json file. This is the recommended place to set your branch configurations:
{
"repositories": [
{
"name": "engine",
"url": "https://github.com/playcanvas/engine.git",
"branch": "release-2.6"
},
// ... other repositories
]
}For temporary changes without modifying the configuration file, you can override branches using command-line arguments in the format repo=branch:
# Override the engine branch for a single build
npm run build engine=dev
# Override multiple repositories for a single build
npm run build engine=dev pcui=feature/new-componentsThe repository names used in the command line must match the name fields in the repos-config.json file.
To view the built API reference, run:
npm run serveThen point your browser at http://localhost:3000.
The API reference is automatically deployed to GitHub Pages whenever the main branch is updated.