A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
# Estella Documentation Build Script (Windows PowerShell)
# Usage: .\build.ps1 [dev|build|all]
param(
[string]$Command = "all"
)
$ErrorActionPreference = "Stop"
$DocsRoot = $PSScriptRoot
function Write-Header {
param([string]$Message)
Write-Host "`n========================================" -ForegroundColor Cyan
Write-Host " $Message" -ForegroundColor Cyan
Write-Host "========================================`n" -ForegroundColor Cyan
}
function Build-Doxygen {
Write-Header "Building Doxygen API Documentation"
Push-Location $DocsRoot
try {
if (!(Get-Command doxygen -ErrorAction SilentlyContinue)) {
Write-Host "ERROR: Doxygen not found. Please install it first." -ForegroundColor Red
Write-Host " Windows: choco install doxygen.install" -ForegroundColor Yellow
Write-Host " Or download from: https://www.doxygen.nl/download.html" -ForegroundColor Yellow
exit 1
}
# PROJECT_NUMBER is injected from the single app-version source.
$env:ESTELLA_VERSION = (node -p "require('../desktop/package.json').version")
doxygen Doxyfile
Write-Host "Doxygen build complete: docs/api/html/" -ForegroundColor Green
}
finally {
Pop-Location
}
}
function Build-Astro {
Write-Header "Building Astro Documentation Site"
Push-Location "$DocsRoot\astro"
try {
if (!(Test-Path "node_modules")) {
Write-Host "Installing dependencies..." -ForegroundColor Yellow
npm install
}
npm run build
Write-Host "Astro build complete: docs/astro/dist/" -ForegroundColor Green
}
finally {
Pop-Location
}
}
function Sync-ApiDocs {
Write-Host "Syncing Doxygen API docs to Astro public..." -ForegroundColor Yellow
$ApiSource = "$DocsRoot\api\html"
$ApiDest = "$DocsRoot\astro\public\api\html"
if (Test-Path $ApiSource) {
New-Item -ItemType Directory -Force -Path "$DocsRoot\astro\public\api" | Out-Null
Copy-Item -Recurse -Force "$ApiSource\*" $ApiDest
Write-Host "API docs synced." -ForegroundColor Green
} else {
Write-Host "No API docs found. Run '.\build.ps1 doxygen' first." -ForegroundColor Yellow
}
}
function Start-Dev {
Write-Header "Starting Astro Dev Server"
# Sync API docs before starting dev server
Sync-ApiDocs
Push-Location "$DocsRoot\astro"
try {
if (!(Test-Path "node_modules")) {
Write-Host "Installing dependencies..." -ForegroundColor Yellow
npm install
}
Write-Host "Starting dev server at http://localhost:4321" -ForegroundColor Green
npm run dev
}
finally {
Pop-Location
}
}
function Merge-Output {
Write-Header "Merging Documentation Output"
$OutputDir = "$DocsRoot\dist"
# Clean output directory
if (Test-Path $OutputDir) {
Remove-Item -Recurse -Force $OutputDir
}
New-Item -ItemType Directory -Force -Path $OutputDir | Out-Null
# The same layout .github/workflows/docs.yml publishes: the landing page at
# the root, the guides under /docs, the C++ reference under /docs/api/html.
# A local build that arranges them differently is a preview of a site that
# does not exist.
if (Test-Path "$DocsRoot\landing") {
Copy-Item -Recurse "$DocsRoot\landing\*" $OutputDir
# The page states the version it was built from — see docs.yml. Read and
# written as UTF-8 through .NET: Get-Content/Set-Content on this host
# decode as the ANSI codepage, which turns every non-ASCII character in
# the page (the 中文 link, the arrows) into mojibake on the way through.
$version = (Get-Content "$DocsRoot\..\desktop\package.json" -Raw | ConvertFrom-Json).version
$index = "$OutputDir\index.html"
$utf8 = New-Object System.Text.UTF8Encoding($false)
$html = [System.IO.File]::ReadAllText($index, $utf8)
[System.IO.File]::WriteAllText($index, $html.Replace('__ESTELLA_VERSION__', $version), $utf8)
}
# Copy Astro output
if (Test-Path "$DocsRoot\astro\dist") {
New-Item -ItemType Directory -Force -Path "$OutputDir\docs" | Out-Null
Copy-Item -Recurse "$DocsRoot\astro\dist\*" "$OutputDir\docs\"
}
# Copy Doxygen output
if (Test-Path "$DocsRoot\api\html") {
New-Item -ItemType Directory -Force -Path "$OutputDir\docs\api\html" | Out-Null
Copy-Item -Recurse "$DocsRoot\api\html\*" "$OutputDir\docs\api\html\"
}
Write-Host "Documentation merged to: docs/dist/" -ForegroundColor Green
}
# Main
switch ($Command.ToLower()) {
"dev" {
Start-Dev
}
"doxygen" {
Build-Doxygen
}
"astro" {
Build-Astro
}
"build" {
Build-Doxygen
Build-Astro
Merge-Output
}
"all" {
Build-Doxygen
Build-Astro
Merge-Output
}
default {
Write-Host "Usage: .\build.ps1 [command]" -ForegroundColor Yellow
Write-Host ""
Write-Host "Commands:" -ForegroundColor Yellow
Write-Host " dev Start Astro dev server"
Write-Host " doxygen Build only Doxygen API docs"
Write-Host " astro Build only Astro site"
Write-Host " build Build everything"
Write-Host " all Build everything (default)"
}
}