2022-03-22 21:07:14 +01:00
|
|
|
Patch the Node version to use the current version of Node
|
|
|
|
|
|
|
|
Previously it would use the yarnrc which results in builds that cannot run with
|
|
|
|
the version of Node they were built with because the native modules are
|
|
|
|
targeting the wrong version.
|
|
|
|
|
2022-04-28 18:51:51 +02:00
|
|
|
To test this:
|
|
|
|
|
|
|
|
1. build fresh Coder workspace
|
|
|
|
2. clone code-server
|
|
|
|
3. `yarn watch`
|
|
|
|
4. test built-in terminal
|
2022-03-22 21:07:14 +01:00
|
|
|
|
|
|
|
Index: code-server/lib/vscode/build/gulpfile.reh.js
|
|
|
|
===================================================================
|
|
|
|
--- code-server.orig/lib/vscode/build/gulpfile.reh.js
|
|
|
|
+++ code-server/lib/vscode/build/gulpfile.reh.js
|
2022-04-27 01:42:09 +02:00
|
|
|
@@ -125,9 +125,7 @@ const serverWithWebEntryPoints = [
|
2022-03-22 21:07:14 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
function getNodeVersion() {
|
|
|
|
- const yarnrc = fs.readFileSync(path.join(REPO_ROOT, 'remote', '.yarnrc'), 'utf8');
|
|
|
|
- const target = /^target "(.*)"$/m.exec(yarnrc)[1];
|
|
|
|
- return target;
|
|
|
|
+ return process.versions.node;
|
|
|
|
}
|
|
|
|
|
|
|
|
const nodeVersion = getNodeVersion();
|
|
|
|
Index: code-server/lib/vscode/build/lib/node.js
|
|
|
|
===================================================================
|
|
|
|
--- code-server.orig/lib/vscode/build/lib/node.js
|
|
|
|
+++ code-server/lib/vscode/build/lib/node.js
|
|
|
|
@@ -7,9 +7,7 @@ Object.defineProperty(exports, "__esModu
|
|
|
|
const path = require("path");
|
|
|
|
const fs = require("fs");
|
|
|
|
const root = path.dirname(path.dirname(__dirname));
|
|
|
|
-const yarnrcPath = path.join(root, 'remote', '.yarnrc');
|
|
|
|
-const yarnrc = fs.readFileSync(yarnrcPath, 'utf8');
|
|
|
|
-const version = /^target\s+"([^"]+)"$/m.exec(yarnrc)[1];
|
|
|
|
+const version = process.versions.node;
|
|
|
|
const platform = process.platform;
|
2022-04-27 01:42:09 +02:00
|
|
|
const arch = process.arch;
|
2022-03-22 21:07:14 +01:00
|
|
|
const node = platform === 'win32' ? 'node.exe' : 'node';
|
|
|
|
Index: code-server/lib/vscode/build/lib/node.ts
|
|
|
|
===================================================================
|
|
|
|
--- code-server.orig/lib/vscode/build/lib/node.ts
|
|
|
|
+++ code-server/lib/vscode/build/lib/node.ts
|
|
|
|
@@ -7,9 +7,7 @@ import * as path from 'path';
|
|
|
|
import * as fs from 'fs';
|
|
|
|
|
|
|
|
const root = path.dirname(path.dirname(__dirname));
|
|
|
|
-const yarnrcPath = path.join(root, 'remote', '.yarnrc');
|
|
|
|
-const yarnrc = fs.readFileSync(yarnrcPath, 'utf8');
|
|
|
|
-const version = /^target\s+"([^"]+)"$/m.exec(yarnrc)![1];
|
|
|
|
+const version = process.versions.node;
|
|
|
|
|
|
|
|
const platform = process.platform;
|
2022-04-27 01:42:09 +02:00
|
|
|
const arch = process.arch;
|
2022-03-22 21:07:14 +01:00
|
|
|
Index: code-server/lib/vscode/build/lib/util.js
|
|
|
|
===================================================================
|
|
|
|
--- code-server.orig/lib/vscode/build/lib/util.js
|
|
|
|
+++ code-server/lib/vscode/build/lib/util.js
|
|
|
|
@@ -298,9 +298,7 @@ function streamToPromise(stream) {
|
|
|
|
}
|
|
|
|
exports.streamToPromise = streamToPromise;
|
|
|
|
function getElectronVersion() {
|
|
|
|
- const yarnrc = fs.readFileSync(path.join(root, '.yarnrc'), 'utf8');
|
|
|
|
- const target = /^target "(.*)"$/m.exec(yarnrc)[1];
|
|
|
|
- return target;
|
|
|
|
+ return process.versions.node;
|
|
|
|
}
|
|
|
|
exports.getElectronVersion = getElectronVersion;
|
|
|
|
function acquireWebNodePaths() {
|
|
|
|
Index: code-server/lib/vscode/build/lib/util.ts
|
|
|
|
===================================================================
|
|
|
|
--- code-server.orig/lib/vscode/build/lib/util.ts
|
|
|
|
+++ code-server/lib/vscode/build/lib/util.ts
|
2022-04-27 01:42:09 +02:00
|
|
|
@@ -371,9 +371,7 @@ export function streamToPromise(stream:
|
2022-03-22 21:07:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export function getElectronVersion(): string {
|
|
|
|
- const yarnrc = fs.readFileSync(path.join(root, '.yarnrc'), 'utf8');
|
|
|
|
- const target = /^target "(.*)"$/m.exec(yarnrc)![1];
|
|
|
|
- return target;
|
|
|
|
+ return process.versions.node;
|
|
|
|
}
|
|
|
|
|
|
|
|
export function acquireWebNodePaths() {
|
|
|
|
@@ -455,4 +453,3 @@ export function buildWebNodePaths(outDir
|
|
|
|
result.taskName = 'build-web-node-paths';
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
-
|