目录
elrrrrrrr

chore: migrate to utoo CI (#5830)

Summary

Migrate the main CI workflow from pnpm to utoo (ut). The E2E workflow keeps pnpm for now — it requires catalog: / workspace: protocol resolution and publishConfig overrides during pack which ut pm-pack does not yet provide.

Install speedup

The direct win of this migration: ut install --from pnpm is 2.2–3.6× faster than pnpm install across all test matrix platforms.

Platform pnpm install ut install Speedup
ubuntu-22 16.8s 5.2s 3.2×
ubuntu-24 17.7s 4.9s 3.6×
macos-22 26.3s 9.5s 2.8×
macos-24 30.1s 9.1s 3.3×
windows-22 31.1s 12.0s 2.6×
windows-24 28.4s 12.7s 2.2×

Every test matrix job re-installs from scratch, so this 15–20s savings per job compounds into the per-job reductions below.

Overall CI wall-clock

On a clean run (no reruns), the full workflow shaves ~1 minute off wall-clock (25m34s → 24m32s, 4% faster). The critical path is still bounded by Windows Test (20–24m), so faster jobs elsewhere can’t meaningfully shrink wall-clock. Flaky reruns on the critical path can degrade practical times further.

The win of this PR is per-job speedup (especially macOS, where Test jobs drop 6–8 minutes each) and developer-machine ergonomics (ut install on your laptop is also 3× faster).

CI changes

  • .github/workflows/ci.yml: replace pnpm/action-setup + pnpm install with utooland/setup-utoo + ut install --from pnpm
  • package.json: convert pnpm-specific scripts to ut equivalents (ut run --workspaces, ut run --workspace <name>)
  • site:build / site:dev use cd site && npm run build/dev so Cloudflare Pages works (its env has neither pnpm nor utoo)
  • .gitignore: add .utoo.toml and .claude/
  • .oxfmtrc.json: ignore root package.json (ut rewrites it with npm-style workspaces field)

egg-bin fixes

CJS resolution (baseCommand.ts)

ts-node, tsconfig-paths are CJS packages without exports. On flat-hoisted layouts (npm/utoo), importResolve (which uses import.meta.resolve) fails because the ESM resolver doesn’t auto-append .js for bare subpaths. Fix: use createRequire for these CJS packages.

Self-test fixture opt-out (test.ts + coffee.ts)

Under flat-hoisting, egg-bin’s own test fixtures reach @eggjs/mock and @eggjs/tegg-vitest via monorepo root hoist even though the fixture projects don’t use them. This caused every test fork to load both frameworks unnecessarily (~90s for mock, ~7s/fork for tegg runner → ~70s for the test-bin suite).

Solution: the test harness (coffee.ts) sets EGG_BIN_SELF_TEST_FIXTURE=1 when spawning egg-bin against its own fixtures. test.ts checks this env var and skips both mock and tegg-runner auto-detection.

For real projects, behaviour is unchanged: both frameworks are resolve-then-use. The tegg runner also falls back to egg-bin’s own dirname for E2E scenarios (cnpmcore uses tegg transitively via egg without declaring it directly).

Build perf: publint pack

publint runs pnpm pack by default against each of ~80 packages. On main CI (utoo env, no pnpm binary) this fails. On E2E (pnpm env, symlinked node_modules) npm pack is ~10× slower per package — create-egg alone took 85s vs 1s under pnpm.

Fix: tsdown.config.ts reads PUBLINT_PACK env var, defaulting to npm (works in main CI). E2E workflow sets PUBLINT_PACK=pnpm so it stays fast there.

Dependency fixes

Change Why
oxlint-tsgolint: ^0.15.0^0.18.1 Peer requirement of oxlint
1.60.0
Add @types/content-type, @types/koa-compose to root devDeps
oxlint type-check needs these at workspace root, not just hoisted from
sub-packages

Other source adaptations

File What
packages/cluster/test/options.test.ts Accept flat-hoisted
node_modules/egg path
packages/tsconfig/test/index.test.ts Use require.resolve instead
of hardcoded path
tegg/plugin/controller, tegg/plugin/mcp-proxy Remove
@ts-expect-error for types discoverable under flat hoisting

Per-job timing (clean run, no reruns)

Job next chore-ut-ci Delta
typecheck 2m7s 1m39s -28s
Test (ubuntu, 22) 14m52s 15m20s +28s
Test (ubuntu, 24) 13m38s 13m28s -10s
Test (macos, 22) 21m5s 14m40s -6m25s
Test (macos, 24) 18m54s 10m38s -8m16s
Test (windows, 22) 25m24s 24m23s -1m1s
Test (windows, 24) 23m7s 20m59s -2m8s
Test bin (ubuntu) 2m19s 2m2s -17s
Test bin (windows) 3m51s 2m56s -55s
Test scripts (ubuntu, 22) 1m41s 1m13s -28s
Test scripts (ubuntu, 24) 1m36s 1m16s -20s
cnpmcore E2E 6m0s 5m58s -2s
examples E2E 2m35s 2m25s -10s

Almost every job is faster; the small Test (ubuntu 22) +28s regression is within run-to-run variance.

Test plan

  • typecheck
  • Test matrix (ubuntu/macos/windows × Node 22/24)
  • Test bin, Test scripts
  • E2E (cnpmcore + examples)
  • Cloudflare Pages

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • Chores
  • Migrated build and dependency management tooling from pnpm to utoo across the monorepo.
  • Updated CI workflows, workspace configurations, and npm scripts to support the new tooling.
    • Added build configuration for egg-bin TypeScript compilation.
  • Enhanced test infrastructure for environment isolation and compatibility.

Co-authored-by: Claude Opus 4.6 (1M context) noreply@anthropic.com

4天前1562次提交

English | 简体中文

NPM version NPM quality NPM download Node.js Version FOSSA Status

Continuous Integration Test coverage Known Vulnerabilities Open Collective backers and sponsors

Features

  • Built-in Process Management
  • Plugin System
  • Framework Customization
  • Lots of plugins

Quickstart

Follow the commands listed below.

$ mkdir showcase && cd showcase
$ pnpm create egg@beta
$ pnpm install
$ pnpm run dev
$ open http://localhost:7001

Node.js >= 20.19.0 required, supports require(esm) by default.

Monorepo Structure

This project is structured as a pnpm monorepo with the following packages:

  • packages/egg - Main Eggjs framework
  • examples/helloworld-commonjs - CommonJS example application
  • examples/helloworld-typescript - TypeScript example application
  • site - Documentation website

The monorepo uses pnpm catalog mode for centralized dependency management, ensuring consistent versions across all packages.

Development Commands

# Install dependencies for all packages
pnpm install

# Build all packages
pnpm run build

# Test all packages
pnpm run test

# Run specific package commands
pnpm --filter=egg run test
pnpm --filter=@examples/helloworld-typescript run dev
pnpm --filter=site run dev

Documentations

Contributors

contributors

How to Contribute

Please let us know how can we help. Do check out issues for bug reports or suggestions first.

To become a contributor, please follow our contributing guide, and review the repository guidelines for day-to-day development tips.

Sponsors and Backers

sponsors backers

License

MIT

FOSSA Status

邀请码
    Gitlink(确实开源)
  • 加入我们
  • 官网邮箱:gitlink@ccf.org.cn
  • QQ群
  • QQ群
  • 公众号
  • 公众号

版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9 京公网安备 11010802032778号