Skip to content

Commit 9a37844

Browse files
fengmk2claude
andauthored
feat: merge core/utils repository into monorepo (#5440)
- Add packages/core directory with complete @eggjs/core codebase - Merge @eggjs/core v6.5.0 from master branch - Update core package.json for monorepo integration: * Change repository URLs to monorepo structure * Convert npm scripts to pnpm commands * Update Node.js engine requirement to >= 20.19.0 * Convert all dependencies to use pnpm catalog references - Add core-specific dependencies to pnpm workspace catalog: * @eggjs/router, get-ready, globby, tsconfig-paths * husky, lint-staged, node-homedir, ready-callback * await-event, gals, js-yaml, ts-node, tshy/tshy-after - Update CLAUDE.md with packages/core documentation - Maintain full compatibility with existing @eggjs/core functionality This brings the core plugin framework directly into the monorepo for better integration and unified development workflow. 🤖 Generated with [Claude Code](https://claude.ai/code) --------- Co-authored-by: Claude <[email protected]>
1 parent 0220801 commit 9a37844

File tree

1,468 files changed

+20335
-14115
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,468 files changed

+20335
-14115
lines changed

.github/workflows/ci.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ master, next ]
6+
pull_request:
7+
branches: [ master, next ]
8+
merge_group:
9+
10+
jobs:
11+
egg:
12+
name: egg
13+
uses: node-modules/github-actions/.github/workflows/node-test.yml@master
14+
with:
15+
os: 'ubuntu-latest, macos-latest, windows-latest'
16+
version: '20, 22, 24'
17+
test: 'pnpm run ci:app'
18+
install: 'corepack enable pnpm && pnpm install'
19+
secrets:
20+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
21+
egg-cluster1:
22+
name: egg-cluster1
23+
uses: node-modules/github-actions/.github/workflows/node-test.yml@master
24+
with:
25+
os: 'ubuntu-latest, windows-latest'
26+
version: '20'
27+
test: 'pnpm run ci:cluster1'
28+
install: 'corepack enable pnpm && pnpm install'
29+
secrets:
30+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
31+
egg-cluster2:
32+
name: egg-cluster2
33+
uses: node-modules/github-actions/.github/workflows/node-test.yml@master
34+
with:
35+
os: 'ubuntu-latest, windows-latest'
36+
version: '22'
37+
test: 'pnpm run ci:cluster2'
38+
install: 'corepack enable pnpm && pnpm install'
39+
secrets:
40+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
41+
egg-lib-core:
42+
name: egg-lib-core
43+
uses: node-modules/github-actions/.github/workflows/node-test.yml@master
44+
with:
45+
os: 'ubuntu-latest, windows-latest'
46+
version: '20, 22'
47+
test: 'pnpm run ci:lib/core'
48+
install: 'corepack enable pnpm && pnpm install'
49+
secrets:
50+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
51+
egg-lib-plugins:
52+
name: egg-lib-plugins
53+
uses: node-modules/github-actions/.github/workflows/node-test.yml@master
54+
with:
55+
os: 'ubuntu-latest, windows-latest'
56+
version: '20, 22'
57+
test: 'pnpm run ci:lib/plugins'
58+
install: 'corepack enable pnpm && pnpm install'
59+
secrets:
60+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
61+
core:
62+
name: "@eggjs/core"
63+
uses: node-modules/github-actions/.github/workflows/node-test.yml@master
64+
with:
65+
os: 'ubuntu-latest, macos-latest, windows-latest'
66+
version: '20, 22, 24'
67+
test: 'pnpm run ci:core'
68+
install: 'corepack enable pnpm && pnpm install'
69+
secrets:
70+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
71+
utils:
72+
name: "@eggjs/utils"
73+
uses: node-modules/github-actions/.github/workflows/node-test.yml@master
74+
with:
75+
os: 'ubuntu-latest, macos-latest, windows-latest'
76+
version: '20, 22, 24'
77+
test: 'pnpm run ci:utils'
78+
install: 'corepack enable pnpm && pnpm install'
79+
secrets:
80+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/nodejs-cluster1.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.

.github/workflows/nodejs-cluster2.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.

.github/workflows/nodejs-lib-core.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.

.github/workflows/nodejs-lib-plugins.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.

.github/workflows/nodejs.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.

CLAUDE.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ This is the **Eggjs** framework - a progressive Node.js framework for building e
1414
- **`packages/egg/`** - Main Eggjs framework package
1515
- `src/` - TypeScript source code
1616
- `test/` - Comprehensive test suite with fixtures
17+
- **`packages/core/`** - Core plugin framework (merged from @eggjs/core)
18+
- `src/` - Core TypeScript source code
19+
- `test/` - Core framework test suite with vitest
20+
- **`packages/utils/`** - Utility functions (merged from @eggjs/utils)
21+
- `src/` - Utils TypeScript source code
22+
- `test/` - Utils test suite
1723
- **`examples/`** - Example applications
1824
- `helloworld-commonjs/` - CommonJS example
1925
- `helloworld-typescript/` - TypeScript example
@@ -146,11 +152,12 @@ The framework extends Koa's context with Egg-specific features:
146152
- Follow existing test patterns for consistency
147153

148154
### TypeScript Support
149-
- Main framework in `packages/egg/` is written in TypeScript with strict mode
155+
- Both `packages/egg/` and `packages/core/` written in TypeScript with strict mode
150156
- Uses tsdown for unbundled ESM builds (faster development, preserves file structure)
151-
- Configured with `tsdown.config.ts` for optimal build settings
157+
- Each package configured with `tsdown.config.ts` for optimal build settings
152158
- Type definitions are exported for framework users
153159
- Examples support both .js and .ts application files
160+
- Cross-package TypeScript references configured for proper module resolution
154161

155162
### Documentation
156163
- Main docs are in the `site/` directory using Dumi

package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,20 @@
1212
"oxlint": "catalog:",
1313
"oxlint-tsgolint": "catalog:",
1414
"prettier": "catalog:",
15-
"tsdown": "catalog:"
15+
"vitest": "catalog:",
16+
"@vitest/ui": "catalog:",
17+
"@vitest/coverage-v8": "catalog:"
1618
},
1719
"scripts": {
1820
"clean": "pnpm -r run clean",
1921
"build": "pnpm -r run build",
2022
"lint": "oxlint --type-aware",
21-
"pretest": "pnpm lint",
22-
"test": "pnpm -r run test",
23+
"test": "vitest run",
2324
"test:changed": "pnpm -r run test:changed",
25+
"cov": "vitest run --coverage",
2426
"ci": "pnpm -r run ci",
27+
"ci:core": "pnpm --filter=core run ci",
28+
"ci:utils": "pnpm run cov packages/utils",
2529
"ci:app": "pnpm --filter=egg run ci:app",
2630
"ci:cluster1": "pnpm --filter=egg run ci:cluster1",
2731
"ci:cluster2": "pnpm --filter=egg run ci:cluster2",

packages/core/.gitignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/node_modules
2+
coverage
3+
.logs
4+
npm-debug.log
5+
.vscode
6+
.DS_Store
7+
yarn.lock
8+
test/fixtures/egg/node_modules/egg-core
9+
.idea
10+
.nyc_output
11+
package-lock.json
12+
run
13+
test/fixtures/*/timing.json
14+
lib/
15+
.tshy*
16+
dist
17+
.package-lock.json

packages/core/.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
CHANGELOG.md
2+
__snapshots__
3+
benchmark

0 commit comments

Comments
 (0)