Compare commits

..

57 Commits

Author SHA1 Message Date
Asher
c56304cf4f Update changelog for 3.10.1 2021-05-17 13:58:23 -05:00
Asher
6bbf7e9e7a Update versions to 3.10.1 2021-05-17 13:50:56 -05:00
SIGSEGV
b3bd6c3703 Termux on Play Store is deprecated; replaced with F-Droid link (#3396)
Fixes #3395.
2021-05-17 12:14:57 -05:00
Joe Previte
a3663f54d0 Merge pull request #3360 from cdr/jsjoeio/document-release-manager
docs(maintaining): add process for release managers
2021-05-14 16:13:36 -07:00
Joe Previte
2438fb307c fix: use next version in changelog 2021-05-14 16:09:30 -07:00
Joe Previte
12b1e484be docs(maintaining): add release manager rotation 2021-05-14 16:09:26 -07:00
Joe Previte
eb82054357 docs: update publishing a release process 2021-05-14 16:09:06 -07:00
Joe Previte
1b75734332 fix(release-prep.sh): don't update CHANGELOG 2021-05-14 16:09:06 -07:00
Joe Previte
ade43c02b7 docs: update release_template PR 2021-05-14 16:09:06 -07:00
Joe Previte
9ab5ccf908 docs: add release issue template 2021-05-14 16:09:05 -07:00
Joe Previte
509d91ddab Merge pull request #3377 from cdr/jsjoeio/docs-clean-commits
docs(contributing): add commits section
2021-05-14 13:54:24 -07:00
Joe Previte
60d71fee6f docs(contributing): add commits section 2021-05-14 13:50:05 -07:00
Joe Previte
62b5fadd9c docs(contributing): add commits section 2021-05-14 13:50:01 -07:00
Joe Previte
a7cf990782 Merge pull request #3375 from cdr/jsjoeio/fix-pr-template
refactor: move default PR template
2021-05-14 13:22:58 -07:00
Joe Previte
6f09749b65 refactor: move default PR template 2021-05-14 13:18:39 -07:00
Asher
b49b1796e9 Add socket type to websocket connection query (#3391)
This was added a long time ago but accidentally lost when we reverted
the retry changes to this file after one of the VS Code updates that
added their own retry (we reverted everything not realizing we had other
unrelated changes in here).
2021-05-14 15:05:05 -05:00
Joe Previte
36265ddfaf Merge pull request #3368 from cdr/jsjoeio/re-enable-trivy
fix(ci): re-enable trivy-scan-repo
2021-05-14 10:47:57 -07:00
Joe Previte
5fe76bdecf fix: update trivy-action to v0.0.17 2021-05-14 10:43:25 -07:00
Joe Previte
065b141106 chore: update CHANGELOG 2021-05-14 10:43:22 -07:00
Joe Previte
604194d1b8 fix: re-enable trivy-scan-repo 2021-05-14 10:42:47 -07:00
Joe Previte
f5b792706a Merge pull request #3387 from cdr/dependabot/npm_and_yarn/types/semver-7.3.6
chore(deps-dev): bump @types/semver from 7.3.5 to 7.3.6
2021-05-14 09:55:03 -07:00
dependabot[bot]
87953ca963 chore(deps-dev): bump @types/semver from 7.3.5 to 7.3.6
Bumps [@types/semver](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/semver) from 7.3.5 to 7.3.6.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/semver)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-14 16:46:14 +00:00
Joe Previte
f80657d560 Merge pull request #3386 from cdr/dependabot/npm_and_yarn/eslint-plugin-import-2.23.0
chore(deps-dev): bump eslint-plugin-import from 2.22.1 to 2.23.0
2021-05-14 09:42:43 -07:00
dependabot[bot]
cf69860aed chore(deps-dev): bump eslint-plugin-import from 2.22.1 to 2.23.0
Bumps [eslint-plugin-import](https://github.com/benmosher/eslint-plugin-import) from 2.22.1 to 2.23.0.
- [Release notes](https://github.com/benmosher/eslint-plugin-import/releases)
- [Changelog](https://github.com/benmosher/eslint-plugin-import/blob/master/CHANGELOG.md)
- [Commits](https://github.com/benmosher/eslint-plugin-import/compare/v2.22.1...v2.23.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-14 11:03:26 +00:00
Joe Previte
10f512c63a Merge pull request #3378 from cdr/jsjoeio/milestones-issues
docs(maintaining): add pull requests section
2021-05-13 12:32:17 -07:00
Joe Previte
7be1ae36a2 docs(maintaining): add merge strategies section 2021-05-13 12:27:29 -07:00
Joe Previte
fc894e47fb docs(maintaining): add pull requests section 2021-05-13 12:25:13 -07:00
Joe Previte
d2337bcd85 Merge pull request #3304 from cdr/jsjoeio/fix-tmp-path
fix(socket): use xdgBasedir.runtime instead of tmp
2021-05-13 12:14:45 -07:00
Joe Previte
46fe77d464 chore: update CHANGELOG 2021-05-13 12:10:22 -07:00
Joe Previte
d7f1415290 refactor: use paths.runtime in socket proxyPipe 2021-05-13 12:10:21 -07:00
Joe Previte
2a657ab930 feat: add tests for getEnvPaths 2021-05-13 12:10:21 -07:00
Joe Previte
a57ee69822 feat: add runtime to getEnvPaths 2021-05-13 12:10:21 -07:00
Joe Previte
adc4463507 docs: update pr template to say default branch 2021-05-13 12:10:21 -07:00
kenve
8e21eb51b3 fix(lib/vscode): fix missing rimraf when running postinstall script (#3383) 2021-05-13 11:06:45 -05:00
repo-ranger[bot]
800815f7fd Merge pull request #3376 from cdr/jsjoeio/install-pi-docs
docs(install): add raspberry pi section
2021-05-12 22:16:38 +00:00
Joe Previte
0699bd7ead docs(install): add raspberry pi 2021-05-12 15:01:31 -07:00
Asher
e64fd451b3 Override existing asar symlink in postinstall (#3369)
This ensures the link is correct. Should fix #3355.
2021-05-12 16:46:29 -05:00
repo-ranger[bot]
8f82d6e8b9 Merge pull request #3374 from cdr/dependabot/npm_and_yarn/types/node-12.20.13
chore(deps-dev): bump @types/node from 12.20.12 to 12.20.13
2021-05-12 21:35:42 +00:00
dependabot[bot]
993b93cf28 chore(deps-dev): bump @types/node from 12.20.12 to 12.20.13
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 12.20.12 to 12.20.13.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-12 21:06:16 +00:00
Joe Previte
83f266e07d Merge pull request #3367 from jawnsy/dependabot-ignore-playwright-updates
chore: ignore updates to microsoft/playwright-github-action
2021-05-12 14:02:08 -07:00
Jonathan Yu
416362be31 chore: ignore updates to microsoft/playwright-github-action
Microsoft publishes updates to this action using the same scheme
as GitHub, where the v1 tag is updated to the latest release of
the 1.0 series. Therefore, we can manage updates manually.
2021-05-12 18:47:37 +00:00
Joe Previte
825a40e897 chore: update CHANGELOG (#3354) 2021-05-12 12:19:02 -05:00
Joe Previte
82ce9d5adb Merge pull request #3357 from cdr/oxy/update-prettier
chore(deps-dev): bump prettier to 2.3.0
2021-05-11 14:23:41 -07:00
Akash Satheesan
74fbb425f2 fix(lib/vscode): update to 1.56.1 (#3351) 2021-05-12 01:15:06 +05:30
Akash Satheesan
adc9b57080 chore: reformat with new prettier 2021-05-12 01:14:04 +05:30
Akash Satheesan
715e5927bc chore(deps-dev): bump prettier to 2.3.0 2021-05-12 01:13:45 +05:30
dependabot[bot]
6a4ff9c05c chore(deps-dev): bump @typescript-eslint/parser from 4.22.1 to 4.23.0 (#3343)
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 4.22.1 to 4.23.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v4.23.0/packages/parser)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-12 00:49:37 +05:30
dependabot[bot]
fd4ecabc02 chore(deps-dev): bump @typescript-eslint/eslint-plugin (#3344)
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 4.22.1 to 4.23.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v4.23.0/packages/eslint-plugin)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-12 00:49:23 +05:30
dependabot[bot]
9e0524a3e7 chore(deps-dev): bump @types/ws from 7.4.2 to 7.4.4 (#3345)
Bumps [@types/ws](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/ws) from 7.4.2 to 7.4.4.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/ws)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-12 00:49:09 +05:30
Akash Satheesan
2ae8729ef3 chore(deps): update postcss, trim (#3356) 2021-05-12 00:44:50 +05:30
dependabot[bot]
f32d8e50e7 chore(deps-dev): bump eslint from 7.25.0 to 7.26.0 (#3333)
Bumps [eslint](https://github.com/eslint/eslint) from 7.25.0 to 7.26.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v7.25.0...v7.26.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-11 23:57:53 +05:30
Joe Previte
cc02b5feba Merge pull request #3352 from cdr/jsjoeio/fix-line
fix(ci): fix typos in ci.yaml
2021-05-11 11:23:53 -07:00
Joe Previte
3cd3490dee fix(ci): fix typos 2021-05-11 11:18:35 -07:00
Joe Previte
6d7f329001 Merge pull request #3341 from cdr/jsjoeio/disable-trivy
fix(ci): disable trivy-scan-repo
2021-05-11 10:30:17 -07:00
Joe Previte
510ff9c9f8 fix(ci): disable trivy-scan-repo 2021-05-11 10:26:04 -07:00
videlanicolas
3df771fbc4 Check the logged user instead of $USER (#3330)
* Check the logged user instead of $USER

Given that `sudo usermod --login "$DOCKER_USER" coder` and `sudo groupmod -n "$DOCKER_USER" coder` modify the container's disk it'll persist across restarts, but environment variables will be reset to whatever state they had at the end of `Dockerfile`. In this case, `$USER` is set to `coder`, so this branch will always be true.

By checking with the output of `whoami`, which gets it's information from `/etc/passwd`, we make sure to get the real logged user and not the one defined by $USER.

We also move `USER="$DOCKER_USER"` out of the branch, since we always want this to happen at entry-point. If we don't do this assignment, $USER will contain `coder` upon restart.

* Update entrypoint.sh

Check `$DOCKER_USER` was defined before copying it to `$USER`.
2021-05-11 10:26:38 -05:00
Akash Satheesan
014d7468f0 release: 3.10.0 (#3338)
Also fixes release scripts.
2021-05-11 03:59:49 +05:30
31 changed files with 1259 additions and 771 deletions

16
.github/ISSUE_TEMPLATE/release.md vendored Normal file
View File

@@ -0,0 +1,16 @@
---
name: Release
about: "*For maintainers only*"
title: "release: 0.0.0"
labels: ""
assignees: "@cdr/code-server-reviewers"
---
<!-- Maintainer: fill out the checklist -->
## Checklist
- [ ] Assign to next release manager
- [ ] Close previous release milestone
- [ ] Create next release milestone
- [ ] Associate issue with next release milestone

View File

@@ -2,7 +2,7 @@
Please link to the issue this PR solves. Please link to the issue this PR solves.
If there is no existing issue, please first create one unless the fix is minor. If there is no existing issue, please first create one unless the fix is minor.
Please make sure the base of your PR is the master branch! Please make sure the base of your PR is the default branch!
--> -->
## Checklist ## Checklist

View File

@@ -8,11 +8,9 @@ TODO
## TODOs ## TODOs
- [ ] test locally Follow "Publishing a release" steps in `ci/README.md`
- [ ] upload assets to draft release
- [ ] test one of the release packages locally <!-- Note some of these steps below are redundant since they're listed in the "Publishing a release" docs -->
- [ ] double-check github release tag is the commit with artifacts (_note gets messed up after uploading assets_)
- [ ] publish release - [ ] publish release and merge PR
- [ ] merge PR
- [ ] update the homebrew package
- [ ] update the AUR package - [ ] update the AUR package

View File

@@ -10,6 +10,7 @@ updates:
# release tag, so handle updates manually # release tag, so handle updates manually
- dependency-name: "actions/*" - dependency-name: "actions/*"
- dependency-name: "github/codeql-action/*" - dependency-name: "github/codeql-action/*"
- dependency-name: "microsoft/playwright-github-action"
- package-ecosystem: "npm" - package-ecosystem: "npm"
directory: "/" directory: "/"

View File

@@ -446,8 +446,8 @@ jobs:
path: ./release-images path: ./release-images
- name: Run Trivy vulnerability scanner in image mode - name: Run Trivy vulnerability scanner in image mode
# Commit SHA for v0.0.14 # Commit SHA for v0.0.17
uses: aquasecurity/trivy-action@341f810bd602419f966a081da3f4debedc3e5c8e uses: aquasecurity/trivy-action@dba83feec810c70bacbc4bead308ae1e466c572b
with: with:
input: "./release-images/code-server-amd64-*.tar" input: "./release-images/code-server-amd64-*.tar"
scan-type: "image" scan-type: "image"
@@ -461,20 +461,17 @@ jobs:
uses: github/codeql-action/upload-sarif@v1 uses: github/codeql-action/upload-sarif@v1
with: with:
sarif_file: "trivy-image-results.sarif" sarif_file: "trivy-image-results.sarif"
# We have to use two trivy jobs # We have to use two trivy jobs
# because GitHub only allows # because GitHub only allows
# codeql/upload-sarif action per job # codeql/upload-sarif action per job
trivy-scan-repo: trivy-scan-repo:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Run Trivy vulnerability scanner in repo mode - name: Run Trivy vulnerability scanner in repo mode
# Commit SHA for v0.0.14 #Commit SHA for v0.0.17
uses: aquasecurity/trivy-action@341f810bd602419f966a081da3f4debedc3e5c8e uses: aquasecurity/trivy-action@dba83feec810c70bacbc4bead308ae1e466c572b
with: with:
scan-type: "fs" scan-type: "fs"
scan-ref: "." scan-ref: "."
@@ -483,7 +480,6 @@ jobs:
template: "@/contrib/sarif.tpl" template: "@/contrib/sarif.tpl"
output: "trivy-repo-results.sarif" output: "trivy-repo-results.sarif"
severity: "HIGH,CRITICAL" severity: "HIGH,CRITICAL"
- name: Upload Trivy scan results to GitHub Security tab - name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v1 uses: github/codeql-action/upload-sarif@v1
with: with:

View File

@@ -3,11 +3,15 @@
# Changelog # Changelog
- [Changelog](#changelog) - [Changelog](#changelog)
- [3.10.1](#3101)
- [Bug Fixes](#bug-fixes)
- [Documentation](#documentation)
- [Development](#development)
- [3.10.0](#3100) - [3.10.0](#3100)
- [New Features](#new-features) - [New Features](#new-features)
- [Bug Fixes](#bug-fixes) - [Bug Fixes](#bug-fixes-1)
- [Documentation](#documentation) - [Documentation](#documentation-1)
- [Development](#development) - [Development](#development-1)
- [Previous versions](#previous-versions) - [Previous versions](#previous-versions)
<!-- END doctoc generated TOC please keep comment here to allow auto update --> <!-- END doctoc generated TOC please keep comment here to allow auto update -->
@@ -25,7 +29,7 @@ We copy from here into the release notes.
<!-- <!--
Add next version above previous version but below this line using the template Add next version above previous version but below this line using the template
## 0.0.0 ## Next Version
VS Code v0.00.0 VS Code v0.00.0
@@ -37,19 +41,44 @@ VS Code v0.00.0
- fix(socket): did this thing #321 @githubuser - fix(socket): did this thing #321 @githubuser
## Documentation ### Documentation
- item - item
## Development ### Development
- item - item
--> -->
## 3.10.1
VS Code v1.56.1
### Bug Fixes
- fix: Check the logged user instead of $USER #3330 @videlanicolas
- fix: Fix broken node_modules.asar symlink in npm package #3355 @code-asher
- fix: Update cloud agent to fix version issue #3342 @oxy
### Documentation
- docs(install): add raspberry pi section #3376 @jsjoeio
- docs(maintaining): add pull requests section #3378 @jsjoeio
- docs(maintaining): add merge strategies section #3379 @jsjoeio
- refactor: move default PR template #3375 @jsjoeio
- docs(contributing): add commits section #3377 @jsjoeio
- docs(maintaining): add process for release managers #3360 @jsjoeio
### Development
- chore: ignore updates to microsoft/playwright-github-action
- fix(socket): use xdgBasedir.runtime instead of tmp #3304 @jsjoeio
- fix(ci): re-enable trivy-scan-repo #3368 @jsjoeio
## 3.10.0 ## 3.10.0
VS Code v1.56 VS Code v1.56.0
### New Features ### New Features
@@ -69,7 +98,7 @@ VS Code v1.56
- fix: add flag for toggling permessage-deflate #3286 @code-asher - fix: add flag for toggling permessage-deflate #3286 @code-asher
- fix: make sure directories exist #3309 @code-asher - fix: make sure directories exist #3309 @code-asher
## Documentation ### Documentation
- docs(FAQ): add mention of sysbox #3087 @bpmct - docs(FAQ): add mention of sysbox #3087 @bpmct
- docs: add security policy #3148 @jsjoeio - docs: add security policy #3148 @jsjoeio
@@ -84,7 +113,7 @@ VS Code v1.56
- docs(maintaining): add versioning #3288 @jsjoeio - docs(maintaining): add versioning #3288 @jsjoeio
- docs: add changelog #3337 @jsjoeio - docs: add changelog #3337 @jsjoeio
## Development ### Development
- fix(update-vscode): add check/docs for git-subtree #3129 @oxy - fix(update-vscode): add check/docs for git-subtree #3129 @oxy
- refactor(testing): migrate to playwright-test from jest-playwright #3133 @jsjoeio - refactor(testing): migrate to playwright-test from jest-playwright #3133 @jsjoeio

View File

@@ -1,7 +1,7 @@
# code-server &middot; [!["GitHub Discussions"](https://img.shields.io/badge/%20GitHub-%20Discussions-gray.svg?longCache=true&logo=github&colorB=purple)](https://github.com/cdr/code-server/discussions) [!["Join us on Slack"](https://img.shields.io/badge/join-us%20on%20slack-gray.svg?longCache=true&logo=slack&colorB=brightgreen)](https://cdr.co/join-community) [![Twitter Follow](https://img.shields.io/twitter/follow/CoderHQ?label=%40CoderHQ&style=social)](https://twitter.com/coderhq) # code-server &middot; [!["GitHub Discussions"](https://img.shields.io/badge/%20GitHub-%20Discussions-gray.svg?longCache=true&logo=github&colorB=purple)](https://github.com/cdr/code-server/discussions) [!["Join us on Slack"](https://img.shields.io/badge/join-us%20on%20slack-gray.svg?longCache=true&logo=slack&colorB=brightgreen)](https://cdr.co/join-community) [![Twitter Follow](https://img.shields.io/twitter/follow/CoderHQ?label=%40CoderHQ&style=social)](https://twitter.com/coderhq)
[![codecov](https://codecov.io/gh/cdr/code-server/branch/main/graph/badge.svg?token=5iM9farjnC)](https://codecov.io/gh/cdr/code-server) [![codecov](https://codecov.io/gh/cdr/code-server/branch/main/graph/badge.svg?token=5iM9farjnC)](https://codecov.io/gh/cdr/code-server)
[![See latest docs](https://img.shields.io/static/v1?label=Docs&message=see%20latest%20&color=blue)](https://github.com/cdr/code-server/tree/v3.10.0/docs) [![See latest docs](https://img.shields.io/static/v1?label=Docs&message=see%20latest%20&color=blue)](https://github.com/cdr/code-server/tree/v3.10.1/docs)
Run [VS Code](https://github.com/Microsoft/vscode) on any machine anywhere and access it in the browser. Run [VS Code](https://github.com/Microsoft/vscode) on any machine anywhere and access it in the browser.

View File

@@ -24,17 +24,13 @@ Any file or directory in this subdirectory should be documented here.
- It will upload them to the draft release. - It will upload them to the draft release.
6. Run some basic sanity tests on one of the released packages. 6. Run some basic sanity tests on one of the released packages.
- Especially make sure the terminal works fine. - Especially make sure the terminal works fine.
7. Make sure the github release tag is the commit with the artifacts. 7. Publish the release and merge the PR.
8. Publish the release and merge the PR.
1. CI will automatically grab the artifacts and then: 1. CI will automatically grab the artifacts and then:
1. Publish the NPM package from `npm-package`. 1. Publish the NPM package from `npm-package`.
2. Publish the Docker Hub image from `release-images`. 2. Publish the Docker Hub image from `release-images`.
9. Update the AUR package. 8. Update the AUR package.
- Instructions on updating the AUR package are at [cdr/code-server-aur](https://github.com/cdr/code-server-aur). - Instructions on updating the AUR package are at [cdr/code-server-aur](https://github.com/cdr/code-server-aur).
10. Wait for the npm package to be published. 9. Wait for the npm package to be published.
11. Update the [homebrew package](https://github.com/Homebrew/homebrew-core/blob/master/Formula/code-server.rb).
1. Install [homebrew](https://brew.sh/)
2. Run `brew bump-formula-pr --version=3.8.1 code-server` and update the version accordingly. This will bump the version and open a PR. Note: this will only work once the version is published on npm.
## dev ## dev

View File

@@ -56,18 +56,21 @@ main() {
fi fi
} }
# This is a copy of symlink_asar in ../lib.sh. Look there for details.
symlink_asar() {
rm -f node_modules.asar
if [ "${WINDIR-}" ]; then
mklink /J node_modules.asar node_modules
else
ln -s node_modules node_modules.asar
fi
}
vscode_yarn() { vscode_yarn() {
cd lib/vscode cd lib/vscode
yarn --production --frozen-lockfile yarn --production --frozen-lockfile
# This is a copy of symlink_asar in ../lib.sh. Look there for details. symlink_asar
if [ ! -e node_modules.asar ]; then
if [ "${WINDIR-}" ]; then
mklink /J node_modules.asar node_modules
else
ln -s node_modules node_modules.asar
fi
fi
cd extensions cd extensions
yarn --production --frozen-lockfile yarn --production --frozen-lockfile

View File

@@ -81,7 +81,7 @@ main() {
read -r -p "What version of code-server do you want to update to?"$'\n' CODE_SERVER_VERSION_TO_UPDATE read -r -p "What version of code-server do you want to update to?"$'\n' CODE_SERVER_VERSION_TO_UPDATE
echo -e "Great! We'll prep a PR for updating to $CODE_SERVER_VERSION_TO_UPDATE\n" echo -e "Great! We'll prep a PR for updating to $CODE_SERVER_VERSION_TO_UPDATE\n"
$CMD rg -g '!yarn.lock' -g '!*.svg' --files-with-matches --fixed-strings "${CODE_SERVER_CURRENT_VERSION}" | $CMD xargs sd "$CODE_SERVER_CURRENT_VERSION" "$CODE_SERVER_VERSION_TO_UPDATE" $CMD rg -g '!yarn.lock' -g '!*.svg' -g '!CHANGELOG.md' --files-with-matches --fixed-strings "${CODE_SERVER_CURRENT_VERSION}" | $CMD xargs sd "$CODE_SERVER_CURRENT_VERSION" "$CODE_SERVER_VERSION_TO_UPDATE"
# Ensure the tests are passing and code coverage is up-to-date # Ensure the tests are passing and code coverage is up-to-date
echo -e "Running unit tests and updating code coverage...\n" echo -e "Running unit tests and updating code coverage...\n"

View File

@@ -20,4 +20,4 @@ version: 1.0.3
# This is the version number of the application being deployed. This version number should be # This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to # incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using. # follow Semantic Versioning. They should reflect the version the application is using.
appVersion: 3.10.0 appVersion: 3.10.1

View File

@@ -1,6 +1,6 @@
# code-server # code-server
![Version: 1.0.0](https://img.shields.io/badge/Version-1.0.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 3.10.0](https://img.shields.io/badge/AppVersion-3.10.0-informational?style=flat-square) ![Version: 1.0.0](https://img.shields.io/badge/Version-1.0.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 3.10.1](https://img.shields.io/badge/AppVersion-3.10.1-informational?style=flat-square)
[code-server](https://github.com/cdr/code-server) code-server is VS Code running [code-server](https://github.com/cdr/code-server) code-server is VS Code running
on a remote server, accessible through the browser. on a remote server, accessible through the browser.
@@ -72,7 +72,7 @@ and their default values.
| hostnameOverride | string | `""` | | | hostnameOverride | string | `""` | |
| image.pullPolicy | string | `"Always"` | | | image.pullPolicy | string | `"Always"` | |
| image.repository | string | `"codercom/code-server"` | | | image.repository | string | `"codercom/code-server"` | |
| image.tag | string | `"3.10.0"` | | | image.tag | string | `"3.10.1"` | |
| imagePullSecrets | list | `[]` | | | imagePullSecrets | list | `[]` | |
| ingress.enabled | bool | `false` | | | ingress.enabled | bool | `false` | |
| nameOverride | string | `""` | | | nameOverride | string | `""` | |

View File

@@ -6,7 +6,7 @@ replicaCount: 1
image: image:
repository: codercom/code-server repository: codercom/code-server
tag: '3.10.0' tag: '3.10.1'
pullPolicy: Always pullPolicy: Always
imagePullSecrets: [] imagePullSecrets: []

View File

@@ -49,14 +49,15 @@ arch() {
esac esac
} }
# Grabs the most recent ci.yaml github workflow run that was successful and triggered from the same commit being pushd. # Grabs the most recent ci.yaml github workflow run that was triggered from the
# pull request of the release branch for this version (regardless of whether
# that run succeeded or failed). The release branch name must be in semver
# format with a v prepended.
# This will contain the artifacts we want. # This will contain the artifacts we want.
# https://developer.github.com/v3/actions/workflow-runs/#list-workflow-runs # https://developer.github.com/v3/actions/workflow-runs/#list-workflow-runs
get_artifacts_url() { get_artifacts_url() {
local artifacts_url local artifacts_url
local workflow_runs_url="repos/:owner/:repo/actions/workflows/ci.yaml/runs?event=pull_request" local workflow_runs_url="repos/:owner/:repo/actions/workflows/ci.yaml/runs?event=pull_request"
# For releases, we look for run based on the branch name v$code_server_version
# example: v3.10.0
local version_branch="v$VERSION" local version_branch="v$VERSION"
artifacts_url=$(gh api "$workflow_runs_url" | jq -r ".workflow_runs[] | select(.head_branch == \"$version_branch\") | .artifacts_url" | head -n 1) artifacts_url=$(gh api "$workflow_runs_url" | jq -r ".workflow_runs[] | select(.head_branch == \"$version_branch\") | .artifacts_url" | head -n 1)
if [[ -z "$artifacts_url" ]]; then if [[ -z "$artifacts_url" ]]; then
@@ -112,13 +113,12 @@ RELEASE_PATH="${RELEASE_PATH-release}"
# Code itself but also extensions will look specifically in this directory for # Code itself but also extensions will look specifically in this directory for
# files (like the ripgrep binary or the oniguruma wasm). # files (like the ripgrep binary or the oniguruma wasm).
symlink_asar() { symlink_asar() {
if [ ! -L node_modules.asar ]; then rm -f node_modules.asar
if [ "${WINDIR-}" ]; then if [ "${WINDIR-}" ]; then
# mklink takes the link name first. # mklink takes the link name first.
mklink /J node_modules.asar node_modules mklink /J node_modules.asar node_modules
else else
# ln takes the link name second. # ln takes the link name second.
ln -s node_modules node_modules.asar ln -s node_modules node_modules.asar
fi
fi fi
} }

View File

@@ -5,16 +5,17 @@ set -eu
# Otherwise the current container UID may not exist in the passwd database. # Otherwise the current container UID may not exist in the passwd database.
eval "$(fixuid -q)" eval "$(fixuid -q)"
if [ "${DOCKER_USER-}" ] && [ "$DOCKER_USER" != "$USER" ]; then if [ "${DOCKER_USER-}" ]; then
echo "$DOCKER_USER ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers.d/nopasswd >/dev/null
# Unfortunately we cannot change $HOME as we cannot move any bind mounts
# nor can we bind mount $HOME into a new home as that requires a privileged container.
sudo usermod --login "$DOCKER_USER" coder
sudo groupmod -n "$DOCKER_USER" coder
USER="$DOCKER_USER" USER="$DOCKER_USER"
if [ "$DOCKER_USER" != "$(whoami)" ]; then
echo "$DOCKER_USER ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers.d/nopasswd >/dev/null
# Unfortunately we cannot change $HOME as we cannot move any bind mounts
# nor can we bind mount $HOME into a new home as that requires a privileged container.
sudo usermod --login "$DOCKER_USER" coder
sudo groupmod -n "$DOCKER_USER" coder
sudo sed -i "/coder/d" /etc/sudoers.d/nopasswd sudo sed -i "/coder/d" /etc/sudoers.d/nopasswd
fi
fi fi
dumb-init /usr/bin/code-server "$@" dumb-init /usr/bin/code-server "$@"

View File

@@ -3,6 +3,7 @@
# Contributing # Contributing
- [Pull Requests](#pull-requests) - [Pull Requests](#pull-requests)
- [Commits](#commits)
- [Requirements](#requirements) - [Requirements](#requirements)
- [Development Workflow](#development-workflow) - [Development Workflow](#development-workflow)
- [Updating VS Code](#updating-vs-code) - [Updating VS Code](#updating-vs-code)
@@ -23,9 +24,11 @@ you'd like to address unless the proposed fix is minor.
In your Pull Requests (PR), link to the issue that the PR solves. In your Pull Requests (PR), link to the issue that the PR solves.
Please ensure that the base of your PR is the **master** branch. (Note: The default Please ensure that the base of your PR is the **main** branch.
GitHub branch is the latest release branch, though you should point all of your changes to be merged into
master). ### Commits
We prefer a clean commit history. This means you should squash all fixups and fixup-type commits before asking for review (cleanup, squash, force-push). If you need help with this, feel free to leave a comment in your PR and we'll guide you.
## Requirements ## Requirements
@@ -42,7 +45,7 @@ There are several differences, however. Here is what is needed:
- [`jq`](https://stedolan.github.io/jq/) - [`jq`](https://stedolan.github.io/jq/)
- used to build code-server releases - used to build code-server releases
- [`gnupg`](https://gnupg.org/index.html) - [`gnupg`](https://gnupg.org/index.html)
- all commits must be signed an verified - all commits must be signed and verified
- see GitHub's ["Managing commit signature verification"](https://docs.github.com/en/github/authenticating-to-github/managing-commit-signature-verification) or follow [this tutorial](https://joeprevite.com/verify-commits-on-github) - see GitHub's ["Managing commit signature verification"](https://docs.github.com/en/github/authenticating-to-github/managing-commit-signature-verification) or follow [this tutorial](https://joeprevite.com/verify-commits-on-github)
- `build-essential` (Linux) - `build-essential` (Linux)
- `apt-get install -y build-essential` - used by VS Code - `apt-get install -y build-essential` - used by VS Code

View File

@@ -8,6 +8,10 @@
- [Triage](#triage) - [Triage](#triage)
- [Project Boards](#project-boards) - [Project Boards](#project-boards)
- [Versioning](#versioning) - [Versioning](#versioning)
- [Pull Requests](#pull-requests)
- [Merge Strategies](#merge-strategies)
- [Release](#release)
- [Release Manager Rotation](#release-manager-rotation)
<!-- END doctoc generated TOC please keep comment here to allow auto update --> <!-- END doctoc generated TOC please keep comment here to allow auto update -->
@@ -62,4 +66,27 @@ It also gives us a way to separate the issue triage from bigger-picture, long-te
`<major.minor.patch>` `<major.minor.patch>`
The code-server project follows traditional [semantic versioning](https://semver.org/), with the objective of minimizing major changes that break backward compatibility. We increment the patch level for all releases, except when the upstream Visual Studio Code project increments its minor version or we change the plugin API in a backward-compatible manner. In those cases, we increment the minor version rather than the patch level.
## Pull Requests
Ideally, every PR should fix an issue. If it doesn't, make sure it's associated with a version milestone.
If a PR does fix an issue, don't add it to the version milestone. Otherwise, the version milestone will have duplicate information: the issue & the PR fixing the issue.
### Merge Strategies
For most things, we recommend "Squash and Merge". If you're updating `lib/vscode`, we suggest using the "Rebase and Merge" strategy. There may be times where "Create a merge commit" makes sense as well. Use your best judgement. If you're unsure, you can always discuss in the PR with the team.
The code-server project follows traditional [semantic versioning](ttps://semver.org/), with the objective of minimizing major changes that break backward compatibility. We increment the patch level for all releases, except when the upstream Visual Studio Code project increments its minor version or we change the plugin API in a backward-compatible manner. In those cases, we increment the minor version rather than the patch level. The code-server project follows traditional [semantic versioning](ttps://semver.org/), with the objective of minimizing major changes that break backward compatibility. We increment the patch level for all releases, except when the upstream Visual Studio Code project increments its minor version or we change the plugin API in a backward-compatible manner. In those cases, we increment the minor version rather than the patch level.
## Release
### Release Manager Rotation
With each release, we rotate the role of "release manager" to ensure every maintainer goes through the process. This helps us keep documentation up-to-date and encourages us to continually review and improve the flow with each set of eyes.
If you're the current release manager, follow these steps:
1. Create a [release issue](../.github/ISSUE_TEMPLATE/release.md)
2. Fill out checklist
3. After release is published, close release milestone

View File

@@ -10,6 +10,7 @@
- [Fedora, CentOS, RHEL, SUSE](#fedora-centos-rhel-suse) - [Fedora, CentOS, RHEL, SUSE](#fedora-centos-rhel-suse)
- [Arch Linux](#arch-linux) - [Arch Linux](#arch-linux)
- [Termux](#termux) - [Termux](#termux)
- [Raspberry Pi](#raspberry-pi)
- [yarn, npm](#yarn-npm) - [yarn, npm](#yarn-npm)
- [macOS](#macos) - [macOS](#macos)
- [Standalone Releases](#standalone-releases) - [Standalone Releases](#standalone-releases)
@@ -68,7 +69,7 @@ commands presented in the rest of this document.
### Detection Reference ### Detection Reference
- For Debian, Ubuntu and Raspbian it will install the latest deb package. - For Debian and Ubuntu it will install the latest deb package.
- For Fedora, CentOS, RHEL and openSUSE it will install the latest rpm package. - For Fedora, CentOS, RHEL and openSUSE it will install the latest rpm package.
- For Arch Linux it will install the AUR package. - For Arch Linux it will install the AUR package.
- For any unrecognized Linux operating system it will install the latest standalone release into `~/.local`. - For any unrecognized Linux operating system it will install the latest standalone release into `~/.local`.
@@ -92,8 +93,8 @@ NOTE: The standalone arm64 .deb does not support Ubuntu <16.04.
Please upgrade or [build with yarn](#yarn-npm). Please upgrade or [build with yarn](#yarn-npm).
```bash ```bash
curl -fOL https://github.com/cdr/code-server/releases/download/v3.10.0/code-server_3.10.0_amd64.deb curl -fOL https://github.com/cdr/code-server/releases/download/v$VERSION/code-server_$VERSION_amd64.deb
sudo dpkg -i code-server_3.10.0_amd64.deb sudo dpkg -i code-server_$VERSION_amd64.deb
sudo systemctl enable --now code-server@$USER sudo systemctl enable --now code-server@$USER
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml # Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
``` ```
@@ -104,8 +105,8 @@ NOTE: The standalone arm64 .rpm does not support CentOS 7.
Please upgrade or [build with yarn](#yarn-npm). Please upgrade or [build with yarn](#yarn-npm).
```bash ```bash
curl -fOL https://github.com/cdr/code-server/releases/download/v3.10.0/code-server-3.10.0-amd64.rpm curl -fOL https://github.com/cdr/code-server/releases/download/v$VERSION/code-server-$VERSION-amd64.rpm
sudo rpm -i code-server-3.10.0-amd64.rpm sudo rpm -i code-server-$VERSION-amd64.rpm
sudo systemctl enable --now code-server@$USER sudo systemctl enable --now code-server@$USER
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml # Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
``` ```
@@ -132,6 +133,10 @@ sudo systemctl enable --now code-server@$USER
Please see "Installation" in the [Termux docs](./termux.md#installation) Please see "Installation" in the [Termux docs](./termux.md#installation)
## Raspberry Pi
If you're running a Raspberry Pi, we recommend install code-server with `yarn` or `npm`. See [yarn-npm](#yarn-npm).
## yarn, npm ## yarn, npm
We recommend installing with `yarn` or `npm` when: We recommend installing with `yarn` or `npm` when:
@@ -179,10 +184,10 @@ Here is an example script for installing and using a standalone `code-server` re
```bash ```bash
mkdir -p ~/.local/lib ~/.local/bin mkdir -p ~/.local/lib ~/.local/bin
curl -fL https://github.com/cdr/code-server/releases/download/v3.10.0/code-server-3.10.0-linux-amd64.tar.gz \ curl -fL https://github.com/cdr/code-server/releases/download/v$VERSION/code-server-$VERSION-linux-amd64.tar.gz \
| tar -C ~/.local/lib -xz | tar -C ~/.local/lib -xz
mv ~/.local/lib/code-server-3.10.0-linux-amd64 ~/.local/lib/code-server-3.10.0 mv ~/.local/lib/code-server-$VERSION-linux-amd64 ~/.local/lib/code-server-$VERSION
ln -s ~/.local/lib/code-server-3.10.0/bin/code-server ~/.local/bin/code-server ln -s ~/.local/lib/code-server-$VERSION/bin/code-server ~/.local/bin/code-server
PATH="~/.local/bin:$PATH" PATH="~/.local/bin:$PATH"
code-server code-server
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml # Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml

View File

@@ -17,7 +17,7 @@ Termux is an Android terminal application and Linux environment, which can also
## Installation ## Installation
1. Install Termux from the [Google Play Store](https://play.google.com/store/apps/details?id=com.termux) 1. Install Termux from [F-Droid](https://f-droid.org/en/packages/com.termux/)
2. Make sure it's up-to-date by running `apt update && apt upgrade` 2. Make sure it's up-to-date by running `apt update && apt upgrade`
3. Install required packages: `apt install build-essential python git nodejs yarn` 3. Install required packages: `apt install build-essential python git nodejs yarn`
4. Install code-server: `yarn global add code-server` 4. Install code-server: `yarn global add code-server`

View File

@@ -419,7 +419,7 @@ install_npm() {
echoh echoh
echoerr "Please install npm or yarn to install code-server!" echoerr "Please install npm or yarn to install code-server!"
echoerr "You will need at least node v12 and a few C dependencies." echoerr "You will need at least node v12 and a few C dependencies."
echoerr "See the docs https://github.com/cdr/code-server/blob/v3.10.0/docs/install.md#yarn-npm" echoerr "See the docs https://github.com/cdr/code-server/blob/v3.10.1/docs/install.md#yarn-npm"
exit 1 exit 1
} }

View File

@@ -1,7 +1,7 @@
{ {
"name": "code-oss-dev", "name": "code-oss-dev",
"version": "1.56.0", "version": "1.56.1",
"distro": "3d76109d9437bda93a3f337625de2833149ca724", "distro": "278cafaa4343ba7b12773886685e04ece97fbdc1",
"author": { "author": {
"name": "Microsoft Corporation" "name": "Microsoft Corporation"
}, },
@@ -76,6 +76,7 @@
"nsfw": "2.1.2", "nsfw": "2.1.2",
"proxy-agent": "^4.0.1", "proxy-agent": "^4.0.1",
"proxy-from-env": "^1.1.0", "proxy-from-env": "^1.1.0",
"rimraf": "^3.0.2",
"spdlog": "^0.11.1", "spdlog": "^0.11.1",
"sudo-prompt": "9.2.1", "sudo-prompt": "9.2.1",
"tas-client-umd": "0.1.4", "tas-client-umd": "0.1.4",
@@ -127,7 +128,8 @@
"copy-webpack-plugin": "^6.0.3", "copy-webpack-plugin": "^6.0.3",
"cson-parser": "^1.3.3", "cson-parser": "^1.3.3",
"css-loader": "^3.2.0", "css-loader": "^3.2.0",
"cssnano": "^4.1.11", "cssnano": "^5.0.2",
"postcss": "^8.2.1",
"debounce": "^1.0.0", "debounce": "^1.0.0",
"deemon": "^1.4.0", "deemon": "^1.4.0",
"eslint": "6.8.0", "eslint": "6.8.0",
@@ -185,7 +187,6 @@
"queue": "3.0.6", "queue": "3.0.6",
"rcedit": "^1.1.0", "rcedit": "^1.1.0",
"request": "^2.85.0", "request": "^2.85.0",
"rimraf": "^3.0.2",
"sinon": "^1.17.2", "sinon": "^1.17.2",
"source-map": "0.6.1", "source-map": "0.6.1",
"source-map-support": "^0.3.2", "source-map-support": "^0.3.2",
@@ -220,6 +221,7 @@
"windows-process-tree": "0.3.0" "windows-process-tree": "0.3.0"
}, },
"resolutions": { "resolutions": {
"postcss": "^8.2.1",
"elliptic": "^6.5.3", "elliptic": "^6.5.3",
"nwmatcher": "^1.4.4" "nwmatcher": "^1.4.4"
} }

View File

@@ -8,6 +8,7 @@
height: 16px; height: 16px;
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: 50%; background-position: 50%;
background-size: 16px;
} }
.monaco-action-bar .action-item.menu-entry .action-label { .monaco-action-bar .action-item.menu-entry .action-label {

View File

@@ -229,7 +229,9 @@ async function connectToRemoteExtensionHostAgent(options: ISimpleConnectionOptio
let socket: ISocket; let socket: ISocket;
try { try {
socket = await createSocket(options.logService, options.socketFactory, options.host, options.port, `reconnectionToken=${options.reconnectionToken}&reconnection=${options.reconnectionProtocol ? 'true' : 'false'}`, timeoutCancellationToken); // NOTE@coder: Add connection type to the socket. This is so they can be
// distinguished by the backend.
socket = await createSocket(options.logService, options.socketFactory, options.host, options.port, `type=${connectionTypeToString(connectionType)}&reconnectionToken=${options.reconnectionToken}&reconnection=${options.reconnectionProtocol ? 'true' : 'false'}`, timeoutCancellationToken);
} catch (error) { } catch (error) {
options.logService.error(`${logPrefix} socketFactory.connect() failed or timed out. Error:`); options.logService.error(`${logPrefix} socketFactory.connect() failed or timed out. Error:`);
options.logService.error(error); options.logService.error(error);

View File

@@ -83,12 +83,6 @@
display: flex; display: flex;
align-items: center; align-items: center;
overflow: hidden; overflow: hidden;
min-width: 16px; /* for flex */
height: 100%;
margin: 0;
background-repeat: no-repeat;
background-position: center;
background-size: contain;
} }
.scm-view .scm-provider > .actions > .monaco-toolbar > .monaco-action-bar > .actions-container > .action-item > .action-label > .codicon { .scm-view .scm-provider > .actions > .monaco-toolbar > .monaco-action-bar > .actions-container > .action-item > .action-label > .codicon {

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
{ {
"name": "code-server", "name": "code-server",
"license": "MIT", "license": "MIT",
"version": "3.10.0", "version": "3.10.1",
"description": "Run VS Code on a remote server.", "description": "Run VS Code on a remote server.",
"homepage": "https://github.com/cdr/code-server", "homepage": "https://github.com/cdr/code-server",
"bugs": { "bugs": {
@@ -77,6 +77,9 @@
"resolutions": { "resolutions": {
"normalize-package-data": "^3.0.0", "normalize-package-data": "^3.0.0",
"doctoc/underscore": "^1.13.1", "doctoc/underscore": "^1.13.1",
"doctoc/**/trim": "^1.0.0",
"postcss": "^8.2.1",
"parcel-bundler/cssnano": "^5.0.2",
"safe-buffer": "^5.1.1", "safe-buffer": "^5.1.1",
"vfile-message": "^2.0.2" "vfile-message": "^2.0.2"
}, },

View File

@@ -4,8 +4,7 @@ import * as path from "path"
import * as tls from "tls" import * as tls from "tls"
import { Emitter } from "../common/emitter" import { Emitter } from "../common/emitter"
import { generateUuid } from "../common/util" import { generateUuid } from "../common/util"
import { tmpdir } from "./constants" import { canConnect, paths } from "./util"
import { canConnect } from "./util"
/** /**
* Provides a way to proxy a TLS socket. Can be used when you need to pass a * Provides a way to proxy a TLS socket. Can be used when you need to pass a
@@ -13,7 +12,7 @@ import { canConnect } from "./util"
*/ */
export class SocketProxyProvider { export class SocketProxyProvider {
private readonly onProxyConnect = new Emitter<net.Socket>() private readonly onProxyConnect = new Emitter<net.Socket>()
private proxyPipe = path.join(tmpdir, "tls-proxy") private proxyPipe = path.join(paths.runtime, "tls-proxy")
private _proxyServer?: Promise<net.Server> private _proxyServer?: Promise<net.Server>
private readonly proxyTimeout = 5000 private readonly proxyTimeout = 5000
@@ -76,7 +75,10 @@ export class SocketProxyProvider {
this._proxyServer = this.findFreeSocketPath(this.proxyPipe) this._proxyServer = this.findFreeSocketPath(this.proxyPipe)
.then((pipe) => { .then((pipe) => {
this.proxyPipe = pipe this.proxyPipe = pipe
return Promise.all([fs.mkdir(tmpdir, { recursive: true }), fs.rmdir(this.proxyPipe, { recursive: true })]) return Promise.all([
fs.mkdir(path.dirname(this.proxyPipe), { recursive: true }),
fs.rmdir(this.proxyPipe, { recursive: true }),
])
}) })
.then(() => { .then(() => {
return new Promise((resolve) => { return new Promise((resolve) => {

View File

@@ -8,9 +8,10 @@ import * as path from "path"
import * as util from "util" import * as util from "util"
import xdgBasedir from "xdg-basedir" import xdgBasedir from "xdg-basedir"
interface Paths { export interface Paths {
data: string data: string
config: string config: string
runtime: string
} }
export const paths = getEnvPaths() export const paths = getEnvPaths()
@@ -20,23 +21,34 @@ export const paths = getEnvPaths()
* On MacOS this function gets the standard XDG directories instead of using the native macOS * On MacOS this function gets the standard XDG directories instead of using the native macOS
* ones. Most CLIs do this as in practice only GUI apps use the standard macOS directories. * ones. Most CLIs do this as in practice only GUI apps use the standard macOS directories.
*/ */
function getEnvPaths(): Paths { export function getEnvPaths(): Paths {
let paths: Paths const paths = envPaths("code-server", { suffix: "" })
if (process.platform === "win32") { const append = (p: string): string => path.join(p, "code-server")
paths = envPaths("code-server", { switch (process.platform) {
suffix: "", case "darwin":
}) return {
} else { // envPaths uses native directories so force Darwin to use the XDG spec
if (xdgBasedir.data === undefined || xdgBasedir.config === undefined) { // to align with other CLI tools.
throw new Error("No home folder?") data: xdgBasedir.data ? append(xdgBasedir.data) : paths.data,
} config: xdgBasedir.config ? append(xdgBasedir.config) : paths.config,
paths = { // Fall back to temp if there is no runtime dir.
data: path.join(xdgBasedir.data, "code-server"), runtime: xdgBasedir.runtime ? append(xdgBasedir.runtime) : paths.temp,
config: path.join(xdgBasedir.config, "code-server"), }
} case "win32":
return {
data: paths.data,
config: paths.config,
// Windows doesn't have a runtime dir.
runtime: paths.temp,
}
default:
return {
data: paths.data,
config: paths.config,
// Fall back to temp if there is no runtime dir.
runtime: xdgBasedir.runtime ? append(xdgBasedir.runtime) : paths.temp,
}
} }
return paths
} }
/** /**

147
test/unit/node/util.test.ts Normal file
View File

@@ -0,0 +1,147 @@
describe("getEnvPaths", () => {
describe("on darwin", () => {
let ORIGINAL_PLATFORM = ""
beforeAll(() => {
ORIGINAL_PLATFORM = process.platform
Object.defineProperty(process, "platform", {
value: "darwin",
})
})
beforeEach(() => {
jest.resetModules()
jest.mock("env-paths", () => {
return () => ({
data: "/home/envPath/.local/share",
config: "/home/envPath/.config",
temp: "/tmp/envPath/runtime",
})
})
})
afterAll(() => {
// Restore old platform
Object.defineProperty(process, "platform", {
value: ORIGINAL_PLATFORM,
})
})
it("should return the env paths using xdgBasedir", () => {
jest.mock("xdg-basedir", () => ({
data: "/home/usr/.local/share",
config: "/home/usr/.config",
runtime: "/tmp/runtime",
}))
const getEnvPaths = require("../../../src/node/util").getEnvPaths
const envPaths = getEnvPaths()
expect(envPaths.data).toEqual("/home/usr/.local/share/code-server")
expect(envPaths.config).toEqual("/home/usr/.config/code-server")
expect(envPaths.runtime).toEqual("/tmp/runtime/code-server")
})
it("should return the env paths using envPaths when xdgBasedir is undefined", () => {
jest.mock("xdg-basedir", () => ({}))
const getEnvPaths = require("../../../src/node/util").getEnvPaths
const envPaths = getEnvPaths()
expect(envPaths.data).toEqual("/home/envPath/.local/share")
expect(envPaths.config).toEqual("/home/envPath/.config")
expect(envPaths.runtime).toEqual("/tmp/envPath/runtime")
})
})
describe("on win32", () => {
let ORIGINAL_PLATFORM = ""
beforeAll(() => {
ORIGINAL_PLATFORM = process.platform
Object.defineProperty(process, "platform", {
value: "win32",
})
})
beforeEach(() => {
jest.resetModules()
jest.mock("env-paths", () => {
return () => ({
data: "/windows/envPath/.local/share",
config: "/windows/envPath/.config",
temp: "/tmp/envPath/runtime",
})
})
})
afterAll(() => {
// Restore old platform
Object.defineProperty(process, "platform", {
value: ORIGINAL_PLATFORM,
})
})
it("should return the env paths using envPaths", () => {
const getEnvPaths = require("../../../src/node/util").getEnvPaths
const envPaths = getEnvPaths()
expect(envPaths.data).toEqual("/windows/envPath/.local/share")
expect(envPaths.config).toEqual("/windows/envPath/.config")
expect(envPaths.runtime).toEqual("/tmp/envPath/runtime")
})
})
describe("on other platforms", () => {
let ORIGINAL_PLATFORM = ""
beforeAll(() => {
ORIGINAL_PLATFORM = process.platform
Object.defineProperty(process, "platform", {
value: "linux",
})
})
beforeEach(() => {
jest.resetModules()
jest.mock("env-paths", () => {
return () => ({
data: "/linux/envPath/.local/share",
config: "/linux/envPath/.config",
temp: "/tmp/envPath/runtime",
})
})
})
afterAll(() => {
// Restore old platform
Object.defineProperty(process, "platform", {
value: ORIGINAL_PLATFORM,
})
})
it("should return the runtime using xdgBasedir if it exists", () => {
jest.mock("xdg-basedir", () => ({
runtime: "/tmp/runtime",
}))
const getEnvPaths = require("../../../src/node/util").getEnvPaths
const envPaths = getEnvPaths()
expect(envPaths.data).toEqual("/linux/envPath/.local/share")
expect(envPaths.config).toEqual("/linux/envPath/.config")
expect(envPaths.runtime).toEqual("/tmp/runtime/code-server")
})
it("should return the env paths using envPaths when xdgBasedir is undefined", () => {
jest.mock("xdg-basedir", () => ({}))
const getEnvPaths = require("../../../src/node/util").getEnvPaths
const envPaths = getEnvPaths()
expect(envPaths.data).toEqual("/linux/envPath/.local/share")
expect(envPaths.config).toEqual("/linux/envPath/.config")
expect(envPaths.runtime).toEqual("/tmp/envPath/runtime")
})
})
})

View File

@@ -9,7 +9,7 @@ describe("register", () => {
beforeAll(() => { beforeAll(() => {
const { window } = new JSDOM() const { window } = new JSDOM()
global.window = (window as unknown) as Window & typeof globalThis global.window = window as unknown as Window & typeof globalThis
global.document = window.document global.document = window.document
global.navigator = window.navigator global.navigator = window.navigator
global.location = window.location global.location = window.location
@@ -35,10 +35,10 @@ describe("register", () => {
jest.restoreAllMocks() jest.restoreAllMocks()
// We don't want these to stay around because it can affect other tests // We don't want these to stay around because it can affect other tests
global.window = (undefined as unknown) as Window & typeof globalThis global.window = undefined as unknown as Window & typeof globalThis
global.document = (undefined as unknown) as Document & typeof globalThis global.document = undefined as unknown as Document & typeof globalThis
global.navigator = (undefined as unknown) as Navigator & typeof globalThis global.navigator = undefined as unknown as Navigator & typeof globalThis
global.location = (undefined as unknown) as Location & typeof globalThis global.location = undefined as unknown as Location & typeof globalThis
}) })
it("test should have access to browser globals from beforeAll", () => { it("test should have access to browser globals from beforeAll", () => {
@@ -110,7 +110,7 @@ describe("register", () => {
origin: "http://localhost:8080", origin: "http://localhost:8080",
} }
const { window } = new JSDOM() const { window } = new JSDOM()
global.window = (window as unknown) as Window & typeof globalThis global.window = window as unknown as Window & typeof globalThis
global.document = window.document global.document = window.document
global.navigator = window.navigator global.navigator = window.navigator
global.location = location as Location global.location = location as Location
@@ -131,10 +131,10 @@ describe("register", () => {
jest.restoreAllMocks() jest.restoreAllMocks()
// We don't want these to stay around because it can affect other tests // We don't want these to stay around because it can affect other tests
global.window = (undefined as unknown) as Window & typeof globalThis global.window = undefined as unknown as Window & typeof globalThis
global.document = (undefined as unknown) as Document & typeof globalThis global.document = undefined as unknown as Document & typeof globalThis
global.navigator = (undefined as unknown) as Navigator & typeof globalThis global.navigator = undefined as unknown as Navigator & typeof globalThis
global.location = (undefined as unknown) as Location & typeof globalThis global.location = undefined as unknown as Location & typeof globalThis
}) })
it("should register when options.base is undefined", async () => { it("should register when options.base is undefined", async () => {
// Mock getElementById // Mock getElementById

790
yarn.lock

File diff suppressed because it is too large Load Diff