Skip to content

Commit b189838

Browse files
fennibayjameslan
andauthored
introduce devcontainers (#29)
* chore: introduce devcontainers This brings in an emscripten environment for all developers, without having to install it manually --------- Co-authored-by: James Lan <[email protected]>
1 parent a5cedc9 commit b189838

File tree

4 files changed

+63
-1
lines changed

4 files changed

+63
-1
lines changed

.devcontainer/Dockerfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM mcr.microsoft.com/devcontainers/typescript-node:1-20-bookworm
2+
3+
ARG EMSDK_DIR=/emsdk
4+
5+
RUN apt-get update -y && \
6+
apt-get -y install --no-install-recommends \
7+
curl \
8+
ca-certificates \
9+
zip \
10+
unzip \
11+
xz-utils \
12+
bzip2 \
13+
sed \
14+
git-core \
15+
python3
16+
17+
RUN git clone --depth 1 -- https://github.com/emscripten-core/emsdk.git $EMSDK_DIR && \
18+
cd $EMSDK_DIR && \
19+
./emsdk install latest && \
20+
./emsdk activate latest && \
21+
echo ". $EMSDK_DIR/emsdk_env.sh" >> /etc/bash.bashrc

.devcontainer/devcontainer.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/typescript-node
3+
{
4+
"name": "libxml2-wasm development environment",
5+
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6+
"build": {
7+
"dockerfile": "Dockerfile"
8+
},
9+
10+
// Features to add to the dev container. More info: https://containers.dev/features.
11+
// "features": {},
12+
13+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
14+
// "forwardPorts": [],
15+
// Use 'postCreateCommand' to run commands after the container is created.
16+
// "postCreateCommand": "yarn install",
17+
18+
// Configure tool-specific properties.
19+
// "customizations": {},
20+
21+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
22+
// "remoteUser": "root"
23+
24+
"runArgs": [
25+
"--userns=keep-id"
26+
],
27+
"containerEnv": {
28+
"HOME": "/home/node"
29+
}
30+
}

.vscode/extensions.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"recommendations": [
3+
"ms-vscode-remote.remote-containers"
4+
]
5+
}

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ it requires the minimum version of the following environments,
3636

3737
## Getting started
3838

39-
Install `lbixml2-wasm` package:
39+
Install `libxml2-wasm` package:
4040

4141
```shell
4242
npm i libxml2-wasm
@@ -77,3 +77,9 @@ For more detail, see the [Doc](https://jameslan.github.io/libxml2-wasm/index.htm
7777

7878
[^1]: The speed of different libraries varies a lot, see [benchmark](performance.md).
7979
[^2]: The requirement of C/C++ toolchain may be waived if prebuilt binary is available.
80+
81+
## Development environment
82+
83+
If you'd like to contribute to `libxml2-wasm`, you need a [Node.js](https://nodejs.org/) (version 16 or newer) and an [emscripten](https://emscripten.org/) installation in your environment.
84+
85+
Alternatively, you can use the provided devcontainer. Then you only need a Docker or Podman environment, and VS Code with the [Dev Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension. Then you can just run the command "Dev Containers: Reopen in Container" which will provide you a container with the needed development environment. See <https://containers.dev/> for further info.

0 commit comments

Comments
 (0)