fix: don't load ts files on production start#5664
Conversation
use EGG_TS_ENABLE=false
|
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. WalkthroughAdds an environment gate for TypeScript support (EGG_TS_ENABLE), updates utils and tests to respect it, sets the env in the start script, tightens worker path matching in stop, migrates tegg templates to use defineConfig and plugin factory patterns, adds tegg benchmark controller files and related TypeScript declarations, and adjusts template package and README. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant StartCmd as start.ts
participant ProcEnv as ProcessEnv
participant Utils as packages/utils/import.ts
participant App as Application
rect rgb(239,246,255)
StartCmd->>ProcEnv: spawn process with EGG_TS_ENABLE='false'
end
App->>Utils: call isSupportTypeScript()
Note right of Utils: check process.env.EGG_TS_ENABLE
alt EGG_TS_ENABLE === 'false'
Utils-->>App: return false (TS disabled)
else not 'false'
Utils->>Utils: perform Node version & extensions checks
Utils-->>App: return boolean (computed)
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (3)packages/**/src/**/*.{ts,tsx}📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
**/*.ts📄 CodeRabbit inference engine (AGENTS.md)
Files:
{packages/**,plugins/**,tools/!(egg-bin)/**}/**/*.ts📄 CodeRabbit inference engine (CLAUDE.md)
Files:
⏰ 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). (6)
🔇 Additional comments (1)
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 |
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 streamlines the production startup process for Egg.js applications by ensuring that TypeScript files are not loaded or processed when 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
|
Deploying egg with
|
| Latest commit: |
adf65c4
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://4816d559.egg-cci.pages.dev |
| Branch Preview URL: | https://disable-ts-file-loader.egg-cci.pages.dev |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## next #5664 +/- ##
==========================================
+ Coverage 87.58% 87.59% +0.01%
==========================================
Files 561 561
Lines 10911 10912 +1
Branches 1231 1231
==========================================
+ Hits 9556 9558 +2
+ Misses 1274 1273 -1
Partials 81 81 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Deploying egg-v3 with
|
| Latest commit: |
adf65c4
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://2ace671a.egg-v3.pages.dev |
| Branch Preview URL: | https://disable-ts-file-loader.egg-v3.pages.dev |
There was a problem hiding this comment.
Code Review
This pull request effectively disables loading of TypeScript files in production by introducing and using the EGG_TS_ENABLE=false environment variable. The implementation is clean, with the necessary logic added to isSupportTypeScript and the variable set in the start command. The PR also includes valuable housekeeping tasks, such as updating create-egg templates to use modern configuration helpers, renaming the tsc script to build for clarity, and fixing worker process detection in the stop command. The changes are well-rounded and improve both functionality and maintainability. I have one suggestion to improve the robustness of the new test case.
There was a problem hiding this comment.
Pull Request Overview
This PR refactors TypeScript configuration and build processes across the Eggjs monorepo to simplify the development workflow and align with modern practices. The changes remove CommonJS/ESM dual-build complexity from the cluster package, disable TypeScript file loading in production mode, and modernize template configurations.
Key changes:
- Simplifies
@eggjs/clusterbuild output paths by removing dual CommonJS/ESM format distinction - Adds
EGG_TS_ENABLE=falseenvironment variable to disable TypeScript loading in production mode - Modernizes tegg template configuration to use
defineConfigandtracerPluginfactory patterns - Adds generated TypeScript declaration files for the tegg benchmark application
Reviewed Changes
Copilot reviewed 12 out of 16 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
tools/scripts/src/commands/stop.ts |
Updated regex patterns to match simplified cluster package paths without CommonJS/ESM distinction |
tools/scripts/src/commands/start.ts |
Sets EGG_TS_ENABLE=false in production to disable TypeScript file loader |
tools/create-egg/test/cli.test.ts |
Reformatted test structure and removed commented-out code blocks |
tools/create-egg/src/templates/tegg/package.json |
Removed egg.typescript config, renamed tsc script to build, added predev script |
tools/create-egg/src/templates/tegg/config/plugin.ts |
Refactored to use modern tracerPlugin() factory pattern instead of manual plugin definition |
tools/create-egg/src/templates/tegg/config/config.*.ts |
Replaced type assertions with defineConfig helper for type-safe configuration |
tools/create-egg/src/templates/tegg/README.md |
Updated commands and documentation links, removed outdated development notes |
tegg/benchmark/http/**/*.d.ts |
Added generated TypeScript declaration files for benchmark application |
tegg/benchmark/http/app/controller/FooTeggController.js |
Added compiled JavaScript output for benchmark controller |
packages/utils/test/import.test.ts |
Added test coverage for EGG_TS_ENABLE=false environment variable behavior |
packages/utils/src/import.ts |
Added early return when EGG_TS_ENABLE=false to disable TypeScript support |
Comments suppressed due to low confidence (1)
tools/create-egg/src/templates/tegg/README.md:26
- Corrected spelling of 'se' to 'Use' at the beginning of the list item.
- se `npm run clean` to clean compiled js at development mode once
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
tools/scripts/src/commands/stop.ts (1)
75-75: Update the comment to reflect the new path structure.The comment example still references the old path structure with
dist/commonjs/agent_worker.js, which is inconsistent with the updated regex patterns that now match onlydist/agent_worker.js.Apply this diff to update the comment:
- // ~/bin/node --no-deprecation --trace-warnings ~/eggjs/examples/helloworld/node_modules/@eggjs/cluster/dist/commonjs/agent_worker.js {"baseDir":"~/eggjs/examples/helloworld","startMode":"process","framework":"~/eggjs/examples/helloworld/node_modules/egg","title":"egg-server-helloworld","workers":10,"clusterPort":58977} + // ~/bin/node --no-deprecation --trace-warnings ~/eggjs/examples/helloworld/node_modules/@eggjs/cluster/dist/agent_worker.js {"baseDir":"~/eggjs/examples/helloworld","startMode":"process","framework":"~/eggjs/examples/helloworld/node_modules/egg","title":"egg-server-helloworld","workers":10,"clusterPort":58977}
🧹 Nitpick comments (9)
tools/scripts/src/commands/start.ts (1)
148-149: Default-disable TS; don’t override a pre-set EGG_TS_ENABLE.Avoid surprising overrides. Only set the flag when the env doesn’t already define it.
- // disable ts file loader - this.env.EGG_TS_ENABLE = 'false'; + // disable ts file loader by default; respect explicit env + if (typeof this.env.EGG_TS_ENABLE === 'undefined') { + this.env.EGG_TS_ENABLE = 'false'; + }tools/create-egg/test/cli.test.ts (1)
159-203: Make skipIf boolean-safe; verify snapshot matcher.
- Coerce CI to boolean for TS type-safety/readability.
- Vitest uses toMatchSnapshot(); if matchSnapshot() isn’t a custom matcher, switch to the canonical name.
-test.skipIf(process.platform === 'win32' || process.env.CI)( +test.skipIf(process.platform === 'win32' || Boolean(process.env.CI))( 'successfully scaffolds a project based on tegg starter template', () => { @@ - expect(generatedFiles).matchSnapshot(); + // If no custom matcher is registered, prefer Vitest's `toMatchSnapshot` + expect(generatedFiles).toMatchSnapshot();If you intentionally added a custom matchSnapshot(), ignore the second hunk.
packages/utils/test/import.test.ts (1)
440-446: Use Node assert in packages/ tests; keep env stubbing.**Guideline prefers Node’s assert for assertions in packages/** tests. Update the new test block accordingly.
As per coding guidelines.
describe('isSupportTypeScript()', () => { it('should be false when EGG_TS_ENABLE is false', () => { vi.stubEnv('EGG_TS_ENABLE', 'false'); - expect(isSupportTypeScript()).toBe(false); + assert.strictEqual(isSupportTypeScript(), false); vi.unstubAllEnvs(); }); });tools/create-egg/src/templates/tegg/README.md (2)
18-18: Nice: build before start. Add a short note about TS being disabled in prod.To avoid confusion when running uncompiled TS in production, consider noting the new default.
### Deploy ```bash npm run build npm start
+Note: Production start disables loading .ts files by default (EGG_TS_ENABLE=false). Always build before starting, or use dev mode when running TS directly.
--- `3-3`: **Link tweak (optional).** If there’s a dedicated tegg HTTPController doc, link it; otherwise this is fine. </blockquote></details> <details> <summary>tegg/benchmark/http/app/router.d.ts (1)</summary><blockquote> `1-3`: **Prefer explicit default function in d.ts for clarity** Avoid the `_default` alias; declare the default export directly. ```diff -import type { Application } from 'egg'; -declare const _default: (app: Application) => void; -export default _default; +import type { Application } from 'egg'; +export default function router(app: Application): void;tegg/benchmark/http/app/controller/template/egg_controller_1.d.ts (1)
1-4: Useimport typefor clarity in declarationsMake the import explicitly type-only.
-import { Controller } from 'egg'; +import type { Controller } from 'egg'; export default class EggController1 extends Controller { hello(): Promise<void>; }tegg/benchmark/http/app/controller/FooTeggController.js (1)
20-20: JSON import attribute requires Node ≥ 22 — confirm engines or use fallback
with { type: 'json' }needs modern Node. If Node 18/20 must remain supported in benches/CI, prefercreateRequire.-import pkg from 'egg/package.json' with { type: 'json' }; +import { createRequire } from 'node:module'; +const require = createRequire(import.meta.url); +const pkg = require('egg/package.json');packages/utils/src/import.ts (1)
52-56: Environment flag is correctly used; flexible parsing is an optional enhancementThe current strict string-based checks (
=== 'false'/=== 'true') work correctly and are consistently used:
- Start script sets
'false'explicitly- Test validates this behavior
- No usage of alternative forms ('0', 'off', 'no') found in the codebase
The suggested helper function would add defensive robustness for future use, but is not required given the current consistent practice. If added, update both the early return and the "true" branch as specified in the original suggestion.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (16)
packages/utils/src/import.ts(1 hunks)packages/utils/test/import.test.ts(2 hunks)tegg/benchmark/http/app/controller/FooTeggController.d.ts(1 hunks)tegg/benchmark/http/app/controller/FooTeggController.js(1 hunks)tegg/benchmark/http/app/controller/template/egg_controller_1.d.ts(1 hunks)tegg/benchmark/http/app/router.d.ts(1 hunks)tegg/benchmark/http/config/config.default.d.ts(1 hunks)tools/create-egg/src/templates/tegg/README.md(2 hunks)tools/create-egg/src/templates/tegg/config/config.local.ts(1 hunks)tools/create-egg/src/templates/tegg/config/config.prod.ts(1 hunks)tools/create-egg/src/templates/tegg/config/config.unittest.ts(1 hunks)tools/create-egg/src/templates/tegg/config/plugin.ts(1 hunks)tools/create-egg/src/templates/tegg/package.json(2 hunks)tools/create-egg/test/cli.test.ts(3 hunks)tools/scripts/src/commands/start.ts(1 hunks)tools/scripts/src/commands/stop.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (9)
**/*.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:
tools/create-egg/src/templates/tegg/config/config.unittest.tspackages/utils/src/import.tstegg/benchmark/http/app/router.d.tspackages/utils/test/import.test.tstools/create-egg/src/templates/tegg/config/plugin.tstegg/benchmark/http/app/controller/FooTeggController.d.tstools/create-egg/src/templates/tegg/config/config.local.tstools/scripts/src/commands/start.tstools/create-egg/src/templates/tegg/config/config.prod.tstools/scripts/src/commands/stop.tstegg/benchmark/http/config/config.default.d.tstegg/benchmark/http/app/controller/template/egg_controller_1.d.tstools/create-egg/test/cli.test.ts
{packages/**,plugins/**,tools/!(egg-bin)/**}/**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
{packages/**,plugins/**,tools/!(egg-bin)/**}/**/*.ts: For isolatedDeclarations support, all exported functions/methods/getters must have explicit return type annotations
Avoid computed property names with symbols in class declarations (no get SYM)
Add explicit type annotations for class properties when needed (no inferred exported property types)
Exported symbols must use unique symbol type (e.g., export const X: unique symbol = Symbol('x'))
Files:
tools/create-egg/src/templates/tegg/config/config.unittest.tspackages/utils/src/import.tspackages/utils/test/import.test.tstools/create-egg/src/templates/tegg/config/plugin.tstools/create-egg/src/templates/tegg/config/config.local.tstools/scripts/src/commands/start.tstools/create-egg/src/templates/tegg/config/config.prod.tstools/scripts/src/commands/stop.tstools/create-egg/test/cli.test.ts
packages/**/src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use TypeScript for all source files in packages (no JavaScript source files)
Files:
packages/utils/src/import.ts
packages/**/test/**/*.test.ts
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
packages/**/test/**/*.test.ts: Name test files as test/**/*.test.ts and run them with Vitest
Use import { describe, it } from 'vitest' in tests
Use Node.js built-in assert module for test assertions
Files:
packages/utils/test/import.test.ts
**/test/**/*.test.ts
📄 CodeRabbit inference engine (AGENTS.md)
**/test/**/*.test.ts: Place test suites following Vitest discovery: /test//*.test.ts
Mirror the repository test pattern when adding new suites
Files:
packages/utils/test/import.test.tstools/create-egg/test/cli.test.ts
{packages/!(cookies)/**/test/**/*.test.ts,plugins/**/test/**/*.test.ts}
📄 CodeRabbit inference engine (CLAUDE.md)
Vitest test files must follow the naming pattern test/**/*.test.ts
Files:
packages/utils/test/import.test.ts
{packages/**/test/**,plugins/**/test/**}
📄 CodeRabbit inference engine (CLAUDE.md)
Use Node.js assert for assertions in Vitest tests
Files:
packages/utils/test/import.test.ts
{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/create-egg/src/templates/tegg/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/create-egg/src/templates/tegg/package.json
🧠 Learnings (10)
📚 Learning: 2025-09-18T07:56:17.417Z
Learnt from: CR
PR: eggjs/egg#0
File: AGENTS.md:0-0
Timestamp: 2025-09-18T07:56:17.417Z
Learning: Applies to **/*.ts : Re-export types thoughtfully to keep the public API stable
Applied to files:
packages/utils/test/import.test.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/**/test/**/*.test.ts : Use import { describe, it } from 'vitest' in tests
Applied to files:
packages/utils/test/import.test.ts
📚 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/**/vitest.config.ts,plugins/**/vitest.config.ts} : Packages using Vitest must include a vitest.config.ts and import test functions from vitest
Applied to files:
packages/utils/test/import.test.ts
📚 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/**/test/**,plugins/**/test/**} : Use Node.js assert for assertions in Vitest tests
Applied to files:
packages/utils/test/import.test.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/**/test/**/*.test.ts : Use Node.js built-in assert module for test assertions
Applied to files:
packages/utils/test/import.test.ts
📚 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/create-egg/src/templates/tegg/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/plugin/*/package.json : Plugin packages must define eggPlugin in package.json with dependencies
Applied to files:
tools/create-egg/src/templates/tegg/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/create-egg/src/templates/tegg/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,plugin,standalone}/*/package.json : Set package.json "type": "module" (ESM only; no CommonJS) in all tegg packages
Applied to files:
tools/create-egg/src/templates/tegg/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: Run build, test, and versioning commands from the monorepo root (Egg.js repo), not from tegg/
Applied to files:
tools/create-egg/test/cli.test.ts
🧬 Code graph analysis (6)
tools/create-egg/src/templates/tegg/config/config.unittest.ts (1)
packages/egg/src/lib/define.ts (1)
defineConfig(29-31)
packages/utils/test/import.test.ts (1)
packages/utils/src/import.ts (1)
isSupportTypeScript(51-76)
tegg/benchmark/http/app/controller/FooTeggController.js (2)
tegg/benchmark/http/app/controller/FooTeggController.d.ts (1)
FooTeggController(1-3)packages/egg/src/index.ts (2)
HTTPMethod(157-157)HTTPMethodEnum(158-158)
tegg/benchmark/http/app/controller/FooTeggController.d.ts (1)
tegg/benchmark/http/app/controller/FooTeggController.js (1)
FooTeggController(21-25)
tools/create-egg/src/templates/tegg/config/config.local.ts (1)
packages/egg/src/lib/define.ts (1)
defineConfig(29-31)
tools/create-egg/src/templates/tegg/config/config.prod.ts (1)
packages/egg/src/lib/define.ts (1)
defineConfig(29-31)
⏰ 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). (20)
- GitHub Check: CodeQL analysis (javascript-typescript)
- GitHub Check: Agent
- GitHub Check: Socket Security: Pull Request Alerts
- GitHub Check: Test (macos-latest, 24, 1/5)
- GitHub Check: Test (windows-latest, 24, 4/5)
- GitHub Check: Test (macos-latest, 24, 2/5)
- GitHub Check: Test (windows-latest, 22, 4/5)
- GitHub Check: Test (macos-latest, 22, 5/5)
- GitHub Check: Test (macos-latest, 22, 4/5)
- GitHub Check: Test (windows-latest, 22, 2/5)
- GitHub Check: Test (windows-latest, 24, 2/5)
- GitHub Check: Test (macos-latest, 24, 4/5)
- GitHub Check: Test bin (windows-latest, 22, 2/3)
- GitHub Check: Test bin (windows-latest, 22, 0/3)
- GitHub Check: Test bin (ubuntu-latest, 22, 2/3)
- GitHub Check: Test bin (windows-latest, 22, 1/3)
- GitHub Check: Test bin (ubuntu-latest, 22, 1/3)
- GitHub Check: Test bin (ubuntu-latest, 22, 0/3)
- GitHub Check: typecheck
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (11)
tools/create-egg/src/templates/tegg/package.json (1)
9-9: LGTM!The script updates align well with the PR objectives and maintain best practices. The new
buildscript consolidates the TypeScript compilation step, andpredevensures a clean state before development. The updatedprepublishOnlyproperly delegates to the newbuildscript. All required scripts (typecheck,lint,build,clean) are present and follow the established patterns. Node.js engine requirement is correctly set to >=22.18.0 as per coding guidelines.Also applies to: 19-19, 21-21
tools/create-egg/src/templates/tegg/config/config.unittest.ts (1)
1-5: LGTM! Improved idiomatic TypeScript pattern.The refactoring from type assertion (
as PartialEggConfig) to thedefineConfighelper function is a cleaner, more maintainable approach that still provides full type safety. This change is consistent across all config templates.tools/create-egg/src/templates/tegg/config/config.prod.ts (1)
1-5: LGTM! Consistent refactoring across templates.The production config now uses the same
defineConfigpattern as the other environment configs, ensuring consistency across all configuration templates.tools/create-egg/src/templates/tegg/config/config.local.ts (1)
1-5: LGTM! Completes the consistent refactoring.The local config now matches the pattern used in production and unittest configs. This unified approach using
defineConfigimproves maintainability and provides a better developer experience for projects created from these templates.tools/scripts/src/commands/stop.ts (1)
13-16: Remove the review comment — the path structure change is correct and necessary.The original review incorrectly warns about breaking existing deployments with old path structures. However, the @eggjs/cluster package exports files directly from
./dist/agent_worker.jsand./dist/app_worker.js, with nocommonjs/oresm/subdirectories. The regex patterns in this PR are being corrected to match the actual current package structure, not narrowed to break backward compatibility. The old paths referenced in the original comments never existed in the published package distribution—this is a necessary fix to align the detection logic with reality.Likely an incorrect or invalid review comment.
tegg/benchmark/http/config/config.default.d.ts (1)
1-3: Minimal d.ts looks good.Default export typed as PartialEggConfig is appropriate here.
packages/utils/test/import.test.ts (2)
4-4: Adding vi import is fine.Needed for env stubbing; no issues.
7-7: Public API surface change: isSupportTypeScript export.Confirm this is intended to be public and covered by semver docs/changelog. If it’s internal-only, consider not exporting from index.
Based on learnings.
tegg/benchmark/http/app/controller/FooTeggController.d.ts (1)
1-3: Typings match runtime implementationThe declaration aligns with FooTeggController.js (hello(): Promise). LGTM.
packages/utils/src/import.ts (2)
64-65: Confirm Node-version heuristic for TS support
nodeMajorVersion >= 22enabling TS may be misleading since Node doesn’t natively execute.tswithout a loader. Verify this is intentional and safe (no accidental TS resolution when no loader is present).
67-73: Debug log improvement acknowledgedLogging
Object.keys(extensions)avoids noisy dumps. Good change.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

use
EGG_TS_ENABLE=falseSummary by CodeRabbit
New Features
Chores