Refactor evaluations (#285)
* Replace evaluations with proxies and messages * Return proxies synchronously Otherwise events can be lost. * Ensure events cannot be missed * Refactor remaining fills * Use more up-to-date version of util For callbackify. * Wait for dispose to come back before removing This prevents issues with the "done" event not always being the last event fired. For example a socket might close and then end, but only if the caller called end. * Remove old node-pty tests * Fix emitting events twice on duplex streams * Preserve environment when spawning processes * Throw a better error if the proxy doesn't exist * Remove rimraf dependency from ide * Update net.Server.listening * Use exit event instead of killed Doesn't look like killed is even a thing. * Add response timeout to server * Fix trash * Require node-pty & spdlog after they get unpackaged This fixes an error when running in the binary. * Fix errors in down emitter preventing reconnecting * Fix disposing proxies when nothing listens to "error" event * Refactor event tests to use jest.fn() * Reject proxy call when disconnected Otherwise it'll wait for the timeout which is a waste of time since we already know the connection is dead. * Use nbin for binary packaging * Remove additional module requires * Attempt to remove require for local bootstrap-fork * Externalize fsevents
This commit is contained in:
@ -33,50 +33,12 @@ const buildServerBinaryPackage = register("build:server:binary:package", async (
|
||||
throw new Error("Cannot build binary without server bundle built");
|
||||
}
|
||||
await buildServerBinaryCopy();
|
||||
await dependencyNexeBinary();
|
||||
const resp = await runner.execute(isWin ? "npm.cmd" : "npm", ["run", "build:nexe"]);
|
||||
const resp = await runner.execute(isWin ? "npm.cmd" : "npm", ["run", "build:binary"]);
|
||||
if (resp.exitCode !== 0) {
|
||||
throw new Error(`Failed to package binary: ${resp.stderr}`);
|
||||
}
|
||||
});
|
||||
|
||||
const dependencyNexeBinary = register("dependency:nexe", async (runner) => {
|
||||
if (os.platform() === "linux" && process.env.COMPRESS === "true") {
|
||||
// Download the nexe binary so we can compress it before nexe runs. If we
|
||||
// don't want compression we don't need to do anything since nexe will take
|
||||
// care of getting the binary.
|
||||
const nexeDir = path.join(os.homedir(), ".nexe");
|
||||
const targetBinaryName = `${os.platform()}-${os.arch()}-${process.version.substr(1)}`;
|
||||
const targetBinaryPath = path.join(nexeDir, targetBinaryName);
|
||||
if (!fs.existsSync(targetBinaryPath)) {
|
||||
fse.mkdirpSync(nexeDir);
|
||||
runner.cwd = nexeDir;
|
||||
await runner.execute("wget", [`https://github.com/nexe/nexe/releases/download/v3.0.0-beta.15/${targetBinaryName}`]);
|
||||
await runner.execute("chmod", ["+x", targetBinaryPath]);
|
||||
}
|
||||
// Compress with upx if it doesn't already look compressed.
|
||||
if (fs.statSync(targetBinaryPath).size >= 20000000) {
|
||||
// It needs to be executable for upx to work, which it might not be if
|
||||
// nexe downloaded it.
|
||||
fs.chmodSync(targetBinaryPath, "755");
|
||||
const upxFolder = path.join(os.tmpdir(), "upx");
|
||||
const upxBinary = path.join(upxFolder, "upx");
|
||||
if (!fs.existsSync(upxBinary)) {
|
||||
fse.mkdirpSync(upxFolder);
|
||||
runner.cwd = upxFolder;
|
||||
const upxExtract = await runner.execute("bash", ["-c", "curl -L https://github.com/upx/upx/releases/download/v3.95/upx-3.95-amd64_linux.tar.xz | tar xJ --strip-components=1"]);
|
||||
if (upxExtract.exitCode !== 0) {
|
||||
throw new Error(`Failed to extract upx: ${upxExtract.stderr}`);
|
||||
}
|
||||
}
|
||||
if (!fs.existsSync(upxBinary)) {
|
||||
throw new Error("Not sure how, but the UPX binary does not exist");
|
||||
}
|
||||
await runner.execute(upxBinary, [targetBinaryPath]);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const buildServerBinaryCopy = register("build:server:binary:copy", async (runner) => {
|
||||
const cliPath = path.join(pkgsPath, "server");
|
||||
const cliBuildPath = path.join(cliPath, "build");
|
||||
|
Reference in New Issue
Block a user