Skip to content

Commit 8377bd2

Browse files
authored
chore: upgrade Code to 1.74.1 (#5909)
* chore: upgrade Code to 1.74.1 * chore: remove require in integration.diff I don't know what the impact of this is but in microsoft/vscode@192c67d they removed the usage of `require` in `server.main.ts`. More details in PR: microsoft/vscode#165831 * chore: update marketplace.diff * chore: update sha hash in webview.diff * chore: update disable-builtin-ext-update.diff If my logic is right, then this patch is now simplified thanks to this: https://github.com/microsoft/vscode/blob/1.74.1/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts#L1238 * chore: refresh proxy-uri patch * chore: refresh local-storage.diff * chore: refresh sourcemaps.diff * chore: refresh disable-downloads.diff * chore: refresh display-language.diff * chore: refresh getting-started.diff * docs: update testing notes for cli-window-open * docs: update telemetry testing instructions * fix: add GITHUB_TOKEN to build code-server job Downloading @vscode/ripgrep is failing only in CI so adding this environment variable to see if it increases the rate limit. Ref: https://github.com/microsoft/vscode-ripgrep#github-api-limit-note * refactor: use own cache key build code-server job * temp: disable vscode test * refactor: delete wrapper test * Revert "refactor: delete wrapper test" This reverts commit 3999279. * refactor: move vscode tests to e2e (#5911) * wip: migrate vscode tests to e2e * feat: add codeWorkspace to global setup * refactor: only use dir in spawn when we should * wip: migrate more tests * refactor: move all vscode tests to e2e * refactor(ci): move unit to own job * fixup: add codecov to unit test step * Update test/e2e/models/CodeServer.ts * Update test/e2e/models/CodeServer.ts * docs: add note about intercept requests * refactor: rm unused clean() calls * refactor: delete duplicate test * refactor: update 'should not redirect' test * refactor: rm unused imports * refactor: rm unnecessary navigate call in test * fixup: formatting * wip: update test * refactor: modify assertion for proxy * fixup: use REVERSE_PROXY_BASE_PATH * refactor: add helper fn getMaybeProxiedPathname * fixup: formatting * fixup: rm unused import * chore: increase playwright timeout * Revert "chore: increase playwright timeout" This reverts commit a059129. * chore: rm timeout
1 parent 930791d commit 8377bd2

21 files changed

+237
-207
lines changed

.github/workflows/build.yaml

+54-16
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,55 @@ jobs:
139139
if: steps.changed-files.outputs.any_changed == 'true'
140140
run: yarn lint:ts
141141

142+
test-unit:
143+
name: Run unit tests
144+
runs-on: ubuntu-20.04
145+
timeout-minutes: 5
146+
steps:
147+
- name: Checkout repo
148+
uses: actions/checkout@v3
149+
with:
150+
fetch-depth: 2
151+
152+
- name: Get changed files
153+
id: changed-files
154+
uses: tj-actions/[email protected]
155+
with:
156+
files: |
157+
**/*.ts
158+
files_ignore: |
159+
lib/vscode/**
160+
161+
- name: Install Node.js v16
162+
if: steps.changed-files.outputs.any_changed == 'true'
163+
uses: actions/setup-node@v3
164+
with:
165+
node-version: "16"
166+
167+
- name: Fetch dependencies from cache
168+
if: steps.changed-files.outputs.any_changed == 'true'
169+
id: cache-node-modules
170+
uses: actions/cache@v3
171+
with:
172+
path: "**/node_modules"
173+
key: yarn-build-${{ hashFiles('**/yarn.lock') }}
174+
restore-keys: |
175+
yarn-build-
176+
177+
- name: Install dependencies
178+
if: steps.changed-files.outputs.any_changed == 'true' && steps.cache-node-modules.outputs.cache-hit != 'true'
179+
run: SKIP_SUBMODULE_DEPS=1 yarn --frozen-lockfile
180+
181+
- name: Run unit tests
182+
if: steps.changed-files.outputs.any_changed == 'true'
183+
run: yarn test:unit
184+
185+
- name: Upload coverage report to Codecov
186+
uses: codecov/codecov-action@v3
187+
with:
188+
token: ${{ secrets.CODECOV_TOKEN }}
189+
if: success()
190+
142191
build:
143192
name: Build code-server
144193
runs-on: ubuntu-20.04
@@ -170,15 +219,17 @@ jobs:
170219
uses: actions/cache@v3
171220
with:
172221
path: "**/node_modules"
173-
key: yarn-build-${{ hashFiles('**/yarn.lock') }}
222+
key: yarn-build-code-server-${{ hashFiles('**/yarn.lock') }}
174223
restore-keys: |
175-
yarn-build-
224+
yarn-build-code-server-
176225
177226
- name: Install dependencies
178227
if: steps.cache-node-modules.outputs.cache-hit != 'true'
179228
run: yarn --frozen-lockfile
180229

181230
- name: Build code-server
231+
env:
232+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
182233
run: yarn build
183234

184235
# Get Code's git hash. When this changes it means the content is
@@ -204,19 +255,6 @@ jobs:
204255
if: steps.cache-vscode.outputs.cache-hit != 'true'
205256
run: yarn build:vscode
206257

207-
# Our code imports code from VS Code's `out` directory meaning VS Code
208-
# must be built before running these tests.
209-
# TODO: Move to its own step?
210-
- name: Run code-server unit tests
211-
run: yarn test:unit
212-
if: success()
213-
214-
- name: Upload coverage report to Codecov
215-
uses: codecov/codecov-action@v3
216-
with:
217-
token: ${{ secrets.CODECOV_TOKEN }}
218-
if: success()
219-
220258
# The release package does not contain any native modules
221259
# and is neutral to architecture/os/libc version.
222260
- name: Create release package
@@ -336,7 +374,7 @@ jobs:
336374
./test/node_modules/.bin/playwright install
337375
338376
- name: Run end-to-end tests
339-
run: CODE_SERVER_TEST_ENTRY=./release yarn test:e2e --global-timeout 840000
377+
run: CODE_SERVER_TEST_ENTRY=./release yarn test:e2e
340378

341379
- name: Upload test artifacts
342380
if: always()

ci/dev/test-unit.sh

-16
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,6 @@ main() {
1111
make -s out/index.js
1212
popd
1313

14-
# Our code imports from `out` in order to work during development but if you
15-
# have only built for production you will have not have this directory. In
16-
# that case symlink `out` to a production build directory.
17-
if [[ ! -e lib/vscode/out ]]; then
18-
pushd lib
19-
local out=(vscode-reh-web-*)
20-
if [[ -d "${out[0]}" ]]; then
21-
ln -s "../${out[0]}/out" ./vscode/out
22-
else
23-
echo "Could not find lib/vscode/out or lib/vscode-reh-web-*"
24-
echo "Code must be built before running unit tests"
25-
exit 1
26-
fi
27-
popd
28-
fi
29-
3014
# We must keep jest in a sub-directory. See ../../test/package.json for more
3115
# information. We must also run it from the root otherwise coverage will not
3216
# include our source files.

lib/vscode

Submodule vscode updated 1777 files

patches/cli-window-open.diff

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ To test:
88
2. Open code-server
99
3. Open terminal
1010
4. Open another code-server window
11-
5. Run code-server with a file or directory argument
11+
5. Run node ./out/node/entry.js with a file or directory argument
1212

1313
The file or directory should only open from the instance attached to that
1414
terminal.

patches/disable-builtin-ext-update.diff

-11
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,3 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/extensions/browser/extens
1818
if (!this.local.preRelease && this.gallery.properties.isPreReleaseVersion) {
1919
return false;
2020
}
21-
@@ -1237,6 +1241,10 @@ export class ExtensionsWorkbenchService
22-
// Skip if check updates only for builtin extensions and current extension is not builtin.
23-
continue;
24-
}
25-
+ if (installed.type !== ExtensionType.User) {
26-
+ // Never update builtin extensions.
27-
+ continue;
28-
+ }
29-
if (installed.isBuiltin && (!installed.local?.identifier.uuid || (!isWeb && this.productService.quality === 'stable'))) {
30-
// Skip checking updates for a builtin extension if it does not has Marketplace identifier or the current product is VS Code Desktop stable.
31-
continue;

patches/disable-downloads.diff

+1-1
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-
@@ -271,6 +271,11 @@ export interface IWorkbenchConstructionO
15+
@@ -264,6 +264,11 @@ export interface IWorkbenchConstructionO
1616
*/
1717
readonly userDataPath?: string
1818

patches/display-language.diff

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Index: code-server/lib/vscode/src/vs/base/common/platform.ts
4242
export const LANGUAGE_DEFAULT = 'en';
4343

4444
let _isWindows = false;
45-
@@ -83,17 +81,19 @@ if (typeof navigator === 'object' && !is
45+
@@ -86,17 +84,19 @@ if (typeof navigator === 'object' && !is
4646
_isMobile = _userAgent?.indexOf('Mobi') >= 0;
4747
_isWeb = true;
4848

@@ -125,7 +125,7 @@ Index: code-server/lib/vscode/src/vs/platform/environment/common/environmentServ
125125
===================================================================
126126
--- code-server.orig/lib/vscode/src/vs/platform/environment/common/environmentService.ts
127127
+++ code-server/lib/vscode/src/vs/platform/environment/common/environmentService.ts
128-
@@ -110,7 +110,7 @@ export abstract class AbstractNativeEnvi
128+
@@ -107,7 +107,7 @@ export abstract class AbstractNativeEnvi
129129
return URI.file(join(vscodePortable, 'argv.json'));
130130
}
131131

patches/getting-started.diff

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/welcomeGettingStarted/bro
1010
===================================================================
1111
--- code-server.orig/lib/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.ts
1212
+++ code-server/lib/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.ts
13-
@@ -62,7 +62,7 @@ import { GettingStartedIndexList } from
13+
@@ -59,7 +59,7 @@ import { GettingStartedIndexList } from
1414
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
1515
import { KeyCode } from 'vs/base/common/keyCodes';
1616
import { getTelemetryLevel } from 'vs/platform/telemetry/common/telemetryUtils';
@@ -19,7 +19,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/welcomeGettingStarted/bro
1919
import { OpenFolderViaWorkspaceAction } from 'vs/workbench/browser/actions/workspaceActions';
2020
import { OpenRecentAction } from 'vs/workbench/browser/actions/windowActions';
2121
import { Toggle } from 'vs/base/browser/ui/toggle/toggle';
22-
@@ -758,6 +758,72 @@ export class GettingStartedPage extends
22+
@@ -756,6 +756,72 @@ export class GettingStartedPage extends
2323
$('p.subtitle.description', {}, localize({ key: 'gettingStarted.editingEvolved', comment: ['Shown as subtitle on the Welcome page.'] }, "Editing evolved"))
2424
);
2525

@@ -92,7 +92,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/welcomeGettingStarted/bro
9292

9393
const leftColumn = $('.categories-column.categories-column-left', {},);
9494
const rightColumn = $('.categories-column.categories-column-right', {},);
95-
@@ -775,13 +841,23 @@ export class GettingStartedPage extends
95+
@@ -773,13 +839,23 @@ export class GettingStartedPage extends
9696
const layoutLists = () => {
9797
if (gettingStartedList.itemCount) {
9898
this.container.classList.remove('noWalkthroughs');
@@ -143,7 +143,7 @@ Index: code-server/lib/vscode/src/vs/workbench/browser/web.api.ts
143143
===================================================================
144144
--- code-server.orig/lib/vscode/src/vs/workbench/browser/web.api.ts
145145
+++ code-server/lib/vscode/src/vs/workbench/browser/web.api.ts
146-
@@ -276,6 +276,11 @@ export interface IWorkbenchConstructionO
146+
@@ -269,6 +269,11 @@ export interface IWorkbenchConstructionO
147147
*/
148148
readonly isEnabledFileDownloads?: boolean
149149

patches/integration.diff

+4-4
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Index: code-server/lib/vscode/src/vs/server/node/server.main.ts
3838
-const LOCAL_HISTORY_HOME = join(APP_SETTINGS_HOME, 'History');
3939
-const MACHINE_SETTINGS_HOME = join(USER_DATA_PATH, 'Machine');
4040
-args['user-data-dir'] = USER_DATA_PATH;
41-
-const APP_ROOT = dirname(FileAccess.asFileUri('', require).fsPath);
41+
-const APP_ROOT = dirname(FileAccess.asFileUri('').fsPath);
4242
-const BUILTIN_EXTENSIONS_FOLDER_PATH = join(APP_ROOT, 'extensions');
4343
-args['builtin-extensions-dir'] = BUILTIN_EXTENSIONS_FOLDER_PATH;
4444
-args['extensions-dir'] = args['extensions-dir'] || join(REMOTE_DATA_FOLDER, 'extensions');
@@ -58,7 +58,7 @@ Index: code-server/lib/vscode/src/vs/server/node/server.main.ts
5858
+ const LOCAL_HISTORY_HOME = join(APP_SETTINGS_HOME, 'History');
5959
+ const MACHINE_SETTINGS_HOME = join(USER_DATA_PATH, 'Machine');
6060
+ args['user-data-dir'] = USER_DATA_PATH;
61-
+ const APP_ROOT = dirname(FileAccess.asFileUri('', require).fsPath);
61+
+ const APP_ROOT = dirname(FileAccess.asFileUri('').fsPath);
6262
+ const BUILTIN_EXTENSIONS_FOLDER_PATH = args['builtin-extensions-dir'] || join(APP_ROOT, 'extensions');
6363
+ args['builtin-extensions-dir'] = BUILTIN_EXTENSIONS_FOLDER_PATH;
6464
+ args['extensions-dir'] = args['extensions-dir'] || join(REMOTE_DATA_FOLDER, 'extensions');
@@ -107,7 +107,7 @@ Index: code-server/lib/vscode/src/vs/workbench/browser/parts/dialogs/dialogHandl
107107
===================================================================
108108
--- code-server.orig/lib/vscode/src/vs/workbench/browser/parts/dialogs/dialogHandler.ts
109109
+++ code-server/lib/vscode/src/vs/workbench/browser/parts/dialogs/dialogHandler.ts
110-
@@ -143,8 +143,11 @@ export class BrowserDialogHandler implem
110+
@@ -145,8 +145,11 @@ export class BrowserDialogHandler implem
111111

112112
async about(): Promise<void> {
113113
const detailString = (useAgo: boolean): string => {
@@ -184,7 +184,7 @@ Index: code-server/lib/vscode/src/vs/workbench/browser/web.main.ts
184184
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
185185
import { IProgressService } from 'vs/platform/progress/common/progress';
186186
import { DelayedLogChannel } from 'vs/workbench/services/output/common/delayedLogChannel';
187-
@@ -117,6 +118,9 @@ export class BrowserMain extends Disposa
187+
@@ -118,6 +119,9 @@ export class BrowserMain extends Disposa
188188
// Startup
189189
const instantiationService = workbench.startup();
190190

patches/local-storage.diff

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Index: code-server/lib/vscode/src/vs/workbench/browser/web.api.ts
3232
===================================================================
3333
--- code-server.orig/lib/vscode/src/vs/workbench/browser/web.api.ts
3434
+++ code-server/lib/vscode/src/vs/workbench/browser/web.api.ts
35-
@@ -266,6 +266,11 @@ export interface IWorkbenchConstructionO
35+
@@ -259,6 +259,11 @@ export interface IWorkbenchConstructionO
3636
*/
3737
readonly configurationDefaults?: Record<string, any>;
3838

patches/marketplace.diff

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Index: code-server/lib/vscode/src/vs/platform/product/common/product.ts
1919
===================================================================
2020
--- code-server.orig/lib/vscode/src/vs/platform/product/common/product.ts
2121
+++ code-server/lib/vscode/src/vs/platform/product/common/product.ts
22-
@@ -53,6 +53,16 @@ else if (typeof require?.__$__nodeRequir
22+
@@ -47,6 +47,16 @@ else if (globalThis._VSCODE_PRODUCT_JSON
2323
version: pkg.version
2424
});
2525
}

patches/proxy-uri.diff

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ Index: code-server/lib/vscode/src/vs/workbench/browser/web.main.ts
9292
===================================================================
9393
--- code-server.orig/lib/vscode/src/vs/workbench/browser/web.main.ts
9494
+++ code-server/lib/vscode/src/vs/workbench/browser/web.main.ts
95-
@@ -248,7 +248,7 @@ export class BrowserMain extends Disposa
95+
@@ -247,7 +247,7 @@ export class BrowserMain extends Disposa
9696

9797
// Remote
9898
const connectionToken = environmentService.options.connectionToken || getCookieValue(connectionTokenCookieName);

patches/sourcemaps.diff

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Index: code-server/lib/vscode/build/gulpfile.reh.js
3232

3333
let version = packageJson.version;
3434
const quality = product.quality;
35-
@@ -388,7 +387,7 @@ function tweakProductForServerWeb(produc
35+
@@ -389,7 +388,7 @@ function tweakProductForServerWeb(produc
3636
const minifyTask = task.define(`minify-vscode-${type}`, task.series(
3737
optimizeTask,
3838
util.rimraf(`out-vscode-${type}-min`),

patches/telemetry.diff

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Add support for telemetry endpoint
22

33
To test:
4-
1. Create a RequestBin - https://requestbin.io/
4+
1. Create a mock API using [RequestBin](https://requestbin.io/) or [Beeceptor](https://beeceptor.com/)
55
2. Run code-server with `CS_TELEMETRY_URL` set:
66
i.e. `CS_TELEMETRY_URL="https://requestbin.io/1ebub9z1" ./code-server-<version>-macos-amd64/bin/code-server`
77
NOTE: it has to be a production build.

patches/webview.diff

+5-5
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Index: code-server/lib/vscode/src/vs/workbench/services/environment/browser/envi
4141
===================================================================
4242
--- code-server.orig/lib/vscode/src/vs/workbench/services/environment/browser/environmentService.ts
4343
+++ code-server/lib/vscode/src/vs/workbench/services/environment/browser/environmentService.ts
44-
@@ -210,7 +210,7 @@ export class BrowserWorkbenchEnvironment
44+
@@ -207,7 +207,7 @@ export class BrowserWorkbenchEnvironment
4545

4646
@memoize
4747
get webviewExternalEndpoint(): string {
@@ -70,12 +70,12 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/webview/browser/pre/index
7070
<meta charset="UTF-8">
7171

7272
<meta http-equiv="Content-Security-Policy"
73-
- content="default-src 'none'; script-src 'sha256-lC8sxUeeYqUtmkCpPt/OX/HQdE0JbHG1Z3dzrilsRU0=' 'self'; frame-src 'self'; style-src 'unsafe-inline';">
74-
+ content="default-src 'none'; script-src 'sha256-/9/YQU12wvTeVXCsIGB4shLwdWrMceCpKojfkloNjPU=' 'self'; frame-src 'self'; style-src 'unsafe-inline';">
73+
- content="default-src 'none'; script-src 'sha256-6s2fEapj0jmA7ZDjzz23Uv4xLlM7KX3p9DYidJX7Zmk=' 'self'; frame-src 'self'; style-src 'unsafe-inline';">
74+
+ content="default-src 'none'; script-src 'sha256-6/HBKMr5Cr24xXtQ+U/BxvVfCvBLYE55u8Jq3j/nzcI=' 'self'; frame-src 'self'; style-src 'unsafe-inline';">
7575

7676
<!-- Disable pinch zooming -->
7777
<meta name="viewport"
78-
@@ -331,6 +331,12 @@
78+
@@ -325,6 +325,12 @@
7979

8080
const hostname = location.hostname;
8181

@@ -92,7 +92,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/webview/browser/pre/index
9292
===================================================================
9393
--- code-server.orig/lib/vscode/src/vs/workbench/contrib/webview/browser/pre/index-no-csp.html
9494
+++ code-server/lib/vscode/src/vs/workbench/contrib/webview/browser/pre/index-no-csp.html
95-
@@ -330,6 +330,12 @@
95+
@@ -318,6 +318,12 @@
9696

9797
const hostname = location.hostname;
9898

test/e2e/models/CodeServer.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ export class CodeServer {
128128
path.join(dir, "extensions"),
129129
"--auth",
130130
"none",
131+
// The workspace to open.
132+
...(this.args.includes("--ignore-last-opened") ? [] : [dir]),
131133
...this.args,
132134
// Using port zero will spawn on a random port.
133135
"--bind-addr",
@@ -139,8 +141,6 @@ export class CodeServer {
139141
path.join(dir, "config.yaml"),
140142
"--user-data-dir",
141143
dir,
142-
// The last argument is the workspace to open.
143-
dir,
144144
]
145145
this.logger.debug("spawning `node " + args.join(" ") + "`")
146146
const proc = cp.spawn("node", args, {

0 commit comments

Comments
 (0)