Skip to content

fix: use tsc build#5582

Merged
fengmk2 merged 2 commits intonextfrom
use-tsc-build
Oct 4, 2025
Merged

fix: use tsc build#5582
fengmk2 merged 2 commits intonextfrom
use-tsc-build

Conversation

@fengmk2
Copy link
Member

@fengmk2 fengmk2 commented Oct 4, 2025

Summary by CodeRabbit

  • New Features

    • Schedule plugin: added Application.runSchedule API to trigger schedules programmatically.
  • Chores

    • Standardized build pipeline across packages to clean outputs and run a full TypeScript rebuild for more reliable releases.
    • Unified TypeScript project layout by setting source/output directories and excluding tests/build artifacts across packages.
    • Enabled unbundled build mode for the Egg-related package.
    • Added prepublishOnly hooks to select packages (e.g., extend2, supertest, logrotator).

@fengmk2 fengmk2 requested a review from Copilot October 4, 2025 16:59
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 tsdown and tsc in the build process
  • Standardizes TypeScript configuration with rootDir and outDir settings
  • 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>;
Copy link

Copilot AI Oct 4, 2025

Choose a reason for hiding this comment

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

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.

Suggested change
runSchedule(schedulePath: string, ...args: any[]): Promise<any>;
runSchedule<T = unknown, Args extends unknown[] = unknown[]>(schedulePath: string, ...args: Args): Promise<T>;

Copilot uses AI. Check for mistakes.
"typecheck": "tsc --noEmit",
"test": "vitest run",
"build": "tsdown",
"build": "tsdown && rimraf dist && tsc -b --clean && tsc",
Copy link

Copilot AI Oct 4, 2025

Choose a reason for hiding this comment

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

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.

Suggested change
"build": "tsdown && rimraf dist && tsc -b --clean && tsc",
"build": "rimraf dist && tsdown && tsc",

Copilot uses AI. Check for mistakes.
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @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 tsc more directly and refining tsconfig.json settings, the changes aim to improve the reliability and consistency of compilation, particularly concerning output directories and type generation. This ensures a more robust build pipeline for the project's modules.

Highlights

  • Build Process Update: The build script for numerous packages has been updated to incorporate tsc (TypeScript compiler) alongside tsdown. This new process includes cleaning the dist directory before compilation, ensuring a fresh build output.
  • TypeScript Configuration Standardization: All affected tsconfig.json files now explicitly define rootDir as ./src and outDir as ./dist. Additionally, common development and build artifacts such as test, dist, tsdown.config.ts, and vitest.config.ts are excluded from compilation.
  • Type Definition Refinement: In the plugins/schedule package, the runSchedule method's type definition has been moved from the MockApplication interface to the main Application interface within the egg module, simplifying type usage.
  • tsdown Configuration Adjustment: The unbundle: true option in packages/egg/tsdown.config.ts has been uncommented, potentially addressing previous issues with type bundling when using tsdown.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@cloudflare-workers-and-pages
Copy link

Deploying egg with  Cloudflare Pages  Cloudflare Pages

Latest commit: ccb6b74
Status:🚫  Build failed.

View logs

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 4, 2025

Caution

Review failed

The pull request is closed.

Note

Other AI code review bot(s) detected

CodeRabbit 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.

Walkthrough

Build pipelines were extended to run tsdown, remove dist, then perform a TypeScript clean and full compile; many package/plugin tsconfigs now set rootDir: "./src", outDir: "./dist" and add broader exclude lists. packages/egg enables unbundle, and plugins/schedule adds an Application.runSchedule type.

Changes

Cohort / File(s) Summary
Extended build script pipeline
packages/{cluster,cookies,core,egg,extend2,koa-static-cache,koa,router,supertest,utils}/package.json, plugins/{development,i18n,jsonp,logrotator,mock,multipart,onerror,schedule,security,session,static,tracer,view,watcher}/package.json
Change scripts.build from tsdown to tsdown && rimraf dist && tsc -b --clean && tsc. Some packages also add post-copy steps (e.g., egg/onerror) as part of the new pipeline.
Added prepublishOnly script
packages/extend2/package.json, packages/supertest/package.json, plugins/logrotator/package.json
Add prepublishOnly: "pnpm run build".
TypeScript project structure updates
packages/{cluster,cookies,core,egg,extend2,koa-static-cache,koa,router,supertest,utils}/tsconfig.json, plugins/{development,i18n,jsonp,logrotator,mock,multipart,onerror,schedule,security,session,static,tracer,view,watcher}/tsconfig.json
Add compilerOptions.rootDir: "./src" and compilerOptions.outDir: "./dist"; introduce/expand top-level exclude arrays (commonly ["test","dist","tsdown.config.ts","vitest.config.ts"]); retain baseUrl: "./".
Enable tsdown unbundle
packages/egg/tsdown.config.ts
Set unbundle: true in the exported tsdown config.
Public type addition
plugins/schedule/src/types.ts
In declare module 'egg', add interface Application { runSchedule(schedulePath: string, ...args: any[]): Promise<any> }.

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
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

Thump! I hop through build and test,
I rimraf dist and do my best,
Roots set to src, outputs to dist,
A runSchedule path on the list.
Unbundle on — carrots for all! 🥕

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title concisely conveys the primary change of using TypeScript’s tsc build step, which aligns with the extensive updates to the build scripts in the changeset.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ccb6b74 and 1b7c383.

📒 Files selected for processing (2)
  • packages/egg/package.json (1 hunks)
  • plugins/onerror/package.json (1 hunks)

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Oct 4, 2025

Deploying egg-v3 with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1b7c383
Status:⚡️  Build in progress...

View logs

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

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",
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The build script can be made more efficient and robust.

  1. The rimraf dist command is redundant, as tsc -b --clean will also clean the output directory specified in tsconfig.json.
  2. Using tsc -b is the correct way to build with TypeScript project references, which are used in this repository. The simple tsc command 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.

Suggested change
"build": "tsdown && rimraf dist && tsc -b --clean && tsc",
"build": "tsdown && tsc -b --clean && tsc -b",

Comment on lines +12 to 17
interface Application {
/**
* Run a schedule, only for unit test
*/
runSchedule(schedulePath: string, ...args: any[]): Promise<any>;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

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
Copy link

codecov bot commented Oct 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.06%. Comparing base (803284e) to head (1b7c383).
⚠️ Report is 3 commits behind head on next.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

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 dist executes after tsdown, so the freshly emitted JS bundle is wiped and the published package ships with an empty dist folder. Additionally, plugins must expose a dedicated clean script (rimraf dist). Reorder the build steps so cleanup runs before compilation, and surface the required clean script.

   "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:fix scripts are still missing, while lint lacks the --type-aware flag and test should cascade through lint:fix. Please revert build back to plain tsdown, add the mandated scripts, and move any extra steps you need into another helper (e.g., tsc-build) that prepublishOnly can 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 prepublishOnly to execute the new tsc build, update it to pnpm run lint && pnpm run typecheck && pnpm run tsc-build (or similar) while still keeping the required build script intact.

Based on learnings.

plugins/i18n/package.json (1)

75-82: Restore required plugin scripts

Per the plugin standards we follow, every plugin package.json must expose a clean script and the test script should chain lint:fix && vitest. This block currently omits clean and 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 required clean script.

Per the plugin package guidelines, each plugin must expose a clean script (typically rimraf 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 chain

Per our plugin packaging rules we still need explicit clean and lint:fix entries, and test must invoke lint:fix && vitest. Without them this package stays out of compliance. Please add the missing scripts and update test accordingly.

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, and test chaining lint: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, keep prepublishOnly pointing at the build.

As per coding guidelines

plugins/multipart/package.json (1)

85-90: Fix build ordering and add the required clean script

Running rimraf dist after tsdown deletes everything tsdown just emitted, so the tsdown step becomes a no-op and we end up shipping only the subsequent tsc output. If we are switching to a pure tsc pipeline, drop the redundant step; otherwise move the clean before any emits. In addition, plugin packages must expose a dedicated clean script (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 dist currently runs after tsdown, so the tsdown output is discarded. Clean before emitting (or remove tsdown if unused). Also, per our plugin template we need a dedicated clean entry. 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 script

Cleaning after tsdown nukes its artifacts, so please clean first (or drop tsdown). Additionally, every package must expose a lint:fix companion 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 dist must run before any emitters; otherwise tsdown’s output is thrown away. Also, per our package guideline we need lint to run oxlint --type-aware and expose a lint: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: Replace any types with generics for better type safety.

The runSchedule method signature uses any[] for parameters and any for return type, which reduces type safety and IntelliSense quality. As per coding guidelines, avoid the any type 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 tsdown first and only then rimraf dist deletes the artifacts that tsdown just produced, so the package ends up shipping whatever plain tsc emits, 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

📥 Commits

Reviewing files that changed from the base of the PR and between c2b9052 and ccb6b74.

📒 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.json
  • plugins/development/tsconfig.json
  • plugins/onerror/tsconfig.json
  • packages/egg/tsconfig.json
  • packages/extend2/tsconfig.json
  • plugins/mock/tsconfig.json
  • packages/supertest/tsconfig.json
  • plugins/session/tsconfig.json
  • packages/router/tsconfig.json
  • plugins/i18n/tsconfig.json
  • plugins/schedule/tsconfig.json
  • plugins/jsonp/tsconfig.json
  • packages/core/tsconfig.json
  • plugins/watcher/tsconfig.json
  • packages/koa-static-cache/tsconfig.json
  • packages/utils/tsconfig.json
  • packages/koa/tsconfig.json
  • packages/cluster/tsconfig.json
  • packages/cookies/tsconfig.json
  • plugins/view/tsconfig.json
  • plugins/static/tsconfig.json
  • plugins/security/tsconfig.json
  • plugins/logrotator/tsconfig.json
  • plugins/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.json
  • packages/extend2/tsconfig.json
  • packages/supertest/tsconfig.json
  • packages/router/tsconfig.json
  • packages/core/tsconfig.json
  • packages/koa-static-cache/tsconfig.json
  • packages/utils/tsconfig.json
  • packages/koa/tsconfig.json
  • packages/cluster/tsconfig.json
  • packages/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.json
  • packages/extend2/tsconfig.json
  • packages/supertest/tsconfig.json
  • packages/router/tsconfig.json
  • packages/core/tsconfig.json
  • packages/koa-static-cache/tsconfig.json
  • packages/utils/tsconfig.json
  • packages/koa/tsconfig.json
  • packages/cluster/tsconfig.json
  • packages/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.json
  • plugins/development/package.json
  • plugins/tracer/package.json
  • packages/cluster/package.json
  • plugins/logrotator/package.json
  • plugins/i18n/package.json
  • packages/extend2/package.json
  • plugins/view/package.json
  • plugins/multipart/package.json
  • packages/cookies/package.json
  • packages/core/package.json
  • plugins/jsonp/package.json
  • plugins/schedule/package.json
  • packages/router/package.json
  • packages/egg/package.json
  • packages/supertest/package.json
  • plugins/session/package.json
  • plugins/static/package.json
  • plugins/mock/package.json
  • plugins/watcher/package.json
  • plugins/onerror/package.json
  • packages/utils/package.json
  • packages/koa/package.json
  • packages/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.json
  • plugins/development/package.json
  • plugins/tracer/package.json
  • plugins/logrotator/package.json
  • plugins/i18n/package.json
  • plugins/view/package.json
  • plugins/multipart/package.json
  • plugins/jsonp/package.json
  • plugins/schedule/package.json
  • plugins/session/package.json
  • plugins/static/package.json
  • plugins/mock/package.json
  • plugins/watcher/package.json
  • plugins/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.json
  • plugins/development/package.json
  • plugins/tracer/package.json
  • packages/cluster/package.json
  • plugins/logrotator/package.json
  • plugins/i18n/package.json
  • packages/extend2/package.json
  • plugins/view/package.json
  • plugins/multipart/package.json
  • packages/cookies/package.json
  • packages/core/package.json
  • plugins/jsonp/package.json
  • plugins/schedule/package.json
  • packages/router/package.json
  • packages/egg/package.json
  • packages/supertest/package.json
  • plugins/session/package.json
  • plugins/static/package.json
  • plugins/mock/package.json
  • plugins/watcher/package.json
  • plugins/onerror/package.json
  • packages/utils/package.json
  • packages/koa/package.json
  • packages/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.json
  • plugins/development/package.json
  • plugins/tracer/package.json
  • packages/cluster/package.json
  • plugins/logrotator/package.json
  • plugins/i18n/package.json
  • packages/extend2/package.json
  • plugins/view/package.json
  • plugins/multipart/package.json
  • packages/cookies/package.json
  • packages/core/package.json
  • plugins/jsonp/package.json
  • plugins/schedule/package.json
  • packages/router/package.json
  • packages/egg/package.json
  • packages/supertest/package.json
  • plugins/session/package.json
  • plugins/static/package.json
  • plugins/mock/package.json
  • plugins/watcher/package.json
  • plugins/onerror/package.json
  • packages/utils/package.json
  • packages/koa/package.json
  • packages/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.json
  • packages/extend2/package.json
  • packages/cookies/package.json
  • packages/core/package.json
  • packages/router/package.json
  • packages/egg/package.json
  • packages/supertest/package.json
  • packages/utils/package.json
  • packages/koa/package.json
  • packages/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.ts
  • packages/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.ts
  • packages/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.json
  • plugins/development/tsconfig.json
  • plugins/onerror/tsconfig.json
  • packages/egg/tsconfig.json
  • packages/extend2/tsconfig.json
  • plugins/mock/tsconfig.json
  • packages/supertest/tsconfig.json
  • plugins/session/tsconfig.json
  • packages/router/tsconfig.json
  • plugins/i18n/tsconfig.json
  • plugins/schedule/tsconfig.json
  • plugins/jsonp/tsconfig.json
  • packages/core/tsconfig.json
  • plugins/watcher/tsconfig.json
  • packages/koa-static-cache/tsconfig.json
  • packages/utils/tsconfig.json
  • packages/koa/tsconfig.json
  • packages/cluster/tsconfig.json
  • packages/cookies/tsconfig.json
  • plugins/view/tsconfig.json
  • plugins/static/tsconfig.json
  • plugins/security/tsconfig.json
  • plugins/logrotator/tsconfig.json
  • plugins/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.json
  • plugins/development/tsconfig.json
  • plugins/onerror/tsconfig.json
  • plugins/session/tsconfig.json
  • plugins/i18n/tsconfig.json
  • plugins/schedule/tsconfig.json
  • packages/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.json
  • plugins/development/tsconfig.json
  • plugins/onerror/tsconfig.json
  • packages/egg/tsconfig.json
  • packages/extend2/tsconfig.json
  • plugins/mock/tsconfig.json
  • packages/supertest/tsconfig.json
  • plugins/session/tsconfig.json
  • packages/router/tsconfig.json
  • plugins/i18n/tsconfig.json
  • plugins/schedule/tsconfig.json
  • plugins/jsonp/tsconfig.json
  • packages/core/tsconfig.json
  • plugins/watcher/tsconfig.json
  • packages/koa-static-cache/tsconfig.json
  • packages/utils/tsconfig.json
  • packages/koa/tsconfig.json
  • packages/cluster/tsconfig.json
  • packages/cookies/tsconfig.json
  • plugins/view/tsconfig.json
  • plugins/static/tsconfig.json
  • plugins/security/tsconfig.json
  • plugins/logrotator/tsconfig.json
  • plugins/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.json
  • packages/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.json
  • plugins/development/package.json
  • plugins/tracer/package.json
  • packages/cluster/package.json
  • plugins/logrotator/package.json
  • plugins/i18n/package.json
  • packages/extend2/package.json
  • plugins/view/package.json
  • plugins/multipart/package.json
  • packages/cookies/package.json
  • packages/core/package.json
  • plugins/jsonp/package.json
  • plugins/schedule/package.json
  • packages/router/package.json
  • packages/egg/package.json
  • packages/supertest/package.json
  • plugins/session/package.json
  • plugins/static/package.json
  • plugins/mock/package.json
  • plugins/watcher/package.json
  • plugins/onerror/package.json
  • packages/utils/package.json
  • packages/koa/package.json
  • packages/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.json
  • plugins/tracer/package.json
  • plugins/logrotator/package.json
  • plugins/i18n/package.json
  • packages/extend2/package.json
  • plugins/view/package.json
  • plugins/multipart/package.json
  • packages/cookies/package.json
  • packages/core/package.json
  • plugins/jsonp/package.json
  • plugins/schedule/package.json
  • packages/egg/package.json
  • packages/supertest/package.json
  • plugins/session/package.json
  • plugins/static/package.json
  • plugins/mock/package.json
  • plugins/watcher/package.json
  • plugins/onerror/package.json
  • packages/utils/package.json
  • packages/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.ts
  • packages/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.

Comment on lines 24 to 26
"scripts": {
"build": "tsdown",
"build": "tsdown && rimraf dist && tsc -b --clean && tsc",
"lint": "oxlint",
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

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",
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

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.

Suggested change
"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.

Comment on lines 172 to 176
"scripts": {
"lint": "oxlint",
"typecheck": "tsc --noEmit",
"build": "tsdown",
"build": "tsdown && rimraf dist && tsc -b --clean && tsc",
"test": "vitest run",
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

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.

Comment on lines 6 to +7
// 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,
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

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:

  1. Keep unbundle disabled until the upstream issue is resolved
  2. 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.

Suggested change
// 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",
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

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.

Suggested change
"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",
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

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.

Suggested change
"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",
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

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:

  1. Running rimraf before tsdown: "rimraf dist && tsdown && tsc -b --clean && tsc"
  2. 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.

Suggested change
"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.

"typecheck": "tsc --noEmit",
"test": "vitest run",
"build": "tsdown",
"build": "tsdown && rimraf dist && tsc -b --clean && tsc",
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

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.

Suggested change
"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",
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

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.

Suggested change
"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.

Comment on lines 76 to 81
"lint": "oxlint --type-aware",
"typecheck": "tsc --noEmit",
"test": "vitest run",
"build": "tsdown",
"build": "tsdown && rimraf dist && tsc -b --clean && tsc",
"prepublishOnly": "npm run build"
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant