Skip to content

Commit e758c13

Browse files
committed
Merge branch 'main' into alex/esm
2 parents 3e1567b + 4552a93 commit e758c13

File tree

373 files changed

+5555
-3449
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

373 files changed

+5555
-3449
lines changed

.devcontainer/Dockerfile

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM mcr.microsoft.com/devcontainers/typescript-node:16-bullseye
2+
3+
ADD install-vscode.sh /root/
4+
RUN /root/install-vscode.sh
5+
6+
RUN git config --system codespaces-theme.hide-status 1
7+
8+
USER node
9+
RUN YARN_CACHE="$(yarn cache dir)" && rm -rf "$YARN_CACHE" && ln -s /vscode-dev/yarn-cache "$YARN_CACHE"
10+
11+
USER root
12+
CMD chown node:node /vscode-dev && sudo -u node mkdir -p /vscode-dev/yarn-cache && sleep inf

.devcontainer/README.md

+14-64
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
# Code - OSS Development Container
22

3-
[![Open in Dev Containers](https://img.shields.io/static/v1?label=Dev%20Containers&message=Open&color=blue&logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/microsoft/vscode)
3+
This dev container includes configuration for a development container for working with Code - OSS in a local container. For using [GitHub Codespaces](https://github.com/features/codespaces) follow the [prebuilt setup](prebuilt/README.md) which installs VNC for displaying the application window.
44

5-
This repository includes configuration for a development container for working with Code - OSS in a local container or using [GitHub Codespaces](https://github.com/features/codespaces).
5+
> **Note:** You will need X11's `DISPLAY` or Wayland's `WAYLAND_DISPLAY` environment variable set locally to allow for the Code - OSS window to display. See [Running GUI app on WSL](https://learn.microsoft.com/en-us/windows/wsl/tutorials/gui-apps) for Windows and [Quartz](https://www.xquartz.org) for Mac.
66
7-
> **Tip:** The default VNC password is `vscode`. The VNC server runs on port `5901` and a web client is available on port `6080`.
8-
9-
## Quick start - local
10-
11-
If you already have VS Code and Docker installed, you can click the badge above or [here](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/microsoft/vscode) to get started. Clicking these links will cause VS Code to automatically install the Dev Containers extension if needed, clone the source code into a container volume, and spin up a dev container for use.
7+
## Quick start
128

139
1. Install Docker Desktop or Docker for Linux on your local machine. (See [docs](https://aka.ms/vscode-remote/containers/getting-started) for additional details.)
1410

@@ -22,63 +18,15 @@ If you already have VS Code and Docker installed, you can click the badge above
2218

2319
> **Note:** The Dev Containers extension requires the Visual Studio Code distribution of Code - OSS. See the [FAQ](https://aka.ms/vscode-remote/faq/license) for details.
2420
25-
4. Press <kbd>Ctrl/Cmd</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd> or <kbd>F1</kbd> and select **Dev Containers: Clone Repository in Container Volume...**.
26-
27-
> **Tip:** While you can use your local source tree instead, operations like `yarn install` can be slow on macOS or when using the Hyper-V engine on Windows. We recommend the "clone repository in container" approach instead since it uses "named volume" rather than the local filesystem.
28-
29-
5. Type `https://github.com/microsoft/vscode` (or a branch or PR URL) in the input box and press <kbd>Enter</kbd>.
30-
31-
6. After the container is running, open a web browser and go to [http://localhost:6080](http://localhost:6080), or use a [VNC Viewer](https://www.realvnc.com/en/connect/download/viewer/) to connect to `localhost:5901` and enter `vscode` as the password.
32-
33-
Anything you start in VS Code, or the integrated terminal, will appear here.
34-
35-
Next: **[Try it out!](#try-it)**
36-
37-
## Quick start - GitHub Codespaces
38-
39-
1. From the [microsoft/vscode GitHub repository](https://github.com/microsoft/vscode), click on the **Code** dropdown, select **Open with Codespaces**, and then click on **New codespace**. If prompted, select the **Standard** machine size (which is also the default).
40-
41-
> **Note:** You will not see these options within GitHub if you are not in the Codespaces beta.
42-
43-
2. After the codespace is up and running in your browser, press <kbd>Ctrl/Cmd</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd> or <kbd>F1</kbd> and select **Ports: Focus on Ports View**.
44-
45-
3. You should see **VNC web client (6080)** under in the list of ports. Select the line and click on the globe icon to open it in a browser tab.
46-
47-
> **Tip:** If you do not see the port, <kbd>Ctrl/Cmd</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd> or <kbd>F1</kbd>, select **Forward a Port** and enter port `6080`.
48-
49-
4. In the new tab, you should see noVNC. Click **Connect** and enter `vscode` as the password.
50-
51-
Anything you start in VS Code, or the integrated terminal, will appear here.
52-
53-
Next: **[Try it out!](#try-it)**
54-
55-
### Using VS Code with GitHub Codespaces
56-
57-
You may see improved VNC responsiveness when accessing a codespace from VS Code client since you can use a [VNC Viewer](https://www.realvnc.com/en/connect/download/viewer/). Here's how to do it.
58-
59-
1. Install [Visual Studio Code Stable](https://code.visualstudio.com/) or [Insiders](https://code.visualstudio.com/insiders/) and the the [GitHub Codespaces extension](https://marketplace.visualstudio.com/items?itemName=GitHub.codespaces).
60-
61-
> **Note:** The GitHub Codespaces extension requires the Visual Studio Code distribution of Code - OSS.
62-
63-
2. After the VS Code is up and running, press <kbd>Ctrl/Cmd</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd> or <kbd>F1</kbd>, choose **Codespaces: Create New Codespace**, and use the following settings:
64-
- `microsoft/vscode` for the repository.
65-
- Select any branch (e.g. **main**) - you can select a different one later.
66-
- Choose **Standard** (4-core, 8GB) as the size.
67-
68-
4. After you have connected to the codespace, you can use a [VNC Viewer](https://www.realvnc.com/en/connect/download/viewer/) to connect to `localhost:5901` and enter `vscode` as the password.
69-
70-
> **Tip:** You may also need change your VNC client's **Picture Quality** setting to **High** to get a full color desktop.
71-
72-
5. Anything you start in VS Code, or the integrated terminal, will appear here.
21+
4. Due to the size of the repository we strongly recommend cloning it on a Linux filesystem for better bind mount performance. On macOS we recommend using a Docker volume (press <kbd>F1</kbd> and select **Dev Containers: Clone Repository in Container Volume...**) and on Windows we recommend using a WSL folder:
22+
- Make sure you are running a recent WSL version to get X11 and Wayland support.
23+
- Use the WSL extension for VS Code to open the cloned folder in WSL.
24+
- Press <kbd>F1</kbd> and select **Dev Containers: Reopen in Container**.
7325

7426
Next: **[Try it out!](#try-it)**
7527

7628
## Try it!
7729

78-
This container uses the [Fluxbox](http://fluxbox.org/) window manager to keep things lean. **Right-click on the desktop** to see menu options. It works with GNOME and GTK applications, so other tools can be installed if needed.
79-
80-
> **Note:** You can also set the resolution from the command line by typing `set-resolution`.
81-
8230
To start working with Code - OSS, follow these steps:
8331

8432
1. In your local VS Code client, open a terminal (<kbd>Ctrl/Cmd</kbd> + <kbd>Shift</kbd> + <kbd>\`</kbd>) and type the following commands:
@@ -88,18 +36,20 @@ To start working with Code - OSS, follow these steps:
8836
bash scripts/code.sh
8937
```
9038

91-
2. After the build is complete, open a web browser or a [VNC Viewer](https://www.realvnc.com/en/connect/download/viewer/) to connect to the desktop environment as described in the quick start and enter `vscode` as the password.
92-
93-
3. You should now see Code - OSS!
39+
2. You should now see Code - OSS!
9440

9541
Next, let's try debugging.
9642
97-
1. Shut down Code - OSS by clicking the box in the upper right corner of the Code - OSS window through your browser or VNC viewer.
43+
1. Shut down Code - OSS by clicking the box in the upper right corner of the Code - OSS window.
9844
9945
2. Go to your local VS Code client, and use the **Run / Debug** view to launch the **VS Code** configuration. (Typically the default, so you can likely just press <kbd>F5</kbd>).
10046
101-
> **Note:** If launching times out, you can increase the value of `timeout` in the "VS Code", "Attach Main Process", "Attach Extension Host", and "Attach to Shared Process" configurations in [launch.json](../.vscode/launch.json). However, running `scripts/code.sh` first will set up Electron which will usually solve timeout issues.
47+
> **Note:** If launching times out, you can increase the value of `timeout` in the "VS Code", "Attach Main Process", "Attach Extension Host", and "Attach to Shared Process" configurations in [launch.json](../../.vscode/launch.json). However, running `scripts/code.sh` first will set up Electron which will usually solve timeout issues.
10248
10349
3. After a bit, Code - OSS will appear with the debugger attached!
10450
10551
Enjoy!
52+
53+
# Notes
54+
55+
The container comes with VS Code Insiders installed. To run it from an Integrated Terminal use `VSCODE_IPC_HOOK_CLI= /usr/bin/code-insiders .`.

.devcontainer/devcontainer.json

+12-34
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,22 @@
11
{
2-
"name": "Code - OSS",
3-
4-
// Image contents: https://github.com/microsoft/vscode-dev-containers/blob/master/repository-containers/images/github.com/microsoft/vscode/.devcontainer/base.Dockerfile
5-
"image": "mcr.microsoft.com/vscode/devcontainers/repos/microsoft/vscode:branch-main",
2+
"name": "VS Code",
3+
"build": {
4+
"dockerfile": "Dockerfile"
5+
},
66
"overrideCommand": false,
7-
"runArgs": [ "--init", "--security-opt", "seccomp=unconfined", "--shm-size=1g"],
8-
9-
// VS Code extensions and settings
7+
"privileged": true,
8+
"mounts": [
9+
{
10+
"source": "vscode-dev",
11+
"target": "/vscode-dev",
12+
"type": "volume"
13+
}
14+
],
1015
"customizations": {
1116
"vscode": {
12-
"settings": {
13-
"resmon.show.battery": false,
14-
"resmon.show.cpufreq": false
15-
},
1617
"extensions": [
17-
"dbaeumer.vscode-eslint",
1818
"mutantdino.resourcemonitor"
1919
]
2020
}
21-
},
22-
23-
// noVNC, VNC
24-
"forwardPorts": [6080, 5901],
25-
"portsAttributes": {
26-
"6080": {
27-
"label": "VNC web client (noVNC)",
28-
"onAutoForward": "silent"
29-
},
30-
"5901": {
31-
"label": "VNC TCP port",
32-
"onAutoForward": "silent"
33-
}
34-
},
35-
36-
// Optionally loads a cached yarn install for the repo
37-
"postCreateCommand": ".devcontainer/cache/restore-diff.sh",
38-
39-
"remoteUser": "node",
40-
41-
"hostRequirements": {
42-
"memory": "9gb"
4321
}
4422
}

.devcontainer/install-vscode.sh

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/sh
2+
3+
apt update
4+
apt install -y wget gpg
5+
6+
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
7+
install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg
8+
sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list'
9+
rm -f packages.microsoft.gpg
10+
11+
apt update
12+
apt install -y code-insiders libsecret-1-dev libxkbfile-dev

.devcontainer/prebuilt/README.md

+105
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# Code - OSS Development Container
2+
3+
[![Open in Dev Containers](https://img.shields.io/static/v1?label=Dev%20Containers&message=Open&color=blue&logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/microsoft/vscode)
4+
5+
This repository includes configuration for a development container for working with Code - OSS in a local container or using [GitHub Codespaces](https://github.com/features/codespaces).
6+
7+
> **Tip:** The default VNC password is `vscode`. The VNC server runs on port `5901` and a web client is available on port `6080`.
8+
9+
## Quick start - local
10+
11+
If you already have VS Code and Docker installed, you can click the badge above or [here](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/microsoft/vscode) to get started. Clicking these links will cause VS Code to automatically install the Dev Containers extension if needed, clone the source code into a container volume, and spin up a dev container for use.
12+
13+
1. Install Docker Desktop or Docker for Linux on your local machine. (See [docs](https://aka.ms/vscode-remote/containers/getting-started) for additional details.)
14+
15+
2. **Important**: Docker needs at least **4 Cores and 8 GB of RAM** to run a full build with **9 GB of RAM** being recommended. If you are on macOS, or are using the old Hyper-V engine for Windows, update these values for Docker Desktop by right-clicking on the Docker status bar item and going to **Preferences/Settings > Resources > Advanced**.
16+
17+
> **Note:** The [Resource Monitor](https://marketplace.visualstudio.com/items?itemName=mutantdino.resourcemonitor) extension is included in the container so you can keep an eye on CPU/Memory in the status bar.
18+
19+
3. Install [Visual Studio Code Stable](https://code.visualstudio.com/) or [Insiders](https://code.visualstudio.com/insiders/) and the [Dev Containers](https://aka.ms/vscode-remote/download/containers) extension.
20+
21+
![Image of Dev Containers extension](https://microsoft.github.io/vscode-remote-release/images/dev-containers-extn.png)
22+
23+
> **Note:** The Dev Containers extension requires the Visual Studio Code distribution of Code - OSS. See the [FAQ](https://aka.ms/vscode-remote/faq/license) for details.
24+
25+
4. Press <kbd>Ctrl/Cmd</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd> or <kbd>F1</kbd> and select **Dev Containers: Clone Repository in Container Volume...**.
26+
27+
> **Tip:** While you can use your local source tree instead, operations like `yarn install` can be slow on macOS or when using the Hyper-V engine on Windows. We recommend the "clone repository in container" approach instead since it uses "named volume" rather than the local filesystem.
28+
29+
5. Type `https://github.com/microsoft/vscode` (or a branch or PR URL) in the input box and press <kbd>Enter</kbd>.
30+
31+
6. After the container is running, open a web browser and go to [http://localhost:6080](http://localhost:6080), or use a [VNC Viewer](https://www.realvnc.com/en/connect/download/viewer/) to connect to `localhost:5901` and enter `vscode` as the password.
32+
33+
Anything you start in VS Code, or the integrated terminal, will appear here.
34+
35+
Next: **[Try it out!](#try-it)**
36+
37+
## Quick start - GitHub Codespaces
38+
39+
1. From the [microsoft/vscode GitHub repository](https://github.com/microsoft/vscode), click on the **Code** dropdown, select **Open with Codespaces**, and then click on **New codespace**. If prompted, select the **Standard** machine size (which is also the default).
40+
41+
> **Note:** You will not see these options within GitHub if you are not in the Codespaces beta.
42+
43+
2. After the codespace is up and running in your browser, press <kbd>Ctrl/Cmd</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd> or <kbd>F1</kbd> and select **Ports: Focus on Ports View**.
44+
45+
3. You should see **VNC web client (6080)** under in the list of ports. Select the line and click on the globe icon to open it in a browser tab.
46+
47+
> **Tip:** If you do not see the port, <kbd>Ctrl/Cmd</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd> or <kbd>F1</kbd>, select **Forward a Port** and enter port `6080`.
48+
49+
4. In the new tab, you should see noVNC. Click **Connect** and enter `vscode` as the password.
50+
51+
Anything you start in VS Code, or the integrated terminal, will appear here.
52+
53+
Next: **[Try it out!](#try-it)**
54+
55+
### Using VS Code with GitHub Codespaces
56+
57+
You may see improved VNC responsiveness when accessing a codespace from VS Code client since you can use a [VNC Viewer](https://www.realvnc.com/en/connect/download/viewer/). Here's how to do it.
58+
59+
1. Install [Visual Studio Code Stable](https://code.visualstudio.com/) or [Insiders](https://code.visualstudio.com/insiders/) and the the [GitHub Codespaces extension](https://marketplace.visualstudio.com/items?itemName=GitHub.codespaces).
60+
61+
> **Note:** The GitHub Codespaces extension requires the Visual Studio Code distribution of Code - OSS.
62+
63+
2. After the VS Code is up and running, press <kbd>Ctrl/Cmd</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd> or <kbd>F1</kbd>, choose **Codespaces: Create New Codespace**, and use the following settings:
64+
- `microsoft/vscode` for the repository.
65+
- Select any branch (e.g. **main**) - you can select a different one later.
66+
- Choose **Standard** (4-core, 8GB) as the size.
67+
68+
4. After you have connected to the codespace, you can use a [VNC Viewer](https://www.realvnc.com/en/connect/download/viewer/) to connect to `localhost:5901` and enter `vscode` as the password.
69+
70+
> **Tip:** You may also need change your VNC client's **Picture Quality** setting to **High** to get a full color desktop.
71+
72+
5. Anything you start in VS Code, or the integrated terminal, will appear here.
73+
74+
Next: **[Try it out!](#try-it)**
75+
76+
## Try it!
77+
78+
This container uses the [Fluxbox](http://fluxbox.org/) window manager to keep things lean. **Right-click on the desktop** to see menu options. It works with GNOME and GTK applications, so other tools can be installed if needed.
79+
80+
> **Note:** You can also set the resolution from the command line by typing `set-resolution`.
81+
82+
To start working with Code - OSS, follow these steps:
83+
84+
1. In your local VS Code client, open a terminal (<kbd>Ctrl/Cmd</kbd> + <kbd>Shift</kbd> + <kbd>\`</kbd>) and type the following commands:
85+
86+
```bash
87+
yarn install
88+
bash scripts/code.sh
89+
```
90+
91+
2. After the build is complete, open a web browser or a [VNC Viewer](https://www.realvnc.com/en/connect/download/viewer/) to connect to the desktop environment as described in the quick start and enter `vscode` as the password.
92+
93+
3. You should now see Code - OSS!
94+
95+
Next, let's try debugging.
96+
97+
1. Shut down Code - OSS by clicking the box in the upper right corner of the Code - OSS window through your browser or VNC viewer.
98+
99+
2. Go to your local VS Code client, and use the **Run / Debug** view to launch the **VS Code** configuration. (Typically the default, so you can likely just press <kbd>F5</kbd>).
100+
101+
> **Note:** If launching times out, you can increase the value of `timeout` in the "VS Code", "Attach Main Process", "Attach Extension Host", and "Attach to Shared Process" configurations in [launch.json](../../.vscode/launch.json). However, running `scripts/code.sh` first will set up Electron which will usually solve timeout issues.
102+
103+
3. After a bit, Code - OSS will appear with the debugger attached!
104+
105+
Enjoy!

.devcontainer/cache/build-cache-image.sh .devcontainer/prebuilt/cache/build-cache-image.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ fi
1717

1818
TAG="branch-${BRANCH//\//-}"
1919
echo "[$(date)] ${BRANCH} => ${TAG}"
20-
cd "${SCRIPT_PATH}/../.."
20+
cd "${SCRIPT_PATH}/../../.."
2121

2222
echo "[$(date)] Starting image build and push..."
2323
export DOCKER_BUILDKIT=1
File renamed without changes.

.devcontainer/cache/cache.Dockerfile .devcontainer/prebuilt/cache/cache.Dockerfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ COPY --chown=${USERNAME}:${USERNAME} . /repo-source-tmp/
99
RUN mkdir -p ${CACHE_FOLDER} && chown ${USERNAME} ${CACHE_FOLDER} /repo-source-tmp \
1010
&& su ${USERNAME} -c "\
1111
cd /repo-source-tmp \
12-
&& .devcontainer/cache/before-cache.sh . ${CACHE_FOLDER} \
13-
&& .devcontainer/prepare.sh . ${CACHE_FOLDER} \
14-
&& .devcontainer/cache/cache-diff.sh . ${CACHE_FOLDER}"
12+
&& .devcontainer/prebuilt/cache/before-cache.sh . ${CACHE_FOLDER} \
13+
&& .devcontainer/prebuilt/prepare.sh . ${CACHE_FOLDER} \
14+
&& .devcontainer/prebuilt/cache/cache-diff.sh . ${CACHE_FOLDER}"
1515

1616
# This second stage starts fresh and just copies in cache.tar from the previous stage. The related
1717
# devcontainer.json file is then setup to have postCreateCommand fire restore-diff.sh to expand it.
+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"name": "Code - OSS",
3+
4+
// Image contents: https://github.com/microsoft/vscode-dev-containers/blob/master/repository-containers/images/github.com/microsoft/vscode/.devcontainer/base.Dockerfile
5+
"image": "mcr.microsoft.com/vscode/devcontainers/repos/microsoft/vscode:branch-main",
6+
"overrideCommand": false,
7+
"runArgs": [ "--init", "--security-opt", "seccomp=unconfined", "--shm-size=1g"],
8+
9+
// VS Code extensions and settings
10+
"customizations": {
11+
"vscode": {
12+
"settings": {
13+
"resmon.show.battery": false,
14+
"resmon.show.cpufreq": false
15+
},
16+
"extensions": [
17+
"dbaeumer.vscode-eslint",
18+
"mutantdino.resourcemonitor"
19+
]
20+
}
21+
},
22+
23+
// noVNC, VNC
24+
"forwardPorts": [6080, 5901],
25+
"portsAttributes": {
26+
"6080": {
27+
"label": "VNC web client (noVNC)",
28+
"onAutoForward": "silent"
29+
},
30+
"5901": {
31+
"label": "VNC TCP port",
32+
"onAutoForward": "silent"
33+
}
34+
},
35+
36+
// Optionally loads a cached yarn install for the repo
37+
"postCreateCommand": ".devcontainer/prebuilt/cache/restore-diff.sh",
38+
39+
"remoteUser": "node",
40+
41+
"hostRequirements": {
42+
"memory": "9gb"
43+
}
44+
}

0 commit comments

Comments
 (0)