mirror of https://git.tuxpa.in/a/code-server.git
Fix VS Code product configuration not loading
This commit is contained in:
parent
256419004d
commit
5baf16622f
|
@ -172,21 +172,9 @@ class Builder {
|
|||
])
|
||||
})
|
||||
|
||||
await this.copyDependencies("code-server", this.rootPath, this.buildPath)
|
||||
|
||||
await this.task("writing final code-server package.json", async () => {
|
||||
const json = JSON.parse(await fs.readFile(path.join(this.buildPath, "package.json"), "utf8"))
|
||||
return fs.writeFile(
|
||||
path.join(this.buildPath, "package.json"),
|
||||
JSON.stringify(
|
||||
{
|
||||
...json,
|
||||
commit,
|
||||
},
|
||||
null,
|
||||
2
|
||||
)
|
||||
)
|
||||
await this.copyDependencies("code-server", this.rootPath, this.buildPath, {
|
||||
commit,
|
||||
version: process.env.VERSION,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -214,34 +202,6 @@ class Builder {
|
|||
})
|
||||
}
|
||||
|
||||
const { productJson, packageJson } = await this.task("generating vs code product configuration", async () => {
|
||||
const merge = async (name: string, json: { [key: string]: string } = {}): Promise<{ [key: string]: string }> => {
|
||||
return {
|
||||
...JSON.parse(await fs.readFile(path.join(this.vscodeSourcePath, `${name}.json`), "utf8")),
|
||||
...json,
|
||||
}
|
||||
}
|
||||
|
||||
const date = new Date().toISOString()
|
||||
const [packageJson, productJson] = await Promise.all([merge("package", {}), merge("product", { commit, date })])
|
||||
|
||||
return { productJson, packageJson }
|
||||
})
|
||||
|
||||
await this.task("inserting vs code product configuration", async () => {
|
||||
const filePath = path.join(this.vscodeSourcePath, "out-build/vs/platform/product/common/product.js")
|
||||
return fs.writeFile(
|
||||
filePath,
|
||||
(await fs.readFile(filePath, "utf8")).replace(
|
||||
"{ /*BUILD->INSERT_PRODUCT_CONFIGURATION*/}",
|
||||
JSON.stringify({
|
||||
version: packageJson.version,
|
||||
...productJson,
|
||||
})
|
||||
)
|
||||
)
|
||||
})
|
||||
|
||||
const vscodeBuildPath = path.join(this.buildPath, "lib/vscode")
|
||||
await this.task("copying vs code into build directory", async () => {
|
||||
await fs.mkdirp(vscodeBuildPath)
|
||||
|
@ -254,14 +214,13 @@ class Builder {
|
|||
])
|
||||
})
|
||||
|
||||
await this.copyDependencies("vs code", this.vscodeSourcePath, vscodeBuildPath)
|
||||
|
||||
await this.task("writing final vs code product.json", () => {
|
||||
return fs.writeFile(path.join(vscodeBuildPath, "product.json"), JSON.stringify(productJson, null, 2))
|
||||
await this.copyDependencies("vs code", this.vscodeSourcePath, vscodeBuildPath, {
|
||||
commit,
|
||||
date: new Date().toISOString(),
|
||||
})
|
||||
}
|
||||
|
||||
private async copyDependencies(name: string, sourcePath: string, buildPath: string): Promise<void> {
|
||||
private async copyDependencies(name: string, sourcePath: string, buildPath: string, merge: object): Promise<void> {
|
||||
await this.task(`copying ${name} dependencies`, async () => {
|
||||
return Promise.all(
|
||||
["node_modules", "package.json", "yarn.lock"].map((fileName) => {
|
||||
|
@ -270,6 +229,22 @@ class Builder {
|
|||
)
|
||||
})
|
||||
|
||||
const fileName = name === "code-server" ? "package" : "product"
|
||||
await this.task(`writing final ${name} ${fileName}.json`, async () => {
|
||||
const json = JSON.parse(await fs.readFile(path.join(sourcePath, `${fileName}.json`), "utf8"))
|
||||
return fs.writeFile(
|
||||
path.join(buildPath, `${fileName}.json`),
|
||||
JSON.stringify(
|
||||
{
|
||||
...json,
|
||||
...merge,
|
||||
},
|
||||
null,
|
||||
2
|
||||
)
|
||||
)
|
||||
})
|
||||
|
||||
if (process.env.MINIFY) {
|
||||
await this.task(`restricting ${name} to production dependencies`, async () => {
|
||||
return util.promisify(cp.exec)("yarn --production --ignore-scripts", { cwd: buildPath })
|
||||
|
|
|
@ -2108,10 +2108,10 @@ index 0000000000..3c74512192
|
|||
+}
|
||||
diff --git a/src/vs/server/node/server.ts b/src/vs/server/node/server.ts
|
||||
new file mode 100644
|
||||
index 0000000000..81d275a80a
|
||||
index 0000000000..ac6bbc8e98
|
||||
--- /dev/null
|
||||
+++ b/src/vs/server/node/server.ts
|
||||
@@ -0,0 +1,253 @@
|
||||
@@ -0,0 +1,252 @@
|
||||
+import * as net from 'net';
|
||||
+import * as path from 'path';
|
||||
+import { Emitter } from 'vs/base/common/event';
|
||||
|
@ -2161,6 +2161,7 @@ index 0000000000..81d275a80a
|
|||
+import { ExtensionEnvironmentChannel, FileProviderChannel, NodeProxyService } from 'vs/server/node/channel';
|
||||
+import { Connection, ExtensionHostConnection, ManagementConnection } from 'vs/server/node/connection';
|
||||
+import { TelemetryClient } from 'vs/server/node/insights';
|
||||
+import { logger } from 'vs/server/node/logger';
|
||||
+import { getLocaleFromConfig, getNlsConfiguration } from 'vs/server/node/nls';
|
||||
+import { Protocol } from 'vs/server/node/protocol';
|
||||
+import { getUriTransformer } from 'vs/server/node/util';
|
||||
|
@ -2193,11 +2194,9 @@ index 0000000000..81d275a80a
|
|||
+ logLevel: getLogLevel(environment),
|
||||
+ },
|
||||
+ remoteUserDataUri: transformer.transformOutgoing(URI.file(environment.userDataPath)),
|
||||
+ productConfiguration: {
|
||||
+ extensionsGallery: product.extensionsGallery,
|
||||
+ },
|
||||
+ productConfiguration: product,
|
||||
+ nlsConfiguration: await getNlsConfiguration(environment.args.locale || await getLocaleFromConfig(environment.userDataPath), environment.userDataPath),
|
||||
+ commit: product.commit || '',
|
||||
+ commit: product.commit || 'development',
|
||||
+ };
|
||||
+ }
|
||||
+
|
||||
|
@ -2222,7 +2221,7 @@ index 0000000000..81d275a80a
|
|||
+
|
||||
+ private async connect(message: ConnectionTypeRequest, protocol: Protocol): Promise<void> {
|
||||
+ if (product.commit && message.commit !== product.commit) {
|
||||
+ throw new Error(`Version mismatch (${message.commit} instead of ${product.commit})`);
|
||||
+ logger.warn(`Version mismatch (${message.commit} instead of ${product.commit})`);
|
||||
+ }
|
||||
+
|
||||
+ switch (message.desiredConnectionType) {
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<!-- Workbench Icon/Manifest/CSS -->
|
||||
<link rel="icon" href="../static-{{COMMIT}}/src/browser/media/favicon.ico" type="image/x-icon" />
|
||||
<link rel="manifest" href="../static-{{COMMIT}}/src/browser/media/manifest.json" crossorigin="use-credentials">
|
||||
<link data-name="vs/workbench/workbench.web.api" rel="stylesheet" href="../static-{{COMMIT}}/out/vs/workbench/workbench.web.api.css">
|
||||
<link data-name="vs/workbench/workbench.web.api" rel="stylesheet" href="./static-{{COMMIT}}/out/vs/workbench/workbench.web.api.css">
|
||||
<link rel="apple-touch-icon" href="../static-{{COMMIT}}/src/browser/media/code-server.png" />
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
|
||||
|
|
Loading…
Reference in New Issue