History

bootstrap: vendor submodules opt-in via --forks

Nothing imports from vendor/ at runtime — the forks are consumed as published npm packages (vendor/README.md is explicit). Forcing the submodule init in bootstrap taught every fresh worktree a false dependency. --forks remains for deliberately developing a fork.

Rhys Sullivan committed 5 months ago

Commit ad84e391 parent 3f3ed8f2 files · +18 −9Browse files

Unified · Split

2 files
  1. AGENTS.md +6 −4
  2. scripts/bootstrap.ts +12 −5
AGENTS.md+6−4
@@ -3,11 +3,13 @@ · 2 unmodified lines
3## Fresh Checkout / Worktree Setup3## Fresh Checkout / Worktree Setup
4 4
5Run `bun run bootstrap` first in any fresh checkout or worktree. It is5Run `bun run bootstrap` first in any fresh checkout or worktree. It is
6idempotent: inits the vendor submodules (`vendor/emulate`, `vendor/mcporter` —6idempotent: runs `bun install` (whose prepare hook builds the internal
7the e2e suite needs both), runs `bun install` (whose prepare hook builds the7packages dev servers fail without) and installs Playwright chromium.
8internal packages dev servers fail without), and installs Playwright chromium.
9Skipping it is why fresh worktrees die with "Failed to resolve entry for8Skipping it is why fresh worktrees die with "Failed to resolve entry for
10package '@executor-js/vite-plugin'".9package '@executor-js/vite-plugin'". The `vendor/` submodules are NOT
10needed — nothing imports from `vendor/` at runtime; those forks are consumed
11from npm (see `vendor/README.md`). `bun run bootstrap --forks` inits them
12only when you're deliberately developing a fork.
11 13
12## Environment Gotchas (learned the hard way)14## Environment Gotchas (learned the hard way)
13 15
scripts/bootstrap.ts+12−5
@@ -1,7 +1,12 @@
1// One-command setup for a fresh checkout or agent worktree: submodules,1// One-command setup for a fresh checkout or agent worktree: dependencies
2// dependencies (whose prepare hook builds the internal packages dev servers2// (whose prepare hook builds the internal packages dev servers need) and the
3// need), and the Playwright browser the e2e suite drives. Idempotent and3// Playwright browser the e2e suite drives. Idempotent and safe to re-run;
4// safe to re-run; each step prints what it is doing.4// each step prints what it is doing.
5//
6// The vendor/ submodules are intentionally NOT initialized: nothing imports
7// from vendor/ at runtime — those forks are consumed as published npm
8// packages (see vendor/README.md). Pass --forks only when deliberately
9// developing a fork.
5import { execFileSync } from "node:child_process";10import { execFileSync } from "node:child_process";
6import { existsSync } from "node:fs";11import { existsSync } from "node:fs";
7import { resolve } from "node:path";12import { resolve } from "node:path";
@@ -14,7 +19,9 @@ const run = (label: string, cmd: string, args: ReadonlyArray<string>) => { · 6 unmodified lines
14 execFileSync(cmd, [...args], { cwd: repoRoot, stdio: "inherit" });19 execFileSync(cmd, [...args], { cwd: repoRoot, stdio: "inherit" });
15};20};
16 21
17run("vendor submodules", "git", ["submodule", "update", "--init", "--recursive"]);22if (process.argv.includes("--forks")) {
23 run("vendor fork submodules", "git", ["submodule", "update", "--init", "--recursive"]);
24}
18 25
19// `bun install` runs the workspace prepare hook, which builds26// `bun install` runs the workspace prepare hook, which builds
20// @executor-js/vite-plugin and @executor-js/react — the two artifacts the27// @executor-js/vite-plugin and @executor-js/react — the two artifacts the