Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR switches the build process from using only tsdown to a hybrid approach that runs both tsdown and tsc for TypeScript compilation. The main purpose is to ensure proper TypeScript compilation and type generation by using the standard TypeScript compiler alongside tsdown.
- Updates all packages and plugins to use both
tsdownandtscin the build process - Standardizes TypeScript configuration with
rootDirandoutDirsettings - Consolidates exclude patterns across all tsconfig.json files
Reviewed Changes
Copilot reviewed 50 out of 50 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| plugins/*/package.json | Updated build scripts to run both tsdown and tsc with dist cleanup |
| packages/*/package.json | Updated build scripts to run both tsdown and tsc with dist cleanup |
| plugins/*/tsconfig.json | Added rootDir/outDir config and standardized exclude patterns |
| packages/*/tsconfig.json | Added rootDir/outDir config and standardized exclude patterns |
| packages/egg/tsdown.config.ts | Enabled unbundle option in tsdown configuration |
| plugins/schedule/src/types.ts | Moved runSchedule method from MockApplication to Application interface |
| /** | ||
| * Run a schedule, only for unit test | ||
| */ | ||
| runSchedule(schedulePath: string, ...args: any[]): Promise<any>; |
There was a problem hiding this comment.
The runSchedule method uses any[] for parameters and any for return type. Consider using more specific types or generics to provide better type safety and IntelliSense support.
| runSchedule(schedulePath: string, ...args: any[]): Promise<any>; | |
| runSchedule<T = unknown, Args extends unknown[] = unknown[]>(schedulePath: string, ...args: Args): Promise<T>; |
| "typecheck": "tsc --noEmit", | ||
| "test": "vitest run", | ||
| "build": "tsdown", | ||
| "build": "tsdown && rimraf dist && tsc -b --clean && tsc", |
There was a problem hiding this comment.
The build command is redundant - it runs tsc -b --clean followed immediately by tsc. The clean operation should be done before compilation, not between tsdown and tsc. Consider reordering to rimraf dist && tsdown && tsc or removing the redundant clean step.
| "build": "tsdown && rimraf dist && tsc -b --clean && tsc", | |
| "build": "rimraf dist && tsdown && tsc", |
Summary of ChangesHello @fengmk2, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request focuses on enhancing and standardizing the TypeScript build process across multiple packages. By integrating Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
Caution Review failedThe pull request is closed. Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughBuild pipelines were extended to run tsdown, remove Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Dev as Developer
participant App as egg Application
participant Schedule as Schedule Plugin
Dev->>App: call runSchedule(path, ...args)
App->>Schedule: load schedule module at path
Schedule-->>App: run job (async) → Promise resolves/rejects
App-->>Dev: return Promise<any>
note right of Schedule: types updated to expose runSchedule in Application
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request refactors the build process across numerous packages to use the TypeScript compiler (tsc) directly, which is a positive change for ensuring correct type declaration generation. The accompanying modifications to tsconfig.json files are well-aligned with this goal. I have two main points of feedback. Firstly, the new build script in the package.json files could be streamlined for better efficiency and correctness, and I've provided a suggestion for this. Secondly, a change in plugins/schedule/src/types.ts moves a test-only type definition into the global Application interface; I recommend reversing this to maintain a clear separation between production and test code.
| "description": "cluster manager for egg", | ||
| "scripts": { | ||
| "build": "tsdown", | ||
| "build": "tsdown && rimraf dist && tsc -b --clean && tsc", |
There was a problem hiding this comment.
The build script can be made more efficient and robust.
- The
rimraf distcommand is redundant, astsc -b --cleanwill also clean the output directory specified intsconfig.json. - Using
tsc -bis the correct way to build with TypeScript project references, which are used in this repository. The simpletsccommand might not behave as expected in a complex monorepo with project references.
I suggest simplifying and correcting the script. This comment applies to all other package.json files with the same change.
| "build": "tsdown && rimraf dist && tsc -b --clean && tsc", | |
| "build": "tsdown && tsc -b --clean && tsc -b", |
| interface Application { | ||
| /** | ||
| * Run a schedule, only for unit test | ||
| */ | ||
| runSchedule(schedulePath: string, ...args: any[]): Promise<any>; | ||
| } |
There was a problem hiding this comment.
This change adds the test-specific runSchedule method to the main Application interface. This pollutes the production Application type with a method that is only available in test environments, which can be misleading.
The previous approach of augmenting @eggjs/mock's MockApplication interface was better as it kept test-specific typings isolated. Please restore the previous approach. It should be placed outside the declare module 'egg' block:
declare module '@eggjs/mock' {
interface MockApplication {
/**
* Run a schedule, only for unit test
*/
runSchedule(schedulePath: string, ...args: any[]): Promise<any>;
}
}If this change was necessary for the tsc build to pass, there might be an issue with how module augmentations are resolved which should be investigated separately, for example by adjusting tsconfig.json.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## next #5582 +/- ##
==========================================
- Coverage 81.09% 81.06% -0.04%
==========================================
Files 209 209
Lines 5989 5989
Branches 873 876 +3
==========================================
- Hits 4857 4855 -2
- Misses 1058 1060 +2
Partials 74 74 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 11
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (13)
plugins/session/package.json (1)
68-74: Fix build pipeline ordering and add missing clean script.
rimraf distexecutes aftertsdown, so the freshly emitted JS bundle is wiped and the published package ships with an emptydistfolder. Additionally, plugins must expose a dedicatedcleanscript (rimraf dist). Reorder the build steps so cleanup runs before compilation, and surface the requiredcleanscript."scripts": { - "build": "tsdown && rimraf dist && tsc -b --clean && tsc", + "clean": "rimraf dist", + "build": "npm run clean && tsc -b --clean && tsdown && tsc", "typecheck": "tsc --noEmit", "lint": "oxlint --type-aware", "lint:fix": "npm run lint -- --fix", "test": "npm run lint:fix && vitest", "prepublishOnly": "npm run build" },As per coding guidelines
plugins/mock/package.json (1)
131-135: Restore required plugin script contract.Repo guidelines for
plugins/**/package.json(see CLAUDE.md learning) require:
"build": "tsdown""clean": "rimraf dist""lint": "oxlint --type-aware""lint:fix": "oxlint --type-aware --fix""test": "pnpm run lint:fix && vitest run""typecheck": "tsc --noEmit""prepublishOnly": "pnpm run build"The new build chain breaks this contract and the
clean/lint:fixscripts are still missing, whilelintlacks the--type-awareflag andtestshould cascade throughlint:fix. Please revertbuildback to plaintsdown, add the mandated scripts, and move any extra steps you need into another helper (e.g.,tsc-build) thatprepublishOnlycan call. Example fix:"scripts": { - "build": "tsdown && rimraf dist && tsc -b --clean && tsc", - "lint": "oxlint", - "typecheck": "tsc --noEmit", - "test": "vitest run", + "build": "tsdown", + "clean": "rimraf dist", + "lint": "oxlint --type-aware", + "lint:fix": "oxlint --type-aware --fix", + "typecheck": "tsc --noEmit", + "test": "pnpm run lint:fix && vitest run", + "tsc-build": "rimraf dist && tsc -b --clean && tsc", "prepublishOnly": "pnpm run build" }Then, if you want
prepublishOnlyto execute the new tsc build, update it topnpm run lint && pnpm run typecheck && pnpm run tsc-build(or similar) while still keeping the requiredbuildscript intact.Based on learnings.
plugins/i18n/package.json (1)
75-82: Restore required plugin scriptsPer the plugin standards we follow, every plugin package.json must expose a
cleanscript and thetestscript should chainlint:fix && vitest. This block currently omitscleanand runs tests directly, so it falls out of compliance. Please bring it back in line:"scripts": { - "build": "tsdown && rimraf dist && tsc -b --clean && tsc", + "build": "tsdown && rimraf dist && tsc -b --clean && tsc", + "clean": "rimraf dist", "typecheck": "tsc --noEmit", "lint": "oxlint --type-aware", "lint:fix": "npm run lint -- --fix", - "test": "vitest run", + "test": "npm run lint:fix && vitest run", "prepublishOnly": "npm run build" },As per coding guidelines.
plugins/schedule/package.json (1)
70-77: Add the requiredcleanscript.Per the plugin package guidelines, each plugin must expose a
cleanscript (typicallyrimraf dist). This file still lacks that script, so the schedule plugin no longer meets the shared tooling contract.As per coding guidelines
plugins/development/package.json (1)
68-74: Add the required clean/lint scripts and fix the test chainPer our plugin packaging rules we still need explicit
cleanandlint:fixentries, andtestmust invokelint:fix && vitest. Without them this package stays out of compliance. Please add the missing scripts and updatetestaccordingly.As per coding guidelines
"scripts": { "lint": "oxlint --type-aware", "typecheck": "tsc --noEmit", - "test": "vitest run", + "lint:fix": "oxlint --type-aware --fix", + "clean": "rimraf dist", + "test": "pnpm run lint:fix && vitest run", "build": "tsdown && rimraf dist && tsc -b --clean && tsc", "prepublishOnly": "pnpm run build" },plugins/logrotator/package.json (1)
94-99: Missing required scripts per coding guidelines.According to the coding guidelines, all plugins must include separate "clean" and "lint:fix" scripts. Currently, the clean operation is embedded in the build script, and lint:fix is missing entirely.
Based on learnings.
Apply this diff to add the missing scripts:
"scripts": { "build": "tsdown && rimraf dist && tsc -b --clean && tsc", + "clean": "rimraf dist", "typecheck": "tsc --noEmit", "lint": "oxlint --type-aware", + "lint:fix": "npm run lint -- --fix", - "test": "vitest run", + "test": "npm run lint:fix && vitest run", "prepublishOnly": "npm run build" },plugins/static/package.json (1)
59-66: Missing required "clean" script per coding guidelines.According to the coding guidelines, all plugins must include a separate "clean" script. Currently, the clean operation is only embedded in the build script.
Based on learnings.
Apply this diff to add the missing script:
"scripts": { "build": "tsdown && rimraf dist && tsc -b --clean && tsc", + "clean": "rimraf dist", "typecheck": "tsc --noEmit", "lint": "oxlint --type-aware", "lint:fix": "npm run lint -- --fix", "test": "npm run lint:fix && vitest run", "ci": "vitest run --coverage", "prepublishOnly": "npm run build" },plugins/onerror/package.json (1)
56-61: Missing required scripts per coding guidelines.According to the coding guidelines, all plugins must include separate "clean" and "lint:fix" scripts.
Based on learnings.
Apply this diff to add the missing scripts:
"scripts": { "lint": "oxlint --type-aware", + "lint:fix": "npm run lint -- --fix", "typecheck": "tsc --noEmit", - "test": "vitest run", + "test": "npm run lint:fix && vitest run", "build": "tsdown && rimraf dist && tsc -b --clean && tsc", + "clean": "rimraf dist", "prepublishOnly": "pnpm run build" },plugins/tracer/package.json (1)
58-63: Plugin scripts still miss required entries.Guidelines for plugins mandate
clean,lint:fix, andtestchaininglint:fix && vitest. They’re absent, so the plugin stays out of compliance. Please add:
"clean": "rimraf dist""lint:fix": "oxlint --type-aware --fix""test": "pnpm run lint:fix && vitest run"
After that, keepprepublishOnlypointing at the build.As per coding guidelines
plugins/multipart/package.json (1)
85-90: Fix build ordering and add the required clean scriptRunning
rimraf distaftertsdowndeletes everythingtsdownjust emitted, so thetsdownstep becomes a no-op and we end up shipping only the subsequenttscoutput. If we are switching to a puretscpipeline, drop the redundant step; otherwise move the clean before any emits. In addition, plugin packages must expose a dedicatedcleanscript (rimraf dist) per our publishing convention. Please align the scripts block like this:"scripts": { - "build": "tsdown && rimraf dist && tsc -b --clean && tsc", + "clean": "rimraf dist", + "build": "npm run clean && tsc -b --clean && tsc", "typecheck": "tsc --noEmit", "lint": "oxlint --type-aware",Based on learnings
plugins/jsonp/package.json (1)
73-78: Add the required clean script and fix build sequence
rimraf distcurrently runs aftertsdown, so thetsdownoutput is discarded. Clean before emitting (or removetsdownif unused). Also, per our plugin template we need a dedicatedcleanentry. Example:"scripts": { - "build": "tsdown && rimraf dist && tsc -b --clean && tsc", + "clean": "rimraf dist", + "build": "npm run clean && tsc -b --clean && tsc", "typecheck": "tsc --noEmit", "lint": "oxlint --type-aware", "lint:fix": "npm run lint -- --fix", "test": "npm run lint:fix && vitest run",Based on learnings
packages/supertest/package.json (1)
57-63: Reorder build and add the mandatory lint:fix scriptCleaning after
tsdownnukes its artifacts, so please clean first (or droptsdown). Additionally, every package must expose alint:fixcompanion to lint. Suggested update:"scripts": { - "build": "tsdown && rimraf dist && tsc -b --clean && tsc", - "test": "vitest run", - "typecheck": "tsc --noEmit", - "lint": "oxlint --type-aware", + "build": "rimraf dist && tsc -b --clean && tsc", + "test": "vitest run", + "typecheck": "tsc --noEmit", + "lint": "oxlint --type-aware", + "lint:fix": "pnpm run lint -- --fix", "prepublishOnly": "pnpm run build" }Based on learnings
packages/extend2/package.json (1)
16-22: Align scripts with the standard build/lint flow
rimraf distmust run before any emitters; otherwisetsdown’s output is thrown away. Also, per our package guideline we needlintto runoxlint --type-awareand expose alint:fix. Proposed changes:"scripts": { - "build": "tsdown && rimraf dist && tsc -b --clean && tsc", - "typecheck": "tsc --noEmit", - "lint": "oxlint", - "test": "vitest run", - "prepublishOnly": "pnpm run build" + "build": "rimraf dist && tsc -b --clean && tsc", + "typecheck": "tsc --noEmit", + "lint": "oxlint --type-aware", + "lint:fix": "pnpm run lint -- --fix", + "test": "vitest run", + "prepublishOnly": "pnpm run build" },Based on learnings
♻️ Duplicate comments (2)
plugins/schedule/src/types.ts (1)
16-16: Replaceanytypes with generics for better type safety.The
runSchedulemethod signature usesany[]for parameters andanyfor return type, which reduces type safety and IntelliSense quality. As per coding guidelines, avoid theanytype and use explicit return types for public APIs.Consider applying Copilot's suggested improvement:
- runSchedule(schedulePath: string, ...args: any[]): Promise<any>; + runSchedule<T = unknown, Args extends unknown[] = unknown[]>(schedulePath: string, ...args: Args): Promise<T>;plugins/watcher/package.json (1)
32-32: Fix build command order; current sequence wipes tsdown output.Running
tsdownfirst and only thenrimraf distdeletes the artifacts that tsdown just produced, so the package ends up shipping whatever plaintscemits, defeating the whole point of using tsdown in this plugin. Clean the directory before compiling so both toolchains contribute to the final dist.- "build": "tsdown && rimraf dist && tsc -b --clean && tsc", + "build": "rimraf dist && tsdown && tsc",
🧹 Nitpick comments (1)
packages/koa-static-cache/package.json (1)
50-50: Inefficient build order.The build script runs tsdown first (which outputs to dist/), then immediately deletes dist/ with rimraf, then rebuilds with tsc. This wastes the tsdown output. Consider reordering:
"rimraf dist && tsdown && tsc -b --clean && tsc"
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (50)
packages/cluster/package.json(1 hunks)packages/cluster/tsconfig.json(1 hunks)packages/cookies/package.json(1 hunks)packages/cookies/tsconfig.json(1 hunks)packages/core/package.json(1 hunks)packages/core/tsconfig.json(1 hunks)packages/egg/package.json(1 hunks)packages/egg/tsconfig.json(1 hunks)packages/egg/tsdown.config.ts(1 hunks)packages/extend2/package.json(1 hunks)packages/extend2/tsconfig.json(1 hunks)packages/koa-static-cache/package.json(1 hunks)packages/koa-static-cache/tsconfig.json(1 hunks)packages/koa/package.json(1 hunks)packages/koa/tsconfig.json(1 hunks)packages/router/package.json(1 hunks)packages/router/tsconfig.json(1 hunks)packages/supertest/package.json(1 hunks)packages/supertest/tsconfig.json(1 hunks)packages/utils/package.json(1 hunks)packages/utils/tsconfig.json(1 hunks)plugins/development/package.json(1 hunks)plugins/development/tsconfig.json(1 hunks)plugins/i18n/package.json(1 hunks)plugins/i18n/tsconfig.json(1 hunks)plugins/jsonp/package.json(1 hunks)plugins/jsonp/tsconfig.json(1 hunks)plugins/logrotator/package.json(1 hunks)plugins/logrotator/tsconfig.json(1 hunks)plugins/mock/package.json(1 hunks)plugins/mock/tsconfig.json(1 hunks)plugins/multipart/package.json(1 hunks)plugins/multipart/tsconfig.json(1 hunks)plugins/onerror/package.json(1 hunks)plugins/onerror/tsconfig.json(1 hunks)plugins/schedule/package.json(1 hunks)plugins/schedule/src/types.ts(1 hunks)plugins/schedule/tsconfig.json(1 hunks)plugins/security/package.json(1 hunks)plugins/security/tsconfig.json(1 hunks)plugins/session/package.json(1 hunks)plugins/session/tsconfig.json(1 hunks)plugins/static/package.json(1 hunks)plugins/static/tsconfig.json(1 hunks)plugins/tracer/package.json(1 hunks)plugins/tracer/tsconfig.json(1 hunks)plugins/view/package.json(1 hunks)plugins/view/tsconfig.json(1 hunks)plugins/watcher/package.json(1 hunks)plugins/watcher/tsconfig.json(1 hunks)
🧰 Additional context used
📓 Path-based instructions (13)
{packages,plugins,tools}/**/tsconfig.json
📄 CodeRabbit inference engine (CLAUDE.md)
All sub-project tsconfig.json files must extend the root config using "extends": "../../tsconfig.json" and include "compilerOptions.baseUrl": "./"
Files:
plugins/multipart/tsconfig.jsonplugins/development/tsconfig.jsonplugins/onerror/tsconfig.jsonpackages/egg/tsconfig.jsonpackages/extend2/tsconfig.jsonplugins/mock/tsconfig.jsonpackages/supertest/tsconfig.jsonplugins/session/tsconfig.jsonpackages/router/tsconfig.jsonplugins/i18n/tsconfig.jsonplugins/schedule/tsconfig.jsonplugins/jsonp/tsconfig.jsonpackages/core/tsconfig.jsonplugins/watcher/tsconfig.jsonpackages/koa-static-cache/tsconfig.jsonpackages/utils/tsconfig.jsonpackages/koa/tsconfig.jsonpackages/cluster/tsconfig.jsonpackages/cookies/tsconfig.jsonplugins/view/tsconfig.jsonplugins/static/tsconfig.jsonplugins/security/tsconfig.jsonplugins/logrotator/tsconfig.jsonplugins/tracer/tsconfig.json
packages/*/tsconfig.json
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
All sub-project tsconfig.json files must extend from the root via "extends": "../../tsconfig.json"
Files:
packages/egg/tsconfig.jsonpackages/extend2/tsconfig.jsonpackages/supertest/tsconfig.jsonpackages/router/tsconfig.jsonpackages/core/tsconfig.jsonpackages/koa-static-cache/tsconfig.jsonpackages/utils/tsconfig.jsonpackages/koa/tsconfig.jsonpackages/cluster/tsconfig.jsonpackages/cookies/tsconfig.json
{tsconfig.json,packages/*/tsconfig.json}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Enable strict TypeScript mode across all packages
Files:
packages/egg/tsconfig.jsonpackages/extend2/tsconfig.jsonpackages/supertest/tsconfig.jsonpackages/router/tsconfig.jsonpackages/core/tsconfig.jsonpackages/koa-static-cache/tsconfig.jsonpackages/utils/tsconfig.jsonpackages/koa/tsconfig.jsonpackages/cluster/tsconfig.jsonpackages/cookies/tsconfig.json
{package.json,packages/**/package.json,plugins/**/package.json,tools/**/package.json}
📄 CodeRabbit inference engine (CLAUDE.md)
All packages must require Node.js >= 22.18.0 (set engines.node to ">=22.18.0")
Files:
plugins/security/package.jsonplugins/development/package.jsonplugins/tracer/package.jsonpackages/cluster/package.jsonplugins/logrotator/package.jsonplugins/i18n/package.jsonpackages/extend2/package.jsonplugins/view/package.jsonplugins/multipart/package.jsonpackages/cookies/package.jsonpackages/core/package.jsonplugins/jsonp/package.jsonplugins/schedule/package.jsonpackages/router/package.jsonpackages/egg/package.jsonpackages/supertest/package.jsonplugins/session/package.jsonplugins/static/package.jsonplugins/mock/package.jsonplugins/watcher/package.jsonplugins/onerror/package.jsonpackages/utils/package.jsonpackages/koa/package.jsonpackages/koa-static-cache/package.json
plugins/**/package.json
📄 CodeRabbit inference engine (CLAUDE.md)
plugins/**/package.json: All plugins must include egg as a peerDependency with version "workspace:"
Plugin package.json exports must map TypeScript sources for dev and mirror them under publishConfig.exports to dist/.js for publish
All plugins must include scripts: build (tsdown), clean (rimraf dist), typecheck (tsc --noEmit), lint (oxlint --type-aware), lint:fix, test (lint:fix && vitest), prepublishOnly (build)
Files:
plugins/security/package.jsonplugins/development/package.jsonplugins/tracer/package.jsonplugins/logrotator/package.jsonplugins/i18n/package.jsonplugins/view/package.jsonplugins/multipart/package.jsonplugins/jsonp/package.jsonplugins/schedule/package.jsonplugins/session/package.jsonplugins/static/package.jsonplugins/mock/package.jsonplugins/watcher/package.jsonplugins/onerror/package.json
{packages/**/package.json,plugins/**/package.json,tools/**/package.json}
📄 CodeRabbit inference engine (CLAUDE.md)
{packages/**/package.json,plugins/**/package.json,tools/**/package.json}: All packages must include a typecheck script running "tsc --noEmit"
All packages must use oxlint for linting with "lint": "oxlint --type-aware" and provide "lint:fix"
Files:
plugins/security/package.jsonplugins/development/package.jsonplugins/tracer/package.jsonpackages/cluster/package.jsonplugins/logrotator/package.jsonplugins/i18n/package.jsonpackages/extend2/package.jsonplugins/view/package.jsonplugins/multipart/package.jsonpackages/cookies/package.jsonpackages/core/package.jsonplugins/jsonp/package.jsonplugins/schedule/package.jsonpackages/router/package.jsonpackages/egg/package.jsonpackages/supertest/package.jsonplugins/session/package.jsonplugins/static/package.jsonplugins/mock/package.jsonplugins/watcher/package.jsonplugins/onerror/package.jsonpackages/utils/package.jsonpackages/koa/package.jsonpackages/koa-static-cache/package.json
{pnpm-workspace.yaml,packages/**/package.json,plugins/**/package.json,tools/**/package.json}
📄 CodeRabbit inference engine (CLAUDE.md)
Use pnpm catalog mode: external deps referenced as "catalog:" and kept in pnpm-workspace.yaml catalog
Files:
plugins/security/package.jsonplugins/development/package.jsonplugins/tracer/package.jsonpackages/cluster/package.jsonplugins/logrotator/package.jsonplugins/i18n/package.jsonpackages/extend2/package.jsonplugins/view/package.jsonplugins/multipart/package.jsonpackages/cookies/package.jsonpackages/core/package.jsonplugins/jsonp/package.jsonplugins/schedule/package.jsonpackages/router/package.jsonpackages/egg/package.jsonpackages/supertest/package.jsonplugins/session/package.jsonplugins/static/package.jsonplugins/mock/package.jsonplugins/watcher/package.jsonplugins/onerror/package.jsonpackages/utils/package.jsonpackages/koa/package.jsonpackages/koa-static-cache/package.json
packages/*/package.json
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use "workspace:*" for internal workspace dependencies in package.json
Files:
packages/cluster/package.jsonpackages/extend2/package.jsonpackages/cookies/package.jsonpackages/core/package.jsonpackages/router/package.jsonpackages/egg/package.jsonpackages/supertest/package.jsonpackages/utils/package.jsonpackages/koa/package.jsonpackages/koa-static-cache/package.json
**/*.ts
📄 CodeRabbit inference engine (AGENTS.md)
**/*.ts: Prefer TypeScript and ESM: write sources and exports in .ts (ESM-first) rather than CommonJS
Use two-space indentation, trailing commas, and semicolons (Prettier/oxlint defaults)
Name files in lowercase with hyphens (e.g., loader-context.ts)
Name classes in PascalCase
Name functions and variables in camelCase
Re-export types thoughtfully to keep the public API stable
Files:
plugins/schedule/src/types.tspackages/egg/tsdown.config.ts
plugins/**/src/types.ts
📄 CodeRabbit inference engine (CLAUDE.md)
All plugins must define src/types.ts that augments the 'egg' module and uses .ts extensions in relative type imports
Files:
plugins/schedule/src/types.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx}: Enable TypeScript strict mode in all TypeScript packages
Use explicit return types for public APIs
Prefer interfaces over type aliases for object shapes
Use readonly modifiers where appropriate
Avoid the any type; use unknown when the type is truly unknown
Files:
plugins/schedule/src/types.tspackages/egg/tsdown.config.ts
packages/*/tsdown.config.ts
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Each package must provide a tsdown.config.ts for unbundled ESM builds
Files:
packages/egg/tsdown.config.ts
{packages,plugins,tools}/**/tsdown.config.ts
📄 CodeRabbit inference engine (CLAUDE.md)
Each package should include tsdown.config.ts for unbundled ESM builds
Files:
packages/egg/tsdown.config.ts
🧠 Learnings (11)
📓 Common learnings
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-04T16:04:36.436Z
Learning: Applies to plugins/**/package.json : All plugins must include scripts: build (tsdown), clean (rimraf dist), typecheck (tsc --noEmit), lint (oxlint --type-aware), lint:fix, test (lint:fix && vitest), prepublishOnly (build)
📚 Learning: 2025-10-04T16:04:36.436Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-04T16:04:36.436Z
Learning: Applies to {packages,plugins,tools}/**/tsconfig.json : All sub-project tsconfig.json files must extend the root config using "extends": "../../tsconfig.json" and include "compilerOptions.baseUrl": "./"
Applied to files:
plugins/multipart/tsconfig.jsonplugins/development/tsconfig.jsonplugins/onerror/tsconfig.jsonpackages/egg/tsconfig.jsonpackages/extend2/tsconfig.jsonplugins/mock/tsconfig.jsonpackages/supertest/tsconfig.jsonplugins/session/tsconfig.jsonpackages/router/tsconfig.jsonplugins/i18n/tsconfig.jsonplugins/schedule/tsconfig.jsonplugins/jsonp/tsconfig.jsonpackages/core/tsconfig.jsonplugins/watcher/tsconfig.jsonpackages/koa-static-cache/tsconfig.jsonpackages/utils/tsconfig.jsonpackages/koa/tsconfig.jsonpackages/cluster/tsconfig.jsonpackages/cookies/tsconfig.jsonplugins/view/tsconfig.jsonplugins/static/tsconfig.jsonplugins/security/tsconfig.jsonplugins/logrotator/tsconfig.jsonplugins/tracer/tsconfig.json
📚 Learning: 2025-10-04T16:04:36.436Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-04T16:04:36.436Z
Learning: Applies to plugins/**/tsdown.config.ts : All plugins must use the standard tsdown configuration template (entry: 'src/**/*.ts', unused.level: 'error', dts: true, exports.devExports: true)
Applied to files:
plugins/multipart/tsconfig.jsonplugins/development/tsconfig.jsonplugins/onerror/tsconfig.jsonplugins/session/tsconfig.jsonplugins/i18n/tsconfig.jsonplugins/schedule/tsconfig.jsonpackages/egg/tsdown.config.ts
📚 Learning: 2025-09-14T08:41:30.618Z
Learnt from: CR
PR: eggjs/egg#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-14T08:41:30.618Z
Learning: Applies to packages/*/tsconfig.json : All sub-project tsconfig.json files must extend from the root via "extends": "../../tsconfig.json"
Applied to files:
plugins/multipart/tsconfig.jsonplugins/development/tsconfig.jsonplugins/onerror/tsconfig.jsonpackages/egg/tsconfig.jsonpackages/extend2/tsconfig.jsonplugins/mock/tsconfig.jsonpackages/supertest/tsconfig.jsonplugins/session/tsconfig.jsonpackages/router/tsconfig.jsonplugins/i18n/tsconfig.jsonplugins/schedule/tsconfig.jsonplugins/jsonp/tsconfig.jsonpackages/core/tsconfig.jsonplugins/watcher/tsconfig.jsonpackages/koa-static-cache/tsconfig.jsonpackages/utils/tsconfig.jsonpackages/koa/tsconfig.jsonpackages/cluster/tsconfig.jsonpackages/cookies/tsconfig.jsonplugins/view/tsconfig.jsonplugins/static/tsconfig.jsonplugins/security/tsconfig.jsonplugins/logrotator/tsconfig.jsonplugins/tracer/tsconfig.json
📚 Learning: 2025-10-04T16:04:36.436Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-04T16:04:36.436Z
Learning: Applies to {packages/!(cookies)/**/vitest.config.ts,tools/!(egg-bin)/**/vitest.config.ts,plugins/**/vitest.config.ts} : All packages (except cookies and egg-bin) must include a vitest.config.ts for tests
Applied to files:
packages/egg/tsconfig.jsonpackages/cookies/tsconfig.json
📚 Learning: 2025-10-04T16:04:36.436Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-04T16:04:36.436Z
Learning: Applies to {packages/egg/src/config/config.default.ts,packages/egg/src/config/plugin.ts} : Default framework configuration and built-in plugin list must be maintained in their respective config files
Applied to files:
packages/egg/tsconfig.json
📚 Learning: 2025-10-04T16:04:36.436Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-04T16:04:36.436Z
Learning: Applies to plugins/**/package.json : All plugins must include scripts: build (tsdown), clean (rimraf dist), typecheck (tsc --noEmit), lint (oxlint --type-aware), lint:fix, test (lint:fix && vitest), prepublishOnly (build)
Applied to files:
plugins/security/package.jsonplugins/development/package.jsonplugins/tracer/package.jsonpackages/cluster/package.jsonplugins/logrotator/package.jsonplugins/i18n/package.jsonpackages/extend2/package.jsonplugins/view/package.jsonplugins/multipart/package.jsonpackages/cookies/package.jsonpackages/core/package.jsonplugins/jsonp/package.jsonplugins/schedule/package.jsonpackages/router/package.jsonpackages/egg/package.jsonpackages/supertest/package.jsonplugins/session/package.jsonplugins/static/package.jsonplugins/mock/package.jsonplugins/watcher/package.jsonplugins/onerror/package.jsonpackages/utils/package.jsonpackages/koa/package.jsonpackages/koa-static-cache/package.json
📚 Learning: 2025-10-04T16:04:36.436Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-04T16:04:36.436Z
Learning: Applies to {packages/**/package.json,plugins/**/package.json,tools/**/package.json} : All packages must include a typecheck script running "tsc --noEmit"
Applied to files:
plugins/security/package.jsonplugins/tracer/package.jsonplugins/logrotator/package.jsonplugins/i18n/package.jsonpackages/extend2/package.jsonplugins/view/package.jsonplugins/multipart/package.jsonpackages/cookies/package.jsonpackages/core/package.jsonplugins/jsonp/package.jsonplugins/schedule/package.jsonpackages/egg/package.jsonpackages/supertest/package.jsonplugins/session/package.jsonplugins/static/package.jsonplugins/mock/package.jsonplugins/watcher/package.jsonplugins/onerror/package.jsonpackages/utils/package.jsonpackages/koa-static-cache/package.json
📚 Learning: 2025-10-04T16:04:36.436Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-04T16:04:36.436Z
Learning: Applies to {packages/!(cookies)/**/test/**/*.test.ts,tools/!(egg-bin)/**/test/**/*.test.ts,plugins/**/test/**/*.test.ts} : Vitest-based packages should write tests under test/**/*.test.ts and import test utilities from 'vitest'
Applied to files:
packages/supertest/tsconfig.json
📚 Learning: 2025-09-14T08:41:30.618Z
Learnt from: CR
PR: eggjs/egg#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-14T08:41:30.618Z
Learning: Applies to packages/*/tsdown.config.ts : Each package must provide a tsdown.config.ts for unbundled ESM builds
Applied to files:
packages/egg/tsdown.config.ts
📚 Learning: 2025-10-04T16:04:36.436Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-04T16:04:36.436Z
Learning: Applies to {packages,plugins,tools}/**/tsdown.config.ts : Each package should include tsdown.config.ts for unbundled ESM builds
Applied to files:
packages/egg/tsdown.config.tspackages/egg/package.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (15)
- GitHub Check: Test (ubuntu-latest, 24, plugins)
- GitHub Check: Test (ubuntu-latest, 22, packages)
- GitHub Check: Test (windows-latest, 24, packages)
- GitHub Check: Test (macos-latest, 22, plugins)
- GitHub Check: Test (windows-latest, 22, plugins)
- GitHub Check: Test (windows-latest, 24, plugins)
- GitHub Check: Test (windows-latest, 22, packages)
- GitHub Check: Test (macos-latest, 24, plugins)
- GitHub Check: Test (ubuntu-latest, 22, plugins)
- GitHub Check: Test (macos-latest, 22, packages)
- GitHub Check: Test (ubuntu-latest, 24, packages)
- GitHub Check: Test (macos-latest, 24, packages)
- GitHub Check: Test egg-bin (windows-latest, 22)
- GitHub Check: Test egg-bin (ubuntu-latest, 22)
- GitHub Check: typecheck
🔇 Additional comments (7)
packages/utils/tsconfig.json (1)
1-9: LGTM!The TypeScript configuration correctly:
- Extends the root config
- Sets explicit source (rootDir) and output (outDir) directories
- Excludes build artifacts and test files
This aligns with the project-wide standardization of build configuration.
As per coding guidelines.
plugins/multipart/tsconfig.json (1)
1-9: LGTM!The TypeScript configuration correctly:
- Extends the root config
- Sets explicit source (rootDir) and output (outDir) directories
- Excludes build artifacts and test files
This aligns with the project-wide standardization of build configuration.
As per coding guidelines.
plugins/i18n/tsconfig.json (1)
4-8: TS config alignment looks good.baseUrl/rootDir/outDir and the new exclude list match the shared tsconfig template. Nice.
plugins/tracer/tsconfig.json (1)
4-8: Consistent tsconfig update confirmed.rootDir/outDir/baseUrl and excludes match the repo standard.
plugins/development/tsconfig.json (1)
4-8: Looks aligned with the shared TS setup.rootDir/outDir/baseUrl and excludes all follow the standard template.
packages/cookies/tsconfig.json (1)
4-8: TS config matches the shared pattern.The root/out directories and excludes align with the project standard. Thanks.
packages/router/tsconfig.json (1)
4-8: Confirmed consistent tsconfig settings.rootDir/outDir/baseUrl and excludes are set per the shared template.
| "scripts": { | ||
| "build": "tsdown", | ||
| "build": "tsdown && rimraf dist && tsc -b --clean && tsc", | ||
| "lint": "oxlint", |
There was a problem hiding this comment.
Bring lint scripts in line with tooling spec.
lint should run oxlint --type-aware, and the package needs a lint:fix helper. Please add both to satisfy the repo linting policy.
As per coding guidelines
🤖 Prompt for AI Agents
In packages/cluster/package.json around lines 24-26, update the "lint" script to
run "oxlint --type-aware" and add a new "lint:fix" script that runs "oxlint
--type-aware --fix" so the package matches the repo linting policy; modify the
scripts object to replace the existing "lint" value accordingly and add the
"lint:fix" entry alongside it.
| "description": "A core plugin framework based on @eggjs/koa", | ||
| "scripts": { | ||
| "build": "tsdown", | ||
| "build": "tsdown && rimraf dist && tsc -b --clean && tsc", |
There was a problem hiding this comment.
Inefficient build order and missing rimraf dependency.
The build script runs tsdown first, then deletes its output with rimraf, then rebuilds with tsc. Consider reordering to avoid wasted work: "rimraf dist && tsdown && tsc -b --clean && tsc"
Additionally, rimraf is used but not listed in devDependencies.
Apply this diff to add rimraf dependency:
"devDependencies": {
"@eggjs/mock": "workspace:*",
"@eggjs/supertest": "workspace:*",
"@eggjs/tsconfig": "workspace:*",
"@types/js-yaml": "catalog:",
"await-event": "catalog:",
"coffee": "catalog:",
"husky": "catalog:",
"prettier": "catalog:",
"gals": "catalog:",
"js-yaml": "catalog:",
"mm": "catalog:",
+ "rimraf": "catalog:",
"tsdown": "catalog:",
"typescript": "catalog:",
"urllib": "catalog:"
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "build": "tsdown && rimraf dist && tsc -b --clean && tsc", | |
| "devDependencies": { | |
| "@eggjs/mock": "workspace:*", | |
| "@eggjs/supertest": "workspace:*", | |
| "@eggjs/tsconfig": "workspace:*", | |
| "@types/js-yaml": "catalog:", | |
| "await-event": "catalog:", | |
| "coffee": "catalog:", | |
| "husky": "catalog:", | |
| "prettier": "catalog:", | |
| "gals": "catalog:", | |
| "js-yaml": "catalog:", | |
| "mm": "catalog:", | |
| "rimraf": "catalog:", | |
| "tsdown": "catalog:", | |
| "typescript": "catalog:", | |
| "urllib": "catalog:" | |
| } |
🤖 Prompt for AI Agents
In packages/core/package.json around line 27, the build script currently runs
"tsdown" before deleting dist and rimraf is missing from devDependencies;
reorder the command to avoid wasted output by updating the script to run rimraf
before tsdown (e.g., "rimraf dist && tsdown && tsc -b --clean && tsc") and add
rimraf to devDependencies so the script has the required tool available.
| "scripts": { | ||
| "lint": "oxlint", | ||
| "typecheck": "tsc --noEmit", | ||
| "build": "tsdown", | ||
| "build": "tsdown && rimraf dist && tsc -b --clean && tsc", | ||
| "test": "vitest run", |
There was a problem hiding this comment.
Add type-aware linting and lint:fix as required.
Packages must expose lint: "oxlint --type-aware" and provide lint:fix. Please update the lint command and add the fix script so builds follow the shared tooling contract.
As per coding guidelines
🤖 Prompt for AI Agents
In packages/egg/package.json around lines 172 to 176 the lint script is not
type-aware and there is no lint:fix script; update the "lint" script to run
"oxlint --type-aware" and add a new "lint:fix" script that runs "oxlint --fix
--type-aware" (or the repo-standard fix flags) so the package conforms to the
shared tooling contract and supports automatic fixes.
| // FIXME: unbundle will missing types https://github.com/fengmk2/tsdown-vs-tsc/blob/main/README.md#tsdown-build-output-missing-types | ||
| // unbundle: true, | ||
| unbundle: true, |
There was a problem hiding this comment.
Critical: Enabling unbundle despite known type generation issue.
The FIXME comment explicitly warns that "unbundle will missing types" with a link to documentation of the problem. Enabling this option will break TypeScript support for consumers of this package, as they won't receive proper type definitions.
Either:
- Keep unbundle disabled until the upstream issue is resolved
- Or verify that the issue is now fixed and remove the FIXME comment
Apply this diff to disable unbundle until the issue is resolved:
// FIXME: unbundle will missing types https://github.com/fengmk2/tsdown-vs-tsc/blob/main/README.md#tsdown-build-output-missing-types
- unbundle: true,
+ // unbundle: true,📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // FIXME: unbundle will missing types https://github.com/fengmk2/tsdown-vs-tsc/blob/main/README.md#tsdown-build-output-missing-types | |
| // unbundle: true, | |
| unbundle: true, | |
| // FIXME: unbundle will missing types https://github.com/fengmk2/tsdown-vs-tsc/blob/main/README.md#tsdown-build-output-missing-types | |
| // unbundle: true, |
🤖 Prompt for AI Agents
In packages/egg/tsdown.config.ts around lines 6 to 7, the config enables
unbundle despite a FIXME noting that unbundle causes missing types; revert this
to disable unbundle until the upstream issue is resolved (or after you verify
the upstream fix remove the FIXME). Update the config to set unbundle: false and
keep or update the FIXME comment to reflect the current status (or delete the
FIXME if you confirmed the fix).
| "description": "Koa web app framework for https://eggjs.org", | ||
| "scripts": { | ||
| "build": "tsdown", | ||
| "build": "tsdown && rimraf dist && tsc -b --clean && tsc", |
There was a problem hiding this comment.
Ordering wipes tsdown output
Running tsdown first and then rimraf dist (followed by tsc -b --clean) deletes everything tsdown just produced, so the published build ends up containing only plain tsc output. That’s a regression compared to the previous script (tsdown only) where those artifacts shipped. Please clean before building, or drop tsdown entirely if it’s no longer needed, e.g.
-"build": "tsdown && rimraf dist && tsc -b --clean && tsc",
+"build": "rimraf dist && tsc -b --clean && tsdown && tsc",(or remove tsdown if redundant). Otherwise tsdown’s results never reach npm.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "build": "tsdown && rimraf dist && tsc -b --clean && tsc", | |
| "build": "rimraf dist && tsc -b --clean && tsdown && tsc", |
🤖 Prompt for AI Agents
In packages/koa/package.json around line 27, the build script runs tsdown before
rimraf dist which deletes tsdown output; either remove tsdown entirely if it's
redundant, or reorder to clean first and then generate tsdown artifacts and
compile. For example, move rimraf (and any tsc -b --clean) to the start so you
run rimraf dist && tsc -b --clean && tsdown && tsc, or simply drop tsdown from
the script if you don't want its artifacts published.
| "typecheck": "tsc --noEmit", | ||
| "test": "vitest run", | ||
| "build": "tsdown", | ||
| "build": "tsdown && rimraf dist && tsc -b --clean && tsc", |
There was a problem hiding this comment.
Build script wipes the tsdown output
Running tsdown first and then rimraf dist / tsc -b --clean deletes everything tsdown just produced. The final tsc rebuild gives you only the TypeScript output, so the tsdown bundle we ship today disappears. Move the clean steps ahead of tsdown and keep tsdown last so its artifacts survive the pipeline.
- "build": "tsdown && rimraf dist && tsc -b --clean && tsc",
+ "build": "rimraf dist && tsc -b --clean && tsc && tsdown",📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "build": "tsdown && rimraf dist && tsc -b --clean && tsc", | |
| "build": "rimraf dist && tsc -b --clean && tsc && tsdown", |
🤖 Prompt for AI Agents
In plugins/development/package.json around line 72, the build script runs tsdown
before cleaning (rimraf dist and tsc -b --clean) which deletes tsdown output;
reorder the commands so the clean steps run first and tsdown runs last — i.e.,
move rimraf dist and tsc -b --clean (and any intermediate tsc) ahead of tsdown
so tsdown artifacts are preserved in the final build.
| }, | ||
| "scripts": { | ||
| "build": "tsdown", | ||
| "build": "tsdown && rimraf dist && tsc -b --clean && tsc", |
There was a problem hiding this comment.
Inefficient build order and missing rimraf dependency.
The build script runs tsdown first (which outputs to dist/), then immediately deletes dist/ with rimraf, then rebuilds with tsc. This wastes the tsdown output. Consider either:
- Running rimraf before tsdown:
"rimraf dist && tsdown && tsc -b --clean && tsc" - Or removing the redundant rimraf step if tsc handles cleanup
Additionally, rimraf is used but not listed in devDependencies. Add it to avoid runtime failures.
Apply this diff to add rimraf dependency:
"devDependencies": {
"@eggjs/mock": "workspace:*",
"@eggjs/schedule": "workspace:*",
"@eggjs/tsconfig": "workspace:*",
"@types/node": "catalog:",
"egg-logger": "catalog:",
"glob": "catalog:",
+ "rimraf": "catalog:",
"tsdown": "catalog:",
"typescript": "catalog:",
"vitest": "catalog:"
},📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "build": "tsdown && rimraf dist && tsc -b --clean && tsc", | |
| "devDependencies": { | |
| "@eggjs/mock": "workspace:*", | |
| "@eggjs/schedule": "workspace:*", | |
| "@eggjs/tsconfig": "workspace:*", | |
| "@types/node": "catalog:", | |
| "egg-logger": "catalog:", | |
| "glob": "catalog:", | |
| "rimraf": "catalog:", | |
| "tsdown": "catalog:", | |
| "typescript": "catalog:", | |
| "vitest": "catalog:" | |
| }, |
🤖 Prompt for AI Agents
In plugins/logrotator/package.json around line 95, the "build" script runs
tsdown then immediately deletes dist with rimraf and also rimraf is not
declared; change the script to run rimraf before tsdown (e.g., "rimraf dist &&
tsdown && tsc -b --clean && tsc") or remove the redundant rimraf if tsc already
cleans, and add rimraf to devDependencies so the script won't fail at runtime.
plugins/onerror/package.json
Outdated
| "typecheck": "tsc --noEmit", | ||
| "test": "vitest run", | ||
| "build": "tsdown", | ||
| "build": "tsdown && rimraf dist && tsc -b --clean && tsc", |
There was a problem hiding this comment.
Inefficient build order and missing rimraf dependency.
The build script runs tsdown first, then deletes its output with rimraf, then rebuilds with tsc. Consider reordering: "rimraf dist && tsdown && tsc -b --clean && tsc"
Additionally, rimraf is used but not listed in devDependencies.
Apply this diff to add rimraf dependency:
"devDependencies": {
"@eggjs/mock": "workspace:*",
"@types/mustache": "catalog:",
"@types/stack-trace": "catalog:",
+ "rimraf": "catalog:",
"tsdown": "catalog:",
"typescript": "catalog:",
"vitest": "catalog:"
},📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "build": "tsdown && rimraf dist && tsc -b --clean && tsc", | |
| "devDependencies": { | |
| "@eggjs/mock": "workspace:*", | |
| "@types/mustache": "catalog:", | |
| "@types/stack-trace": "catalog:", | |
| "rimraf": "catalog:", | |
| "tsdown": "catalog:", | |
| "typescript": "catalog:", | |
| "vitest": "catalog:" | |
| }, |
🤖 Prompt for AI Agents
In plugins/onerror/package.json around line 60, the build script runs tsdown
before cleaning and rimraf is referenced but not declared; update the "build"
script to run rimraf dist first, then tsdown, then tsc steps (e.g., "rimraf dist
&& tsdown && tsc -b --clean && tsc") and add rimraf to devDependencies (install
or add the appropriate version entry) so the script has its dependency declared.
| }, | ||
| "scripts": { | ||
| "build": "tsdown", | ||
| "build": "tsdown && rimraf dist && tsc -b --clean && tsc", |
There was a problem hiding this comment.
Inefficient build order and missing rimraf dependency.
The build script runs tsdown first (which outputs to dist/), then immediately deletes dist/ with rimraf, then rebuilds with tsc. This wastes the tsdown output. Consider reordering: "rimraf dist && tsdown && tsc -b --clean && tsc"
Additionally, rimraf is used but not listed in devDependencies.
Apply this diff to add rimraf dependency:
"devDependencies": {
"@eggjs/tsconfig": "workspace:*",
"@types/koa-compose": "catalog:",
"@types/koa-range": "catalog:",
"@eggjs/mock": "workspace:*",
"oxlint": "catalog:",
+ "rimraf": "catalog:",
"tsdown": "catalog:",
"typescript": "catalog:",
"vitest": "catalog:"
},📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "build": "tsdown && rimraf dist && tsc -b --clean && tsc", | |
| "devDependencies": { | |
| "@eggjs/tsconfig": "workspace:*", | |
| "@types/koa-compose": "catalog:", | |
| "@types/koa-range": "catalog:", | |
| "@eggjs/mock": "workspace:*", | |
| "oxlint": "catalog:", | |
| "rimraf": "catalog:", | |
| "tsdown": "catalog:", | |
| "typescript": "catalog:", | |
| "vitest": "catalog:" | |
| }, |
🤖 Prompt for AI Agents
In plugins/static/package.json around line 60, the build script runs tsdown
before deleting dist and also uses rimraf without declaring it; reorder the
script to remove dist first then run tsdown and tsc (for example: run rimraf
dist && tsdown && tsc -b --clean && tsc) and add rimraf as a devDependency in
package.json (matching the project's package manager and versioning convention),
then run npm/yarn install to update lockfiles.
| "lint": "oxlint --type-aware", | ||
| "typecheck": "tsc --noEmit", | ||
| "test": "vitest run", | ||
| "build": "tsdown", | ||
| "build": "tsdown && rimraf dist && tsc -b --clean && tsc", | ||
| "prepublishOnly": "npm run build" | ||
| } |
There was a problem hiding this comment.
Restore required plugin scripts and clean-first build
rimraf dist runs after tsdown, erasing its artifacts, so the initial step is wasted. Clean before emitting—or drop tsdown entirely if we now rely on tsc. Also, plugin packages must provide the standard script set (clean, lint:fix, and test chaining lint:fix) to stay consistent with our release tooling. Suggested fix:
"scripts": {
"lint": "oxlint --type-aware",
- "typecheck": "tsc --NoEmit",
- "test": "vitest run",
- "build": "tsdown && rimraf dist && tsc -b --clean && tsc",
+ "lint:fix": "npm run lint -- --fix",
+ "typecheck": "tsc --noEmit",
+ "test": "npm run lint:fix && vitest",
+ "clean": "rimraf dist",
+ "build": "npm run clean && tsc -b --clean && tsc",
"prepublishOnly": "npm run build"
}Based on learnings
Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In plugins/view/package.json around lines 76 to 81, the build sequence and
missing standard scripts are incorrect: move or run the clean step before
emitting (run "clean" or "rimraf dist" before "tsdown" and tsc), or remove
"tsdown" if you rely solely on tsc; add a "clean" script (e.g. rimraf dist), add
"lint:fix" (e.g. oxlint --fix --type-aware) and update "test" to run lint:fix
before tests (e.g. "npm run lint:fix && vitest run"); ensure "build" runs the
clean step first (clean && tsdown && tsc -b --clean && tsc or clean && tsc) so
artifacts are not removed after generation.

Summary by CodeRabbit
New Features
Chores