diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index 72ce590b..00000000 --- a/.dockerignore +++ /dev/null @@ -1,12 +0,0 @@ -Dockerfile -build -deployment -doc -.github -.gitignore -.node-version -.travis.yml -LICENSE -README.md -node_modules -release diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index de976600..00000000 --- a/.drone.yml +++ /dev/null @@ -1,331 +0,0 @@ -kind: pipeline -type: docker -name: amd64:linux - -platform: - arch: amd64 - -steps: -- name: cache:restore - image: codercom/nbin:centos - commands: - - yum install -y libxkbfile-devel libsecret-devel - - . /opt/rh/devtoolset-6/enable - - ./scripts/cacher.sh - -- name: lint - image: node:12 - commands: - - yarn lint - -- name: test - image: codercom/nbin:centos - commands: - - yum install -y openssl - - yarn test - -- name: build - image: codercom/nbin:centos - commands: - - yum install -y libxkbfile-devel libsecret-devel - - . /opt/rh/devtoolset-6/enable - - timeout 50m ./scripts/ci.bash || echo 'Timed out or failed; continuing to preserve cache for the next run' - -- name: cache:package - image: node:12 - commands: - - ./scripts/cacher.sh - when: - event: push - -- name: cache:push - image: plugins/gcs - settings: - source: cache-upload/ - target: codesrv-ci.cdr.sh - token: - from_secret: gcs-token - when: - event: push - -- name: test:build - image: codercom/nbin:centos - commands: - - yarn test:build - -- name: publish:github - image: plugins/github-release - settings: - api_key: - from_secret: github_token - files: release/*.tar.gz - draft: true - overwrite: true - title: ${DRONE_TAG} - when: - event: tag - -- name: publish:docker - image: plugins/docker - settings: - username: - from_secret: docker_user - password: - from_secret: docker_pass - repo: codercom/code-server - dockerfile: scripts/ci.dockerfile - tags: - - ${DRONE_TAG} - when: - event: tag - -- name: publish:gcs - image: plugins/gcs - settings: - source: binary-upload - target: codesrv-ci.cdr.sh/ - token: - from_secret: gcs-token - when: - event: tag - ---- -kind: pipeline -type: docker -name: amd64:alpine - -platform: - arch: amd64 - -steps: -- name: cache:restore - image: node:12-alpine - commands: - - apk add libxkbfile-dev libsecret-dev build-base git bash python - - ./scripts/cacher.sh - -- name: lint - image: node:12-alpine - commands: - - yarn lint - -- name: test - image: node:12-alpine - commands: - - apk add openssl - - yarn test - -- name: build - image: node:12-alpine - commands: - - apk add libxkbfile-dev libsecret-dev build-base git bash python - - timeout 50m ./scripts/ci.bash || echo 'Timed out or failed; continuing to preserve cache for the next run' - -- name: cache:package - image: node:12-alpine - commands: - - ./scripts/cacher.sh - when: - event: push - -- name: cache:push - image: plugins/gcs - settings: - source: cache-upload/ - target: codesrv-ci.cdr.sh - token: - from_secret: gcs-token - when: - event: push - -- name: test:build - image: node:12-alpine - commands: - - yarn test:build - -- name: publish:github - image: plugins/github-release - settings: - api_key: - from_secret: github_token - files: release/*.tar.gz - draft: true - overwrite: true - title: ${DRONE_TAG} - when: - event: tag - -- name: publish:gcs - image: plugins/gcs - settings: - source: binary-upload - target: codesrv-ci.cdr.sh/ - token: - from_secret: gcs-token - when: - event: tag - ---- -kind: pipeline -type: docker -name: arm64:linux - -platform: - arch: arm64 - -steps: -- name: cache:restore - image: node:12 - commands: - - apt update && apt install -y build-essential git libsecret-1-dev libx11-dev libxkbfile-dev - - ./scripts/cacher.sh - -- name: lint - image: node:12 - commands: - - yarn lint - -- name: test - image: node:12 - commands: - - yarn test - -- name: build - image: node:12 - commands: - - apt update && apt install -y build-essential git libsecret-1-dev libx11-dev libxkbfile-dev - - timeout 50m ./scripts/ci.bash || echo 'Timed out or failed; continuing to preserve cache for the next run' - -- name: cache:package - image: node:12 - commands: - - ./scripts/cacher.sh - when: - event: push - -- name: cache:push - image: plugins/gcs - settings: - source: cache-upload/ - target: codesrv-ci.cdr.sh - token: - from_secret: gcs-token - when: - event: push - -- name: test:build - image: node:12 - commands: - - yarn test:build - -- name: publish:github - image: plugins/github-release - settings: - api_key: - from_secret: github_token - files: release/*.tar.gz - draft: true - overwrite: true - title: ${DRONE_TAG} - when: - event: tag - -- name: publish:docker - image: plugins/docker - settings: - username: - from_secret: docker_user - password: - from_secret: docker_pass - repo: codercom/code-server - dockerfile: scripts/ci.dockerfile - tags: - - ${DRONE_TAG}-arm64 - when: - event: tag - -- name: publish:gcs - image: plugins/gcs - settings: - source: binary-upload - target: codesrv-ci.cdr.sh/ - token: - from_secret: gcs-token - when: - event: tag - ---- -kind: pipeline -type: docker -name: arm64:alpine - -platform: - arch: arm64 - -steps: -- name: cache:restore - image: node:12-alpine - commands: - - apk add libxkbfile-dev libsecret-dev build-base git bash python - - ./scripts/cacher.sh - -- name: lint - image: node:12-alpine - commands: - - yarn lint - -- name: test - image: node:12-alpine - commands: - - apk add openssl - - yarn test - -- name: build - image: node:12-alpine - commands: - - apk add libxkbfile-dev libsecret-dev build-base git bash python - - timeout 50m ./scripts/ci.bash || echo 'Timed out or failed; continuing to preserve cache for the next run' - -- name: cache:package - image: node:12-alpine - commands: - - ./scripts/cacher.sh - when: - event: push - -- name: cache:push - image: plugins/gcs - settings: - source: cache-upload/ - target: codesrv-ci.cdr.sh - token: - from_secret: gcs-token - when: - event: push - -- name: test:build - image: node:12-alpine - commands: - - yarn test:build - -- name: publish:github - image: plugins/github-release - settings: - api_key: - from_secret: github_token - files: release/*.tar.gz - draft: true - overwrite: true - title: ${DRONE_TAG} - when: - event: tag - -- name: publish:gcs - image: plugins/gcs - settings: - source: binary-upload - target: codesrv-ci.cdr.sh/ - token: - from_secret: gcs-token - when: - event: tag diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 65705d95..00000000 --- a/.editorconfig +++ /dev/null @@ -1,6 +0,0 @@ -root = true - -[*] -indent_style = space -trim_trailing_whitespace = true -indent_size = 2 diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 11fee14e..c68d7da5 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,2 +1 @@ -* @code-asher @kylecarbs -Dockerfile @nhooyr +* @code-asher @nhooyr diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 50e90f1f..00000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -name: Bug Report -about: Report problems and unexpected behavior. -title: '' -labels: 'bug' -assignees: '' ---- - - - - -- `code-server` version: -- OS Version: - -## Description - - - -## Steps to Reproduce - -1. -1. \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/extension_bug.md b/.github/ISSUE_TEMPLATE/extension_bug.md deleted file mode 100644 index 7c30b947..00000000 --- a/.github/ISSUE_TEMPLATE/extension_bug.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -name: Extension Bug -about: Report problems and unexpected behavior with extensions. -title: '' -labels: 'extension-specific' -assignees: '' ---- - - - -- `code-server` version: -- OS Version: -- Extension: - -## Description - - - -## Steps to Reproduce - -1. -1. \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index b33f67bc..00000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: Feature Request -about: Suggest an idea for this project. -title: '' -labels: 'feature' -assignees: '' ---- - - - - \ No newline at end of file diff --git a/.github/issue_template.md b/.github/issue_template.md new file mode 100644 index 00000000..eaafce94 --- /dev/null +++ b/.github/issue_template.md @@ -0,0 +1,4 @@ + diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index e056fdf5..6e29ad1b 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,6 +1,4 @@ - - -### Describe in detail the problem you had and how this PR fixes it - -### Is there an open issue you can link to? - + diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..a5279a3e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,24 @@ +name: ci +on: [push, pull_request] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + + - name: get yarn cache directory path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + - uses: actions/cache@v1 + id: yarn-cache + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - name: yarn lint + uses: ./ci/image + with: + args: yarn && yarn lint diff --git a/.gitignore b/.gitignore index 69c3c58f..d228a31f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,7 @@ *.tsbuildinfo .cache -binaries -*-upload build dist* -node_modules out* release -source -yarn-cache +node_modules diff --git a/.node-version b/.node-version deleted file mode 100644 index 65d83ce5..00000000 --- a/.node-version +++ /dev/null @@ -1 +0,0 @@ -12.14.0 diff --git a/.npmrc b/.npmrc deleted file mode 100644 index 5fca0d51..00000000 --- a/.npmrc +++ /dev/null @@ -1 +0,0 @@ -scripts-prepend-node-path=true diff --git a/.prettierrc.yaml b/.prettierrc.yaml index aaaa29c7..a0634116 100644 --- a/.prettierrc.yaml +++ b/.prettierrc.yaml @@ -1,7 +1,4 @@ printWidth: 120 semi: false -tabWidth: 2 -singleQuote: false -trailingComma: es5 -useTabs: false +trailingComma: all arrowParens: always diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d417dcc5..00000000 --- a/.travis.yml +++ /dev/null @@ -1,37 +0,0 @@ -language: node_js -node_js: - - 12.14.0 -services: - - docker - -jobs: - include: - - name: "MacOS build" - os: osx - script: travis_wait 60 scripts/ci.bash - -git: - depth: 3 - -deploy: - - provider: releases - file_glob: true - draft: true - tag_name: "$TRAVIS_TAG" - target_commitish: "$TRAVIS_COMMIT" - name: "$TRAVIS_TAG" - skip_cleanup: true - api_key: - secure: YL/x24KjYjgYXPcJWk3FV7FGxI79Mh6gBECQEcdlf3fkLEoKFVgzHBoUNWrFPzyR4tgLyWNAgcpD9Lkme1TRWTom7UPjXcwMNyLcLa+uec7ciSAnYD9ntLTpiCuPDD1u0LtRGclSi/EHQ+F8YVq+HZJpXTsJeAmOmihma3GVbGKSZr+BRum+0YZSG4w+o4TOlYzw/4bLWS52MogZcwpjd+hemBbgXLuGU2ziKv2vEKCZFbEeA16II4x1WLI4mutDdCeh7+3aLzGLwDa49NxtsVYNjyNFF75JhCTCNA55e2YMiLz9Uq69IXe/mi5F7xUaFfhIqqLNyKBnKeEOzu3dYnc+8n3LjnQ+00PmkF05nx9kBn3UfV1kwQGh6QbyDmTtBP07rtUMyI14aeQqHjxsaVRdMnwj9Q2DjXRr8UDqESZF0rmK3pHCXS2fBhIzLE8tLVW5Heiba2pQRFMHMZW+KBE97FzcFh7is90Ait3T8enfcd/PWFPYoBejDAdjwxwOkezh5N5ZkYquEfDYuWrFi6zRFCktsruaAcA+xGtTf9oilBBzUqu8Ie+YFWH5me83xakcblJWdaW/D2rLJAJH3m6LFm8lBqyUgDX5t/etob6CpDuYHu5D1J3XINOj/+aLAcadq6qlh70PMZS3zYffUu3JlzaD2amlSHIT8b5YXFc= - file: - - release/*.tar.gz - - release/*.zip - on: - repo: cdr/code-server - tags: true - -cache: - timeout: 1000 - yarn: true - directories: - - source diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 08005dbc..00000000 --- a/Dockerfile +++ /dev/null @@ -1,57 +0,0 @@ -FROM node:12.14.0 -ARG tag -ARG githubToken - -# Install VS Code's deps. These are the only two it seems we need. -RUN apt-get update && apt-get install -y \ - libxkbfile-dev \ - libsecret-1-dev - -WORKDIR /src -COPY . . - -RUN yarn \ - && DRONE_TAG="$tag" MINIFY=true STRIP_BIN_TARGET=true GITHUB_TOKEN="$githubToken" ./scripts/ci.bash \ - && rm -r /src/build \ - && rm -r /src/source - -# We deploy with Ubuntu so that devs have a familiar environment. -FROM ubuntu:18.04 - -RUN apt-get update && apt-get install -y \ - openssl \ - net-tools \ - git \ - locales \ - sudo \ - dumb-init \ - vim \ - curl \ - wget \ - && rm -rf /var/lib/apt/lists/* - -RUN locale-gen en_US.UTF-8 -# We cannot use update-locale because docker will not use the env variables -# configured in /etc/default/locale so we need to set it manually. -ENV LC_ALL=en_US.UTF-8 \ - SHELL=/bin/bash - -RUN adduser --gecos '' --disabled-password coder && \ - echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd - -USER coder -# Create first so these directories will be owned by coder instead of root -# (workdir and mounting appear to both default to root). -RUN mkdir -p /home/coder/project -RUN mkdir -p /home/coder/.local/share/code-server - -WORKDIR /home/coder/project - -# This ensures we have a volume mounted even if the user forgot to do bind -# mount. So that they do not lose their data if they delete the container. -VOLUME [ "/home/coder/project" ] - -COPY --from=0 /src/binaries/code-server /usr/local/bin/code-server -EXPOSE 8080 - -ENTRYPOINT ["dumb-init", "code-server", "--host", "0.0.0.0"] diff --git a/LICENSE b/LICENSE.txt similarity index 100% rename from LICENSE rename to LICENSE.txt diff --git a/ci/Dockerfile b/ci/Dockerfile new file mode 100644 index 00000000..c7064ced --- /dev/null +++ b/ci/Dockerfile @@ -0,0 +1,37 @@ +FROM debian:10 + +RUN apt-get update +RUN apt-get install -y curl + +ARG DOWNLOAD_URL=https://github.com/cdr/code-server/releases/download/2.1698/code-server2.1698-vsc1.41.1-linux-x86_64.tar.gz + +RUN cd /tmp && curl -L "$DOWNLOAD_URL" | \ + tar -xz && \ + cp code-server*/code-server /usr/local/bin/code-server + +# https://wiki.debian.org/Locale#Manually +RUN apt-get install -y locales +RUN sed -i "s/# en_US.UTF-8/en_US.UTF-8/" /etc/locale.gen +RUN locale-gen +ENV LANG=en_US.UTF-8 + +RUN chsh -s /bin/bash +ENV SHELL=/bin/bash + +RUN apt-get install -y dumb-init sudo +RUN apt-get install -y man procps vim nano htop ssh git + +RUN adduser --gecos '' --disabled-password coder && \ + echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd + +RUN curl -SsL https://github.com/boxboat/fixuid/releases/download/v0.4/fixuid-0.4-linux-amd64.tar.gz | tar -C /usr/local/bin -xzf - && \ + chown root:root /usr/local/bin/fixuid && \ + chmod 4755 /usr/local/bin/fixuid && \ + mkdir -p /etc/fixuid && \ + printf "user: coder\ngroup: coder\n" > /etc/fixuid/config.yml + +RUN rm -rf /var/lib/apt/lists/* +EXPOSE 8080 +USER coder +WORKDIR /home/coder +ENTRYPOINT ["dumb-init", "fixuid", "-q", "code-server", "--host", "0.0.0.0"] diff --git a/scripts/build.ts b/ci/build.ts similarity index 100% rename from scripts/build.ts rename to ci/build.ts diff --git a/ci/clean.sh b/ci/clean.sh new file mode 100755 index 00000000..92637b5a --- /dev/null +++ b/ci/clean.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +set -euo pipefail + +main() { + git clean -xffd + git submodule foreach --recursive git clean -xffd + git submodule foreach --recursive git reset --hard +} + +main "$@" diff --git a/ci/fmt.sh b/ci/fmt.sh new file mode 100755 index 00000000..9f9c2315 --- /dev/null +++ b/ci/fmt.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +set -euo pipefail + +main() { + shfmt -i 2 -w -s -sr $$(git ls-files "*.sh") + prettier --write --loglevel=warn $$(git ls-files "*.js" "*.ts" "*.tsx" "*.html" "*.json" "*.css" "*.md" "*.toml" "*.yaml" "*.yml") + if [[ "$CI" != "" && $$(git ls-files --other --modified --exclude-standard) != "" ]]; then + echo "Files need generation or are formatted incorrectly:" + git -c color.ui=always status | grep --color=no '\[31m' + echo "Please run the following locally:" + echo " make fmt" + exit 1 + fi +} + +main "$@" diff --git a/ci/image/Dockerfile b/ci/image/Dockerfile new file mode 100644 index 00000000..6bef9e51 --- /dev/null +++ b/ci/image/Dockerfile @@ -0,0 +1,12 @@ +FROM node:12-buster + +RUN apt-get update && apt-get install -y \ + libxkbfile-dev \ + libsecret-1-dev \ + dumb-init + +RUN curl -L https://github.com/mvdan/sh/releases/download/v3.0.1/shfmt_v3.0.1_linux_amd64 > /usr/local/bin/shfmt && chmod +x /usr/local/bin/shfmt + +COPY entrypoint.sh /bin/entrypoint.sh + +ENTRYPOINT ["dumb-init", "/bin/entrypoint.sh"] diff --git a/ci/image/entrypoint.sh b/ci/image/entrypoint.sh new file mode 100755 index 00000000..a8aa34c7 --- /dev/null +++ b/ci/image/entrypoint.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +set -euo pipefail + +eval "$@" diff --git a/ci/lint.sh b/ci/lint.sh new file mode 100755 index 00000000..5b60c894 --- /dev/null +++ b/ci/lint.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +set -euo pipefail + +main() { + eslint --max-warnings=0 --fix $$(git ls-files "*.ts" "*.tsx" "*.js") + stylelint --fix $$(git ls-files "*.css") +} + +main "$@" diff --git a/scripts/ci.bash b/ci/release.bash similarity index 100% rename from scripts/ci.bash rename to ci/release.bash diff --git a/ci/tsconfig.json b/ci/tsconfig.json new file mode 100644 index 00000000..d4b88657 --- /dev/null +++ b/ci/tsconfig.json @@ -0,0 +1,6 @@ +{ + "extends": "../tsconfig.json", + "include": [ + "./**/*.ts" + ] +} diff --git a/scripts/vscode.patch b/ci/vscode.patch similarity index 93% rename from scripts/vscode.patch rename to ci/vscode.patch index 77fe4367..05899ce9 100644 --- a/scripts/vscode.patch +++ b/ci/vscode.patch @@ -87,7 +87,7 @@ index 0000000000..fc18355f89 + common.minifyTask("out-vscode") +)); diff --git a/extensions/vscode-api-tests/package.json b/extensions/vscode-api-tests/package.json -index 8ac6b2806c..8562a284db 100644 +index 8ac6b2806c..60b1255e2c 100644 --- a/extensions/vscode-api-tests/package.json +++ b/extensions/vscode-api-tests/package.json @@ -121,7 +121,7 @@ @@ -95,7 +95,7 @@ index 8ac6b2806c..8562a284db 100644 "mocha-junit-reporter": "^1.17.0", "mocha-multi-reporters": "^1.1.7", - "typescript": "^1.6.2", -+ "typescript": "3.7.2", ++ "typescript": "3.7.2", "vscode": "1.1.5" } } @@ -106,7 +106,7 @@ index 2d8b725ff2..a8d93a17ca 100644 @@ -1855,10 +1855,10 @@ tweetnacl@^0.14.3, tweetnacl@~0.14.0: resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" integrity sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q= - + -typescript@^1.6.2: - version "1.8.10" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-1.8.10.tgz#b475d6e0dff0bf50f296e5ca6ef9fbb5c7320f1e" @@ -115,25 +115,25 @@ index 2d8b725ff2..a8d93a17ca 100644 + version "3.7.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.2.tgz#27e489b95fa5909445e9fef5ee48d81697ad18fb" + integrity sha512-ml7V7JfiN2Xwvcer+XAf2csGO1bPBdRbFCkYBczNZggrBZ9c7G3riSUeJmqEU5uOtXNPMhE3n+R4FA/3YOAWOQ== - + unique-stream@^2.0.2: version "2.2.1" diff --git a/package.json b/package.json -index fde05321d2..1a7ed2fa47 100644 +index ade5fcdaf0..73d661eb57 100644 --- a/package.json +++ b/package.json -@@ -32,6 +32,9 @@ - "eslint": "eslint -c .eslintrc.json --rulesdir ./build/lib/eslint --ext .ts --ext .js ./src/vs ./extensions" +@@ -30,6 +30,9 @@ + "web": "node scripts/code-web.js" }, "dependencies": { -+ "@coder/logger": "^1.1.12", ++ "@coder/logger": "^1.1.11", + "@coder/node-browser": "^1.0.8", -+ "@coder/requirefs": "^1.1.4", ++ "@coder/requirefs": "^1.0.6", "applicationinsights": "1.0.8", "chokidar": "3.2.3", "graceful-fs": "4.1.11", diff --git a/src/vs/base/common/network.ts b/src/vs/base/common/network.ts -index a68e020f9f..c31e7befa3 100644 +index 231180d513..5b98e191c1 100644 --- a/src/vs/base/common/network.ts +++ b/src/vs/base/common/network.ts @@ -88,16 +88,17 @@ class RemoteAuthoritiesImpl { @@ -180,17 +180,16 @@ index 5a631e0b39..4114bd9287 100644 _isWindows = (process.platform === 'win32'); _isMacintosh = (process.platform === 'darwin'); diff --git a/src/vs/base/common/processes.ts b/src/vs/base/common/processes.ts -index c52f7b3774..967943d27b 100644 +index c52f7b3774..4c9a0c4bab 100644 --- a/src/vs/base/common/processes.ts +++ b/src/vs/base/common/processes.ts -@@ -110,7 +110,10 @@ export function sanitizeProcessEnvironment(env: IProcessEnvironment, ...preserve +@@ -110,7 +110,9 @@ export function sanitizeProcessEnvironment(env: IProcessEnvironment, ...preserve /^ELECTRON_.+$/, /^GOOGLE_API_KEY$/, /^VSCODE_.+$/, - /^SNAP(|_.*)$/ + /^SNAP(|_.*)$/, + // NOTE@coder: Add our variables. -+ /^NBIN_BYPASS$/, + /^LAUNCH_VSCODE$/ ]; const envKeys = Object.keys(env); @@ -211,48 +210,8 @@ index 2c64061da7..c0ef8faedd 100644 } catch (err) { // Do nothing. If we can't read the file we have no // language pack config. -diff --git a/src/vs/code/browser/workbench/workbench.ts b/src/vs/code/browser/workbench/workbench.ts -index a599f5a7eb..ec7ccd43f8 100644 ---- a/src/vs/code/browser/workbench/workbench.ts -+++ b/src/vs/code/browser/workbench/workbench.ts -@@ -298,35 +298,6 @@ class WorkspaceProvider implements IWorkspaceProvider { - let workspace: IWorkspace; - let payload = Object.create(null); - -- const query = new URL(document.location.href).searchParams; -- query.forEach((value, key) => { -- switch (key) { -- -- // Folder -- case WorkspaceProvider.QUERY_PARAM_FOLDER: -- workspace = { folderUri: URI.parse(value) }; -- foundWorkspace = true; -- break; -- -- // Workspace -- case WorkspaceProvider.QUERY_PARAM_WORKSPACE: -- workspace = { workspaceUri: URI.parse(value) }; -- foundWorkspace = true; -- break; -- -- // Empty -- case WorkspaceProvider.QUERY_PARAM_EMPTY_WINDOW: -- workspace = undefined; -- foundWorkspace = true; -- break; -- -- // Payload -- case WorkspaceProvider.QUERY_PARAM_PAYLOAD: -- payload = JSON.parse(value); -- break; -- } -- }); -- - // If no workspace is provided through the URL, check for config attribute from server - if (!foundWorkspace) { - if (config.folderUri) { diff --git a/src/vs/platform/environment/common/environment.ts b/src/vs/platform/environment/common/environment.ts -index abd1e33b18..bf75952ce1 100644 +index 033cdc575f..23f775f27d 100644 --- a/src/vs/platform/environment/common/environment.ts +++ b/src/vs/platform/environment/common/environment.ts @@ -37,6 +37,8 @@ export interface ParsedArgs { @@ -264,7 +223,7 @@ index abd1e33b18..bf75952ce1 100644 extensionDevelopmentPath?: string[]; // // undefined or array of 1 or more local paths or URIs extensionTestsPath?: string; // either a local path or a URI 'extension-development-confirm-save'?: boolean; -@@ -147,6 +149,8 @@ export interface IEnvironmentService extends IUserHomeProvider { +@@ -144,6 +146,8 @@ export interface IEnvironmentService extends IUserHomeProvider { disableExtensions: boolean | string[]; builtinExtensionsPath: string; extensionsPath?: string; @@ -274,11 +233,11 @@ index abd1e33b18..bf75952ce1 100644 extensionTestsLocationURI?: URI; logExtensionHostCommunication?: boolean; diff --git a/src/vs/platform/environment/node/argv.ts b/src/vs/platform/environment/node/argv.ts -index e68e0647c3..49a5aae2fa 100644 +index 6832b93c5c..1e451584eb 100644 --- a/src/vs/platform/environment/node/argv.ts +++ b/src/vs/platform/environment/node/argv.ts @@ -55,6 +55,8 @@ export const OPTIONS: OptionDescriptions> = { - + 'extensions-dir': { type: 'string', deprecates: 'extensionHomePath', cat: 'e', args: 'dir', description: localize('extensionHomePath', "Set the root path for extensions.") }, 'builtin-extensions-dir': { type: 'string' }, + 'extra-builtin-extensions-dir': { type: 'string[]', cat: 'o', description: 'Path to an extra builtin extension directory.' }, @@ -286,35 +245,34 @@ index e68e0647c3..49a5aae2fa 100644 'list-extensions': { type: 'boolean', cat: 'e', description: localize('listExtensions', "List the installed extensions.") }, 'show-versions': { type: 'boolean', cat: 'e', description: localize('showVersions', "Show versions of installed extensions, when using --list-extension.") }, 'category': { type: 'string', cat: 'e', description: localize('category', "Filters installed extensions by provided category, when using --list-extension.") }, -@@ -310,4 +312,3 @@ export function buildHelpMessage(productName: string, executableName: string, ve +@@ -308,4 +310,3 @@ export function buildHelpMessage(productName: string, executableName: string, ve export function buildVersionMessage(version: string | undefined, commit: string | undefined): string { return `${version || localize('unknownVersion', "Unknown version")}\n${commit || localize('unknownCommit', "Unknown commit")}\n${process.arch}`; } - diff --git a/src/vs/platform/environment/node/environmentService.ts b/src/vs/platform/environment/node/environmentService.ts -index 0428e1e888..9b3cddcb3a 100644 +index 99cab4bba2..531b1d7177 100644 --- a/src/vs/platform/environment/node/environmentService.ts +++ b/src/vs/platform/environment/node/environmentService.ts -@@ -197,6 +197,13 @@ export class EnvironmentService implements IEnvironmentService { - return path.join(this.userHome, product.dataFolderName, 'extensions'); - } - +@@ -266,6 +266,12 @@ export class EnvironmentService implements IEnvironmentService { + + get driverHandle(): string | undefined { return this._args['driver']; } + get driverVerbose(): boolean { return !!this._args['driver-verbose']; } + @memoize get extraExtensionPaths(): string[] { + return (this._args['extra-extensions-dir'] || []).map((p) => parsePathArg(p, process)); + } + @memoize get extraBuiltinExtensionPaths(): string[] { + return (this._args['extra-builtin-extensions-dir'] || []).map((p) => parsePathArg(p, process)); + } -+ - @memoize - get extensionDevelopmentLocationURI(): URI[] | undefined { - const s = this._args.extensionDevelopmentPath; + + constructor(private _args: ParsedArgs, private _execPath: string) { + if (!process.env['VSCODE_LOGS']) { diff --git a/src/vs/platform/extensionManagement/node/extensionManagementService.ts b/src/vs/platform/extensionManagement/node/extensionManagementService.ts -index 5b05650591..aa8712d8fb 100644 +index 5bfc2bb66c..49a6ce8540 100644 --- a/src/vs/platform/extensionManagement/node/extensionManagementService.ts +++ b/src/vs/platform/extensionManagement/node/extensionManagementService.ts -@@ -743,11 +743,15 @@ export class ExtensionManagementService extends Disposable implements IExtension - +@@ -741,11 +741,15 @@ export class ExtensionManagementService extends Disposable implements IExtension + private scanSystemExtensions(): Promise { this.logService.trace('Started scanning system extensions'); - const systemExtensionsPromise = this.scanExtensions(this.systemExtensionsPath, ExtensionType.System) @@ -334,10 +292,10 @@ index 5b05650591..aa8712d8fb 100644 if (this.environmentService.isBuilt) { return systemExtensionsPromise; } -@@ -769,9 +773,16 @@ export class ExtensionManagementService extends Disposable implements IExtension +@@ -767,9 +771,16 @@ export class ExtensionManagementService extends Disposable implements IExtension .then(([systemExtensions, devSystemExtensions]) => [...systemExtensions, ...devSystemExtensions]); } - + + private scanAllUserExtensions(folderName: string, type: ExtensionType): Promise { + return Promise.all([ + this.scanExtensions(folderName, type), @@ -352,7 +310,7 @@ index 5b05650591..aa8712d8fb 100644 .then(([uninstalled, extensions]) => { extensions = extensions.filter(e => !uninstalled[new ExtensionIdentifierWithVersion(e.identifier, e.manifest.version).key()]); if (excludeOutdated) { -@@ -786,6 +797,12 @@ export class ExtensionManagementService extends Disposable implements IExtension +@@ -784,6 +795,12 @@ export class ExtensionManagementService extends Disposable implements IExtension private scanExtensions(root: string, type: ExtensionType): Promise { const limiter = new Limiter(10); return pfs.readdir(root) @@ -360,13 +318,13 @@ index 5b05650591..aa8712d8fb 100644 + if (error.code !== 'ENOENT') { + throw error; + } -+ return []; ++ return []; + }) .then(extensionsFolders => Promise.all(extensionsFolders.map(extensionFolder => limiter.queue(() => this.scanExtension(extensionFolder, root, type))))) .then(extensions => extensions.filter(e => e && e.identifier)); } -@@ -824,7 +841,7 @@ export class ExtensionManagementService extends Disposable implements IExtension - +@@ -822,7 +839,7 @@ export class ExtensionManagementService extends Disposable implements IExtension + private async removeUninstalledExtensions(): Promise { const uninstalled = await this.getUninstalledExtensions(); - const extensions = await this.scanExtensions(this.extensionsPath, ExtensionType.User); // All user extensions @@ -374,15 +332,15 @@ index 5b05650591..aa8712d8fb 100644 const installed: Set = new Set(); for (const e of extensions) { if (!uninstalled[new ExtensionIdentifierWithVersion(e.identifier, e.manifest.version).key()]) { -@@ -843,7 +860,7 @@ export class ExtensionManagementService extends Disposable implements IExtension +@@ -841,7 +858,7 @@ export class ExtensionManagementService extends Disposable implements IExtension } - + private removeOutdatedExtensions(): Promise { - return this.scanExtensions(this.extensionsPath, ExtensionType.User) // All user extensions + return this.scanAllUserExtensions(this.extensionsPath, ExtensionType.User) // All user extensions .then(extensions => { const toRemove: ILocalExtension[] = []; - + diff --git a/src/vs/platform/product/common/product.ts b/src/vs/platform/product/common/product.ts index 804d113856..30a349f69f 100644 --- a/src/vs/platform/product/common/product.ts @@ -404,33 +362,33 @@ index 804d113856..30a349f69f 100644 + assign(product, JSON.parse(rawProductConfiguration)); + } } - + // Node: AMD loader @@ -36,7 +43,7 @@ else if (typeof require !== 'undefined' && typeof require.__$__nodeRequire === ' const rootPath = path.dirname(getPathFromAmdModule(require, '')); - + product = assign({}, require.__$__nodeRequire(path.join(rootPath, 'product.json')) as IProductConfiguration); - const pkg = require.__$__nodeRequire(path.join(rootPath, 'package.json')) as { version: string; }; + const pkg = require.__$__nodeRequire(path.join(rootPath, 'package.json')) as { version: string; codeServerVersion: string; }; - + // Running out of sources if (env['VSCODE_DEV']) { @@ -48,7 +55,8 @@ else if (typeof require !== 'undefined' && typeof require.__$__nodeRequire === ' } - + assign(product, { - version: pkg.version + version: pkg.version, + codeServerVersion: pkg.codeServerVersion, }); } - + diff --git a/src/vs/platform/product/common/productService.ts b/src/vs/platform/product/common/productService.ts -index 120fd66644..52547bdb0e 100644 +index 6db9725704..779b3cbdea 100644 --- a/src/vs/platform/product/common/productService.ts +++ b/src/vs/platform/product/common/productService.ts @@ -16,6 +16,7 @@ export interface IProductService extends Readonly { - + export interface IProductConfiguration { readonly version: string; + readonly codeServerVersion: string; @@ -443,7 +401,7 @@ index d0f6e6b18a..1966fd297d 100644 +++ b/src/vs/platform/remote/browser/browserSocketFactory.ts @@ -205,7 +205,8 @@ export class BrowserSocketFactory implements ISocketFactory { } - + connect(host: string, port: number, query: string, callback: IConnectCallback): void { - const socket = this._webSocketFactory.create(`ws://${host}:${port}/?${query}&skipWebSocketFrames=false`); + // NOTE@coder: Modified to work against the current path. @@ -1432,10 +1390,10 @@ index 0000000000..9c240b992d +} diff --git a/src/vs/server/node/connection.ts b/src/vs/server/node/connection.ts new file mode 100644 -index 0000000000..9b8969690c +index 0000000000..3b42933419 --- /dev/null +++ b/src/vs/server/node/connection.ts -@@ -0,0 +1,158 @@ +@@ -0,0 +1,156 @@ +import * as cp from 'child_process'; +import { getPathFromAmdModule } from 'vs/base/common/amd'; +import { VSBuffer } from 'vs/base/common/buffer'; @@ -1570,10 +1528,8 @@ index 0000000000..9b8969690c + + proc.on('error', () => this.dispose()); + proc.on('exit', () => this.dispose()); -+ if (proc.stdout && proc.stderr) { -+ proc.stdout.setEncoding('utf8').on('data', (d) => this.log.info('Extension host stdout', d)); -+ proc.stderr.setEncoding('utf8').on('data', (d) => this.log.error('Extension host stderr', d)); -+ } ++ proc.stdout.setEncoding('utf8').on('data', (d) => this.log.info('Extension host stdout', d)); ++ proc.stderr.setEncoding('utf8').on('data', (d) => this.log.error('Extension host stderr', d)); + proc.on('message', (event) => { + if (event && event.type === '__$console') { + const severity = (this.log)[event.severity] ? event.severity : 'info'; @@ -2152,7 +2108,7 @@ index 0000000000..3c74512192 +} diff --git a/src/vs/server/node/server.ts b/src/vs/server/node/server.ts new file mode 100644 -index 0000000000..13d71949ce +index 0000000000..ac6bbc8e98 --- /dev/null +++ b/src/vs/server/node/server.ts @@ -0,0 +1,252 @@ @@ -2189,6 +2145,7 @@ index 0000000000..13d71949ce +import { IProductService } from 'vs/platform/product/common/productService'; +import { ConnectionType, ConnectionTypeRequest } from 'vs/platform/remote/common/remoteAgentConnection'; +import { RemoteAgentConnectionContext } from 'vs/platform/remote/common/remoteAgentEnvironment'; ++import { REMOTE_FILE_SYSTEM_CHANNEL_NAME } from 'vs/platform/remote/common/remoteAgentFileSystemChannel'; +import { IRequestService } from 'vs/platform/request/common/request'; +import { RequestChannel } from 'vs/platform/request/common/requestIpc'; +import { RequestService } from 'vs/platform/request/node/requestService'; @@ -2208,7 +2165,6 @@ index 0000000000..13d71949ce +import { getLocaleFromConfig, getNlsConfiguration } from 'vs/server/node/nls'; +import { Protocol } from 'vs/server/node/protocol'; +import { getUriTransformer } from 'vs/server/node/util'; -+import { REMOTE_FILE_SYSTEM_CHANNEL_NAME } from "vs/workbench/services/remote/common/remoteAgentFileSystemChannel"; +import { RemoteExtensionLogFileName } from 'vs/workbench/services/remote/common/remoteAgentService'; + +export class Vscode { @@ -2454,19 +2410,19 @@ index 0000000000..06b080044c + return new URITransformer(rawURITransformer); +}; diff --git a/src/vs/workbench/api/browser/extensionHost.contribution.ts b/src/vs/workbench/api/browser/extensionHost.contribution.ts -index e69aa80159..71a899d37b 100644 +index 2905c52411..6ecfae2634 100644 --- a/src/vs/workbench/api/browser/extensionHost.contribution.ts +++ b/src/vs/workbench/api/browser/extensionHost.contribution.ts -@@ -58,6 +58,7 @@ import './mainThreadWorkspace'; - import './mainThreadComments'; +@@ -57,6 +57,7 @@ import './mainThreadComments'; import './mainThreadTask'; import './mainThreadLabelService'; + import 'vs/workbench/api/common/apiCommands'; +import 'vs/server/browser/mainThreadNodeProxy'; - import './mainThreadTunnelService'; - import './mainThreadAuthentication'; - import './mainThreadTimeline'; + + export class ExtensionPoints implements IWorkbenchContribution { + diff --git a/src/vs/workbench/api/common/extHost.api.impl.ts b/src/vs/workbench/api/common/extHost.api.impl.ts -index 91045fcda6..a41624e3d2 100644 +index ea5ad7991f..e5e0ec0fce 100644 --- a/src/vs/workbench/api/common/extHost.api.impl.ts +++ b/src/vs/workbench/api/common/extHost.api.impl.ts @@ -67,6 +67,7 @@ import { ILogService } from 'vs/platform/log/common/log'; @@ -2474,36 +2430,44 @@ index 91045fcda6..a41624e3d2 100644 import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService'; import { IExtHostInitDataService } from 'vs/workbench/api/common/extHostInitDataService'; +import { IExtHostNodeProxy } from 'vs/server/browser/extHostNodeProxy'; - import { ExtHostTheming } from 'vs/workbench/api/common/extHostTheming'; - import { IExtHostTunnelService } from 'vs/workbench/api/common/extHostTunnelService'; - import { IExtHostApiDeprecationService } from 'vs/workbench/api/common/extHostApiDeprecationService'; -@@ -91,6 +92,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I + + export interface IExtensionApiFactory { + (extension: IExtensionDescription, registry: ExtensionDescriptionRegistry, configProvider: ExtHostConfigProvider): typeof vscode; +@@ -86,6 +87,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I const rpcProtocol = accessor.get(IExtHostRpcService); const extHostStorage = accessor.get(IExtHostStorage); const extHostLogService = accessor.get(ILogService); + const extHostNodeProxy = accessor.get(IExtHostNodeProxy); - const extHostTunnelService = accessor.get(IExtHostTunnelService); - const extHostApiDeprecation = accessor.get(IExtHostApiDeprecationService); - -@@ -100,6 +102,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I + + // register addressable instances + rpcProtocol.set(ExtHostContext.ExtHostLogService, extHostLogService); +@@ -93,6 +95,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I rpcProtocol.set(ExtHostContext.ExtHostConfiguration, extHostConfiguration); rpcProtocol.set(ExtHostContext.ExtHostExtensionService, extensionService); rpcProtocol.set(ExtHostContext.ExtHostStorage, extHostStorage); + rpcProtocol.set(ExtHostContext.ExtHostNodeProxy, extHostNodeProxy); - rpcProtocol.set(ExtHostContext.ExtHostTunnelService, extHostTunnelService); - + // automatically create and register addressable instances + const extHostDecorations = rpcProtocol.set(ExtHostContext.ExtHostDecorations, accessor.get(IExtHostDecorations)); diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts -index 55130ff918..35ae724c4f 100644 +index 3dab81c9c5..73fc57118a 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts -@@ -667,6 +667,16 @@ export interface MainThreadLabelServiceShape extends IDisposable { +@@ -655,6 +655,10 @@ export interface MainThreadLabelServiceShape extends IDisposable { $unregisterResourceLabelFormatter(handle: number): void; } - + +export interface MainThreadNodeProxyShape extends IDisposable { + $send(message: string): void; +} ++ + export interface MainThreadSearchShape extends IDisposable { + $registerFileSearchProvider(handle: number, scheme: string): void; + $registerTextSearchProvider(handle: number, scheme: string): void; +@@ -888,6 +892,13 @@ export interface ExtHostLabelServiceShape { + $registerResourceLabelFormatter(formatter: ResourceLabelFormatter): IDisposable; + } + +export interface ExtHostNodeProxyShape { + $onMessage(message: string): void; + $onClose(): void; @@ -2511,31 +2475,33 @@ index 55130ff918..35ae724c4f 100644 + $onUp(): void; +} + - export interface MainThreadSearchShape extends IDisposable { - $registerFileSearchProvider(handle: number, scheme: string): void; - $registerTextSearchProvider(handle: number, scheme: string): void; -@@ -1496,6 +1506,7 @@ export const MainContext = { + export interface ExtHostSearchShape { + $provideFileSearchResults(handle: number, session: number, query: search.IRawQuery, token: CancellationToken): Promise; + $provideTextSearchResults(handle: number, session: number, query: search.IRawTextQuery, token: CancellationToken): Promise; +@@ -1431,7 +1442,8 @@ export const MainContext = { + MainThreadSearch: createMainId('MainThreadSearch'), MainThreadTask: createMainId('MainThreadTask'), MainThreadWindow: createMainId('MainThreadWindow'), - MainThreadLabelService: createMainId('MainThreadLabelService'), -+ MainThreadNodeProxy: createMainId('MainThreadNodeProxy'), - MainThreadTheming: createMainId('MainThreadTheming'), - MainThreadTunnelService: createMainId('MainThreadTunnelService'), - MainThreadTimeline: createMainId('MainThreadTimeline') -@@ -1533,6 +1544,7 @@ export const ExtHostContext = { +- MainThreadLabelService: createMainId('MainThreadLabelService') ++ MainThreadLabelService: createMainId('MainThreadLabelService'), ++ MainThreadNodeProxy: createMainId('MainThreadNodeProxy') + }; + + export const ExtHostContext = { +@@ -1465,5 +1477,6 @@ export const ExtHostContext = { + ExtHostStorage: createMainId('ExtHostStorage'), ExtHostUrls: createExtId('ExtHostUrls'), ExtHostOutputService: createMainId('ExtHostOutputService'), - ExtHostLabelService: createMainId('ExtHostLabelService'), -+ ExtHostNodeProxy: createMainId('ExtHostNodeProxy'), - ExtHostTheming: createMainId('ExtHostTheming'), - ExtHostTunnelService: createMainId('ExtHostTunnelService'), - ExtHostAuthentication: createMainId('ExtHostAuthentication'), +- ExtHosLabelService: createMainId('ExtHostLabelService') ++ ExtHosLabelService: createMainId('ExtHostLabelService'), ++ ExtHostNodeProxy: createMainId('ExtHostNodeProxy') + }; diff --git a/src/vs/workbench/api/common/extHostExtensionService.ts b/src/vs/workbench/api/common/extHostExtensionService.ts -index 978bf32fcd..809b51227c 100644 +index a3b5ed0057..679be7f377 100644 --- a/src/vs/workbench/api/common/extHostExtensionService.ts +++ b/src/vs/workbench/api/common/extHostExtensionService.ts @@ -5,7 +5,7 @@ - + import * as nls from 'vs/nls'; import * as path from 'vs/base/common/path'; -import { originalFSPath, joinPath } from 'vs/base/common/resources'; @@ -2548,37 +2514,39 @@ index 978bf32fcd..809b51227c 100644 import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService'; import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection'; +import { IExtHostNodeProxy } from 'vs/server/browser/extHostNodeProxy'; - import { IExtHostTunnelService } from 'vs/workbench/api/common/extHostTunnelService'; - + interface ITestRunner { -@@ -77,6 +78,7 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio + /** Old test runner API, as exported from `vscode/lib/testrunner` */ +@@ -76,6 +77,7 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio protected readonly _extHostWorkspace: ExtHostWorkspace; protected readonly _extHostConfiguration: ExtHostConfiguration; protected readonly _logService: ILogService; + protected readonly _nodeProxy: IExtHostNodeProxy; - protected readonly _extHostTunnelService: IExtHostTunnelService; - + protected readonly _mainThreadWorkspaceProxy: MainThreadWorkspaceShape; -@@ -107,7 +109,8 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio + protected readonly _mainThreadTelemetryProxy: MainThreadTelemetryShape; +@@ -104,15 +106,18 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio + @IExtHostConfiguration extHostConfiguration: IExtHostConfiguration, @ILogService logService: ILogService, @IExtHostInitDataService initData: IExtHostInitDataService, - @IExtensionStoragePaths storagePath: IExtensionStoragePaths, -- @IExtHostTunnelService extHostTunnelService: IExtHostTunnelService +- @IExtensionStoragePaths storagePath: IExtensionStoragePaths ++ @IExtensionStoragePaths storagePath: IExtensionStoragePaths, + @IExtHostNodeProxy nodeProxy: IExtHostNodeProxy, -+ @IExtHostTunnelService extHostTunnelService: IExtHostTunnelService, ) { this._hostUtils = hostUtils; this._extHostContext = extHostContext; -@@ -116,6 +119,7 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio + this._initData = initData; ++ this._nodeProxy = nodeProxy; + this._extHostWorkspace = extHostWorkspace; this._extHostConfiguration = extHostConfiguration; this._logService = logService; + this._nodeProxy = nodeProxy; - this._extHostTunnelService = extHostTunnelService; this._disposables = new DisposableStore(); - -@@ -341,14 +345,14 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio - + + this._mainThreadWorkspaceProxy = this._extHostContext.getProxy(MainContext.MainThreadWorkspace); +@@ -337,14 +342,14 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio + const activationTimesBuilder = new ExtensionActivationTimesBuilder(reason.startup); return Promise.all([ - this._loadCommonJSModule(joinPath(extensionDescription.extensionLocation, extensionDescription.main), activationTimesBuilder), @@ -2588,29 +2556,29 @@ index 978bf32fcd..809b51227c 100644 return AbstractExtHostExtensionService._callActivate(this._logService, extensionDescription.identifier, values[0], values[1], activationTimesBuilder); }); } - + - protected abstract _loadCommonJSModule(module: URI, activationTimesBuilder: ExtensionActivationTimesBuilder): Promise; + protected abstract _loadCommonJSModule(module: URI | IExtensionDescription, activationTimesBuilder: ExtensionActivationTimesBuilder): Promise; - + private _loadExtensionContext(extensionDescription: IExtensionDescription): Promise { - + diff --git a/src/vs/workbench/api/node/extHost.services.ts b/src/vs/workbench/api/node/extHost.services.ts -index 72ad75d63e..07b8a3f20c 100644 +index 9ae085f536..2510c86617 100644 --- a/src/vs/workbench/api/node/extHost.services.ts +++ b/src/vs/workbench/api/node/extHost.services.ts -@@ -24,6 +24,8 @@ import { IExtensionStoragePaths } from 'vs/workbench/api/common/extHostStoragePa - import { IExtHostExtensionService } from 'vs/workbench/api/common/extHostExtensionService'; - import { ExtHostExtensionService } from 'vs/workbench/api/node/extHostExtensionService'; +@@ -26,6 +26,8 @@ import { ExtHostExtensionService } from 'vs/workbench/api/node/extHostExtensionS import { IExtHostStorage, ExtHostStorage } from 'vs/workbench/api/common/extHostStorage'; -+import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; -+import { IExtHostNodeProxy } from 'vs/server/browser/extHostNodeProxy'; import { ILogService } from 'vs/platform/log/common/log'; import { ExtHostLogService } from 'vs/workbench/api/node/extHostLogService'; - import { IExtHostTunnelService } from 'vs/workbench/api/common/extHostTunnelService'; -@@ -47,3 +49,19 @@ registerSingleton(IExtensionStoragePaths, ExtensionStoragePaths); ++import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; ++import { IExtHostNodeProxy } from 'vs/server/browser/extHostNodeProxy'; + + // register singleton services + registerSingleton(ILogService, ExtHostLogService); +@@ -42,3 +44,19 @@ registerSingleton(IExtHostSearch, NativeExtHostSearch); + registerSingleton(IExtensionStoragePaths, ExtensionStoragePaths); registerSingleton(IExtHostExtensionService, ExtHostExtensionService); registerSingleton(IExtHostStorage, ExtHostStorage); - registerSingleton(IExtHostTunnelService, ExtHostTunnelService); + +function NotImplementedProxy(name: ServiceIdentifier): { new(): T } { + return class { @@ -2637,13 +2605,13 @@ index a1c3e50ffd..910627aaf9 100644 import { Schemas } from 'vs/base/common/network'; +import { IExtensionDescription } from 'vs/platform/extensions/common/extensions'; +import { joinPath } from 'vs/base/common/resources'; - + class NodeModuleRequireInterceptor extends RequireInterceptor { - + @@ -76,7 +78,10 @@ export class ExtHostExtensionService extends AbstractExtHostExtensionService { }; } - + - protected _loadCommonJSModule(module: URI, activationTimesBuilder: ExtensionActivationTimesBuilder): Promise { + protected _loadCommonJSModule(module: URI | IExtensionDescription, activationTimesBuilder: ExtensionActivationTimesBuilder): Promise { + if (!URI.isUri(module)) { @@ -2657,7 +2625,7 @@ index afdd6bf398..604fdd255c 100644 --- a/src/vs/workbench/api/node/extHostStoragePaths.ts +++ b/src/vs/workbench/api/node/extHostStoragePaths.ts @@ -5,13 +5,14 @@ - + import * as path from 'vs/base/common/path'; import { URI } from 'vs/base/common/uri'; -import * as pfs from 'vs/base/node/pfs'; @@ -2670,9 +2638,9 @@ index afdd6bf398..604fdd255c 100644 import { ILogService } from 'vs/platform/log/common/log'; +import { IExtHostRpcService } from '../common/extHostRpcService'; +import { VSBuffer } from 'vs/base/common/buffer'; - + export class ExtensionStoragePaths implements IExtensionStoragePaths { - + @@ -26,6 +27,7 @@ export class ExtensionStoragePaths implements IExtensionStoragePaths { constructor( @IExtHostInitDataService initData: IExtHostInitDataService, @@ -2684,17 +2652,17 @@ index afdd6bf398..604fdd255c 100644 @@ -54,21 +56,25 @@ export class ExtensionStoragePaths implements IExtensionStoragePaths { const storageName = this._workspace.id; const storagePath = path.join(this._environment.appSettingsHome.fsPath, 'workspaceStorage', storageName); - + - const exists = await pfs.dirExists(storagePath); + // NOTE@coder: Use the file system proxy so this will work in the browser. + // writeFile performs a mkdirp so we don't need to bother ourselves. + const fileSystem = this._extHostRpc.getProxy(MainContext.MainThreadFileSystem); + const exists = fileSystem.$stat(URI.file(storagePath)); - + if (exists) { return storagePath; } - + try { - await pfs.mkdirp(storagePath); - await pfs.writeFile( @@ -2715,7 +2683,7 @@ index afdd6bf398..604fdd255c 100644 + ) ); return storagePath; - + diff --git a/src/vs/workbench/api/worker/extHostExtensionService.ts b/src/vs/workbench/api/worker/extHostExtensionService.ts index 4781f22676..86c9246f51 100644 --- a/src/vs/workbench/api/worker/extHostExtensionService.ts @@ -2727,13 +2695,13 @@ index 4781f22676..86c9246f51 100644 +import { joinPath } from 'vs/base/common/resources'; +import { IExtensionDescription } from 'vs/platform/extensions/common/extensions'; +import { loadCommonJSModule } from 'vs/server/browser/worker'; - + class WorkerRequireInterceptor extends RequireInterceptor { - + @@ -41,7 +44,14 @@ export class ExtHostExtensionService extends AbstractExtHostExtensionService { await this._fakeModules.install(); } - + - protected async _loadCommonJSModule(module: URI, activationTimesBuilder: ExtensionActivationTimesBuilder): Promise { + protected async _loadCommonJSModule(module: URI | IExtensionDescription, activationTimesBuilder: ExtensionActivationTimesBuilder): Promise { + if (!URI.isUri(module) && module.extensionKind !== 'web') { @@ -2743,7 +2711,7 @@ index 4781f22676..86c9246f51 100644 + if (!URI.isUri(module)) { + module = joinPath(module.extensionLocation, module.main!); + } - + module = module.with({ path: ensureSuffix(module.path, '.js') }); const response = await fetch(module.toString(true)); @@ -57,7 +67,7 @@ export class ExtHostExtensionService extends AbstractExtHostExtensionService { @@ -2756,25 +2724,33 @@ index 4781f22676..86c9246f51 100644 throw new Error(`Cannot load module '${request}'`); } diff --git a/src/vs/workbench/browser/web.main.ts b/src/vs/workbench/browser/web.main.ts -index 94e7052574..4e83208017 100644 +index 807ac56d8f..7482c92fd4 100644 --- a/src/vs/workbench/browser/web.main.ts +++ b/src/vs/workbench/browser/web.main.ts -@@ -49,6 +49,7 @@ import { IndexedDBLogProvider } from 'vs/workbench/services/log/browser/indexedD +@@ -50,6 +50,7 @@ import { IndexedDBLogProvider } from 'vs/workbench/services/log/browser/indexedD import { InMemoryLogProvider } from 'vs/workbench/services/log/common/inMemoryLogProvider'; import { isWorkspaceToOpen, isFolderToOpen } from 'vs/platform/windows/common/windows'; import { getWorkspaceIdentifier } from 'vs/workbench/services/workspaces/browser/workspaces'; +import { initialize } from 'vs/server/browser/client'; - + class BrowserMain extends Disposable { - -@@ -85,6 +86,7 @@ class BrowserMain extends Disposable { - + +@@ -86,6 +87,7 @@ class BrowserMain extends Disposable { + // Startup workbench.startup(); + await initialize(services.serviceCollection); } - + private registerListeners(workbench: Workbench, storageService: BrowserStorageService): void { +@@ -247,6 +249,7 @@ class BrowserMain extends Disposable { + const channel = connection.getChannel(REMOTE_FILE_SYSTEM_CHANNEL_NAME); + const remoteFileSystemProvider = this._register(new RemoteFileSystemProvider(channel, remoteAgentService.getEnvironment())); + fileService.registerProvider(Schemas.vscodeRemote, remoteFileSystemProvider); ++ fileService.registerProvider(Schemas.file, remoteFileSystemProvider); + + if (!this.configuration.userDataProvider) { + const remoteUserDataUri = this.getRemoteUserDataUri(); diff --git a/src/vs/workbench/common/resources.ts b/src/vs/workbench/common/resources.ts index c509716fc4..2b4c847d1e 100644 --- a/src/vs/workbench/common/resources.ts @@ -2784,9 +2760,9 @@ index c509716fc4..2b4c847d1e 100644 import { IConfigurationService, IConfigurationChangeEvent } from 'vs/platform/configuration/common/configuration'; import { withNullAsUndefined } from 'vs/base/common/types'; +import { Schemas } from 'vs/base/common/network'; - + export class ResourceContextKey extends Disposable implements IContextKey { - + @@ -63,7 +64,8 @@ export class ResourceContextKey extends Disposable implements IContextKey { set(value: URI | null) { if (!ResourceContextKey._uriEquals(this._resourceKey.get(), value)) { @@ -2798,7 +2774,7 @@ index c509716fc4..2b4c847d1e 100644 this._langIdKey.set(value ? this._modeService.getModeIdByFilepathOrFirstLine(value) : null); this._extensionKey.set(value ? extname(value) : null); diff --git a/src/vs/workbench/contrib/webview/browser/pre/main.js b/src/vs/workbench/contrib/webview/browser/pre/main.js -index 63c9af47e2..021358fef9 100644 +index 138707c9a9..9134d5f503 100644 --- a/src/vs/workbench/contrib/webview/browser/pre/main.js +++ b/src/vs/workbench/contrib/webview/browser/pre/main.js @@ -329,7 +329,8 @@ @@ -2816,7 +2792,7 @@ index f67f9aa064..add754cd5a 100644 --- a/src/vs/workbench/services/dialogs/browser/dialogService.ts +++ b/src/vs/workbench/services/dialogs/browser/dialogService.ts @@ -122,11 +122,12 @@ export class DialogService implements IDialogService { - + async about(): Promise { const detail = nls.localize('aboutDetail', - "Version: {0}\nCommit: {1}\nDate: {2}\nBrowser: {3}", @@ -2828,14 +2804,14 @@ index f67f9aa064..add754cd5a 100644 + navigator.userAgent, + this.productService.codeServerVersion || 'Unknown', ); - + const { choice } = await this.show(Severity.Info, this.productService.nameLong, [nls.localize('copy', "Copy"), nls.localize('ok', "OK")], { detail, cancelId: 1 }); diff --git a/src/vs/workbench/services/environment/browser/environmentService.ts b/src/vs/workbench/services/environment/browser/environmentService.ts -index 1bf4cfad2a..924a2fcd87 100644 +index d54e68fa70..d1cd9c4c1b 100644 --- a/src/vs/workbench/services/environment/browser/environmentService.ts +++ b/src/vs/workbench/services/environment/browser/environmentService.ts -@@ -195,8 +195,8 @@ export class BrowserWorkbenchEnvironmentService implements IWorkbenchEnvironment - +@@ -189,8 +189,8 @@ export class BrowserWorkbenchEnvironmentService implements IWorkbenchEnvironment + @memoize get webviewExternalEndpoint(): string { - // TODO: get fallback from product.json @@ -2843,42 +2819,42 @@ index 1bf4cfad2a..924a2fcd87 100644 + // NOTE@coder: Modified to work against the current URL. + return `${window.location.origin}${window.location.pathname.replace(/\/+$/, '')}/webview/`; } - + @memoize -@@ -249,6 +249,8 @@ export class BrowserWorkbenchEnvironmentService implements IWorkbenchEnvironment +@@ -245,6 +245,8 @@ export class BrowserWorkbenchEnvironmentService implements IWorkbenchEnvironment installSourcePath!: string; - + builtinExtensionsPath!: string; + extraExtensionPaths!: string[]; + extraBuiltinExtensionPaths!: string[]; - + globalStorageHome!: string; workspaceStorageHome!: string; diff --git a/src/vs/workbench/services/extensions/browser/extensionService.ts b/src/vs/workbench/services/extensions/browser/extensionService.ts -index fe891a042e..21d0d4bf61 100644 +index d164f2c127..5a08106f04 100644 --- a/src/vs/workbench/services/extensions/browser/extensionService.ts +++ b/src/vs/workbench/services/extensions/browser/extensionService.ts @@ -119,6 +119,7 @@ export class ExtensionService extends AbstractExtensionService implements IExten - + } else { // remote: only enabled and none-web'ish extension + localExtensions.push(...remoteEnv.extensions.filter(extension => this._isEnabled(extension) && canExecuteOnWeb(extension, this._productService, this._configService))); remoteEnv.extensions = remoteEnv.extensions.filter(extension => this._isEnabled(extension) && !canExecuteOnWeb(extension, this._productService, this._configService)); this._checkEnableProposedApi(remoteEnv.extensions); - + diff --git a/src/vs/workbench/services/extensions/common/extensionsUtil.ts b/src/vs/workbench/services/extensions/common/extensionsUtil.ts -index 9e8352ac88..22a2d296f9 100644 +index 75f715cc51..4422cfa418 100644 --- a/src/vs/workbench/services/extensions/common/extensionsUtil.ts +++ b/src/vs/workbench/services/extensions/common/extensionsUtil.ts @@ -32,7 +32,8 @@ export function canExecuteOnWorkspace(manifest: IExtensionManifest, productServi - + export function canExecuteOnWeb(manifest: IExtensionManifest, productService: IProductService, configurationService: IConfigurationService): boolean { const extensionKind = getExtensionKind(manifest, productService, configurationService); - return extensionKind.some(kind => kind === 'web'); + // NOTE@coder: Hardcode vim for now. + return extensionKind.some(kind => kind === 'web') || manifest.name === 'vim'; } - + export function getExtensionKind(manifest: IExtensionManifest, productService: IProductService, configurationService: IConfigurationService): ExtensionKind[] { diff --git a/src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts b/src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts index 0f35c54431..32fff09b18 100644 @@ -2887,21 +2863,21 @@ index 0f35c54431..32fff09b18 100644 @@ -53,12 +53,13 @@ const args = minimist(process.argv.slice(2), { const Module = require.__$__nodeRequire('module') as any; const originalLoad = Module._load; - + - Module._load = function (request: string) { + Module._load = function (request: string, parent: object, isMain: boolean) { if (request === 'natives') { throw new Error('Either the extension or a NPM dependency is using the "natives" node module which is unsupported as it can cause a crash of the extension host. Click [here](https://go.microsoft.com/fwlink/?linkid=871887) to find out more'); } - + - return originalLoad.apply(this, arguments); + // NOTE@coder: Map node_module.asar requests to regular node_modules. + return originalLoad.apply(this, [request.replace(/node_modules\.asar(\.unpacked)?/, 'node_modules'), parent, isMain]); }; })(); - + @@ -131,8 +132,11 @@ function _createExtHostProtocol(): Promise { - + // Wait for rich client to reconnect protocol.onSocketClose(() => { - // The socket has closed, let's give the renderer a certain amount of time to reconnect @@ -2915,7 +2891,7 @@ index 0f35c54431..32fff09b18 100644 } } diff --git a/src/vs/workbench/services/extensions/worker/extHost.services.ts b/src/vs/workbench/services/extensions/worker/extHost.services.ts -index bbb72e9511..0785d3391d 100644 +index 8a65101aa4..1c4923dd6d 100644 --- a/src/vs/workbench/services/extensions/worker/extHost.services.ts +++ b/src/vs/workbench/services/extensions/worker/extHost.services.ts @@ -18,9 +18,10 @@ import { IExtensionStoragePaths } from 'vs/workbench/api/common/extHostStoragePa @@ -2927,16 +2903,15 @@ index bbb72e9511..0785d3391d 100644 import { ExtHostLogService } from 'vs/workbench/api/worker/extHostLogService'; +import { ExtHostNodeProxy, IExtHostNodeProxy } from 'vs/server/browser/extHostNodeProxy'; +import { ExtensionStoragePaths } from 'vs/workbench/api/node/extHostStoragePaths'; - import { IExtHostTunnelService, ExtHostTunnelService } from 'vs/workbench/api/common/extHostTunnelService'; - import { IExtHostApiDeprecationService, ExtHostApiDeprecationService, } from 'vs/workbench/api/common/extHostApiDeprecationService'; - -@@ -36,24 +37,10 @@ registerSingleton(IExtHostDocumentsAndEditors, ExtHostDocumentsAndEditors); + + // register singleton services + registerSingleton(ILogService, ExtHostLogService); +@@ -33,25 +34,9 @@ registerSingleton(IExtHostDocumentsAndEditors, ExtHostDocumentsAndEditors); registerSingleton(IExtHostStorage, ExtHostStorage); registerSingleton(IExtHostExtensionService, ExtHostExtensionService); registerSingleton(IExtHostSearch, ExtHostSearch); +registerSingleton(IExtHostNodeProxy, ExtHostNodeProxy); - registerSingleton(IExtHostTunnelService, ExtHostTunnelService); - + -// register services that only throw errors -function NotImplementedProxy(name: ServiceIdentifier): { new(): T } { - return class { @@ -2955,14 +2930,16 @@ index bbb72e9511..0785d3391d 100644 registerSingleton(IExtHostTerminalService, WorkerExtHostTerminalService); registerSingleton(IExtHostTask, WorkerExtHostTask); registerSingleton(IExtHostDebugService, WorkerExtHostDebugService); --registerSingleton(IExtensionStoragePaths, class extends NotImplementedProxy(IExtensionStoragePaths) { whenReady = Promise.resolve(); }); +-registerSingleton(IExtensionStoragePaths, class extends NotImplementedProxy(IExtensionStoragePaths) { +- whenReady = Promise.resolve(); +-}); +registerSingleton(IExtensionStoragePaths, ExtensionStoragePaths); diff --git a/src/vs/workbench/services/extensions/worker/extensionHostWorkerMain.ts b/src/vs/workbench/services/extensions/worker/extensionHostWorkerMain.ts index 79455414c0..5ba66b2d83 100644 --- a/src/vs/workbench/services/extensions/worker/extensionHostWorkerMain.ts +++ b/src/vs/workbench/services/extensions/worker/extensionHostWorkerMain.ts @@ -14,7 +14,11 @@ - + require.config({ baseUrl: monacoBaseUrl, - catchError: true @@ -2972,24 +2949,25 @@ index 79455414c0..5ba66b2d83 100644 + '@coder/requirefs': `../../static-{{COMMIT}}/node_modules/@coder/requirefs/out/requirefs.js`, + } }); - + require(['vs/workbench/services/extensions/worker/extensionHostWorker'], () => { }, err => console.error(err)); diff --git a/src/vs/workbench/services/localizations/electron-browser/localizationsService.ts b/src/vs/workbench/services/localizations/electron-browser/localizationsService.ts -index 99394090da..4891e0fece 100644 +index 99394090da..fa86aef420 100644 --- a/src/vs/workbench/services/localizations/electron-browser/localizationsService.ts +++ b/src/vs/workbench/services/localizations/electron-browser/localizationsService.ts -@@ -5,17 +5,17 @@ - +@@ -5,17 +5,18 @@ + import { createChannelSender } from 'vs/base/parts/ipc/node/ipc'; import { ILocalizationsService } from 'vs/platform/localizations/common/localizations'; -import { ISharedProcessService } from 'vs/platform/ipc/electron-browser/sharedProcessService'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; +import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService'; - + export class LocalizationsService { - + _serviceBrand: undefined; - + ++ // NOTE@coder: Patched to work in the browser. constructor( - @ISharedProcessService sharedProcessService: ISharedProcessService, + @IRemoteAgentService remoteAgentService: IRemoteAgentService, @@ -2998,9 +2976,9 @@ index 99394090da..4891e0fece 100644 + return createChannelSender(remoteAgentService.getConnection()!.getChannel('localizations')); } } - + diff --git a/src/vs/workbench/workbench.web.main.ts b/src/vs/workbench/workbench.web.main.ts -index 0719b361e0..b9420ba206 100644 +index f424c87d92..6fb1e4f2ed 100644 --- a/src/vs/workbench/workbench.web.main.ts +++ b/src/vs/workbench/workbench.web.main.ts @@ -34,7 +34,8 @@ import 'vs/workbench/services/textfile/browser/browserTextFileService'; @@ -3033,28 +3011,28 @@ index 297dce969b..06e0199c74 100644 }, "dependencies": { diff --git a/test/automation/yarn.lock b/test/automation/yarn.lock -index 94a1350861..e45971c254 100644 +index 94a1350861..d75660c5af 100644 --- a/test/automation/yarn.lock +++ b/test/automation/yarn.lock @@ -21,10 +21,10 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-12.7.1.tgz#3b5c3a26393c19b400844ac422bd0f631a94d69d" integrity sha512-aK9jxMypeSrhiYofWWBf/T7O+KwaiAHzM4sveCdWPn71lzUSMimRnKzhXDKfKwV1kWoBo2P1aGgaIYGLf9/ljw== - + -"@types/node@8.0.33": - version "8.0.33" - resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.33.tgz#1126e94374014e54478092830704f6ea89df04cd" - integrity sha512-vmCdO8Bm1ExT+FWfC9sd9r4jwqM7o97gGy2WBshkkXbf/2nLAJQUrZfIhw27yVOtLUev6kSZc4cav/46KbDd8A== +"@types/node@^10.12.12": -+ version "10.17.15" -+ resolved "https://registry.yarnpkg.com/@types/node/-/node-10.17.15.tgz#bfff4e23e9e70be6eec450419d51e18de1daf8e7" -+ integrity sha512-daFGV9GSs6USfPgxceDA8nlSe48XrVCJfDeYm7eokxq/ye7iuOH87hKXgMtEAVLFapkczbZsx868PMDT1Y0a6A== - ++ version "10.17.13" ++ resolved "https://registry.yarnpkg.com/@types/node/-/node-10.17.13.tgz#ccebcdb990bd6139cd16e84c39dc2fb1023ca90c" ++ integrity sha512-pMCcqU2zT4TjqYFrWtYHKal7Sl30Ims6ulZ4UFXxI4xbtQqK/qqKwkDoBFCfooRqqmRu9vY3xaJRwxSh673aYg== + "@types/puppeteer@^1.19.0": version "1.19.1" @@ -1751,10 +1751,10 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= - + -typescript@2.9.2: - version "2.9.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.9.2.tgz#1cbf61d05d6b96269244eb6a3bce4bd914e0f00c" @@ -3063,7 +3041,7 @@ index 94a1350861..e45971c254 100644 + version "3.7.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.2.tgz#27e489b95fa5909445e9fef5ee48d81697ad18fb" + integrity sha512-ml7V7JfiN2Xwvcer+XAf2csGO1bPBdRbFCkYBczNZggrBZ9c7G3riSUeJmqEU5uOtXNPMhE3n+R4FA/3YOAWOQ== - + union-value@^1.0.0: version "1.0.1" diff --git a/test/smoke/package.json b/test/smoke/package.json @@ -3086,7 +3064,7 @@ index 82626a55c7..5d3ee1b69b 100644 @@ -2122,10 +2122,10 @@ tree-kill@^1.1.0: resolved "https://registry.yarnpkg.com/tree-kill/-/tree-kill-1.2.0.tgz#5846786237b4239014f05db156b643212d4c6f36" integrity sha512-DlX6dR0lOIRDFxI0mjL9IYg6OTncLm/Zt+JiBhE5OlFcAR8yc9S7FFXU9so0oda47frdM/JFsk7UjNt9vscKcg== - + -typescript@2.9.2: - version "2.9.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.9.2.tgz#1cbf61d05d6b96269244eb6a3bce4bd914e0f00c" @@ -3095,41 +3073,41 @@ index 82626a55c7..5d3ee1b69b 100644 + version "3.7.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.2.tgz#27e489b95fa5909445e9fef5ee48d81697ad18fb" + integrity sha512-ml7V7JfiN2Xwvcer+XAf2csGO1bPBdRbFCkYBczNZggrBZ9c7G3riSUeJmqEU5uOtXNPMhE3n+R4FA/3YOAWOQ== - + union-value@^1.0.0: version "1.0.1" diff --git a/yarn.lock b/yarn.lock -index a98533bad9..19e94f8c4a 100644 +index edbbc9743d..fabb9c1491 100644 --- a/yarn.lock +++ b/yarn.lock -@@ -140,6 +140,23 @@ - lodash "^4.17.13" +@@ -95,6 +95,23 @@ + lodash "^4.17.11" to-fast-properties "^2.0.0" - -+"@coder/logger@^1.1.12": -+ version "1.1.12" -+ resolved "https://registry.yarnpkg.com/@coder/logger/-/logger-1.1.12.tgz#def113b7183abc35a8da2b57f0929f7e9626f4e0" -+ integrity sha512-oM0j3lTVPqApUm3e0bKKcXpfAiJEys31fgEfQlHmvEA13ujsC4zDuXnt0uzDtph48eMoNRLOF/EE4mNShVJKVw== + ++"@coder/logger@^1.1.11": ++ version "1.1.11" ++ resolved "https://registry.yarnpkg.com/@coder/logger/-/logger-1.1.11.tgz#e6f36dba9436ae61e66e3f66787d75c768617605" ++ integrity sha512-EEh1dqSU0AaqjjjMsVqumgZGbrZimKFKIb4t5E6o3FLfVUxJCReSME78Yj2N1xWUVAHMnqafDCxLostpuIotzw== + +"@coder/node-browser@^1.0.8": + version "1.0.8" + resolved "https://registry.yarnpkg.com/@coder/node-browser/-/node-browser-1.0.8.tgz#c22f581b089ad7d95ad1362fd351c57b7fbc6e70" + integrity sha512-NLF9sYMRCN9WK1C224pHax1Cay3qKypg25BhVg7VfNbo3Cpa3daata8RF/rT8JK3lPsu8PmFgDRQjzGC9X1Lrw== + -+"@coder/requirefs@^1.1.4": -+ version "1.1.4" -+ resolved "https://registry.yarnpkg.com/@coder/requirefs/-/requirefs-1.1.4.tgz#ca59223a396021f2f606f71b833c43dbba06b10b" -+ integrity sha512-E+WB3Wvr31v7eqWdItBW4eVQ0tWr4iKH6qjzCMnRxTsbiiNzLgtDzRBYt/3KxnPrtWXXX6Fn02Ut933soZXJ+g== ++"@coder/requirefs@^1.0.6": ++ version "1.0.6" ++ resolved "https://registry.yarnpkg.com/@coder/requirefs/-/requirefs-1.0.6.tgz#d2d9b529d55e00da5b779aba0ac37c534a9fe55c" ++ integrity sha512-AEHfWXXJV1FGB0CjTVz+BhyS9G5xUlC0L1+/jDgGE9CuKK2obZzg3xdALFXadZhcpQGa2vXFEmrtkkW2xP6X2A== + optionalDependencies: + jszip "2.6.0" + - "@istanbuljs/schema@^0.1.2": - version "0.1.2" - resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.2.tgz#26520bf09abe4a5644cd5414e37125a8954241dd" -@@ -5371,6 +5388,13 @@ jsprim@^1.2.2: + "@types/applicationinsights@0.20.0": + version "0.20.0" + resolved "https://registry.yarnpkg.com/@types/applicationinsights/-/applicationinsights-0.20.0.tgz#fa7b36dc954f635fa9037cad27c378446b1048fb" +@@ -4943,6 +4960,13 @@ jsprim@^1.2.2: json-schema "0.2.3" verror "1.10.0" - + +jszip@2.6.0: + version "2.6.0" + resolved "https://registry.yarnpkg.com/jszip/-/jszip-2.6.0.tgz#7fb3e9c2f11c8a9840612db5dabbc8cf3a7534b7" @@ -3140,14 +3118,14 @@ index a98533bad9..19e94f8c4a 100644 just-debounce@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/just-debounce/-/just-debounce-1.0.0.tgz#87fccfaeffc0b68cd19d55f6722943f929ea35ea" -@@ -6761,6 +6785,11 @@ p-try@^2.0.0: +@@ -6248,6 +6272,11 @@ p-try@^2.0.0: resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.0.0.tgz#85080bb87c64688fa47996fe8f7dfbe8211760b1" integrity sha512-hMp0onDKIajHfIkdRk3P4CdCmErkYAxxDtP3Wx/4nZ3aGlau2VKh3mZpcuFkH27WQkL/3WBCPOktzA9ZOAnMQQ== - + +pako@~1.0.0: -+ version "1.0.11" -+ resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.11.tgz#6c9599d340d54dfd3946380252a35705a6b992bf" -+ integrity sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw== ++ version "1.0.10" ++ resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.10.tgz#4328badb5086a426aa90f541977d4955da5c9732" ++ integrity sha512-0DTvPVU3ed8+HNXOu5Bs+o//Mbdj9VNQMUOe9oKCwh8l0GNwpTDMKCWbRjgtD291AWnkAgkqA/LOnQS8AmS1tw== + pako@~1.0.5: version "1.0.6" diff --git a/ci/vscode.sh b/ci/vscode.sh new file mode 100755 index 00000000..4fd5ec78 --- /dev/null +++ b/ci/vscode.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +set -euo pipefail + +# 1. Ensures VS Code is cloned. +# 2. Patches it. +# 3. Installs it. +main() { + cd "$(dirname "$0")/.." + + git submodule update --init + + # If the patch fails to apply, then it's likely already applied + yarn vscode:patch &>/dev/null || true + + # Install VS Code dependencies. + (cd lib/vscode && yarn) +} + +main "$@" diff --git a/doc/assets/cros.png b/doc/assets/cros.png deleted file mode 100644 index 64d94c23..00000000 Binary files a/doc/assets/cros.png and /dev/null differ diff --git a/doc/assets/droplet.svg b/doc/assets/droplet.svg deleted file mode 100644 index ecbb3f24..00000000 --- a/doc/assets/droplet.svg +++ /dev/null @@ -1,24 +0,0 @@ - - - - do-btn-blue-ghost - Created with Sketch. - - - - - - - - - - - - - - Create a Droplet - - - - - diff --git a/doc/assets/ide.gif b/doc/assets/ide.gif deleted file mode 100644 index c8183c1e..00000000 Binary files a/doc/assets/ide.gif and /dev/null differ diff --git a/doc/assets/release.gif b/doc/assets/release.gif deleted file mode 100644 index b8ad4997..00000000 Binary files a/doc/assets/release.gif and /dev/null differ diff --git a/doc/cros-install.md b/doc/cros-install.md deleted file mode 100644 index 0c12b6db..00000000 --- a/doc/cros-install.md +++ /dev/null @@ -1,75 +0,0 @@ -# Installing code-server in your ChromiumOS/ChromeOS/CloudReady machine - -This guide will show you how to install code-server into your CrOS machine. - -## Using Crostini - -One of the easier ways to run code-server is via -[Crostini](https://www.aboutchromebooks.com/tag/project-crostini/), the Linux -apps support feature in CrOS. Make sure you have enough RAM, HDD space and your -CPU has VT-x/ AMD-V support. If your chromebook has this, then you are -qualified to use Crostini. - -If you are running R69, you might want to enable this on -[Chrome Flags](chrome://flags/#enable-experimental-crostini-ui). -If you run R72, however, this is already enabled for you. - -After checking your prerequisites, follow the steps in [the self-host install guide](index.md) -on installing code-server. Once done, make sure code-server works by running -it. After running it, simply go to `penguin.linux.test:8080` to access -code-server. Now you should be greeted with this screen. If you did, -congratulations, you have installed code-server in your Chromebook! - -![code-server on Chromebook](assets/cros.png) - -Alternatively, if you ran code-server in another container and you need the IP -for that specific container, simply go to Termina's shell via `crosh` and type -`vsh termina`. - -```bash -Loading extra module: /usr/share/crosh/dev.d/50-crosh.sh -Welcome to crosh, the Chrome OS developer shell. - -If you got here by mistake, don't panic! Just close this tab and carry on. - -Type 'help' for a list of commands. - -If you want to customize the look/behavior, you can use the options page. -Load it by using the Ctrl+Shift+P keyboard shortcut. - -crosh> vsh termina -(termina) chronos@localhost ~ $ -``` -While in termina, run `lxc list`. It should output the list of running containers. - -```bash -(termina) chronos@localhost ~ $ lxc list -+---------|---------|-----------------------|------|------------|-----------+ -| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS | -+---------|---------|-----------------------|------|------------|-----------+ -| penguin | RUNNING | 100.115.92.199 (eth0) | | PERSISTENT | 0 | -+---------|---------|-----------------------|------|------------|-----------+ -(termina) chronos@localhost ~ $ -``` - -For this example, we show the default `penguin` container, which is exposed on -`eth0` at 100.115.92.199. Simply enter the IP of the container where the -code-server runs to Chrome. - -## Using Crouton - -[Crouton](https://github.com/dnschneid/crouton) is one of the old ways to get a -running full Linux via `chroot` on a Chromebook. To use crouton, enable -developer mode and go to `crosh`. This time, run `shell`, which should drop you -to `bash`. - -Make sure you downloaded `crouton`, if so, go ahead and run it under -`~/Downloads`. After installing your chroot container via crouton, go ahead and -enter `enter-chroot` to enter your container. - -Follow the instructions set in [the self-host install guide](index.md) to -install code-server. After that is done, run `code-server` and verify it works -by going to `localhost:8080`. - -> At this point in writing, `localhost` seems to work in this method. However, -> the author is not sure if it applies still to newer Chromebooks. diff --git a/doc/deploy.md b/doc/deploy.md deleted file mode 100644 index f2505e50..00000000 --- a/doc/deploy.md +++ /dev/null @@ -1,73 +0,0 @@ -# Set up instance -## EC2 on AWS -- Click **Launch Instance** from your [EC2 dashboard](https://console.aws.amazon.com/ec2/v2/home). -- Select the Ubuntu Server 18.04 LTS (HVM), SSD Volume Type -- Select an appropriate instance size (we recommend t2.medium/large, depending - on team size and number of repositories/languages enabled), then - **Next: Configure Instance Details**. -- Select **Next: ...** until you get to the **Configure Security Group** page, - then add a **Custom TCP Rule** rule with port range set to `8080` and source - set to "Anywhere". - > Rules with source of 0.0.0.0/0 allow all IP addresses to access your - > instance. We recommend setting [security group rules](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-network-security.html?icmpid=docs_ec2_console) - > to allow access from known IP addresses only. -- Click **Launch**. -- You will be prompted to create a key pair. -- From the dropdown choose "create a new pair", give the key pair a name. -- Click **Download Key Pair** and store the file in a safe place. -- Click **Launch Instances**. -- Head to your [EC2 dashboard](https://console.aws.amazon.com/ec2/v2/home) - and choose instances from the left panel. -- In the description of your EC2 instance copy the public DNS (iPv4) address - using the copy to clipboard button. -- Open a terminal on your computer and SSH into your instance: - ``` - ssh -i ${path to key pair} ubuntu@${public address} - ``` - -## DigitalOcean -[Open your DigitalOcean dashboard](https://cloud.digitalocean.com/droplets/new) -to create a new droplet - -- **Choose an image -** Select the **Distributions** tab and then choose Ubuntu. -- **Choose a size -** We recommend at least 4GB RAM and 2 CPU, more depending - on team size and number of repositories/languages enabled. -- Launch your instance. -- Open a terminal on your computer and SSH into your instance: - ``` - ssh root@${instance ip} - ``` - -## Google Cloud -> Pre-requisite: Set up the [Google Cloud SDK](https://cloud.google.com/sdk/docs/) -> on your local machine - -- [Open your Google Cloud console](https://console.cloud.google.com/compute/instances) - to create a new VM instance and click **Create Instance**. -- Choose an appropriate machine type (we recommend 2 vCPU and 7.5 GB RAM, more - depending on team size and number of repositories/languages enabled). -- Choose Ubuntu 16.04 LTS as your boot disk. -- Expand the "Management, security, disks, networking, sole tenancy" section, - go to the "Networking" tab, then under network tags add "code-server". -- Create your VM, and **take note** of its public IP address. -- Visit "VPC network" in the console and go to "Firewall rules". Create a new - firewall rule called "http-8080". Under "Target tags" add "code-server", and - under "Protocols and ports" tick "Specified protocols and ports" and "tcp". - Beside "tcp", add "8080", then create the rule. -- Open a terminal on your computer and SSH into your Google Cloud VM: - ``` - gcloud compute ssh --zone ${region} ${instance name} - ``` -# Run code-server -- Download the latest code-server release from the - [releases page](https://github.com/cdr/code-server/releases/latest) - to the instance, extract the file, then run the code-server binary: - ``` - wget https://github.com/cdr/code-server/releases/download/{version}/code-server{version}-linux-x64.tar.gz - tar -xvzf code-server{version}-linux-x64.tar.gz - cd code-server{version}-linux-x64 - ./code-server - ``` -- Open your browser and visit http://$public_ip:8080/ where `$public_ip` is - your instance's public IP address. -- For long-term use, set up a systemd service to run code-server. diff --git a/doc/examples/fail2ban.conf b/doc/examples/fail2ban.conf deleted file mode 100644 index 7968ce0b..00000000 --- a/doc/examples/fail2ban.conf +++ /dev/null @@ -1,15 +0,0 @@ -# Fail2Ban filter for code-server - -[Definition] - -failregex = ^Failed login attempt\s+{\"remoteAddress\":\"\" - -# Use this instead for proxies (ensure the proxy is configured to send the -# X-Forwarded-For header). -# failregex = ^Failed login attempt\s+{\"xForwardedFor\":\"\" - -ignoreregex = - -datepattern = "timestamp":{EPOCH}}$ - -# Author: Dean Sheather diff --git a/doc/examples/kubernetes.aws.yaml b/doc/examples/kubernetes.aws.yaml deleted file mode 100644 index 079da4b4..00000000 --- a/doc/examples/kubernetes.aws.yaml +++ /dev/null @@ -1,73 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - name: code-server ---- -apiVersion: v1 -kind: Service -metadata: - name: code-server - namespace: code-server -spec: - ports: - - port: 8080 - name: https - protocol: TCP - selector: - app: code-server - type: ClusterIP ---- -kind: StorageClass -apiVersion: storage.k8s.io/v1 -metadata: - name: gp2 - annotations: - storageclass.kubernetes.io/is-default-class: "true" -provisioner: kubernetes.io/aws-ebs -parameters: - type: gp2 - fsType: ext4 ---- -kind: PersistentVolumeClaim -apiVersion: v1 -metadata: - name: code-store - namespace: code-server -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 60Gi ---- -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - labels: - app: code-server - name: code-server - namespace: code-server -spec: - selector: - matchLabels: - app: code-server - replicas: 1 - template: - metadata: - labels: - app: code-server - spec: - containers: - - image: codercom/code-server:v2 - imagePullPolicy: Always - name: code-servery - ports: - - containerPort: 8080 - name: https - volumeMounts: - - name: code-server-storage - mountPath: /go/src - volumes: - - name: code-server-storage - persistentVolumeClaim: - claimName: code-store diff --git a/doc/examples/kubernetes.yaml b/doc/examples/kubernetes.yaml deleted file mode 100644 index 6259689d..00000000 --- a/doc/examples/kubernetes.yaml +++ /dev/null @@ -1,43 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - name: code-server ---- -apiVersion: v1 -kind: Service -metadata: - name: code-server - namespace: code-server -spec: - ports: - - port: 8080 - name: https - protocol: TCP - selector: - app: code-server - type: ClusterIP ---- -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - labels: - app: code-server - name: code-server - namespace: code-server -spec: - selector: - matchLabels: - app: code-server - replicas: 1 - template: - metadata: - labels: - app: code-server - spec: - containers: - - image: codercom/code-server:v2 - imagePullPolicy: Always - name: code-server - ports: - - containerPort: 8080 - name: https diff --git a/doc/fail2ban.md b/doc/fail2ban.md deleted file mode 100644 index ce4b7179..00000000 --- a/doc/fail2ban.md +++ /dev/null @@ -1,35 +0,0 @@ -# Protecting code-server from bruteforce attempts -code-server outputs all failed login attempts, along with the IP address, -provided password, user agent and timestamp by default. - -When using a reverse proxy such as Nginx or Apache, the remote address may -appear to be `127.0.0.1` or a similar address so `X-Forwarded-For` should be -used instead. Ensure that you are setting this value in your reverse proxy: - -Nginx: -``` -location / { - ... - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - ... -} -``` - -Apache: -``` - - ... - SetEnvIf X-Forwarded-For "^.*\..*\..*\..*" forwarded - ... - -``` - -It is extremely important that you ensure that your code-server instance is not -accessible from the internet (use localhost or block it in your firewall). - -## Fail2Ban -Fail2Ban allows for automatically banning and logging repeated failed -authentication attempts for many applications through regex filters. A working -filter for code-server can be found in `./examples/fail2ban.conf`. Once this -is installed and configured correctly, repeated failed login attempts should -automatically be banned from connecting to your server. diff --git a/doc/quickstart.md b/doc/quickstart.md deleted file mode 100644 index 318bbeba..00000000 --- a/doc/quickstart.md +++ /dev/null @@ -1,98 +0,0 @@ -# Quickstart Guide -1. Visit the [releases page](https://github.com/cdr/code-server/releases) and - download the latest binary for your operating system. -2. Unpack the downloaded file then run the binary. -3. In your browser navigate to `localhost:8080`. - -## Usage -Run `code-server --help` to view available options. - -### Nginx Reverse Proxy -The trailing slashes are important. - -``` -server { - listen 80; - listen [::]:80; - server_name code.example.com code.example.org; - location /some/path/ { # Or / if hosting at the root. - proxy_pass http://localhost:8080/; - proxy_set_header Host $host; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection upgrade; - proxy_set_header Accept-Encoding gzip; - } -} -``` - -### Apache Reverse Proxy -``` - - ServerName code.example.com - - RewriteEngine On - RewriteCond %{HTTP:Upgrade} =websocket [NC] - RewriteRule /(.*) ws://localhost:8080/$1 [P,L] - RewriteCond %{HTTP:Upgrade} !=websocket [NC] - RewriteRule /(.*) http://localhost:8080/$1 [P,L] - - ProxyRequests off - ProxyPass / http://localhost:8080/ nocanon - ProxyPassReverse / http://localhost:8080/ - -``` - -### Run automatically at startup - -In some cases you might need to run code-server automatically once the host starts. You may use your local init service to do so. - -#### Systemd - -```ini -[Unit] -Description=Code Server IDE -After=network.target - -[Service] -Type=simple -User= -EnvironmentFile=$HOME/.profile -WorkingDirectory=$HOME -Restart=on-failure -RestartSec=10 - -ExecStart= $(pwd) - -StandardOutput=file:/var/log/code-server-output.log -StandardError=file:/var/log/code-server-error.log - -[Install] -WantedBy=multi-user.target -``` - -#### OpenRC - -```sh -#!/sbin/openrc-run - -depend() { - after net-online - need net -} - -supervisor=supervise-daemon -name="code-server" -command="/opt/cdr/code-server" -command_args="" - -pidfile="/var/run/cdr.pid" -respawn_delay=5 - -set -o allexport -if [ -f /etc/environment ]; then source /etc/environment; fi -set +o allexport -``` - -#### Kubernetes/Docker - -Make sure you set your restart policy to always - this will ensure your container starts as the daemon starts. diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 203f96f6..00000000 --- a/docker-compose.yml +++ /dev/null @@ -1,13 +0,0 @@ -version: "3" - -services: - code-server: - container_name: code-server - image: codercom/code-server - ports: - - "8080:8080" - volumes: - - "${PWD}:/home/coder/project" - - "${HOME}/.local/share/code-server:/home/coder/.local/share/code-server" - environment: - PASSWORD: ${PASSWORD} diff --git a/package.json b/package.json index 73f29e70..34a37365 100644 --- a/package.json +++ b/package.json @@ -3,19 +3,19 @@ "license": "MIT", "version": "2.1.0", "scripts": { - "i": "yarn install --ignore-scripts", - "preinstall": "./scripts/preinstall.sh", - "postinstall": "./scripts/postinstall.sh", - "patch:generate": "cd ./lib/vscode && git diff HEAD > ../../scripts/vscode.patch", - "patch:apply": "cd ./lib/vscode && git apply ../../scripts/vscode.patch", + "clean": "ci/clean.sh", + "vscode": "ci/vscode.sh", + "vscode:patch": "cd ./lib/vscode && git apply ../../ci/vscode.patch", + "vscode:diff": "cd ./lib/vscode && git diff HEAD > ../../ci/vscode.patch", + "test": "mocha -r ts-node/register ./test/*.test.ts", - "test:build": "./scripts/test.sh", - "lint:js": "eslint src test scripts --ext .ts,.tsx", - "lint:css": "stylelint 'src/**/*.css'", - "lint": "./scripts/lint.sh", - "watch": "yarn runner watch", - "runner": "cd ./scripts && node --max-old-space-size=32384 -r ts-node/register ./build.ts", + + "lint": "ci/lint.sh", + "fmt": "ci/fmt.sh", + + "runner": "cd ./scripts && NODE_OPTIONS=--max_old_space_size=32384 ts-node ./build.ts", "build": "yarn runner build", + "watch": "yarn runner watch", "binary": "yarn runner binary", "package": "yarn runner package" }, diff --git a/scripts/cacher.sh b/scripts/cacher.sh deleted file mode 100755 index 23912f62..00000000 --- a/scripts/cacher.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/env sh -# cacher.sh -- Restore and rebuild cache. -# Cache paths are designed to work with multi-arch builds and are organized -# based on the branch or tag. The master branch cache is used as a fallback. -# This will download and package the cache but it will not upload it. - -set -eu - -# Try restoring from each argument in turn until we get something. -restore() { - for branch in "$@" ; do - if [ -n "$branch" ] ; then - cache_path="https://codesrv-ci.cdr.sh/cache/$branch/$tar.tar.gz" - if wget "$cache_path" ; then - tar xzvf "$tar.tar.gz" - break - fi - fi - done -} - -# We need to cache the built-in extensions and Node modules. Everything inside -# the cache-upload directory will be uploaded as-is to the code-server bucket. -package() { - mkdir -p "cache-upload/cache/$1" - tar czfv "cache-upload/cache/$1/$tar.tar.gz" node_modules yarn-cache \ - lib/vscode/.build \ - lib/vscode/node_modules -} - -main() { - cd "$(dirname "$0")/.." - - # Get the branch for this build. - branch=${DRONE_BRANCH:-${DRONE_SOURCE_BRANCH:-${DRONE_TAG:-}}} - - # The cache will be named based on the arch, platform, and libc. - arch=$DRONE_STAGE_ARCH - platform=${PLATFORM:-linux} - case $DRONE_STAGE_NAME in - *alpine*) libc=musl ;; - * ) libc=glibc ;; - esac - - tar="$platform-$arch-$libc" - - # The action is determined by the name of the step. - case $DRONE_STEP_NAME in - *restore*) - # Sub-modules must be pulled first since extracting the cache directories - # will prevent git from cloning into them. - git submodule update --init - - restore "$branch" "$DRONE_REPO_BRANCH" - - # Now make sure the pulled Node modules are up to date. - YARN_CACHE_FOLDER="$(pwd)/yarn-cache" - export YARN_CACHE_FOLDER - yarn - ;; - *rebuild*|*package*) package "$branch" ;; - *) exit 1 ;; - esac -} - -main "$@" diff --git a/scripts/ci.dockerfile b/scripts/ci.dockerfile deleted file mode 100644 index d32b51ea..00000000 --- a/scripts/ci.dockerfile +++ /dev/null @@ -1,39 +0,0 @@ -# We deploy with Ubuntu so that devs have a familiar environment. -FROM ubuntu:18.04 - -RUN apt-get update && apt-get install -y \ - openssl \ - net-tools \ - git \ - locales \ - sudo \ - dumb-init \ - vim \ - curl \ - wget - -RUN locale-gen en_US.UTF-8 -# We cannot use update-locale because docker will not use the env variables -# configured in /etc/default/locale so we need to set it manually. -ENV LC_ALL=en_US.UTF-8 \ - SHELL=/bin/bash - -RUN adduser --gecos '' --disabled-password coder && \ - echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd - -USER coder -# Create first so these directories will be owned by coder instead of root -# (workdir and mounting appear to both default to root). -RUN mkdir -p /home/coder/project -RUN mkdir -p /home/coder/.local/share/code-server - -WORKDIR /home/coder/project - -# This ensures we have a volume mounted even if the user forgot to do bind -# mount. So that they do not lose their data if they delete the container. -VOLUME [ "/home/coder/project" ] - -COPY ./binaries/code-server* /usr/local/bin/code-server -EXPOSE 8080 - -ENTRYPOINT ["dumb-init", "code-server", "--host", "0.0.0.0"] diff --git a/scripts/code-server.sh b/scripts/code-server.sh deleted file mode 100755 index 64066fbd..00000000 --- a/scripts/code-server.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash -# code-server.sh -- Run code-server with the bundled Node binary. - -main() { - cd "$(dirname "$0")" || exit 1 - ./node ./out/node/entry.js "$@" -} - -main "$@" diff --git a/scripts/lint.sh b/scripts/lint.sh deleted file mode 100755 index de9b59ea..00000000 --- a/scripts/lint.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env sh -# lint.sh -- Lint CSS and JS files. - -set -eu - -main() { - yarn lint:css "$@" - yarn lint:js "$@" -} - -main "$@" diff --git a/scripts/postinstall.sh b/scripts/postinstall.sh deleted file mode 100755 index 353f02e2..00000000 --- a/scripts/postinstall.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env sh -# postinstall.sh - Does nothing at the moment. - -set -eu - -main() { - cd "$(dirname "${0}")/.." -} - -main "$@" diff --git a/scripts/preinstall.sh b/scripts/preinstall.sh deleted file mode 100755 index 127311fb..00000000 --- a/scripts/preinstall.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env sh -# preinstall.sh -- Prepare VS Code. - -set -eu - -main() { - cd "$(dirname "${0}")/.." - -# Ensure submodules are cloned and up to date. - git submodule update --init - - # Try patching but don't worry too much if it fails. It's possible VS Code has - # already been patched. - yarn patch:apply || echo "Unable to patch; assuming already patched" - - # Install VS Code dependencies. - cd ./lib/vscode - yarn -} - -main "$@" diff --git a/scripts/test.sh b/scripts/test.sh deleted file mode 100755 index c6dd7e5d..00000000 --- a/scripts/test.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env sh -# test.sh -- Simple build test. - -set -eu - -main() { - cd "$(dirname "$0")/.." - - # The main goal here is to ensure that the build fully completed and the - # result looks usable. - version=$(node ./build/out/node/entry.js --version --json) - echo "Got '$version' for the version" - case $version in - "{ codeServer":*) exit 0 ;; - *) exit 1 ;; - esac -} - -main "$@" diff --git a/scripts/tsconfig.json b/scripts/tsconfig.json deleted file mode 100644 index 93e81846..00000000 --- a/scripts/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "compilerOptions": { - "target": "es5", - "module": "commonjs", - "moduleResolution": "node", - "strict": true, - "noImplicitReturns": true, - "noUnusedLocals": true, - "forceConsistentCasingInFileNames": true, - "outDir": "./out", - "declaration": true, - "experimentalDecorators": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "resolveJsonModule": true, - "sourceMap": true - }, - "include": [ - "./**/*.ts" - ] -}