mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-10 05:37:29 +03:00
Add support for --release
flag to zed-local
script
This commit is contained in:
parent
0ea59d6466
commit
170e332417
@ -5,6 +5,7 @@ const { spawn, execFileSync } = require("child_process");
|
|||||||
const RESOLUTION_REGEX = /(\d+) x (\d+)/;
|
const RESOLUTION_REGEX = /(\d+) x (\d+)/;
|
||||||
const DIGIT_FLAG_REGEX = /^--?(\d+)$/;
|
const DIGIT_FLAG_REGEX = /^--?(\d+)$/;
|
||||||
const ZED_2_MODE = "--zed2";
|
const ZED_2_MODE = "--zed2";
|
||||||
|
const RELEASE_MODE = "--release";
|
||||||
|
|
||||||
const args = process.argv.slice(2);
|
const args = process.argv.slice(2);
|
||||||
|
|
||||||
@ -16,6 +17,7 @@ if (digitMatch) {
|
|||||||
args.shift();
|
args.shift();
|
||||||
}
|
}
|
||||||
const isZed2 = args.some((arg) => arg === ZED_2_MODE);
|
const isZed2 = args.some((arg) => arg === ZED_2_MODE);
|
||||||
|
const isReleaseMode = args.some((arg) => arg === RELEASE_MODE);
|
||||||
if (instanceCount > 4) {
|
if (instanceCount > 4) {
|
||||||
throw new Error("Cannot spawn more than 4 instances");
|
throw new Error("Cannot spawn more than 4 instances");
|
||||||
}
|
}
|
||||||
@ -63,8 +65,25 @@ const positions = [
|
|||||||
`${instanceWidth},${instanceHeight}`,
|
`${instanceWidth},${instanceHeight}`,
|
||||||
];
|
];
|
||||||
|
|
||||||
const buildArgs = isZed2 ? ["build", "-p", "zed2"] : ["build"];
|
const buildArgs = (() => {
|
||||||
const zedBinary = isZed2 ? "target/debug/Zed2" : "target/debug/Zed";
|
const buildArgs = ["build"];
|
||||||
|
if (isReleaseMode) {
|
||||||
|
buildArgs.push("--release");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isZed2) {
|
||||||
|
buildArgs.push("-p", "zed2");
|
||||||
|
}
|
||||||
|
|
||||||
|
return buildArgs;
|
||||||
|
})();
|
||||||
|
const zedBinary = (() => {
|
||||||
|
const target = isReleaseMode ? "release" : "debug";
|
||||||
|
const binary = isZed2 ? "Zed2" : "Zed";
|
||||||
|
|
||||||
|
return `target/${target}/${binary}`;
|
||||||
|
})();
|
||||||
|
|
||||||
execFileSync("cargo", buildArgs, { stdio: "inherit" });
|
execFileSync("cargo", buildArgs, { stdio: "inherit" });
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
for (let i = 0; i < instanceCount; i++) {
|
for (let i = 0; i < instanceCount; i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user