Skip to content

fix: i18n.json is now virtual module#80

Merged
JounQin merged 2 commits intomainfrom
fix/i18n
Jun 9, 2025
Merged

fix: i18n.json is now virtual module#80
JounQin merged 2 commits intomainfrom
fix/i18n

Conversation

@JounQin
Copy link
Member

@JounQin JounQin commented Jun 9, 2025

related web-infra-dev/rspress#2019

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of the i18n configuration file, preventing unnecessary restarts when changes are detected.
  • Chores
    • Updated internal tracking for configuration files to streamline file change detection.

@JounQin JounQin self-assigned this Jun 9, 2025
Copilot AI review requested due to automatic review settings June 9, 2025 10:00
@JounQin JounQin added the bug Something isn't working label Jun 9, 2025
@changeset-bot
Copy link

changeset-bot bot commented Jun 9, 2025

🦋 Changeset detected

Latest commit: ea076ab

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@alauda/doom Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link

coderabbitai bot commented Jun 9, 2025

Walkthrough

A patch update was recorded for the @alauda/doom package to fix the handling of the i18n.json file by making it a virtual module. In the CLI source, references to the i18n file were removed from configuration arrays and file change detection logic, streamlining how file changes trigger restarts.

Changes

File(s) Change Summary
.changeset/sharp-snails-draw.md Added changeset describing a patch for making i18n.json a virtual module in @alauda/doom.
src/cli/index.ts Removed I18N_FILE from imports and config arrays; simplified file watcher to exclude i18n.

Poem

In the warren, code hops anew,
i18n now virtual, not in the queue.
The watcher listens with keener ear,
Only the right files trigger a cheer.
Patch applied, the snails draw near—
🐇✨ All is tidy, nothing to fear!


📜 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 b1c632f and ea076ab.

📒 Files selected for processing (2)
  • .changeset/sharp-snails-draw.md (1 hunks)
  • src/cli/index.ts (3 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/cli/index.ts (1)
src/cli/constants.ts (2)
  • DEFAULT_CONFIGS (26-28)
  • SITES_FILE (32-32)
🪛 LanguageTool
.changeset/sharp-snails-draw.md

[uncategorized] ~5-~5: You might be missing the article “a” here.
Context: ...om": patch --- fix: i18n.json is now virtual module

(AI_EN_LECTOR_MISSING_DETERMINER_A)

⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Build and Lint with Node.js 24 on ubuntu-latest
  • GitHub Check: Build and Lint with Node.js 22 on ubuntu-latest
  • GitHub Check: Build and Lint with Node.js 18 on ubuntu-latest
🔇 Additional comments (4)
.changeset/sharp-snails-draw.md (1)

1-6: LGTM! Changeset follows proper format.

The changeset correctly documents the patch update for the @alauda/doom package. The description "fix: i18n.json is now virtual module" is clear and appropriate for a changeset title - no article is needed here.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~5-~5: You might be missing the article “a” here.
Context: ...om": patch --- fix: i18n.json is now virtual module

(AI_EN_LECTOR_MISSING_DETERMINER_A)

src/cli/index.ts (3)

19-19: Clean removal of I18N_FILE import.

The removal of I18N_FILE from the import statement aligns with treating i18n.json as a virtual module, eliminating the need to track it as a regular configuration file.


29-29: CONFIG_FILES array correctly updated.

The array now only includes DEFAULT_CONFIGS and SITES_FILE, which is appropriate since i18n files are now handled as virtual modules and don't need to be tracked in the configuration files list.


173-180: File watcher logic properly simplified.

The removal of the config.i18nSourcePath condition from the file watcher makes sense for virtual modules. The watcher now only restarts the dev server for actual configuration file changes (CONFIG_FILES) and meta file changes, which is the expected behavior when i18n is handled virtually.

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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

The PR removes direct references to the now-virtual i18n.json file so it’s no longer treated as a physical config file or trigger for watcher restarts.

  • Drop I18N_FILE from imported constants and CONFIG_FILES
  • Adjust file-watcher logic to stop checking for i18n.json changes
Comments suppressed due to low confidence (2)

src/cli/index.ts:29

  • Add or update tests to verify that the file watcher no longer restarts when the virtual i18n.json module is modified, ensuring this behavior is covered.
const CONFIG_FILES = [...DEFAULT_CONFIGS, SITES_FILE]

src/cli/index.ts:19

  • [nitpick] If I18N_FILE is not used anywhere else, consider removing its definition and export from constants.js to clean up dead code.
import { CWD, DEFAULT_CONFIGS, SITES_FILE } from './constants.js'

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jun 9, 2025

Open in StackBlitz

npm i https://pkg.pr.new/@alauda/doom@80

commit: ea076ab

Signed-off-by: JounQin <admin@1stg.me>
@JounQin JounQin merged commit 853961e into main Jun 9, 2025
16 checks passed
@JounQin JounQin deleted the fix/i18n branch June 9, 2025 10:06
github-actions bot pushed a commit that referenced this pull request Jun 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants