Skip to content

Moved @tryghost/dynamic-routing-events to Ghost core#22327

Merged
daniellockyer merged 2 commits intomainfrom
dynamic-routing-events
Mar 4, 2025
Merged

Moved @tryghost/dynamic-routing-events to Ghost core#22327
daniellockyer merged 2 commits intomainfrom
dynamic-routing-events

Conversation

@daniellockyer
Copy link
Contributor

fix https://linear.app/ghost/issue/ENG-2065/dynamic-routing-events

  • this package just exports one class, which is used by the server and frontend code, so I think it's OK to move it into shared until we have a better place to put it
  • this then also removes the files for this package, as it's no longer needed

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 3, 2025

Walkthrough

The changes remove multiple Docker volume declarations from the configuration file, eliminating mounts previously used for dynamic routing and members events modules. Import paths across various services and tests have been updated to reference local files instead of external packages, specifically for the URL resource updated event and members events components. The external dependencies for dynamic routing events and members events services have been removed from the main package configuration, reflecting a shift away from these packages. Additional adjustments include the removal of ESLint configuration files, test suites, and module export files related to these services. The updates indicate a reorganization of how specific event handling and related services are implemented and referenced, consolidating functionality into local modules and simplifying the Docker and dependency setup.

Suggested labels

browser-tests


📜 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 f2016bb4d219b46a6ce1ef016b0479efe3306a31 and ddd4e1d.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (21)
  • compose.yml (0 hunks)
  • ghost/core/core/frontend/services/sitemap/SiteMapManager.js (1 hunks)
  • ghost/core/core/server/services/members-events/index.js (1 hunks)
  • ghost/core/core/server/services/url/Resources.js (1 hunks)
  • ghost/core/package.json (0 hunks)
  • ghost/core/test/unit/frontend/services/sitemap/manager.test.js (1 hunks)
  • ghost/core/test/unit/server/services/members-events/event-storage.test.js (1 hunks)
  • ghost/core/test/unit/server/services/members-events/last-seen-at-cache.test.js (1 hunks)
  • ghost/core/test/unit/server/services/members-events/last-seen-at-updater.test.js (1 hunks)
  • ghost/core/test/unit/shared/events/URLResourceUpdatedEvent.test.js (1 hunks)
  • ghost/dynamic-routing-events/.eslintrc.js (0 hunks)
  • ghost/dynamic-routing-events/README.md (0 hunks)
  • ghost/dynamic-routing-events/index.js (0 hunks)
  • ghost/dynamic-routing-events/package.json (0 hunks)
  • ghost/dynamic-routing-events/test/.eslintrc.js (0 hunks)
  • ghost/dynamic-routing-events/test/dynamic-routing-events.test.js (0 hunks)
  • ghost/members-events-service/.eslintrc.js (0 hunks)
  • ghost/members-events-service/index.js (0 hunks)
  • ghost/members-events-service/lib/index.js (0 hunks)
  • ghost/members-events-service/package.json (0 hunks)
  • ghost/members-events-service/test/.eslintrc.js (0 hunks)
💤 Files with no reviewable changes (13)
  • ghost/dynamic-routing-events/index.js
  • ghost/members-events-service/test/.eslintrc.js
  • ghost/dynamic-routing-events/test/dynamic-routing-events.test.js
  • ghost/members-events-service/lib/index.js
  • ghost/dynamic-routing-events/README.md
  • ghost/members-events-service/index.js
  • ghost/members-events-service/package.json
  • compose.yml
  • ghost/members-events-service/.eslintrc.js
  • ghost/core/package.json
  • ghost/dynamic-routing-events/package.json
  • ghost/dynamic-routing-events/test/.eslintrc.js
  • ghost/dynamic-routing-events/.eslintrc.js
✅ Files skipped from review due to trivial changes (2)
  • ghost/core/test/unit/server/services/members-events/event-storage.test.js
  • ghost/core/test/unit/server/services/members-events/last-seen-at-cache.test.js
🚧 Files skipped from review as they are similar to previous changes (3)
  • ghost/core/core/frontend/services/sitemap/SiteMapManager.js
  • ghost/core/test/unit/frontend/services/sitemap/manager.test.js
  • ghost/core/core/server/services/url/Resources.js
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Setup
🔇 Additional comments (4)
ghost/core/test/unit/shared/events/URLResourceUpdatedEvent.test.js (1)

2-2: Import path updated to reference the core module instead of the package.

This change aligns with the PR objective of moving the @tryghost/dynamic-routing-events package into Ghost core. The import now directly references the URLResourceUpdatedEvent from its new location in the core/shared/events directory instead of importing it through an index file.

ghost/core/core/server/services/members-events/index.js (1)

16-18: Import paths updated correctly.

The imports have been properly updated to use local modules instead of the external @tryghost/members-events-service package, aligning with the PR objective of moving external packages into Ghost core.

ghost/core/test/unit/server/services/members-events/last-seen-at-updater.test.js (2)

1-1: Added missing should dependency.

The should assertion library has been properly added as a dependency, ensuring test assertions like should.throws() (line 26) are properly supported.


4-4:

Details

✅ Verification successful

Module import path corrected.

The import path for LastSeenAtUpdater has been updated to reference the module in its new location in Ghost core, consistent with the PR's objective of relocating external packages into the core.

Run the following script to validate that the import path is correct:


🏁 Script executed:

#!/bin/bash
# Description: Verify that the LastSeenAtUpdater module exists at the specified path

# Check if the file exists at the specified path
ls -la ghost/core/core/server/services/members-events/LastSeenAtUpdater.js

# Check other files that have been moved into the same directory
ls -la ghost/core/core/server/services/members-events/

Length of output: 636


Verified: Module import path is correct.
The import statement in
ghost/core/test/unit/server/services/members-events/last-seen-at-updater.test.js
now correctly resolves to the module at
ghost/core/core/server/services/members-events/LastSeenAtUpdater.js
as confirmed by the file system check.

  • The file exists with the expected permissions.
  • The relative path (../../../../../core/server/services/members-events/LastSeenAtUpdater) accurately navigates from the test file to the module.
✨ Finishing Touches
  • 📝 Generate Docstrings

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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

fix https://linear.app/ghost/issue/ENG-2065/dynamic-routing-events

- this package just exports one class, which is used by the server and
  frontend code, so I think it's OK to move it into shared until we have
  a better place to put it
- this then also removes the files for this package, as it's no longer
  needed
@daniellockyer daniellockyer force-pushed the dynamic-routing-events branch from f2016bb to 9df0fa8 Compare March 3, 2025 14:53
fix https://linear.app/ghost/issue/ENG-2066/members-events-service

- this commit migrates the code and test for the members events service
  into Ghost core so we can keep all related code together and reduce
  overhead
- as a result of this change, we can remove the package and associated
  references
@daniellockyer daniellockyer merged commit ca7e622 into main Mar 4, 2025
24 checks passed
@daniellockyer daniellockyer deleted the dynamic-routing-events branch March 4, 2025 07:42
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