Skip to content

Commit d8c344b

Browse files
GirlBossRushTeffen
authored and
Teffen
committed
Refactor vscode endpoints to use fork directly.
1 parent beebf53 commit d8c344b

Some content is hidden

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

52 files changed

+503
-3407
lines changed

.editorconfig

+5
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,9 @@ root = true
33
[*]
44
indent_style = space
55
trim_trailing_whitespace = true
6+
7+
# The indent size used in the `package.json` file cannot be changed
8+
# https://github.com/npm/npm/pull/3180#issuecomment-16336516
9+
[{*.yml,*.yaml,package.json}]
10+
indent_style = space
611
indent_size = 2

.github/workflows/ci.yaml

+3-4
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,6 @@ jobs:
5454
run: yarn lint
5555
if: success()
5656

57-
- name: Run code-server unit tests
58-
run: yarn test:unit
59-
if: success()
60-
6157
- name: Upload coverage report to Codecov
6258
run: yarn coverage
6359
if: success()
@@ -408,6 +404,9 @@ jobs:
408404
rm -r node_modules/playwright
409405
yarn install --check-files
410406
407+
- name: Run end-to-end tests
408+
run: yarn test:unit
409+
411410
- name: Run end-to-end tests
412411
run: yarn test:e2e
413412

.prettierrc.yaml

+13
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,16 @@ printWidth: 120
22
semi: false
33
trailingComma: all
44
arrowParens: always
5+
singleQuote: false
6+
useTabs: false
7+
8+
overrides:
9+
# Attempt to keep VScode's existing code style intact.
10+
- files: "vendor/modules/code-oss-dev/**/*.ts"
11+
options:
12+
# No limit defined upstream.
13+
printWidth: 10000
14+
semi: true
15+
singleQuote: true
16+
useTabs: true
17+
arrowParens: avoid

ci/build/build-code-server.sh

-4
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@ main() {
3737
chmod +x ./lib/linkup
3838
set -e
3939
fi
40-
41-
yarn browserify out/browser/register.js -o out/browser/register.browserified.js
42-
yarn browserify out/browser/pages/login.js -o out/browser/pages/login.browserified.js
43-
yarn browserify out/browser/pages/vscode.js -o out/browser/pages/vscode.browserified.js
4440
}
4541

4642
main "$@"

ci/build/build-release.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ bundle_vscode() {
8181
rsync "$VSCODE_SRC_PATH/extensions/postinstall.js" "$VSCODE_OUT_PATH/extensions"
8282

8383
mkdir -p "$VSCODE_OUT_PATH/resources/"{linux,web}
84-
rsync "$VSCODE_SRC_PATH/resources/linux/code.png" "$VSCODE_OUT_PATH/resources/linux/code.png"
85-
rsync "$VSCODE_SRC_PATH/resources/web/callback.html" "$VSCODE_OUT_PATH/resources/web/callback.html"
84+
rsync "$VSCODE_SRC_PATH/resources/linux/" "$VSCODE_OUT_PATH/resources/linux/"
85+
rsync "$VSCODE_SRC_PATH/resources/web/" "$VSCODE_OUT_PATH/resources/web/"
8686

8787
# Add the commit and date and enable telemetry. This just makes telemetry
8888
# available; telemetry can still be disabled by flag or setting.

ci/build/build-vscode.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ main() {
1111

1212
cd vendor/modules/code-oss-dev
1313

14-
yarn gulp compile-build compile-extensions-build compile-extension-media
14+
yarn gulp compile-build compile-extensions-build compile-extension-media compile-web
15+
1516
yarn gulp optimize --gulpfile ./coder.js
17+
1618
if [[ $MINIFY ]]; then
1719
yarn gulp minify --gulpfile ./coder.js
1820
fi

ci/dev/watch.ts

+17-25
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
import browserify from "browserify"
21
import * as cp from "child_process"
3-
import * as fs from "fs"
42
import * as path from "path"
53
import { onLine } from "../../src/node/util"
64

75
async function main(): Promise<void> {
86
try {
97
const watcher = new Watcher()
108
await watcher.watch()
11-
} catch (error) {
9+
} catch (error: any) {
1210
console.error(error.message)
1311
process.exit(1)
1412
}
@@ -38,6 +36,9 @@ class Watcher {
3836
}
3937

4038
const vscode = cp.spawn("yarn", ["watch"], { cwd: this.vscodeSourcePath })
39+
40+
const vscodeWebExtensions = cp.spawn("yarn", ["watch-web"], { cwd: this.vscodeSourcePath })
41+
4142
const tsc = cp.spawn("tsc", ["--watch", "--pretty", "--preserveWatchOutput"], { cwd: this.rootPath })
4243
const plugin = process.env.PLUGIN_DIR
4344
? cp.spawn("yarn", ["build", "--watch"], { cwd: process.env.PLUGIN_DIR })
@@ -48,6 +49,10 @@ class Watcher {
4849
vscode.removeAllListeners()
4950
vscode.kill()
5051

52+
Watcher.log("killing vs code web extension watcher")
53+
vscodeWebExtensions.removeAllListeners()
54+
vscodeWebExtensions.kill()
55+
5156
Watcher.log("killing tsc")
5257
tsc.removeAllListeners()
5358
tsc.kill()
@@ -75,29 +80,32 @@ class Watcher {
7580
Watcher.log("vs code watcher terminated unexpectedly")
7681
cleanup(code)
7782
})
83+
84+
vscodeWebExtensions.on("exit", (code) => {
85+
Watcher.log("vs code extension watcher terminated unexpectedly")
86+
cleanup(code)
87+
})
88+
7889
tsc.on("exit", (code) => {
7990
Watcher.log("tsc terminated unexpectedly")
8091
cleanup(code)
8192
})
93+
8294
if (plugin) {
8395
plugin.on("exit", (code) => {
8496
Watcher.log("plugin terminated unexpectedly")
8597
cleanup(code)
8698
})
8799
}
88100

101+
vscodeWebExtensions.stderr.on("data", (d) => process.stderr.write(d))
89102
vscode.stderr.on("data", (d) => process.stderr.write(d))
90103
tsc.stderr.on("data", (d) => process.stderr.write(d))
104+
91105
if (plugin) {
92106
plugin.stderr.on("data", (d) => process.stderr.write(d))
93107
}
94108

95-
const browserFiles = [
96-
path.join(this.rootPath, "out/browser/register.js"),
97-
path.join(this.rootPath, "out/browser/pages/login.js"),
98-
path.join(this.rootPath, "out/browser/pages/vscode.js"),
99-
]
100-
101109
let startingVscode = false
102110
let startedVscode = false
103111
onLine(vscode, (line, original) => {
@@ -120,7 +128,6 @@ class Watcher {
120128
console.log("[tsc]", original)
121129
}
122130
if (line.includes("Watching for file changes")) {
123-
bundleBrowserCode(browserFiles)
124131
restartServer()
125132
}
126133
})
@@ -139,19 +146,4 @@ class Watcher {
139146
}
140147
}
141148

142-
function bundleBrowserCode(inputFiles: string[]) {
143-
console.log(`[browser] bundling...`)
144-
inputFiles.forEach(async (path: string) => {
145-
const outputPath = path.replace(".js", ".browserified.js")
146-
browserify()
147-
.add(path)
148-
.bundle()
149-
.on("error", function (error: Error) {
150-
console.error(error.toString())
151-
})
152-
.pipe(fs.createWriteStream(outputPath))
153-
})
154-
console.log(`[browser] done bundling`)
155-
}
156-
157149
main()

package.json

+2-8
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@
3535
"main": "out/node/entry.js",
3636
"devDependencies": {
3737
"@schemastore/package": "^0.0.6",
38-
"@types/body-parser": "^1.19.0",
39-
"@types/browserify": "^12.0.36",
4038
"@types/compression": "^1.7.0",
4139
"@types/cookie-parser": "^1.4.2",
4240
"@types/express": "^4.17.8",
@@ -48,13 +46,11 @@
4846
"@types/safe-compare": "^1.1.0",
4947
"@types/semver": "^7.1.0",
5048
"@types/split2": "^3.2.0",
51-
"@types/tar-fs": "^2.0.0",
52-
"@types/tar-stream": "^2.1.0",
49+
"@types/trusted-types": "^2.0.2",
5350
"@types/ws": "^8.0.0",
5451
"@typescript-eslint/eslint-plugin": "^4.7.0",
5552
"@typescript-eslint/parser": "^4.7.0",
5653
"audit-ci": "^4.0.0",
57-
"browserify": "^17.0.0",
5854
"codecov": "^3.8.3",
5955
"doctoc": "^2.0.0",
6056
"eslint": "^7.7.0",
@@ -68,7 +64,7 @@
6864
"stylelint": "^13.0.0",
6965
"stylelint-config-recommended": "^5.0.0",
7066
"ts-node": "^10.0.0",
71-
"typescript": "^4.1.3"
67+
"typescript": "^4.4.0-dev.20210528"
7268
},
7369
"resolutions": {
7470
"ansi-regex": "^5.0.1",
@@ -85,7 +81,6 @@
8581
"dependencies": {
8682
"@coder/logger": "1.1.16",
8783
"argon2": "^0.28.0",
88-
"body-parser": "^1.19.0",
8984
"compression": "^1.7.4",
9085
"cookie-parser": "^1.4.5",
9186
"env-paths": "^2.2.0",
@@ -103,7 +98,6 @@
10398
"safe-compare": "^1.1.4",
10499
"semver": "^7.1.3",
105100
"split2": "^3.2.2",
106-
"tar-fs": "^2.0.0",
107101
"ws": "^8.0.0",
108102
"xdg-basedir": "^4.0.0",
109103
"yarn": "^1.22.4"

src/browser/media/manifest.json

-20
This file was deleted.

src/browser/pages/error.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@
1010
http-equiv="Content-Security-Policy"
1111
content="style-src 'self'; manifest-src 'self'; img-src 'self' data:; font-src 'self' data:;"
1212
/>
13+
1314
<title>{{ERROR_TITLE}} - code-server</title>
1415
<link rel="icon" href="{{CS_STATIC_BASE}}/src/browser/media/favicon-dark-support.svg" />
1516
<link rel="alternate icon" href="{{CS_STATIC_BASE}}/src/browser/media/favicon.ico" />
16-
<link rel="manifest" href="{{CS_STATIC_BASE}}/src/browser/media/manifest.json" crossorigin="use-credentials" />
17+
<link rel="manifest" href="/manifest.json" crossorigin="use-credentials" />
1718
<link rel="apple-touch-icon" sizes="192x192" href="{{CS_STATIC_BASE}}/src/browser/media/pwa-icon-192.png" />
1819
<link rel="apple-touch-icon" sizes="512x512" href="{{CS_STATIC_BASE}}/src/browser/media/pwa-icon-512.png" />
1920
<link href="{{CS_STATIC_BASE}}/src/browser/pages/global.css" rel="stylesheet" />
@@ -30,6 +31,5 @@ <h2 class="header">{{ERROR_HEADER}}</h2>
3031
</div>
3132
</div>
3233
</div>
33-
<script data-cfasync="false" src="{{CS_STATIC_BASE}}/out/browser/register.browserified.js"></script>
3434
</body>
3535
</html>

src/browser/pages/login.html

+1-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<title>code-server login</title>
1414
<link rel="icon" href="{{CS_STATIC_BASE}}/src/browser/media/favicon-dark-support.svg" />
1515
<link rel="alternate icon" href="{{CS_STATIC_BASE}}/src/browser/media/favicon.ico" />
16-
<link rel="manifest" href="{{CS_STATIC_BASE}}/src/browser/media/manifest.json" crossorigin="use-credentials" />
16+
<link rel="manifest" href="{{BASE}}/manifest.json" crossorigin="use-credentials" />
1717
<link rel="apple-touch-icon" sizes="192x192" href="{{CS_STATIC_BASE}}/src/browser/media/pwa-icon-192.png" />
1818
<link rel="apple-touch-icon" sizes="512x512" href="{{CS_STATIC_BASE}}/src/browser/media/pwa-icon-512.png" />
1919
<link href="{{CS_STATIC_BASE}}/src/browser/pages/global.css" rel="stylesheet" />
@@ -30,7 +30,6 @@ <h1 class="main">Welcome to code-server</h1>
3030
<div class="content">
3131
<form class="login-form" method="post">
3232
<input class="user" type="text" autocomplete="username" />
33-
<input id="base" type="hidden" name="base" value="/" />
3433
<div class="field">
3534
<input
3635
required
@@ -49,5 +48,4 @@ <h1 class="main">Welcome to code-server</h1>
4948
</div>
5049
</div>
5150
</body>
52-
<script data-cfasync="false" src="{{CS_STATIC_BASE}}/out/browser/pages/login.browserified.js"></script>
5351
</html>

src/browser/pages/login.ts

-8
This file was deleted.

src/browser/pages/vscode.html

-54
This file was deleted.

0 commit comments

Comments
 (0)