build: replace Yarn with Bun as the package manager #42

Merged
martin merged 7 commits from build/bun-package-manager into main 2026-11-21 12:04:32 +00:00
Owner

Replaces Yarn 4.18 with Bun 1.4.4 for installing dependencies and running repository scripts. Node 22/24 remains the runtime for Backstage, Jest, tsc, and the production backend, because better-sqlite3 cannot load under Bun.

Refs #20

What changed

  • bun.lock migrated from yarn.lock with Bun 1.4.4 (zero version drift), packageManager: bun@1.4.4, and trustedDependencies: ["better-sqlite3"]. yarn.lock, .yarnrc.yml, and .yarn/ are removed.
  • patches/@backstage%2Fcli-module-build@0.1.9.patch: the Backstage packager hardcodes yarn run build for bundled packages and copies yarn.lock into the dist workspace. The patch uses bun run build and copies no lockfile. bun install fails loudly if the patch stops applying.
  • Scripts: dev, build:app, build:backend, build-image, and the playwright.config.ts web servers use Bun. sync:forgejo still runs before dev.
  • Woodpecker installs pinned Bun 1.4.4 into .ci/bun, runs bun install --frozen-lockfile, then typecheck, lint, formatting, unit tests, frontend build, backend build, and Playwright E2E. The apt step installs only ca-certificates, curl, and unzip: the better-sqlite3 prebuild matches the Node 24 ABI, so no Python or compiler is needed.
  • Dockerfile: Node 24 base plus the pinned Bun binary, bun install --omit=dev instead of yarn workspaces focus, CMD still node packages/backend. The image installs no Python or compiler for the same reason.
  • flake: a separate nixpkgs-unstable input supplies Bun 1.4.4; corepack is removed.
  • README, AGENTS.md, .gitignore, and .dockerignore updated.

Validation

  • bun install --frozen-lockfile from an empty node_modules on Bun 1.4.4: 2651 packages, patch applied, better-sqlite3 loads under Node 22.
  • bun run tsc, bun run lint:all, bun run prettier:check, bun run test:ci --runInBand, bun run build:app, bun run build:backend: pass.
  • bun run test:e2e: 5 passed (2.0m) against the fixture catalog, with the Playwright web servers started through bun run start app / bun run start backend and channel: 'chromium' plus the Nix PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH override.
  • Woodpecker pull-request pipeline #117 at f1d6d1f: application-checks passed every step, including E2E; pr-review passed.
  • Lock comparison against yarn.lock: 0 changed packages; 13 differing names are alias/patch bookkeeping only.
  • Python-free simulation of the CI install on Node 24, with python3 and gcc removed from PATH: bun install --frozen-lockfile installed 2651 packages with the prebuilt better-sqlite3 (no build/Makefile, patch applied), and bun run test:ci --runInBand, bun run build:app, and bun run build:backend passed.
  • Production simulation of the image: extract skeleton, bun install --omit=dev on Node 24, extract bundle, start node packages/backend --config app-config.yaml ... -> "Listening on 127.0.0.1:7107", "Serving static app content from packages/app/dist", GET / 200 with the built frontend, and the ABI 137 better-sqlite3 binary loads.

Not verified yet

  • The Docker image was simulated rather than built; the local Docker daemon is not accessible.
  • backstage-cli versions:bump is Yarn-lockfile-only in Backstage 1.56; documented in the README along with bun update as the replacement.

Merge status

  • Woodpecker application-checks passes on 5f6b081 (pipeline #128), including E2E on Node 22.
  • The global Bun workflows (bun-verify, bun-push, bun-deploy) no longer match this repository: the bun-astro rule now requires an Astro config (Personal/nixos-configuration#68, deployed).
  • CI and the backend image are pinned to Node 22 until the upgrade in Personal/backstage#47.
Replaces Yarn 4.18 with Bun 1.4.4 for installing dependencies and running repository scripts. Node 22/24 remains the runtime for Backstage, Jest, `tsc`, and the production backend, because `better-sqlite3` cannot load under Bun. Refs #20 ## What changed - `bun.lock` migrated from `yarn.lock` with Bun 1.4.4 (zero version drift), `packageManager: bun@1.4.4`, and `trustedDependencies: ["better-sqlite3"]`. `yarn.lock`, `.yarnrc.yml`, and `.yarn/` are removed. - `patches/@backstage%2Fcli-module-build@0.1.9.patch`: the Backstage packager hardcodes `yarn run build` for bundled packages and copies `yarn.lock` into the dist workspace. The patch uses `bun run build` and copies no lockfile. `bun install` fails loudly if the patch stops applying. - Scripts: `dev`, `build:app`, `build:backend`, `build-image`, and the `playwright.config.ts` web servers use Bun. `sync:forgejo` still runs before `dev`. - Woodpecker installs pinned Bun 1.4.4 into `.ci/bun`, runs `bun install --frozen-lockfile`, then typecheck, lint, formatting, unit tests, frontend build, backend build, and Playwright E2E. The apt step installs only `ca-certificates`, `curl`, and `unzip`: the `better-sqlite3` prebuild matches the Node 24 ABI, so no Python or compiler is needed. - Dockerfile: Node 24 base plus the pinned Bun binary, `bun install --omit=dev` instead of `yarn workspaces focus`, CMD still `node packages/backend`. The image installs no Python or compiler for the same reason. - flake: a separate `nixpkgs-unstable` input supplies Bun 1.4.4; corepack is removed. - README, AGENTS.md, `.gitignore`, and `.dockerignore` updated. ## Validation - `bun install --frozen-lockfile` from an empty `node_modules` on Bun 1.4.4: 2651 packages, patch applied, `better-sqlite3` loads under Node 22. - `bun run tsc`, `bun run lint:all`, `bun run prettier:check`, `bun run test:ci --runInBand`, `bun run build:app`, `bun run build:backend`: pass. - `bun run test:e2e`: 5 passed (2.0m) against the fixture catalog, with the Playwright web servers started through `bun run start app` / `bun run start backend` and `channel: 'chromium'` plus the Nix `PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH` override. - Woodpecker pull-request pipeline #117 at `f1d6d1f`: `application-checks` passed every step, including E2E; `pr-review` passed. - Lock comparison against `yarn.lock`: 0 changed packages; 13 differing names are alias/patch bookkeeping only. - Python-free simulation of the CI install on Node 24, with `python3` and `gcc` removed from `PATH`: `bun install --frozen-lockfile` installed 2651 packages with the prebuilt `better-sqlite3` (no `build/Makefile`, patch applied), and `bun run test:ci --runInBand`, `bun run build:app`, and `bun run build:backend` passed. - Production simulation of the image: extract skeleton, `bun install --omit=dev` on Node 24, extract bundle, start `node packages/backend --config app-config.yaml ...` -> "Listening on 127.0.0.1:7107", "Serving static app content from packages/app/dist", `GET /` 200 with the built frontend, and the ABI 137 `better-sqlite3` binary loads. ## Not verified yet - The Docker image was simulated rather than built; the local Docker daemon is not accessible. - `backstage-cli versions:bump` is Yarn-lockfile-only in Backstage 1.56; documented in the README along with `bun update` as the replacement. ## Merge status - Woodpecker `application-checks` passes on `5f6b081` (pipeline #128), including E2E on Node 22. - The global Bun workflows (`bun-verify`, `bun-push`, `bun-deploy`) no longer match this repository: the `bun-astro` rule now requires an Astro config (Personal/nixos-configuration#68, deployed). - CI and the backend image are pinned to Node 22 until the upgrade in Personal/backstage#47.
build: replace Yarn with Bun as the package manager
Some checks failed
ci/woodpecker/pr/pr-review Pipeline was successful
ci/woodpecker/push/bun-verify Pipeline failed
ci/woodpecker/pr/application-checks Pipeline failed
880bf893b0
- Migrate yarn.lock to bun.lock with Bun 1.4.4, which reproduces the Yarn
  graph without version drift, and pin packageManager. Only
  better-sqlite3 is trusted to run its native build script.
- Patch @backstage/cli-module-build so bundled packages build with
  `bun run build` and the dist workspace no longer copies a yarn.lock.
- Run repository scripts through Bun while Node 22/24 stays the runtime for
  Backstage, Jest, tsc, and the production backend, because better-sqlite3
  cannot load under Bun.
- Extend the Woodpecker workflow to bun install --frozen-lockfile, frontend
  and backend builds, and Playwright E2E, using a pinned Bun binary in .ci.
- Replace `yarn workspaces focus` with a Bun production install in the
  backend Dockerfile and document the runtime and ABI decision.
- Track nixpkgs-unstable for Bun 1.4.4, drop corepack, and update README,
  AGENTS.md, and ignore files.

Refs #20

Co-authored-by: OpenCode <opencode@anoma.ly>
ci: install dependencies without Python
Some checks failed
ci/woodpecker/pr/pr-review Pipeline was successful
ci/woodpecker/push/bun-verify Pipeline failed
ci/woodpecker/pr/application-checks Pipeline failed
74081a9bdc
Node 22 and 24 use the published better-sqlite3 prebuilt binary, so the
install step never invokes node-gyp. Drop python3 from the apt packages and
document that Python is only needed when a native module has to compile.

Co-authored-by: OpenCode <opencode@anoma.ly>
Author
Owner

Status update: the chosen fix is the direct ignored_workflows opt-out proposed in Personal/woodpecker-extension#50, not the label-based rule exclusion.

Tracking:

This PR stays blocked until #50 ships and the extension is deployed, because bun-deploy has persistent effects. match_not_patterns and the label-rule approach are both dropped.

Status update: the chosen fix is the direct `ignored_workflows` opt-out proposed in Personal/woodpecker-extension#50, not the label-based rule exclusion. Tracking: - #44 adds `woodpecker.toml` here. - Personal/nixos-configuration#68 bumps and deploys the extension after the feature ships. - Personal/woodpecker-extension#50 implements the feature. This PR stays blocked until #50 ships and the extension is deployed, because `bun-deploy` has persistent effects. `match_not_patterns` and the label-rule approach are both dropped.
fix(e2e): use Playwright Chromium instead of branded Chrome
Some checks failed
ci/woodpecker/pr/pr-review Pipeline was successful
ci/woodpecker/push/bun-verify Pipeline failed
ci/woodpecker/pr/application-checks Pipeline was successful
f1d6d1f7f2
The Backstage Playwright helper defaults the generated projects to the
"chrome" channel, but CI installs Playwright's bundled Chromium. Select
the "chromium" channel explicitly; the Nix shell still overrides the
executable path through PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH.

Co-authored-by: OpenCode <opencode@anoma.ly>
Author
Owner

CI is green on the pull-request pipeline. f1d6d1f (fix(e2e): use Playwright Chromium instead of branded Chrome) passes all of application-checks:

  • Install (frozen lockfile), typecheck, lint, formatting
  • Unit tests
  • Build frontend and backend
  • End-to-end tests (the previous failure)

The Backstage Playwright helper defaulted generated projects to the branded chrome channel while CI installs Playwright Chromium. playwright.config.ts now requests channel: 'chromium'; local Nix runs still override the executable through PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH.

The push pipeline for the same commit still fails, but only in the global bun-verify workflow (Astro-oriented, injected by the shared bun-astro rule). This is the known blocker; application-checks is repository-owned and passes. The PR stays blocked until Personal/woodpecker-extension#50 ships and Personal/nixos-configuration#68 deploys it, then #44 adds woodpecker.toml with ignored_workflows.

CI is green on the pull-request pipeline. `f1d6d1f` (`fix(e2e): use Playwright Chromium instead of branded Chrome`) passes all of `application-checks`: - Install (frozen lockfile), typecheck, lint, formatting - Unit tests - Build frontend and backend - End-to-end tests (the previous failure) The Backstage Playwright helper defaulted generated projects to the branded `chrome` channel while CI installs Playwright Chromium. `playwright.config.ts` now requests `channel: 'chromium'`; local Nix runs still override the executable through `PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH`. The push pipeline for the same commit still fails, but only in the **global** `bun-verify` workflow (Astro-oriented, injected by the shared `bun-astro` rule). This is the known blocker; `application-checks` is repository-owned and passes. The PR stays blocked until Personal/woodpecker-extension#50 ships and Personal/nixos-configuration#68 deploys it, then #44 adds `woodpecker.toml` with `ignored_workflows`.
martin changed title from WIP: build: replace Yarn with Bun as the package manager to build: replace Yarn with Bun as the package manager 2026-11-20 19:31:45 +00:00
Author
Owner

Approach changed: narrow the shared rule instead of opting out per repository.

  • Personal/nixos-configuration#68 now adds an Astro config requirement (astro.config.*) to bun-astro.match_patterns, keeping bun.lock and package.json.
  • No woodpecker-extension release and no woodpecker.toml file are needed; #44 is closed as superseded.
  • The PR is blocked only until #68 is deployed. After that, the push pipeline should no longer inject bun-verify, and this PR can merge.

The PR body's blocking section now reflects this.

Approach changed: narrow the shared rule instead of opting out per repository. - Personal/nixos-configuration#68 now adds an Astro config requirement (`astro.config.*`) to `bun-astro.match_patterns`, keeping `bun.lock` and `package.json`. - No `woodpecker-extension` release and no `woodpecker.toml` file are needed; #44 is closed as superseded. - The PR is blocked only until #68 is deployed. After that, the push pipeline should no longer inject `bun-verify`, and this PR can merge. The PR body's blocking section now reflects this.
Author
Owner

Follow-up tracked in Personal/nixos-configuration#69: all global workflows will be renamed with a global- prefix (bun-verify → global-bun-verify, pr-review → global-pr-review, etc.).

That is a separate config change and does not block this PR. If #69 lands before Personal/nixos-configuration#68, the blocked workflow names here appear as global-bun-*; the narrow-the-rule fix is unchanged.

Follow-up tracked in Personal/nixos-configuration#69: all global workflows will be renamed with a `global-` prefix (`bun-verify` → `global-bun-verify`, `pr-review` → `global-pr-review`, etc.). That is a separate config change and does not block this PR. If #69 lands before Personal/nixos-configuration#68, the blocked workflow names here appear as `global-bun-*`; the narrow-the-rule fix is unchanged.
martin force-pushed build/bun-package-manager from f1d6d1f7f2
Some checks failed
ci/woodpecker/pr/pr-review Pipeline was successful
ci/woodpecker/push/bun-verify Pipeline failed
ci/woodpecker/pr/application-checks Pipeline was successful
to 61ebe6cc62
Some checks failed
ci/woodpecker/pr/pr-review Pipeline was successful
ci/woodpecker/pr/application-checks Pipeline failed
2026-11-21 09:12:31 +00:00
Compare
ci: rerun application checks after E2E startup failure
Some checks failed
ci/woodpecker/push/renovate-lint Pipeline was successful
ci/woodpecker/pr/pr-review Pipeline was successful
ci/woodpecker/pr/application-checks Pipeline failed
da0032ce4b
Co-authored-by: OpenCode <opencode@anoma.ly>
ci: pin application checks and image to Node 22
Some checks failed
ci/woodpecker/pr/pr-review Pipeline was successful
ci/woodpecker/pr/application-checks Pipeline failed
2952085c8e
Node 24 and 26 both fail the Playwright suite in this repository: the guest
sign-in route returns 404 while the welcome page stays visible. Node 22 passes
all five E2E tests locally on the same commit. Pin the CI image, the backend
Dockerfile base, and the documented runtime to Node 22 until the upgrade in
#47 is complete. Node 22 reaches end-of-life in April 2027.

Co-authored-by: OpenCode <opencode@anoma.ly>
ci: capture the E2E backend log for diagnosis
Some checks failed
ci/woodpecker/pr/pr-review Pipeline was successful
ci/woodpecker/pr/application-checks Pipeline failed
b6aeef9022
The Node 22 pipeline still fails the guest sign-in in E2E, while the same
suite passes locally. Playwright does not show the backend's output in CI,
so write it to a file and print it in a step that runs only on failure.
This is diagnostic and will be removed once the cause is fixed.

Co-authored-by: OpenCode <opencode@anoma.ly>
ci: run every application check step on Node 22
All checks were successful
ci/woodpecker/pr/pr-review Pipeline was successful
ci/woodpecker/pr/application-checks Pipeline was successful
5f6b0814b4
Two steps still used node:24-trixie after the Node 22 pin, so the E2E step
loaded a better-sqlite3 binary built for Node 22 under Node 24 and every
database connection failed. Pin all steps to the same major, and drop the
temporary E2E backend log capture now that the cause is known.

Co-authored-by: OpenCode <opencode@anoma.ly>
martin merged commit 4fb240bff8 into main 2026-11-21 12:04:32 +00:00
Sign in to join this conversation.
No description provided.