Skip to content

Commit

Permalink
Merge f043c29 into b312c28
Browse files Browse the repository at this point in the history
  • Loading branch information
senritsu committed Aug 22, 2021
2 parents b312c28 + f043c29 commit abc0541
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.191.1/containers/typescript-node/.devcontainer/base.Dockerfile

# [Choice] Node.js version: 16, 14, 12
ARG VARIANT="16-buster"
FROM mcr.microsoft.com/vscode/devcontainers/typescript-node:0-${VARIANT}

# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>

# [Optional] Uncomment if you want to install an additional version of node using nvm
# ARG EXTRA_NODE_VERSION=10
# RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}"

# [Optional] Uncomment if you want to install more global node packages
# RUN su node -c "npm install -g <your-package-list -here>"
33 changes: 33 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.191.1/containers/typescript-node
{
"name": "Node.js & TypeScript",
"build": {
"dockerfile": "Dockerfile",
// Update 'VARIANT' to pick a Node version: 12, 14, 16
"args": {
"VARIANT": "16"
}
},

// Set *default* container specific settings.json values on container create.
"settings": {},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"dsznajder.es7-react-js-snippets",
"eamodio.gitlens",
"github.vscode-pull-request-github"
],

// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [3000, 8000],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "npm ci && npm run prestart",

// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "node"
}
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,27 @@ npm start

The examples can be found in the [examples](examples/) folder.

#### Running inside a dev container using VS Code

It is also possible to run the examples or contribute to the repository using a preconfigured dev container. This removes the need to install dependencies like Node.js on your local machine, and provides a consistent development environment no matter what OS you are on.

Prerequisites on the local machine:

- [VS Code](https://code.visualstudio.com/) + [Remote Development](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.vscode-remote-extensionpack) extension
- [git](https://git-scm.com/)
- [Docker](https://www.docker.com/)

To run the examples or start developing:

- Open VS Code
- Click the Remote Development icon in the bottom left corner of the UI -> "Clone repository in Container Volume..."
- Paste `https://github.com/boardgameio/boardgame.io` or use your own fork (or any branch or pull request)
- The container will start up and install all required dependencies automatically
- Wait for terminal output to finish
- Open NPM Scripts panel in the sidebar and run `package.json > start`

If your VS Code Explorer sidebar has no NPM scripts panel right-click the Explorer header and check "NPM Scripts", or just run `npm run start` yourself from a terminal.

## Changelog

See [changelog](docs/documentation/CHANGELOG.md).
Expand Down

0 comments on commit abc0541

Please sign in to comment.