Refactor vscode endpoints to use fork directly.
This commit is contained in:
@ -37,10 +37,6 @@ main() {
|
||||
chmod +x ./lib/linkup
|
||||
set -e
|
||||
fi
|
||||
|
||||
yarn browserify out/browser/register.js -o out/browser/register.browserified.js
|
||||
yarn browserify out/browser/pages/login.js -o out/browser/pages/login.browserified.js
|
||||
yarn browserify out/browser/pages/vscode.js -o out/browser/pages/vscode.browserified.js
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
@ -81,8 +81,8 @@ bundle_vscode() {
|
||||
rsync "$VSCODE_SRC_PATH/extensions/postinstall.js" "$VSCODE_OUT_PATH/extensions"
|
||||
|
||||
mkdir -p "$VSCODE_OUT_PATH/resources/"{linux,web}
|
||||
rsync "$VSCODE_SRC_PATH/resources/linux/code.png" "$VSCODE_OUT_PATH/resources/linux/code.png"
|
||||
rsync "$VSCODE_SRC_PATH/resources/web/callback.html" "$VSCODE_OUT_PATH/resources/web/callback.html"
|
||||
rsync "$VSCODE_SRC_PATH/resources/linux/" "$VSCODE_OUT_PATH/resources/linux/"
|
||||
rsync "$VSCODE_SRC_PATH/resources/web/" "$VSCODE_OUT_PATH/resources/web/"
|
||||
|
||||
# Add the commit and date and enable telemetry. This just makes telemetry
|
||||
# available; telemetry can still be disabled by flag or setting.
|
||||
|
@ -11,8 +11,10 @@ main() {
|
||||
|
||||
cd vendor/modules/code-oss-dev
|
||||
|
||||
yarn gulp compile-build compile-extensions-build compile-extension-media
|
||||
yarn gulp compile-build compile-extensions-build compile-extension-media compile-web
|
||||
|
||||
yarn gulp optimize --gulpfile ./coder.js
|
||||
|
||||
if [[ $MINIFY ]]; then
|
||||
yarn gulp minify --gulpfile ./coder.js
|
||||
fi
|
||||
|
@ -1,6 +1,4 @@
|
||||
import browserify from "browserify"
|
||||
import * as cp from "child_process"
|
||||
import * as fs from "fs"
|
||||
import * as path from "path"
|
||||
import { onLine } from "../../src/node/util"
|
||||
|
||||
@ -8,7 +6,7 @@ async function main(): Promise<void> {
|
||||
try {
|
||||
const watcher = new Watcher()
|
||||
await watcher.watch()
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
console.error(error.message)
|
||||
process.exit(1)
|
||||
}
|
||||
@ -38,6 +36,9 @@ class Watcher {
|
||||
}
|
||||
|
||||
const vscode = cp.spawn("yarn", ["watch"], { cwd: this.vscodeSourcePath })
|
||||
|
||||
const vscodeWebExtensions = cp.spawn("yarn", ["watch-web"], { cwd: this.vscodeSourcePath })
|
||||
|
||||
const tsc = cp.spawn("tsc", ["--watch", "--pretty", "--preserveWatchOutput"], { cwd: this.rootPath })
|
||||
const plugin = process.env.PLUGIN_DIR
|
||||
? cp.spawn("yarn", ["build", "--watch"], { cwd: process.env.PLUGIN_DIR })
|
||||
@ -48,6 +49,10 @@ class Watcher {
|
||||
vscode.removeAllListeners()
|
||||
vscode.kill()
|
||||
|
||||
Watcher.log("killing vs code web extension watcher")
|
||||
vscodeWebExtensions.removeAllListeners()
|
||||
vscodeWebExtensions.kill()
|
||||
|
||||
Watcher.log("killing tsc")
|
||||
tsc.removeAllListeners()
|
||||
tsc.kill()
|
||||
@ -75,10 +80,17 @@ class Watcher {
|
||||
Watcher.log("vs code watcher terminated unexpectedly")
|
||||
cleanup(code)
|
||||
})
|
||||
|
||||
vscodeWebExtensions.on("exit", (code) => {
|
||||
Watcher.log("vs code extension watcher terminated unexpectedly")
|
||||
cleanup(code)
|
||||
})
|
||||
|
||||
tsc.on("exit", (code) => {
|
||||
Watcher.log("tsc terminated unexpectedly")
|
||||
cleanup(code)
|
||||
})
|
||||
|
||||
if (plugin) {
|
||||
plugin.on("exit", (code) => {
|
||||
Watcher.log("plugin terminated unexpectedly")
|
||||
@ -86,18 +98,14 @@ class Watcher {
|
||||
})
|
||||
}
|
||||
|
||||
vscodeWebExtensions.stderr.on("data", (d) => process.stderr.write(d))
|
||||
vscode.stderr.on("data", (d) => process.stderr.write(d))
|
||||
tsc.stderr.on("data", (d) => process.stderr.write(d))
|
||||
|
||||
if (plugin) {
|
||||
plugin.stderr.on("data", (d) => process.stderr.write(d))
|
||||
}
|
||||
|
||||
const browserFiles = [
|
||||
path.join(this.rootPath, "out/browser/register.js"),
|
||||
path.join(this.rootPath, "out/browser/pages/login.js"),
|
||||
path.join(this.rootPath, "out/browser/pages/vscode.js"),
|
||||
]
|
||||
|
||||
let startingVscode = false
|
||||
let startedVscode = false
|
||||
onLine(vscode, (line, original) => {
|
||||
@ -120,7 +128,6 @@ class Watcher {
|
||||
console.log("[tsc]", original)
|
||||
}
|
||||
if (line.includes("Watching for file changes")) {
|
||||
bundleBrowserCode(browserFiles)
|
||||
restartServer()
|
||||
}
|
||||
})
|
||||
@ -139,19 +146,4 @@ class Watcher {
|
||||
}
|
||||
}
|
||||
|
||||
function bundleBrowserCode(inputFiles: string[]) {
|
||||
console.log(`[browser] bundling...`)
|
||||
inputFiles.forEach(async (path: string) => {
|
||||
const outputPath = path.replace(".js", ".browserified.js")
|
||||
browserify()
|
||||
.add(path)
|
||||
.bundle()
|
||||
.on("error", function (error: Error) {
|
||||
console.error(error.toString())
|
||||
})
|
||||
.pipe(fs.createWriteStream(outputPath))
|
||||
})
|
||||
console.log(`[browser] done bundling`)
|
||||
}
|
||||
|
||||
main()
|
||||
|
Reference in New Issue
Block a user