Update local development workflow to not involve zed.dev (#4103)

When testing Zed locally, it's rarely necessary to log in the real with,
via Zed.dev and GitHub. We usually use `zed-local`. Since zed.dev is not
going to be open source (at least right away), this PR removes it from
our local development workflow.

* Remove zed.dev from the Procfile
* Change the `seed` script to not create an admin user for your
signed-in github user
* Instead have both `zed-local` and the `seed` script read from an
`.admins.json` file, which the user can create in order to customize who
they sign in as when running `zed-local`.
* Update all of the docs for building and developing zed.
This commit is contained in:
Max Brunsfeld 2024-01-17 15:07:20 -08:00 committed by GitHub
commit 647b08b101
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 172 additions and 211 deletions

View file

@ -2,8 +2,4 @@
set -e
cd crates/collab
# Export contents of .env.toml
eval "$(cargo run --quiet --bin dotenv)"
cargo run --quiet --package=collab --features seed-support --bin seed -- $@

View file

@ -4,6 +4,11 @@ const HELP = `
USAGE
zed-local [options] [zed args]
SUMMARY
Runs 1-4 instances of Zed using a locally-running collaboration server.
Each instance of Zed will be signed in as a different user specified in
either \`.admins.json\` or \`.admins.default.json\`.
OPTIONS
--help Print this help message
--release Build Zed in release mode
@ -12,6 +17,16 @@ OPTIONS
`.trim();
const { spawn, execFileSync } = require("child_process");
const assert = require("assert");
const defaultUsers = require("../crates/collab/.admins.default.json");
let users = defaultUsers;
try {
const customUsers = require("../crates/collab/.admins.json");
assert(customUsers.length > 0);
assert(customUsers.every((user) => typeof user === "string"));
users.splice(0, 0, ...customUsers);
} catch (_) {}
const RESOLUTION_REGEX = /(\d+) x (\d+)/;
const DIGIT_FLAG_REGEX = /^--?(\d+)$/;
@ -71,10 +86,6 @@ if (instanceCount > 1) {
}
}
let users = ["nathansobo", "as-cii", "maxbrunsfeld", "iamnbutler"];
const RUST_LOG = process.env.RUST_LOG || "info";
// If a user is specified, make sure it's first in the list
const user = process.env.ZED_IMPERSONATE;
if (user) {
@ -88,18 +99,12 @@ const positions = [
`${instanceWidth},${instanceHeight}`,
];
const buildArgs = (() => {
const buildArgs = ["build"];
if (isReleaseMode) {
buildArgs.push("--release");
}
return buildArgs;
})();
const zedBinary = (() => {
const target = isReleaseMode ? "release" : "debug";
return `target/${target}/Zed`;
})();
let buildArgs = ["build"];
let zedBinary = "target/debug/Zed";
if (isReleaseMode) {
buildArgs.push("--release");
zedBinary = "target/release/Zed";
}
execFileSync("cargo", buildArgs, { stdio: "inherit" });
setTimeout(() => {
@ -115,7 +120,7 @@ setTimeout(() => {
ZED_ADMIN_API_TOKEN: "secret",
ZED_WINDOW_SIZE: `${instanceWidth},${instanceHeight}`,
PATH: process.env.PATH,
RUST_LOG,
RUST_LOG: process.env.RUST_LOG || "info",
},
});
}