Skip to content

Where people and agents ship software together. The open-source git platform for the whole job: issues, agents, checks and deploys to the edge.

g1t.sh
47 linesCodeBlameRaw

Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.

The sidebar asks billing whether it is on, not for the account, so no page waits on the card processor1#!/usr/bin/env node
2// Builds the Rust Worker in the current folder: the build command in each
3// Rust unit's wrangler.jsonc, so `wrangler deploy`, `wrangler dev` and
4// scripts/deploy.mjs all build the same way.
5//
6// worker-build is installed only when it is missing or another version:
7// `cargo install` on every build cost a crates.io index check each time,
8// and a full compile on a fresh machine. Every Rust Worker shares the
9// workspace's Cargo target directory, so builds running side by side take
10// turns on Cargo's lock while their wasm-bindgen and wasm-opt steps
11// overlap. How hard wasm-opt works is each crate's
The docs folder is gone, and what it held lives where people read it: how a self-hosted g1t runs and how to deploy g1t to Cloudflare are pages on docs.g1t.sh under Run g1t yourself, and speed, rate limits and operating g1t.sh are sections of CONTRIBUTING.md; code that cited a file in docs/ now points to the page or section that covers it, or says what it means itself, and applied migrations and the runner images are left as they were.12// [package.metadata.wasm-pack.profile.release].
The sidebar asks billing whether it is on, not for the account, so no page waits on the card processor13//
14// node ../../scripts/build-rust-worker.mjs [worker-build args]
15// node scripts/build-rust-worker.mjs --ensure # install only
16
17import { spawnSync } from "node:child_process";
18
19export const WORKER_BUILD_VERSION = "0.8.7";
20
21const run = (command, args, options = {}) =>
22 spawnSync(command, args, { stdio: "inherit", shell: process.platform === "win32", ...options });
23
24/** The installed worker-build's version, or null. */
25export function installedVersion() {
26 const found = spawnSync("worker-build", ["--version"], { encoding: "utf8", shell: process.platform === "win32" });
27 return found.status === 0 ? found.stdout.trim() : null;
28}
29
30/** Installs the pinned worker-build unless it is already there. */
31export function ensureWorkerBuild() {
32 const version = installedVersion();
33 if (version === WORKER_BUILD_VERSION) return;
34 console.error(`worker-build ${version ?? "is missing"}; installing ${WORKER_BUILD_VERSION}`);
35 const installed = run("cargo", ["install", "-q", "--locked", `worker-build@${WORKER_BUILD_VERSION}`, "--force"]);
36 if (installed.status !== 0) process.exit(installed.status ?? 1);
37}
38
39// Run, not imported (scripts/deploy.mjs imports ensureWorkerBuild).
40if (process.argv[1]?.replaceAll("\\", "/").endsWith("scripts/build-rust-worker.mjs")) {
41 const args = process.argv.slice(2);
42 ensureWorkerBuild();
43 if (!args.includes("--ensure")) {
44 const built = run("worker-build", ["--release", ...args]);
45 process.exit(built.status ?? 1);
46 }
47}

This file's history is long; its oldest lines are credited to the oldest commit read.