Skip to content

Conversation

@fengmk2
Copy link
Member

@fengmk2 fengmk2 commented Oct 28, 2025

Summary by CodeRabbit

  • Chores
    • Removed egg-ts-helper and associated post-install automation; cleaned up packaging, scripts, and debug log namespaces.
  • Documentation
    • Simplified TypeScript tutorials by removing egg-ts-helper guidance, examples, and related notes.
  • Deprecations
    • The --declarations flag is now deprecated and will be removed in a future release.
  • Tests
    • Removed obsolete test fixtures and test cases tied to the removed helper.

@fengmk2 fengmk2 requested a review from Copilot October 28, 2025 12:45
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 28, 2025

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

This PR removes egg-ts-helper integration (workspace/dependency entries, postinstall hook, auto-run logic), strips egg-ts-helper guidance from TypeScript docs, deletes related tests/fixtures/typings, and updates several egg-bin debug namespace strings and the declarations flag description.

Changes

Cohort / File(s) Change Summary
Workspace / Package manifests
pnpm-workspace.yaml, tools/egg-bin/package.json
Removed egg-ts-helper from workspace/catalog and egg-bin deps; adjusted devDependencies (added/moved @eggjs/supertest, types, tools), removed postinstall script and added build/prepublish scripts; reordered entries.
Documentation
site/docs/tutorials/typescript.md, site/docs/zh-CN/tutorials/typescript.md
Removed egg-ts-helper sections, examples, plugin/typing-generation guidance and related notices; minor title/format changes.
Postinstall & integration logic
tools/egg-bin/scripts/postinstall.mjs, tools/egg-bin/src/baseCommand.ts
Deleted postinstall.mjs; removed runScript import and auto-detection/auto-run of egg-ts-helper; changed declarations baseFlag description to deprecated.
Debug namespace updates
tools/egg-bin/scripts/start-cluster.cjs, tools/egg-bin/scripts/start-cluster.mjs, tools/egg-bin/src/commands/dev.ts, tools/egg-bin/src/commands/test.ts
Updated debug logger namespace strings from egg-bin/... to egg/bin/... without logic changes.
Tests & fixtures removed
tools/egg-bin/test/postinstall.test.ts, tools/egg-bin/test/commands/dev.test.ts, tools/egg-bin/test/fixtures/test-postinstall/*
Deleted postinstall test, removed a skipped dev test case referencing declarations, and removed the test-postinstall fixture including package.json and generated typings typings/app/index.d.ts.

Sequence Diagram(s)

sequenceDiagram
    participant DevPkg as Developer package
    participant Postinst as postinstall.mjs (was)
    participant ETS as egg-ts-helper (was)
    participant EggBin as egg-bin CLI

    rect rgb(230,245,255)
    Note over DevPkg,Postinst: OLD flow (before this PR)
    DevPkg->>Postinst: install triggers postinstall
    Postinst->>DevPkg: read package.json (egg.declarations)
    alt declarations enabled & framework present
        Postinst->>ETS: spawn ETS bin in project context
        ETS-->>EggBin: typings/registration actions
    end
    end

    rect rgb(245,255,230)
    Note over DevPkg,EggBin: NEW flow (after this PR)
    DevPkg--xPostinst: no postinstall (file removed)
    DevPkg->>EggBin: install/run without ETS auto-run
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~30 minutes

  • Focus review on:
    • Removal of tools/egg-bin/scripts/postinstall.mjs and any CI/packaging expectations around postinstall behavior.
    • tools/egg-bin/src/baseCommand.ts changes (removed auto-run logic and updated declarations flag description).
    • Tests and fixture deletions to ensure no residual references remain in test suites or CI.
    • package.json script and dependency adjustments in tools/egg-bin/package.json for publishing/build flow.

Possibly related PRs

Suggested reviewers

  • gxkl
  • akitaSummer

Poem

🐰 I hopped through code and pulled a thread,
Trimmed the helper from the docs and shed,
Logs now point a clearer trail,
Tests and typings left the vale,
Tiny paws, a lighter spread. 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title "refactor: remove egg-ts-helper" directly and clearly summarizes the main objective of the changeset. The title accurately reflects the central theme across all modified files: the removal of the egg-ts-helper dependency and its associated functionality, including its removal from package.json, the deletion of postinstall scripts that invoked it, removal of related documentation, and deprecation of the declarations flag. The title is specific, concise, and uses conventional commit format (refactor:) appropriately without vague terminology.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dont-run-ets

📜 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 b67871a and 801802f.

📒 Files selected for processing (1)
  • tools/egg-bin/package.json (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • tools/egg-bin/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). (3)
  • GitHub Check: Socket Security: Pull Request Alerts
  • GitHub Check: Test scripts (ubuntu-latest, 22)
  • GitHub Check: Analyze (javascript-typescript)

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.

@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 a significant refactoring effort to remove the egg-ts-helper dependency from the project. This change aims to simplify the project's dependency graph, reduce maintenance overhead, and streamline the TypeScript development workflow by eliminating a tool previously responsible for generating TypeScript declaration files. The removal is comprehensive, encompassing dependency declarations, build scripts, and all relevant documentation across the codebase.

Highlights

  • Dependency Removal: The egg-ts-helper package has been completely removed from the project's dependencies and lock files (pnpm-lock.yaml, pnpm-workspace.yaml, tools/egg-bin/package.json).
  • Documentation Updates: All references, explanations, and usage instructions for egg-ts-helper have been removed from both English and Chinese TypeScript tutorial documentation.
  • Build Process Streamlining: The postinstall script that previously invoked egg-ts-helper has been removed, and related logic in tools/egg-bin/src/baseCommand.ts has been eliminated, simplifying the build and development setup.
  • Dependency Cleanup: Several transitive dependencies that were likely pulled in by egg-ts-helper (e.g., ansi-colors, dot-prop, enquirer, is-obj) have been removed, and some others are now marked as optional.
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.

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 removes the deprecated egg-ts-helper dependency and all related functionality from the Eggjs framework. The egg-ts-helper was previously used to automatically generate TypeScript declaration files for Egg's auto-loaded modules, but is being removed as part of modernizing the framework.

Key Changes:

  • Removed egg-ts-helper dependency from package catalogs and build configurations
  • Deleted the postinstall script that ran egg-ts-helper automatically
  • Removed the --declarations flag functionality from CLI commands
  • Updated documentation to remove references to egg-ts-helper

Reviewed Changes

Copilot reviewed 13 out of 17 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tools/egg-bin/test/postinstall.test.ts Deleted entire test file for postinstall script functionality
tools/egg-bin/test/fixtures/test-postinstall/package.json Deleted test fixture package.json used for postinstall tests
tools/egg-bin/test/commands/dev.test.ts Removed skipped test case that verified egg-ts-helper integration with dev command
tools/egg-bin/src/commands/test.ts Updated debug namespace from egg-bin/commands/test to egg/bin/commands/test
tools/egg-bin/src/commands/dev.ts Updated debug namespace from egg-bin/commands/dev to egg/bin/commands/dev
tools/egg-bin/src/baseCommand.ts Removed egg-ts-helper execution logic and deprecated the --declarations flag
tools/egg-bin/scripts/start-cluster.mjs Updated debug namespace from egg-bin/scripts/start-cluster to egg/bin/scripts/start-cluster
tools/egg-bin/scripts/start-cluster.cjs Updated debug namespace and removed unused eslint-disable comment
tools/egg-bin/scripts/postinstall.mjs Deleted entire postinstall script that ran egg-ts-helper
tools/egg-bin/package.json Removed egg-ts-helper dependency and postinstall script hook
site/docs/zh-CN/tutorials/typescript.md Removed Chinese documentation sections about egg-ts-helper usage
site/docs/tutorials/typescript.md Removed English documentation sections about egg-ts-helper usage and fixed frontmatter formatting
pnpm-workspace.yaml Removed egg-ts-helper from catalog dependencies
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

---
title: TypeScript
---
# TypeScript
Copy link

Copilot AI Oct 28, 2025

Choose a reason for hiding this comment

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

The frontmatter YAML block (---) was removed, which may break documentation site rendering. The title metadata is typically required by documentation generators like Dumi. Consider restoring the frontmatter block or verify that the documentation site can properly render markdown files without it.

Copilot uses AI. Check for mistakes.
If the egg's plugin has the right declaration, we need to import it exclipitly and ts can load the related object.

If you use `egg-ts-helper`, it will automatically generate the exclipit importing declarations according to what plugins you've enabled in the application. If you don't use that, you have to import the declaration of plugins manually.
If you don't use that, you have to import the declaration of plugins manually.
Copy link

Copilot AI Oct 28, 2025

Choose a reason for hiding this comment

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

The sentence fragment 'If you don't use that' is unclear after removing the egg-ts-helper context. The preceding sentence should be updated to clarify what 'that' refers to, or this sentence should be revised to stand alone without the removed context.

Suggested change
If you don't use that, you have to import the declaration of plugins manually.
If you do not import the plugin declaration explicitly, you have to import the declaration of plugins manually.

Copilot uses AI. Check for mistakes.
@cloudflare-workers-and-pages
Copy link

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

Deploying egg with  Cloudflare Pages  Cloudflare Pages

Latest commit: 801802f
Status: ✅  Deploy successful!
Preview URL: https://e7dc774b.egg-cci.pages.dev
Branch Preview URL: https://dont-run-ets.egg-cci.pages.dev

View logs

@codecov
Copy link

codecov bot commented Oct 28, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.58%. Comparing base (cbb96d3) to head (801802f).
⚠️ Report is 5 commits behind head on next.

Additional details and impacted files
@@            Coverage Diff             @@
##             next    #5657      +/-   ##
==========================================
- Coverage   87.68%   87.58%   -0.11%     
==========================================
  Files         565      561       -4     
  Lines       11010    10911      -99     
  Branches     1243     1231      -12     
==========================================
- Hits         9654     9556      -98     
+ Misses       1275     1274       -1     
  Partials       81       81              

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

@cloudflare-workers-and-pages
Copy link

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

Deploying egg-v3 with  Cloudflare Pages  Cloudflare Pages

Latest commit: 801802f
Status: ✅  Deploy successful!
Preview URL: https://944f8db0.egg-v3.pages.dev
Branch Preview URL: https://dont-run-ets.egg-v3.pages.dev

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 is a significant refactoring that removes the egg-ts-helper dependency and all related code, configuration, and documentation. The changes are well-executed and cover all aspects of the removal, from dependency management in pnpm-lock.yaml and package.json files to updating documentation and cleaning up related scripts and tests. The removal of this deprecated tool is a good improvement for the project's maintainability. I have one minor suggestion for improving the clarity of the English documentation after the removal of content related to egg-ts-helper.

Comment on lines 48 to 57
"@eggjs/mock": "workspace:*",
"@eggjs/supertest": "workspace:*",
"@eggjs/tsconfig": "workspace:*",
"@types/node": "catalog:",
"@types/mocha": "catalog:",
"@swc-node/register": "catalog:",
"@swc/core": "catalog:",
"@types/mocha": "catalog:",
"@types/node": "catalog:",
"assert-file": "catalog:",
"coffee": "catalog:",
"cpy": "catalog:",
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

While not an error, sorting devDependencies alphabetically would improve readability and maintainability, making it easier to find specific packages.

    "@eggjs/mock": "workspace:*",
    "@eggjs/supertest": "workspace:*",
    "@eggjs/tsconfig": "workspace:*",
    "@swc-node/register": "catalog:",
    "@swc/core": "catalog:",
    "@types/mocha": "catalog:",
    "@types/node": "catalog:",
    "assert-file": "catalog:",
    "coffee": "catalog:",
    "cpy": "catalog:"

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: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9b975e1 and b67871a.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (1)
  • tools/egg-bin/package.json (2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
{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:

  • tools/egg-bin/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}: Use workspace:* for internal dependencies between monorepo packages
Use catalog: versions for external dependencies defined in pnpm-workspace.yaml
Include script "typecheck": "tsc --noEmit" in all packages
Include script "lint": "oxlint --type-aware" in all packages
Include script "lint:fix" that runs oxlint with --fix (e.g., "pnpm run lint -- --fix")

Files:

  • tools/egg-bin/package.json
🧠 Learnings (6)
📚 Learning: 2025-10-23T17:37:37.549Z
Learnt from: CR
PR: eggjs/egg#0
File: tegg/CLAUDE.md:0-0
Timestamp: 2025-10-23T17:37:37.549Z
Learning: Applies to tegg/{core,plugin,standalone}/*/package.json : Use workspace:* for internal monorepo dependencies and catalog: for external dependencies

Applied to files:

  • tools/egg-bin/package.json
📚 Learning: 2025-10-18T11:59:58.226Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-18T11:59:58.226Z
Learning: Applies to plugins/*/package.json : Plugins must declare peerDependencies: { "egg": "workspace:*" }

Applied to files:

  • tools/egg-bin/package.json
📚 Learning: 2025-10-18T11:59:58.226Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-18T11:59:58.226Z
Learning: Applies to {packages/cookies/test/**/*.test.ts,tools/egg-bin/test/**/*.test.ts} : Mocha test suites (cookies, egg-bin) must use test/**/*.test.ts

Applied to files:

  • tools/egg-bin/package.json
📚 Learning: 2025-10-18T11:59:58.226Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-18T11:59:58.226Z
Learning: Applies to plugins/*/package.json : Plugins must include scripts: build (tsdown && rimraf dist *.tsbuildinfo && tsc -p tsconfig.build.json), typecheck (tsc --noEmit), lint (oxlint --type-aware), test (vitest run), prepublishOnly (pnpm run build)

Applied to files:

  • tools/egg-bin/package.json
📚 Learning: 2025-10-23T17:37:37.549Z
Learnt from: CR
PR: eggjs/egg#0
File: tegg/CLAUDE.md:0-0
Timestamp: 2025-10-23T17:37:37.549Z
Learning: Applies to tegg/core/*/package.json : Core packages should include scripts: typecheck, clean, build (tsc --noEmit, rimraf, build pipeline)

Applied to files:

  • tools/egg-bin/package.json
📚 Learning: 2025-10-18T11:59:58.226Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-18T11:59:58.226Z
Learning: Applies to {packages/**/package.json,plugins/**/package.json,tools/**/package.json} : Include script "typecheck": "tsc --noEmit" in all packages

Applied to files:

  • tools/egg-bin/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). (4)
  • GitHub Check: Socket Security: Pull Request Alerts
  • GitHub Check: Test bin (windows-latest, 22, 1/3)
  • GitHub Check: typecheck
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (2)
tools/egg-bin/package.json (2)

25-64: Verify appropriateness of relocated and newly-added dependencies after egg-ts-helper removal.

The PR successfully removes egg-ts-helper integration and replaces it with direct tsdown/typescript dependencies in devDependencies (lines 63-64). The addition of runscript (line 62), @types/mocha, and @types/node (lines 52-53) should be verified to ensure they align with the build and test workflow changes introduced by this refactor.

Please confirm:

  1. That runscript, tsdown, and typescript are being actively used in the build/dev workflow
  2. That @types/mocha and @types/node are needed given the removal of egg-ts-helper

74-74: Verify clean script updates align with build artifacts.

The clean script now includes *.tsbuildinfo (line 74), which is appropriate for TypeScript build cleanup. Confirm that all tsbuildinfo artifacts generated during the build process will be properly removed.

@fengmk2 fengmk2 merged commit ca92ccb into next Oct 28, 2025
47 of 51 checks passed
@fengmk2 fengmk2 deleted the dont-run-ets branch October 28, 2025 13:16
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