Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 34 additions & 34 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,30 @@

Eggjs is a progressive Node.js framework for building enterprise-class server-side applications. Built on top of Koa.js, it provides a plugin system, conventions over configuration, and enterprise-grade features like clustering, logging, and security.

This is a **pnpm monorepo** with multiple packages using pnpm workspaces and catalog mode for centralized dependency management.
This is a **utoo monorepo** with multiple packages using utoo workspaces and catalog mode for centralized dependency management.

## Prerequisites and Environment Setup

- **Node.js >= 20.19.0 required** - This is a hard requirement
- Enable pnpm first: `corepack enable pnpm` (installs pnpm v10.16.0)
- **Node.js >= 22.18.0 required** - This is a hard requirement
- Enable utoo first: `corepack enable utoo` (installs utoo v1.0.28)
Comment thread
coderabbitai[bot] marked this conversation as resolved.
- **NEVER CANCEL** any build or test commands - they can take several minutes to complete

## Bootstrap and Build Process

**Always run these commands in sequence after fresh clone:**

```bash
# 1. Enable pnpm (required first)
corepack enable pnpm
# 1. Enable utoo (required first)
corepack enable utoo

# 2. Install all dependencies - takes ~63 seconds. NEVER CANCEL. Set timeout to 120+ seconds.
pnpm install
ut install

# 3. Build all packages - takes ~14 seconds. NEVER CANCEL. Set timeout to 60+ seconds.
pnpm run build
ut run build

# 4. Run linting (optional but recommended) - takes ~2 seconds
pnpm run lint
ut run lint
```

## Monorepo Structure
Expand All @@ -48,51 +48,51 @@ pnpm run lint
### Supporting Directories

- **`examples/`** - Two example apps: `helloworld-commonjs` and `helloworld-typescript` (currently have runtime issues)
- **`site/`** - Documentation website built with Dumi
- **`site/`** - Documentation website built with VitePress

## Essential Commands and Timing

### Build Commands

- `pnpm run build` - **Build all packages (~14 seconds). NEVER CANCEL. Set timeout to 60+ seconds.**
- `pnpm run clean` - Clean all dist directories
- `ut run build` - **Build all packages (~14 seconds). NEVER CANCEL. Set timeout to 60+ seconds.**
- `ut run clean-dist` - Clean all dist directories

### Testing Commands

- `pnpm run test` - **Run all tests (~2 minutes). NEVER CANCEL. Set timeout to 180+ seconds.**
- `pnpm run test:cov` - **Run tests with coverage (~2 minutes). NEVER CANCEL. Set timeout to 180+ seconds.**
- `pnpm run ci` - **Run test coverage + build (~2.1 minutes). NEVER CANCEL. Set timeout to 180+ seconds.**
- `ut run test` - **Run all tests (~2 minutes). NEVER CANCEL. Set timeout to 180+ seconds.**
- `ut run test:cov` - **Run tests with coverage (~2 minutes). NEVER CANCEL. Set timeout to 180+ seconds.**
- `ut run ci` - **Run tests with coverage (~2 minutes). NEVER CANCEL. Set timeout to 180+ seconds.**

### Linting Commands

- `pnpm run lint` - Run oxlint across all packages (~2 seconds)
- `ut run lint` - Run oxlint across all packages (~2 seconds)

### Documentation Commands

- `pnpm run site:dev` - Start documentation dev server at http://localhost:8000
- `cd site && pnpm run build:skip` - **Build documentation site (~24 seconds). NEVER CANCEL. Set timeout to 60+ seconds.**
- `ut run site:dev` - Start documentation dev server (defaults to VitePress port 5173)
Comment on lines 70 to +72
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in e38249c — site/ description now correctly says VitePress (matches site/package.json).

- `ut run site:build` - **Build documentation site (~24 seconds). NEVER CANCEL. Set timeout to 60+ seconds.**

### Example Applications (Currently Not Working)

- `pnpm run example:commonjs` - Start CommonJS example (has runtime issues)
- `pnpm run example:typescript` - Start TypeScript example (has runtime issues)
- `ut run example:dev:commonjs` - Start CommonJS example (has runtime issues)
- `ut run example:dev:typescript` - Start TypeScript example (has runtime issues)

## Package-Specific Commands

Run commands for specific packages using `pnpm --filter=<package>`:
Run commands for specific packages using `ut --filter=<package>`:

```bash
# Examples
pnpm --filter=egg run test
pnpm --filter=@eggjs/core run build
pnpm --filter=site run dev
ut --filter=egg run test
ut --filter=@eggjs/core run build
ut --filter=site run dev
```

## Development Workflow

### 1. Making Changes

- Always build packages first: `pnpm run build`
- Always build packages first: `ut run build`
- Work primarily in `packages/egg/src/` for core framework features
- Use TypeScript throughout - all packages are TypeScript-based
- Follow the existing directory conventions in `packages/egg/src/`:
Expand All @@ -108,16 +108,16 @@ pnpm --filter=site run dev

```bash
# 1. Build all packages (required)
pnpm run build
ut run build

# 2. Run linting
pnpm run lint
ut run lint

# 3. Run tests (some failures are expected in fresh environment)
pnpm run test
ut run test

# 4. Test documentation site
pnpm run site:dev
ut run site:dev
```

### 3. Testing Strategy
Expand Down Expand Up @@ -162,7 +162,7 @@ pnpm run site:dev
- **All sub-project tsconfig.json files MUST extend from root:** `"extends": "../../tsconfig.json"`
- Root tsconfig.json includes all packages in `references` array

## pnpm Workspace & Catalog Dependencies
## utoo Workspace & Catalog Dependencies

- Dependencies defined in `pnpm-workspace.yaml` catalog section
- Reference catalog entries: `"package-name": "catalog:"`
Expand All @@ -179,7 +179,7 @@ pnpm run site:dev

### Build Issues

- Always run `pnpm run build` after making changes
- Always run `ut run build` after making changes
- TypeScript compilation errors will show clearly
- Build warnings are generally acceptable

Expand Down Expand Up @@ -217,10 +217,10 @@ pnpm run site:dev

After making changes, always verify:

1. **Build Success**: `pnpm run build` completes without errors
2. **Linting Passes**: `pnpm run lint` shows no new errors
3. **Documentation Loads**: `pnpm run site:dev` starts successfully and site loads at http://localhost:8000
4. **Tests Run**: `pnpm run test` executes (some failures expected, focus on your changes)
1. **Build Success**: `ut run build` completes without errors
2. **Linting Passes**: `ut run lint` shows no new errors
3. **Documentation Loads**: `ut run site:dev` starts successfully and the printed VitePress URL responds
4. **Tests Run**: `ut run test` executes (some failures expected, focus on your changes)

**Remember**: This is a complex enterprise framework. Always build first, validate incrementally, and focus on the core packages (`egg`, `core`, `utils`) for most development work.

Expand Down
Loading
Loading