diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..c24c0fe --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,30 @@ +{ + "name": "DS Development Container", + "image": "mcr.microsoft.com/devcontainers/base:ubuntu", + "features": { + "ghcr.io/devcontainers/features/cmake:1": { + "version": "latest" + }, + "ghcr.io/devcontainers/features/python:1": { + "version": "latest" + }, + "ghcr.io/devcontainers/features/node:1": { + "version": "latest" + } + }, + "postCreateCommand": ".devcontainer/post-create.sh", + "customizations": { + "vscode": { + "extensions": [ + "ms-vscode.cpptools-extension-pack", + "ms-vscode.cmake-tools", + "clang-format.vscode-clang-format", + "ms-python.python", + "ms-python.vscode-pylance", + "ms-pyright.pyright", + "charliermarsh.ruff", + "biomejs.biome" + ] + } + } +} diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh new file mode 100755 index 0000000..2ca803c --- /dev/null +++ b/.devcontainer/post-create.sh @@ -0,0 +1,38 @@ +#!/bin/bash +set -euo pipefail + +# Install apt packages +sudo apt-get update +sudo apt-get install -y libgtest-dev clang-format + +# Install uv (Python package manager) +curl -LsSf https://astral.sh/uv/install.sh | sh + +# Add uv to PATH for this script and future sessions +export PATH="$HOME/.local/bin:$PATH" +echo 'export PATH="$HOME/.local/bin:$PATH"' >> "$HOME/.bashrc" + +# Install Python dependencies +uv sync --locked --extra dev + +# Install Node.js dependencies +npm ci + +# Install emscripten to a persistent location +EMSDK_DIR="$HOME/emsdk" +if [ ! -d "$EMSDK_DIR" ]; then + git clone https://github.com/emscripten-core/emsdk.git "$EMSDK_DIR" +else + git -C "$EMSDK_DIR" pull +fi +( + cd "$EMSDK_DIR" + ./emsdk install latest + ./emsdk activate latest +) + +# Add emsdk to shell config for future sessions +echo "source $EMSDK_DIR/emsdk_env.sh" >> "$HOME/.bashrc" + +# Install pre-commit hooks +uv run pre-commit install