Skip to content

Commit 7027ec7

Browse files
jsjoeiocode-asher
andauthored
chore: upgrade Code to 1.66 (#5135)
* chore: upgrade Code to 1.66 * docs: update docs for Code upgrades * fixup!: docs * chore: update vscode submodule * chore: update integration patch * chore: update node-version patch * chore: update github-auth patch They completely changed how auth is handled for GitHub in microsoft/vscode#145424 so our patch may not work. Will need to test and revisit. * refactor: remove postinstall patch It appears they renamed postinstall.js to postinstall.mjs and removed the use of `rimraf` which means our patch is no longer needed! 🎉 microsoft/vscode@b0e8554 * chore: refresh local-storage patch * chore: refresh service-worker patch * chore: bulk refresh patches * fixup!: docs formatting * refactor: remove unused last-opened patch * fixup!: formatting docs * fixup!: formatting docs * refactor: remove rsync postinstall * Revert "refactor: remove rsync postinstall" This reverts commit 8d6b613. * refactor: update postinstall.js to .mjs * feat(patches): add parent-origin bypass * docs(patches): add notes for testing store-socket * docs(patches): update testing info for node-version * refactor(patches): delete github-auth.diff patch * docs(patches): add notes for testing connection-type * fixup!: delete github-auth patch * fixup!: update connection type testing * docs(patches): add notes to insecure-notification.diff * docs(patches): add nots for update-check.diff * fixup!: remove comma in integration patch * fix(e2e): disable workspace trust * refactor: add --no-default-rc for yarn install * feat(patches): remove yarnrc in presinstall * fixup!: silly mistake * docs: add note about KEEP_MODULES=1 * docs(patches): add testing notes for node-version * refactor(patches): remove node-version It appears this is no longer needed due to the `remote/package.json` now which targets node rather than electron. * fixup!: add cd ../.. to code upgrade instructions * fixup!: add note to yarn --production flag * fixup!: make parent-origin easier to upstream * Revert "refactor(patches): delete github-auth.diff patch" This reverts commit 31a354a. * Revert "fixup!: delete github-auth patch" This reverts commit bdeb521. * Merge webview origin patch into webview patch * Remove unused post-install patch * Prevent builtin extensions from updating * Refresh sourcemaps patch * Update Node to v16 This matches the version in ./lib/vscode/remote/.yarnrc. I changed the engine to exactly 16 since if you use any different version it will just not work since the modules will have been built for 16 (due to the .yarnrc). * Replace fs.rmdir with fs.rm Node is showing a deprecation warning about it. * Update github-auth patch The local credentials provider is no longer used when there is a remote so this code moved into the backend web credential provider. * Prevent fs.rm from erroring about non-existent files We were using fs.rmdir which presumably did not have the same behavior in v14 (in v16 fs.rmdir also errors). * Install Python 3 in CentOS CI container Co-authored-by: Asher <[email protected]>
1 parent 4e93db5 commit 7027ec7

38 files changed

+293
-341
lines changed

.github/workflows/ci.yaml

+16-16
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ jobs:
3333
fetch-depth: 0
3434
submodules: true
3535

36-
- name: Install Node.js v14
36+
- name: Install Node.js v16
3737
uses: actions/setup-node@v3
3838
with:
39-
node-version: "14"
39+
node-version: "16"
4040

4141
- name: Install helm
4242
uses: azure/[email protected]
@@ -74,10 +74,10 @@ jobs:
7474
fetch-depth: 0
7575
submodules: true
7676

77-
- name: Install Node.js v14
77+
- name: Install Node.js v16
7878
uses: actions/setup-node@v3
7979
with:
80-
node-version: "14"
80+
node-version: "16"
8181

8282
- name: Fetch dependencies from cache
8383
id: cache-yarn
@@ -116,10 +116,10 @@ jobs:
116116
- name: Patch Code
117117
run: quilt push -a
118118

119-
- name: Install Node.js v14
119+
- name: Install Node.js v16
120120
uses: actions/setup-node@v3
121121
with:
122-
node-version: "14"
122+
node-version: "16"
123123

124124
- name: Fetch dependencies from cache
125125
id: cache-yarn
@@ -253,15 +253,15 @@ jobs:
253253
with:
254254
fetch-depth: 0
255255

256-
- name: Install Node.js v14
256+
- name: Install Node.js v16
257257
uses: actions/setup-node@v3
258258
with:
259-
node-version: "14"
259+
node-version: "16"
260260

261261
- name: Install development tools
262262
run: |
263263
yum install -y epel-release centos-release-scl
264-
yum install -y devtoolset-9-{make,gcc,gcc-c++} jq rsync
264+
yum install -y devtoolset-9-{make,gcc,gcc-c++} jq rsync python3
265265
266266
- name: Install nfpm and envsubst
267267
run: |
@@ -337,18 +337,18 @@ jobs:
337337
CXX: ${{ format('{0}-g++', matrix.prefix) }}
338338
LINK: ${{ format('{0}-g++', matrix.prefix) }}
339339
NPM_CONFIG_ARCH: ${{ matrix.arch }}
340-
NODE_VERSION: v14.17.4
340+
NODE_VERSION: v16.13.0
341341

342342
steps:
343343
- name: Checkout repo
344344
uses: actions/checkout@v3
345345
with:
346346
fetch-depth: 0
347347

348-
- name: Install Node.js v14
348+
- name: Install Node.js v16
349349
uses: actions/setup-node@v3
350350
with:
351-
node-version: "14"
351+
node-version: "16"
352352

353353
- name: Install nfpm
354354
run: |
@@ -397,10 +397,10 @@ jobs:
397397
with:
398398
fetch-depth: 0
399399

400-
- name: Install Node.js v14
400+
- name: Install Node.js v16
401401
uses: actions/setup-node@v3
402402
with:
403-
node-version: "14"
403+
node-version: "16"
404404

405405
- name: Install nfpm
406406
run: |
@@ -446,10 +446,10 @@ jobs:
446446
fetch-depth: 0
447447
submodules: true
448448

449-
- name: Install Node.js v14
449+
- name: Install Node.js v16
450450
uses: actions/setup-node@v3
451451
with:
452-
node-version: "14"
452+
node-version: "16"
453453

454454
- name: Fetch dependencies from cache
455455
id: cache-yarn

ci/build/build-release.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ EOF
146146
# Include global extension dependencies as well.
147147
rsync "$VSCODE_SRC_PATH/extensions/package.json" "$VSCODE_OUT_PATH/extensions/package.json"
148148
rsync "$VSCODE_SRC_PATH/extensions/yarn.lock" "$VSCODE_OUT_PATH/extensions/yarn.lock"
149-
rsync "$VSCODE_SRC_PATH/extensions/postinstall.js" "$VSCODE_OUT_PATH/extensions/postinstall.js"
149+
rsync "$VSCODE_SRC_PATH/extensions/postinstall.mjs" "$VSCODE_OUT_PATH/extensions/postinstall.mjs"
150150

151151
pushd "$VSCODE_OUT_PATH"
152152
symlink_asar

ci/build/npm-postinstall.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ main() {
3333
echo "USE AT YOUR OWN RISK!"
3434
fi
3535

36-
if [ "$major_node_version" -ne "${FORCE_NODE_VERSION:-14}" ]; then
37-
echo "ERROR: code-server currently requires node v14."
36+
if [ "$major_node_version" -ne "${FORCE_NODE_VERSION:-16}" ]; then
37+
echo "ERROR: code-server currently requires node v16."
3838
if [ -n "$FORCE_NODE_VERSION" ]; then
3939
echo "However, you have overrided the version check to use v$FORCE_NODE_VERSION."
4040
fi
@@ -92,7 +92,7 @@ symlink_asar() {
9292
vscode_yarn() {
9393
echo 'Installing Code dependencies...'
9494
cd lib/vscode
95-
yarn --production --frozen-lockfile
95+
yarn --production --frozen-lockfile --no-default-rc
9696

9797
symlink_asar
9898

ci/dev/postinstall.sh

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ install-deps() {
77
if [[ ${CI-} ]]; then
88
args+=(--frozen-lockfile)
99
fi
10+
if [[ "$1" == "lib/vscode" ]]; then
11+
args+=(--no-default-rc)
12+
fi
1013
# If there is no package.json then yarn will look upward and end up installing
1114
# from the root resulting in an infinite loop (this can happen if you have not
1215
# checked out the submodule yet for example).

docs/CONTRIBUTING.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ re-apply the patches.
9696
### Version updates to Code
9797

9898
1. Update the `lib/vscode` submodule to the desired upstream version branch.
99+
1. `cd lib/vscode && git checkout release/1.66 && cd ../..`
100+
2. `git add lib && git commit -m "chore: update Code"`
99101
2. Apply the patches (`quilt push -a`) or restore your stashed changes. At this
100102
stage you may need to resolve conflicts. For example use `quilt push -f`,
101103
manually apply the rejected portions, then `quilt refresh`.
@@ -130,11 +132,13 @@ yarn build:vscode
130132
yarn release
131133
```
132134

135+
_NOTE: this does not keep `node_modules`. If you want them to be kept, use `KEEP_MODULES=1 yarn release` (if you're testing in Coder, you'll want to do this)_
136+
133137
Run your build:
134138

135139
```shell
136140
cd release
137-
yarn --production
141+
yarn --production # Skip if you used KEEP_MODULES=1
138142
# Runs the built JavaScript with Node.
139143
node .
140144
```

docs/android.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
1111
```
1212

1313
6. Exit the terminal using `exit` and then reopen the terminal
14-
7. Install and use Node.js 14:
14+
7. Install and use Node.js 16:
1515

1616
```shell
17-
nvm install 14
18-
nvm use 14
17+
nvm install 16
18+
nvm use 16
1919
```
2020

2121
8. Install code-server globally on device with: `npm i -g code-server`

docs/npm.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ includes installing instructions based on your operating system.
2222

2323
## Node.js version
2424

25-
We use the same major version of Node.js shipped with VSCode's Electron,
26-
which is currently `14.x`. VS Code also [lists Node.js
25+
We use the same major version of Node.js shipped with Code's remote, which is
26+
currently `16.x`. VS Code also [lists Node.js
2727
requirements](https://github.com/microsoft/vscode/wiki/How-to-Contribute#prerequisites).
2828

2929
Using other versions of Node.js [may lead to unexpected
@@ -72,7 +72,7 @@ Proceed to [installing](#installing)
7272
## FreeBSD
7373

7474
```sh
75-
pkg install -y git python npm-node14 yarn-node14 pkgconf
75+
pkg install -y git python npm-node16 yarn-node16 pkgconf
7676
pkg install -y libinotify
7777
```
7878

lib/vscode

Submodule vscode updated 1246 files

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122
"browser-ide"
123123
],
124124
"engines": {
125-
"node": ">= 14"
125+
"node": "16"
126126
},
127127
"jest": {
128128
"transform": {

patches/base-path.diff

+7-7
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
159159
===================================================================
160160
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
161161
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
162-
@@ -252,7 +252,10 @@ export class WebClientServer {
162+
@@ -253,7 +253,10 @@ export class WebClientServer {
163163
return res.end();
164164
}
165165

@@ -171,7 +171,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
171171

172172
function escapeAttribute(value: string): string {
173173
return value.replace(/"/g, '&quot;');
174-
@@ -272,6 +275,8 @@ export class WebClientServer {
174+
@@ -275,6 +278,8 @@ export class WebClientServer {
175175
accessToken: this._environmentService.args['github-auth'],
176176
scopes: [['user:email'], ['repo']]
177177
} : undefined;
@@ -180,15 +180,15 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
180180
const data = (await util.promisify(fs.readFile)(filePath)).toString()
181181
.replace('{{WORKBENCH_WEB_CONFIGURATION}}', escapeAttribute(JSON.stringify({
182182
remoteAuthority,
183-
@@ -279,6 +284,7 @@ export class WebClientServer {
184-
developmentOptions: { enableSmokeTestDriver: this._environmentService.driverHandle === 'web' ? true : undefined },
185-
settingsSyncOptions: !this._environmentService.isBuilt && this._environmentService.args['enable-sync'] ? { enabled: true } : undefined,
183+
@@ -285,6 +290,7 @@ export class WebClientServer {
184+
folderUri: resolveWorkspaceURI(this._environmentService.args['default-folder']),
185+
workspaceUri: resolveWorkspaceURI(this._environmentService.args['default-workspace']),
186186
productConfiguration: <Partial<IProductConfiguration>>{
187187
+ rootEndpoint: base,
188188
codeServerVersion: this._productService.codeServerVersion,
189189
embedderIdentifier: 'server-distro',
190190
extensionsGallery: this._webExtensionResourceUrlTemplate ? {
191-
@@ -291,7 +297,9 @@ export class WebClientServer {
191+
@@ -297,7 +303,9 @@ export class WebClientServer {
192192
} : undefined
193193
}
194194
})))
@@ -199,7 +199,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
199199

200200
const cspDirectives = [
201201
'default-src \'self\';',
202-
@@ -370,3 +378,70 @@ export class WebClientServer {
202+
@@ -376,3 +384,70 @@ export class WebClientServer {
203203
return res.end(data);
204204
}
205205
}

patches/connection-type.diff

+7-1
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,18 @@ This allows the backend to distinguish them. In our case we use them to count a
44
single "open" of Code so we need to be able to distinguish between web sockets
55
from two instances and two web sockets used in a single instance.
66

7+
To test this,
8+
1. Run code-server
9+
2. Open Network tab in Browser DevTools and filter for websocket requests
10+
3. You should see the `type=<connection-type>` in the request url
11+
12+
713
Index: code-server/lib/vscode/src/vs/platform/remote/common/remoteAgentConnection.ts
814
===================================================================
915
--- code-server.orig/lib/vscode/src/vs/platform/remote/common/remoteAgentConnection.ts
1016
+++ code-server/lib/vscode/src/vs/platform/remote/common/remoteAgentConnection.ts
1117
@@ -231,7 +231,7 @@ async function connectToRemoteExtensionH
12-
18+
1319
let socket: ISocket;
1420
try {
1521
- socket = await createSocket(options.logService, options.socketFactory, options.host, options.port, `reconnectionToken=${options.reconnectionToken}&reconnection=${options.reconnectionProtocol ? 'true' : 'false'}`, `renderer-${connectionTypeToString(connectionType)}-${options.reconnectionToken}`, timeoutCancellationToken);
+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Prevent builtin extensions from being updated
2+
3+
Updating builtin extensions from the marketplace prevents us from patching them
4+
(for example out GitHub authentication patches).
5+
6+
Index: code-server/lib/vscode/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts
7+
===================================================================
8+
--- code-server.orig/lib/vscode/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts
9+
+++ code-server/lib/vscode/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts
10+
@@ -206,6 +206,9 @@ export class Extension implements IExten
11+
if (!this.gallery || !this.local) {
12+
return false;
13+
}
14+
+ if (this.type !== ExtensionType.User) {
15+
+ return false;
16+
+ }
17+
if (!this.local.preRelease && this.gallery.properties.isPreReleaseVersion) {
18+
return false;
19+
}
20+
@@ -1057,6 +1060,10 @@ export class ExtensionsWorkbenchService
21+
// Skip if check updates only for builtin extensions and current extension is not builtin.
22+
continue;
23+
}
24+
+ if (installed.type !== ExtensionType.User) {
25+
+ // Never update builtin extensions.
26+
+ continue;
27+
+ }
28+
if (installed.isBuiltin && !installed.local?.identifier.uuid) {
29+
// Skip if the builtin extension does not have Marketplace id
30+
continue;

patches/disable-downloads.diff

+7-7
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Index: code-server/lib/vscode/src/vs/workbench/browser/web.api.ts
1212
===================================================================
1313
--- code-server.orig/lib/vscode/src/vs/workbench/browser/web.api.ts
1414
+++ code-server/lib/vscode/src/vs/workbench/browser/web.api.ts
15-
@@ -210,6 +210,11 @@ export interface IWorkbenchConstructionO
15+
@@ -215,6 +215,11 @@ export interface IWorkbenchConstructionO
1616
*/
1717
readonly userDataPath?: string
1818

@@ -66,7 +66,7 @@ Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
6666

6767
/* ----- server setup ----- */
6868

69-
@@ -92,6 +93,7 @@ export interface ServerParsedArgs {
69+
@@ -96,6 +97,7 @@ export interface ServerParsedArgs {
7070
'disable-update-check'?: boolean;
7171
'auth'?: string
7272
'locale'?: string
@@ -78,14 +78,14 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
7878
===================================================================
7979
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
8080
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
81-
@@ -290,6 +290,7 @@ export class WebClientServer {
81+
@@ -293,6 +293,7 @@ export class WebClientServer {
8282
logLevel: this._logService.getLevel(),
8383
},
8484
userDataPath: this._environmentService.userDataPath,
8585
+ isEnabledFileDownloads: !this._environmentService.args['disable-file-downloads'],
8686
settingsSyncOptions: !this._environmentService.isBuilt && this._environmentService.args['enable-sync'] ? { enabled: true } : undefined,
87-
productConfiguration: <Partial<IProductConfiguration>>{
88-
rootEndpoint: base,
87+
enableWorkspaceTrust: !this._environmentService.args['disable-workspace-trust'],
88+
folderUri: resolveWorkspaceURI(this._environmentService.args['default-folder']),
8989
Index: code-server/lib/vscode/src/vs/workbench/browser/contextkeys.ts
9090
===================================================================
9191
--- code-server.orig/lib/vscode/src/vs/workbench/browser/contextkeys.ts
@@ -135,7 +135,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/files/browser/fileActions
135135
===================================================================
136136
--- code-server.orig/lib/vscode/src/vs/workbench/contrib/files/browser/fileActions.contribution.ts
137137
+++ code-server/lib/vscode/src/vs/workbench/contrib/files/browser/fileActions.contribution.ts
138-
@@ -21,7 +21,7 @@ import { CLOSE_SAVED_EDITORS_COMMAND_ID,
138+
@@ -22,7 +22,7 @@ import { CLOSE_SAVED_EDITORS_COMMAND_ID,
139139
import { AutoSaveAfterShortDelayContext } from 'vs/workbench/services/filesConfiguration/common/filesConfigurationService';
140140
import { WorkbenchListDoubleSelection } from 'vs/platform/list/browser/listService';
141141
import { Schemas } from 'vs/base/common/network';
@@ -144,7 +144,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/files/browser/fileActions
144144
import { IsWebContext } from 'vs/platform/contextkey/common/contextkeys';
145145
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
146146
import { ThemeIcon } from 'vs/platform/theme/common/themeService';
147-
@@ -475,13 +475,16 @@ MenuRegistry.appendMenuItem(MenuId.Explo
147+
@@ -476,13 +476,16 @@ MenuRegistry.appendMenuItem(MenuId.Explo
148148
id: DOWNLOAD_COMMAND_ID,
149149
title: DOWNLOAD_LABEL
150150
},

0 commit comments

Comments
 (0)