Skip to content

Commit 2cb0ef2

Browse files
authored
Create an HTTP server to serve up our react UI (#8931)
* Preliminary work * Fix border * Fix linter * Get basic react code loading * Get web view to work Add settings Hardcode working dir for now. It's used for file returns * Switching idea and fixed settings * Dynamic port number * Force localhost * Change parsing of settings * Move settings and json init into messages so can not send so much in initial HTTP request * Update docker container settings * Load index bundle with http instead of inline * Add token for authentication * Fix style to eliminate padding * Update debugging comments * Move web panel server into code instead of using node * Undo unneeded node js debugging configs * Add unit tests for the server * Fix webpanel mock to work with a promise Fix install test to actually verify results * Fix settings to be there for tests Fix intellisense tests to clean up the suggestion box * Fix more functional tests * Change webServer default to off unless insiders * Add news entry * Use portfinder for webpanel tests. * Add issue to comment instead of TODO * Fix unit tests * Attempt to get vsix to build * Different way to ignore warnings * Change error to be easier to fix later. * Try warning in different spot * Code review feedback * Change to not using a stream for the main index.html
1 parent 8ec4cd7 commit 2cb0ef2

Some content is hidden

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

57 files changed

+1615
-487
lines changed

.devcontainer/Dockerfile

Lines changed: 35 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,49 @@
55

66
FROM node:8
77

8-
# Configure apt
8+
# Avoid warnings by switching to noninteractive
99
ENV DEBIAN_FRONTEND=noninteractive
10-
RUN apt-get update \
11-
&& apt-get -y install --no-install-recommends apt-utils 2>&1
1210

13-
# Verify git and needed tools are installed
14-
RUN apt-get install -y git procps
11+
# The node image comes with a base non-root 'node' user which this Dockerfile
12+
# gives sudo access. However, for Linux, this user's GID/UID must match your local
13+
# user UID/GID to avoid permission issues with bind mounts. Update USER_UID / USER_GID
14+
# if yours is not 1000. See https://aka.ms/vscode-remote/containers/non-root-user.
15+
ARG USER_UID=1000
16+
ARG USER_GID=$USER_UID
1517

16-
# Remove outdated yarn from /opt and install via package
17-
# so it can be easily updated via apt-get upgrade yarn
18-
RUN rm -rf /opt/yarn-* \
18+
# Configure apt and install packages
19+
RUN apt-get update \
20+
&& apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \
21+
#
22+
# Verify git and needed tools are installed
23+
&& apt-get -y install git iproute2 procps \
24+
#
25+
# Remove outdated yarn from /opt and install via package
26+
# so it can be easily updated via apt-get upgrade yarn
27+
&& rm -rf /opt/yarn-* \
1928
&& rm -f /usr/local/bin/yarn \
2029
&& rm -f /usr/local/bin/yarnpkg \
2130
&& apt-get install -y curl apt-transport-https lsb-release \
2231
&& curl -sS https://dl.yarnpkg.com/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/pubkey.gpg | apt-key add - 2>/dev/null \
2332
&& echo "deb https://dl.yarnpkg.com/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
2433
&& apt-get update \
25-
&& apt-get -y install --no-install-recommends yarn
26-
27-
# Install tslint and typescript
28-
RUN npm install -g tslint typescript
29-
30-
# Clean up
31-
RUN apt-get autoremove -y \
34+
&& apt-get -y install --no-install-recommends yarn \
35+
#
36+
# Install tslint and typescript globally
37+
&& npm install -g tslint typescript \
38+
#
39+
# [Optional] Update a non-root user to match UID/GID - see https://aka.ms/vscode-remote/containers/non-root-user.
40+
&& if [ "$USER_GID" != "1000" ]; then groupmod node --gid $USER_GID; fi \
41+
&& if [ "$USER_UID" != "1000" ]; then usermod --uid $USER_UID node; fi \
42+
# [Optional] Add add sudo support for non-root user
43+
&& apt-get install -y sudo \
44+
&& echo node ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/node \
45+
&& chmod 0440 /etc/sudoers.d/node \
46+
#
47+
# Clean up
48+
&& apt-get autoremove -y \
3249
&& apt-get clean -y \
3350
&& rm -rf /var/lib/apt/lists/*
34-
ENV DEBIAN_FRONTEND=dialog
51+
52+
# Switch back to dialog for any ad-hoc use of apt-get
53+
ENV DEBIAN_FRONTEND=

.devcontainer/devcontainer.json

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,27 @@
1-
// See https://aka.ms/vscode-remote/devcontainer.json for format details.
1+
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or the definition README at
2+
// https://github.com/microsoft/vscode-dev-containers/tree/master/containers/typescript-node-8
23
{
34
"name": "Node.js 8 & TypeScript",
45
"dockerFile": "Dockerfile",
6+
7+
// Use 'settings' to set *default* container specific settings.json values on container create.
8+
// You can edit these settings after create using File > Preferences > Settings > Remote.
9+
"settings": {
10+
"terminal.integrated.shell.linux": "/bin/bash"
11+
},
12+
13+
// Uncomment the next line if you want to publish any ports.
14+
// "appPort": [],
15+
16+
// Uncomment the next line to run commands after the container is created.
17+
// "postCreateCommand": "yarn install",
18+
19+
// Uncomment the next line to use a non-root user. On Linux, this will prevent
20+
// new files getting created as root, but you may need to update the USER_UID
21+
// and USER_GID in .devcontainer/Dockerfile to match your user if not 1000.
22+
// "runArgs": [ "-u", "node" ],
23+
24+
// Add the IDs of extensions you want installed when the container is created in the array below.
525
"extensions": [
626
"ms-vscode.vscode-typescript-tslint-plugin"
727
]

build/webpack/common.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ exports.nodeModulesToExternalize = [
3131
'crypto-js',
3232
'fontkit',
3333
'linebreak',
34-
'png-js'
34+
'png-js',
35+
'@koa/cors',
36+
'koa',
37+
'koa-compress',
38+
'koa-logger'
3539
];
3640
exports.nodeModulesToReplacePaths = [
3741
...exports.nodeModulesToExternalize

build/webpack/common.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ export const nodeModulesToExternalize = [
3333
'crypto-js',
3434
'fontkit',
3535
'linebreak',
36-
'png-js'
36+
'png-js',
37+
'@koa/cors',
38+
'koa',
39+
'koa-compress',
40+
'koa-logger'
3741
];
3842

3943
export const nodeModulesToReplacePaths = [

gulpfile.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ async function buildWebPack(webpackConfigName, args) {
179179
throw new Error(`Errors in ${webpackConfigName}, \n${warnings.join(', ')}\n\n${stdOut}`);
180180
}
181181
if (warnings.length > 0) {
182-
throw new Error(`Warnings in ${webpackConfigName}, \n\n${stdOut}`);
182+
throw new Error(`Warnings in ${webpackConfigName}, Check gulpfile.js to see if the warning should be allowed., \n\n${stdOut}`);
183183
}
184184
}
185185
function getAllowedWarningsForWebPack(buildConfig) {
@@ -196,15 +196,17 @@ function getAllowedWarningsForWebPack(buildConfig) {
196196
'WARNING in ./node_modules/ws/lib/Validation.js',
197197
'WARNING in ./node_modules/ws/lib/validation.js',
198198
'WARNING in ./node_modules/@jupyterlab/services/node_modules/ws/lib/buffer-util.js',
199-
'WARNING in ./node_modules/@jupyterlab/services/node_modules/ws/lib/validation.js'
199+
'WARNING in ./node_modules/@jupyterlab/services/node_modules/ws/lib/validation.js',
200+
'WARNING in ./node_modules/any-promise/register.js'
200201
];
201202
case 'extension':
202203
return [
203204
'WARNING in ./node_modules/encoding/lib/iconv-loader.js',
204205
'WARNING in ./node_modules/ws/lib/BufferUtil.js',
205206
'WARNING in ./node_modules/ws/lib/buffer-util.js',
206207
'WARNING in ./node_modules/ws/lib/Validation.js',
207-
'WARNING in ./node_modules/ws/lib/validation.js'
208+
'WARNING in ./node_modules/ws/lib/validation.js',
209+
'WARNING in ./node_modules/any-promise/register.js'
208210
];
209211
case 'debugAdapter':
210212
return ['WARNING in ./node_modules/vscode-uri/lib/index.js'];

news/2 Fixes/7704.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Support local images in markdown and output for notebooks.

0 commit comments

Comments
 (0)