diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 000000000..688e743f9 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,11 @@ +ARG NODE_MAJOR_VERSION + +FROM mcr.microsoft.com/devcontainers/javascript-node:${NODE_MAJOR_VERSION} + +ENV EDITOR="code -w" VISUAL="code -w" + +# install system dependencies for cypress (https://docs.cypress.io/guides/continuous-integration/introduction) +RUN apt update && apt install -y libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libnss3 libxss1 libasound2 libxtst6 xauth xvfb + +# uncomment to install additional npm packages +# RUN su node -c 'npm i -g cowsay@1.5.0' diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..1428e6ac2 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,16 @@ +{ + "name": "compiler-explorer", + "dockerFile": "Dockerfile", + "build": { + "args": {"NODE_MAJOR_VERSION": "20"} + }, + "postCreateCommand": [".devcontainer/post-create.sh"], + "portsAttributes": { + "10240": {"label": "Compiler Explorer"} + }, + "customizations": { + "vscode": { + "extensions": ["dbaeumer.vscode-eslint", "EditorConfig.EditorConfig", "esbenp.prettier-vscode"] + } + } +} diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh new file mode 100755 index 000000000..c7b706cc2 --- /dev/null +++ b/.devcontainer/post-create.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +set -eo pipefail + +# when in a VS Code or GitHub Codespaces devcontainer +if [ -n "${REMOTE_CONTAINERS}" ]; then + this_dir=$(cd -P -- "$(dirname -- "$(command -v -- "$0")")" && pwd -P) + workspace_root=$(realpath ${this_dir}/..) + + # perform additional one-time setup just after + # the devcontainer is created + npm install --prefix "${workspace_root}" # install node dependencies + +fi diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d1baecb0a..1c3a21241 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -23,6 +23,10 @@ in the right direction. **Compiler Explorer** currently targets [Node.js](https://nodejs.org/) version 20, so it's better if you do so as well when testing your changes locally. +> Note that this repository is compatible with `GitHub Codespaces` as well as `VS Code Dev Containers`. Opening your +> cloned project with either of these options will ensure that your development environment is already set up and +> configured correctly! + ## In brief - Make your changes, trying to stick to the style and format where possible. diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 4fcd91f0f..5c6fc4893 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -139,3 +139,4 @@ From oldest to newest contributor, we would like to thank: - [Seyed Ali Ghasemi](https://github.com/gha3mi) - [Guo Ci](https://github.com/guoci) - [Rupert Tombs](https://github.com/Rupt) +- [Andrew Brey](https://github.com/andrewbrey)