Moved the comments domain from the posts package into apps/admin - #29209
Conversation
ref https://linear.app/ghost/issue/PLA-221/posts-admin-move-tags-comments-automations - third domain to leave the posts package as it dissolves into apps/admin; comments already read the filter engine from admin-x-framework (extracted earlier), so its only posts-internal ties were MainLayout and the comments-only pinning hook, both handled here - the comments route folds into the shell's own route table; MainLayout is replaced with shade Box + Container, unchanged rendering - use-comments-pinning-enabled moves into the comments domain (its only consumers) - brings the migrated code up to Admin's stricter lint/tsconfig: verbatimModuleSyntax type-only imports, voided react-query fetchNextPage, a non-component thread-link helper extracted for react-refresh, and the nql-lang test type declaration carried over - the moved tests colocate beside their sources; adds @tryghost/nql-lang to admin for the comment-fields filter test
WalkthroughThis PR migrates the comments feature from apps/posts into apps/admin. It adds a new /comments route in apps/admin's router and removes the corresponding route from apps/posts. Import paths across comment components, hooks, and tests are updated from Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx run @tryghost/admin:build |
✅ Succeeded | 5s | View ↗ |
nx run ghost:build:assets |
✅ Succeeded | 2s | View ↗ |
nx run ghost:build:tsc |
✅ Succeeded | 7s | View ↗ |
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗
☁️ Nx Cloud last updated this comment at 2026-07-09 17:48:40 UTC
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/admin/package.json`:
- Line 22: Move `@tryghost/nql-lang` out of the production dependencies and into
devDependencies in the admin package manifest, since it is only used by the
comment-fields test and should not be included in the shipped runtime bundle.
Update the package.json entry for `@tryghost/nql-lang` accordingly and keep the
rest of the dependency list unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: a815ef3f-ac9a-4abb-8897-03cfb0fe52b0
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (28)
apps/admin/package.jsonapps/admin/src/comments/comment-fields.test.tsapps/admin/src/comments/comment-fields.tsapps/admin/src/comments/comment-filter-query.test.tsapps/admin/src/comments/comment-filter-query.tsapps/admin/src/comments/comments.tsxapps/admin/src/comments/components/comment-content.tsxapps/admin/src/comments/components/comment-header.test.tsxapps/admin/src/comments/components/comment-header.tsxapps/admin/src/comments/components/comment-likes-modal.tsxapps/admin/src/comments/components/comment-menu.tsxapps/admin/src/comments/components/comment-metrics.tsxapps/admin/src/comments/components/comment-reports-modal.tsxapps/admin/src/comments/components/comment-thread-list.tsxapps/admin/src/comments/components/comment-thread-sidebar.tsxapps/admin/src/comments/components/comments-filters.tsxapps/admin/src/comments/components/comments-list.tsxapps/admin/src/comments/components/disable-commenting-dialog.tsxapps/admin/src/comments/components/thread-link.tsapps/admin/src/comments/hooks/use-comments-pinning-enabled.tsapps/admin/src/comments/hooks/use-filter-state.test.tsxapps/admin/src/comments/hooks/use-filter-state.tsapps/admin/src/comments/legacy-comment-filter-query.tsapps/admin/src/comments/use-comment-filter-fields.test.tsxapps/admin/src/comments/use-comment-filter-fields.tsapps/admin/src/nql-lang.d.tsapps/admin/src/routes.tsxapps/posts/src/routes.tsx
💤 Files with no reviewable changes (1)
- apps/posts/src/routes.tsx
| "@tryghost/admin-x-settings": "workspace:*", | ||
| "@tryghost/kg-unsplash-selector": "workspace:*", | ||
| "@tryghost/koenig-lexical": "workspace:*", | ||
| "@tryghost/nql-lang": "catalog:", |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Description: Check whether `@tryghost/nql-lang` is imported in non-test source files within apps/admin.
# Search for imports of `@tryghost/nql-lang` in non-test files
rg -nP --type=ts --type=tsx -g '!**/*.test.*' -g '!**/*.spec.*' "`@tryghost/nql-lang`" apps/admin/src/ 2>/dev/null || echo "No non-test imports found"
# Also check for any require() calls
rg -nP "require\(['\"]`@tryghost/nql-lang`" apps/admin/src/ 2>/dev/null || echo "No require() calls found"Repository: TryGhost/Ghost
Length of output: 203
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo '--- apps/admin/package.json ---'
nl -ba apps/admin/package.json | sed -n '1,120p'
echo
echo '--- repo-wide references to `@tryghost/nql-lang` ---'
rg -n "`@tryghost/nql-lang`" . --glob '!**/node_modules/**' --glob '!**/dist/**' --glob '!**/build/**' || true
echo
echo '--- test-file references under apps/admin ---'
rg -n "`@tryghost/nql-lang`" apps/admin --glob '**/*.test.*' --glob '**/*.spec.*' --glob '!**/node_modules/**' || trueRepository: TryGhost/Ghost
Length of output: 224
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo '--- apps/admin/package.json (top-level deps) ---'
sed -n '1,140p' apps/admin/package.json
echo
echo '--- repo-wide references to `@tryghost/nql-lang` ---'
rg -n "`@tryghost/nql-lang`" . --glob '!**/node_modules/**' --glob '!**/dist/**' --glob '!**/build/**' || true
echo
echo '--- test-file references under apps/admin ---'
rg -n "`@tryghost/nql-lang`" apps/admin --glob '**/*.test.*' --glob '**/*.spec.*' --glob '!**/node_modules/**' || trueRepository: TryGhost/Ghost
Length of output: 6573
Move @tryghost/nql-lang to devDependencies. It’s only imported by apps/admin/src/comments/comment-fields.test.ts, so it doesn’t need to ship as a production dependency.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@apps/admin/package.json` at line 22, Move `@tryghost/nql-lang` out of the
production dependencies and into devDependencies in the admin package manifest,
since it is only used by the comment-fields test and should not be included in
the shipped runtime bundle. Update the package.json entry for `@tryghost/nql-lang`
accordingly and keep the rest of the dependency list unchanged.
Source: Coding guidelines
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #29209 +/- ##
==========================================
+ Coverage 74.04% 74.07% +0.02%
==========================================
Files 1570 1570
Lines 136624 136624
Branches 16524 16528 +4
==========================================
+ Hits 101165 101199 +34
+ Misses 34423 34389 -34
Partials 1036 1036
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|

ref https://linear.app/ghost/issue/PLA-221/posts-admin-move-tags-comments-automations
Third domain to leave the
postspackage as it dissolves intoapps/admin(PLA-221), after tags and automations.Comments was the cleanest large move because the shared filter engine was already extracted to
admin-x-frameworkin an earlier PR — comments already imports@tryghost/admin-x-framework/filters//filter-sources/utils/get-site-timezone. So its only remaining posts-internal ties wereMainLayoutand the comments-onlyuse-comments-pinning-enabledhook.What changed
apps/posts/src/views/comments/→apps/admin/src/comments/(17 files);use-comments-pinning-enabled(its only consumers are comments) moves intosrc/comments/hooks/.MainLayout→ shadeBox+Container, matching the tags/automations moves; rendered layout unchanged.Admin strictness
The stricter admin config surfaced the usual set, all fixed at source (no disables):
verbatimModuleSyntax: type-only imports forComment,Filter,FilterFieldConfig,ValueSourceno-misused-promises: react-queryfetchNextPagevoided at the two call sitesreact-refresh/only-export-components: the non-componentbuildThreadLinkhelper extracted tothread-link.tsexpect.any(Function)cast; carried over the@tryghost/nql-langmodule type declaration and added the dep (used by the comment-fields filter test)Verification
tsc -b,eslint .(admin) — exit 0vitest run(admin) — 479 tests pass (incl. the 5 moved comments suites, 30 tests)@tryghost/postsbuild / lint / test — exit 0 (comments removed cleanly; 279 tests, the 30 comments tests now live in admin)nx build @tryghost/admin— exit 0; comments code-splits into its own lazy chunkComments has solid e2e coverage (
comment-moderation,disable-commenting,thread-sidebar), so the domain move is well netted.