Skip to content

Added plan for merging Koenig packages into the monorepo - #29156

Closed
kevinansfield wants to merge 3 commits into
mainfrom
koenig-monorepo-merge-plan
Closed

Added plan for merging Koenig packages into the monorepo#29156
kevinansfield wants to merge 3 commits into
mainfrom
koenig-monorepo-merge-plan

Conversation

@kevinansfield

Copy link
Copy Markdown
Member

Summary

This PR adds a plan document (docs/koenig-monorepo-merge-plan.md) proposing the migration of all 13 Koenig packages from TryGhost/Koenig into this repo under koenig/*, with full git history preserved. No migration work happens in this PR — it's the plan itself, published for review.

It supersedes an unmerged July 2025 attempt, which predated the Yarn→pnpm switch, the Nx-affected CI restructure, and the pnpm deploy-based release packaging. Everything in the doc was re-verified against both repos as of 2026-07-07.

Key points for reviewers

Git migration

  • git filter-repo --path packages/ --path-rename packages/:koenig/ — only package history is imported, so there are no root-file conflicts to resolve. Commit-message issue refs get rewritten to TryGhost/Koenig#N, and the ~2k lerna tags are stripped.
  • The import must land as a true merge commit, which our squash-merge PR flow would destroy — needs an admin push or a one-off merge-commit PR (same as the 2022 Admin merge), plus a short freeze on the Koenig repo.

Dependency model

  • All Ghost consumers (ghost/core, ghost/admin, apps/admin, apps/posts, apps/admin-x-settings, apps/admin-x-framework) switch to workspace:*; Koenig inter-package deps use workspace:~ so published artifacts tolerate the auto-computed patch digit.
  • Local dev and CI never touch npm for Koenig packages. Production doesn't either: pnpm deploy --config.inject-workspace-packages=true in ghost/core/scripts/pack.js ships them as component tarballs inside the Ghost archive, same as @tryghost/i18n today — version skew between Ghost and the editor becomes structurally impossible.

CI

  • No bespoke Koenig test job. Packages conform to the existing conventions (test:unit, test:acceptance) and flow through the Nx-affected machinery; koenig-lexical's Playwright suite joins job_apps_acceptance-tests (needs the MS core fonts install added there).

Publishing

  • npm publishing continues for external consumers only (gscan, third parties using the renderers), and moves from lerna/yarn ship to an automated publish_koenig_packages job in the release (tag) lane, gated on publish_ghost succeeding. Only packages changed since the previous release tag are published, with the patch number computed from npm (same model as public apps). A workflow_dispatch escape hatch covers urgent out-of-band publishes.

Main risk called out

  • The Yarn v1 → pnpm jump: phantom dependencies and catalogMode: strict normalization are the least predictable part; the first full pnpm install + build + test run is the real smoke test.

Full details, current dependency graph, step-by-step process, and a verification checklist are in the doc.

- documents the proposed migration of all 13 Koenig packages into koenig/* with full git history (git filter-repo + merge commit)
- production and local dev stop depending on npm-published Koenig packages: workspace links for dev/CI, component tarballs in the Ghost archive for releases
- npm publishing continues for external consumers only, automated as part of the Ghost release (tag) lane rather than per main-merge
- published for team review before any migration work starts
@cursor

cursor Bot commented Jul 7, 2026

Copy link
Copy Markdown

Bugbot is not enabled for this team, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@nx-cloud

nx-cloud Bot commented Jul 7, 2026

Copy link
Copy Markdown

🤖 Nx Cloud AI Fix

Ensure the fix-ci command is configured to always run in your CI pipeline to get automatic fixes in future runs. For more information, please see https://nx.dev/ci/features/self-healing-ci


View your CI Pipeline Execution ↗ for commit 8f872f0

Command Status Duration Result
nx run-many -t lint -p ghost-monorepo ✅ Succeeded <1s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-07-08 08:42:13 UTC

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: fdf66ad4-586c-4eef-807e-4e7de8e1de29

📥 Commits

Reviewing files that changed from the base of the PR and between b17d591 and 8f872f0.

📒 Files selected for processing (1)
  • docs/koenig-monorepo-merge-plan.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/koenig-monorepo-merge-plan.md

Walkthrough

This pull request adds docs/koenig-monorepo-merge-plan.md, a runbook for merging Koenig into Ghost under koenig/ while preserving git history. It documents the merge sequence, workspace and dependency changes, CI and release publishing updates, demo hosting, cleanup tasks, and a verification checklist. No exported code entities are changed.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding a plan to merge Koenig packages into the monorepo.
Description check ✅ Passed The description is directly about the same Koenig monorepo merge plan and matches the documented changes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch koenig-monorepo-merge-plan

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f625831214

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


| File | Packages |
|------|----------|
| `ghost/core/package.json` | kg-card-factory, kg-clean-basic-html, kg-converters, kg-default-cards, kg-default-nodes, kg-html-to-lexical, kg-lexical-html-renderer, kg-markdown-html-renderer |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Pack transitive Koenig packages in the archive

Following this ghost/core dependency list leaves packages such as kg-utils and kg-default-transforms only as transitive Koenig dependencies, but ghost/core/scripts/pack.js only repacks file: refs found in the deployed root pkg.dependencies. Those transitive workspace:~ deps will be rewritten by pnpm pack to semver ranges and fetched from npm during ghost install --archive, so the plan does not satisfy the stated zero-registry/zero-skew production requirement unless every Koenig package needed at runtime is made a root dependency or the pack step is made recursive.

Useful? React with 👍 / 👎.

Comment on lines +137 to +141
**Root `package.json`:** keep `dev:lexical` as-is (it already points at the
built editor assets); optionally add `dev:koenig` →
`pnpm nx run @tryghost/koenig-lexical:dev` for standalone editor dev with
EDITOR_URL pointing at the Vite dev server. Check the docker-compose dev
setup (`ghost-monorepo:docker:dev`) mounts `koenig/` like it does `apps/`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Copy Koenig manifests into the dev image

After Step 4 changes ghost/core to use workspace:* Koenig dependencies, the dev Docker build needs the Koenig package manifests before pnpm install: I checked docker/ghost-dev/Dockerfile, and it currently copies only the root plus ghost/core, ghost/i18n, and ghost/parse-email-address package.json files, while compose.dev.yaml mounts only those Ghost subtrees at runtime. Only checking the compose mount here misses the Dockerfile update, so a fresh pnpm dev image will fail to resolve the new workspace dependencies instead of satisfying the local-dev requirement.

Useful? React with 👍 / 👎.

Comment on lines +213 to +215
- **Path filters:** confirm the `shared`/`e2e`/`any-code` path filters in
`job_setup` treat `koenig/**` as code (Nx-affected does the per-project
work, but the workflow-level filters gate whole lanes like run_e2e).

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Gate core server tests on Koenig changes

The path-filter checklist should include the core filter as well: in .github/workflows/ci.yml, job_acceptance-tests and job_legacy-tests run only when changed_core == true, and that filter currently matches ghost/** rather than future koenig/** paths. Since ghost/core will directly depend on the Koenig renderers/converters, a server-affecting change under koenig/ could skip Ghost integration/e2e/legacy suites unless the plan updates that gate or moves it to Nx affected.

Useful? React with 👍 / 👎.

Comment on lines +236 to +240
- **Changed-only detection via git, not Nx-affected:** checkout with
`fetch-depth: 0`, find the previous release tag with
`git describe --tags --abbrev=0 --match 'v*' ${GITHUB_REF_NAME}^`, and for
each koenig package publish only if
`git diff --quiet $PREV $GITHUB_REF_NAME -- koenig/<pkg>/` reports changes.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Publish Koenig packages for shared dependency changes

Selecting npm publishes only with git diff ... -- koenig/<pkg>/ misses changes outside the package directory that still alter what gets published, especially the catalog-normalized dependencies the plan introduces in pnpm-workspace.yaml. For example, a Lexical or React catalog bump would change the dependency version that pnpm publish writes into Koenig package manifests, but no package would be selected, leaving external npm consumers on the old dependency line while Ghost's workspace build uses the new one.

Useful? React with 👍 / 👎.

- Playwright CI matrix selection uses an nx 'playwright' tag instead of directory globs, per review
- MS core fonts install dropped: the visual-regression assertions it supported no longer exist in koenig-lexical's suite
@cursor

cursor Bot commented Jul 7, 2026

Copy link
Copy Markdown

Bugbot is not enabled for this team, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

The first full CI run showed caret-position assertions depend on Arial
font metrics (not just the removed screenshot assertions), and firefox
video card tests need system codecs via playwright install-deps.
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