Skip to content

fix: codemod publish and docs 5x - #2759

Merged
wayfarer3130 merged 6 commits into
mainfrom
fix/codemod-publish-and-docs-5x
Jun 11, 2026
Merged

wayfarer3130 merged 6 commits into
mainfrom
fix/codemod-publish-and-docs-5x

Conversation

@wayfarer3130

@wayfarer3130 wayfarer3130 commented Jun 10, 2026 •

Copy link
Copy Markdown
Collaborator

No functitonal change, just publish codemod and versions to github.
Update the docs to 5.x

Context

Changes & Results

Testing

Checklist

PR

  • [] My Pull Request title is descriptive, accurate and follows the
    semantic-release format and guidelines.

Code

  • [] My code has been well-documented (function documentation, inline comments,
    etc.)

Public Documentation Updates

  • [] The documentation page has been updated as necessary for any public API
    additions or removals.

Tested Environment

  • [] "OS:
  • [] "Node version:
  • [] "Browser:

Summary by CodeRabbit

  • Documentation

    • Updated codemod usage and registry references to use scoped package names across guides and CLI examples
    • Refreshed migration guides, navigation and version labeling to emphasize 5.x migration resources
  • Chores

    • Improved publish process with best-effort GitHub release creation after tagging; safer token handling and non-blocking failures
    • Made several packages publishable (public) and updated workflows/verifications to use scoped codemod package identifiers
    • Tightened version file generation to only write releases for public packages with source present

wayfarer3130 and others added 3 commits June 10, 2026 16:36
The codemod publish CLI rejects slash-namespaced names (cornerstone3d/5, cornerstone3d/5/generic-viewport); names must match ^(@scope/)?name$. Rename the published packages under the @cornerstonejs scope so 'codemod publish' passes name validation: @cornerstonejs/cornerstone3d-5 and @cornerstonejs/cornerstone3d-5-generic-viewport.

Update the aggregate workflow source ref, the publish workflow verify step, and the READMEs to match. Directory paths and git tags (resolved by path) are unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The published docs header still read 4.0 (Latest) and linked the 4.x migration guides. Bump to 5.0 to match the current release line.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Since #2612 (2026-02-11) the publish pipeline runs 'lerna version' with --no-push so the version bump and generated files land as one amended commit (replacing the previous two-commit flow). But lerna only creates a GitHub release when it pushes the tag itself, so --no-push silently disabled release creation. npm kept publishing (separate 'lerna publish from-package' step), so npm latest advanced to 5.0.1 while GitHub Releases froze at v4.16.0.

Drop the now-inert --create-release github from the lerna call and instead create the release explicitly via the GitHub API after the tag is pushed.

TOKEN: reuses the same GH_TOKEN that lerna --create-release used previously (falls back to GITHUB_TOKEN). It is read from the environment in the CircleCI NPM_PUBLISH job and must be set as a CircleCI project/context environment variable (Project Settings > Environment Variables, or the shared context the workflow uses) - it is not defined in .circleci/config.yml. The token needs 'repo'/'contents: write' scope to create releases. If the token is absent or the API call fails, the step logs a warning and the build/release continues (npm publish is unaffected).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@wayfarer3130
wayfarer3130 requested a review from sedghi June 10, 2026 20:55
@coderabbitai

coderabbitai Bot commented Jun 10, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Scoped codemod package names replaced across registry entries, READMEs, and workflows; publish-version now creates GitHub releases post-tag; package manifests set public publish access and generate-version gates writing to public packages; docs config updated to surface v5 migration guides and current version label.

Changes

Cornerstone v5 Release and Documentation Updates

Layer / File(s) Summary
Codemod package naming refactor
packages/codemods/registry/cornerstone3d/5/codemod.yaml, packages/codemods/registry/cornerstone3d/5/generic-viewport/codemod.yaml, packages/codemods/registry/cornerstone3d/5/workflow.yaml, packages/codemods/README.md, packages/codemods/registry/cornerstone3d/5/README.md, packages/codemods/registry/cornerstone3d/5/generic-viewport/README.md, .github/workflows/publish-codemod-registry.yml, packages/codemods/package.json
Registry name fields, README CLI examples, workflow codemod.source, and package manifest changed from unscoped names (e.g., cornerstone3d/5...) to scoped @cornerstonejs package identifiers.
GitHub release creation refactor
publish-version.mjs
Removed --create-release github from lerna version and added createGithubRelease(tagName, version) that reads GH token env vars and invokes gh release create --generate-notes (marks prerelease when version contains -) and logs non-fatal warnings on errors.
PublishConfig and version generation gating
packages/core/package.json, packages/tools/package.json, packages/codemods/package.json, scripts/generate-version.js
Added publishConfig.access: "public" to package manifests and updated scripts/generate-version.js to skip writing src/version.ts unless publishConfig.access === 'public' and a src/ directory exists.
Documentation version update
packages/docs/docusaurus.config.js
Navbar and docs version metadata updated to reference 5x migration guides and show current docs as 5.0 (Latest) instead of 4.0 (Latest).
sequenceDiagram
  participant PublishScript as publish-version.mjs
  participant Git as git
  participant GH_CLI as gh CLI
  PublishScript->>Git: lerna version (no --create-release)
  PublishScript->>Git: git push --tags
  PublishScript->>PublishScript: createGithubRelease(tagName, version)
  PublishScript->>GH_CLI: gh release create <tag> --generate-notes [--prerelease]
  GH_CLI-->>PublishScript: success / error (logged)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 Scoped names hop in tidy rows,
README seeds point where the v5 wind blows.
Tags are pushed, a gentle GH call sings,
releases formed on careful little wings.
A rabbit cheers the tidy things.

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (2 warnings, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is largely incomplete. The author provided only a brief summary ('No functional change, just publish codemod and versions to github. Update the docs to 5.x') without filling the required template sections: Context (missing issue link), detailed Changes & Results, and Testing instructions remain unfilled. Complete the PR description by providing: (1) a Context section with issue link or reasoning, (2) detailed Changes & Results listing all modifications and their effects, and (3) Testing section with steps to verify the changes work correctly.
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The PR title 'fix: codemod publish and docs 5x' is partially related to the changeset but lacks specificity and clarity. While it mentions the main topics (codemod publish, docs 5x), it uses vague phrasing ('5x') that doesn't clearly convey what the fix addresses. Consider a more descriptive title that clarifies the main intent, such as: 'fix: update codemod registry to scoped packages and configure 5.x documentation' or 'fix: enable codemod publishing and update docs to 5.x release line'.
✅ Passed checks (2 passed)
Check name Status Explanation
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/codemod-publish-and-docs-5x

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

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

Comment thread publish-version.mjs Outdated
gh release create reads the same GH_TOKEN/GITHUB_TOKEN and infers owner/repo from the origin remote, so it replaces the hand-rolled fetch + remote-URL parsing. --verify-tag confirms the just-pushed tag exists; --generate-notes mirrors lerna's old auto-notes; --prerelease is added for prerelease versions. gh ships in CircleCI's cimg base image. Still best-effort: any failure logs a warning and does not fail the build/release.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@sedghi sedghi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we should put the public : true in package json for codemod

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

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 `@publish-version.mjs`:
- Around line 207-228: The CI is invoking publish-version.mjs which calls
execa('gh', ...) using tagName and version and requires GH_TOKEN/GITHUB_TOKEN,
but CircleCI doesn't install the gh CLI or set the token; update the CircleCI
job that runs node ./publish-version.mjs to install the GitHub CLI (gh) in the
cimg/node:24.0.0-browsers image and ensure GH_TOKEN (or GITHUB_TOKEN) is
provided via project or context environment variables, and optionally add a
pre-check in publish-version.mjs to verify gh is on PATH and the token exists
before calling execa('gh', ...) so failures are explicit.
🪄 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b8993961-cf50-41c2-9f54-84b998c491cb

📥 Commits

Reviewing files that changed from the base of the PR and between badf641 and 1bff992.

📒 Files selected for processing (1)
  • publish-version.mjs

Comment thread publish-version.mjs

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

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 `@packages/codemods/package.json`:
- Around line 10-12: The README currently states this package is intentionally
private but package.json now sets "publishConfig": {"access":"public"}, so
update the codemods README text that mentions npm visibility to reflect the
package is published publicly; locate the README section that says the package
is intentionally private and change the wording to indicate it is published to
the public npm registry (or remove the private reference), and ensure the
messaging aligns with the "publishConfig" entry in package.json so release docs
are consistent.
🪄 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 5353493c-7ca0-497e-9d94-b63537d7a564

📥 Commits

Reviewing files that changed from the base of the PR and between 1bff992 and 296cc54.

📒 Files selected for processing (1)
  • packages/codemods/package.json

Comment on lines +10 to +12
"publishConfig": {
"access": "public"
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Align npm visibility docs with the new public publish config.

Line 10 switches this package to public publish behavior, but the registry publishing docs currently state the package is intentionally private to npm (packages/codemods/README.md, Lines 68-69). Please update that text to avoid release-process confusion.

🤖 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 `@packages/codemods/package.json` around lines 10 - 12, The README currently
states this package is intentionally private but package.json now sets
"publishConfig": {"access":"public"}, so update the codemods README text that
mentions npm visibility to reflect the package is published publicly; locate the
README section that says the package is intentionally private and change the
wording to indicate it is published to the public npm registry (or remove the
private reference), and ensure the messaging aligns with the "publishConfig"
entry in package.json so release docs are consistent.

generate-version.js skipped packages without a src directory as a proxy for 'not published'. Gate on the real signal instead: publishConfig.access === 'public'. Private packages (e.g. the docs site) are skipped. A defensive no-src skip remains so a published-but-srcless package (the codemods registry package) does not fail the release.

core and tools were published but lacked publishConfig.access, so add it to keep the convention true for everything published (and so their version.ts keeps regenerating under the new gate).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

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

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 `@scripts/generate-version.js`:
- Around line 20-25: The catch block around JSON.parse currently treats any
error reading packageJsonPath as a harmless skip by logging and exiting 0;
change it to surface failures by logging the error and exiting non-zero (or
rethrowing) so CI fails on malformed/unreadable package.json. Update the catch
to include the caught error (error) in the log message referencing
packagePath/packageJsonPath and call process.exit(1) (or throw) instead of
process.exit(0) so version generation does not silently succeed when
package.json is bad.
🪄 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: fe71ac62-c6fa-40a6-933d-c9baa8d53164

📥 Commits

Reviewing files that changed from the base of the PR and between 296cc54 and 01411f9.

📒 Files selected for processing (3)
  • packages/core/package.json
  • packages/tools/package.json
  • scripts/generate-version.js
✅ Files skipped from review due to trivial changes (1)
  • packages/tools/package.json

Comment thread scripts/generate-version.js
@wayfarer3130
wayfarer3130 merged commit 0a4064d into main Jun 11, 2026
15 checks passed
@wayfarer3130
wayfarer3130 deleted the fix/codemod-publish-and-docs-5x branch June 11, 2026 12:43
@coderabbitai coderabbitai Bot mentioned this pull request Jun 11, 2026
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.

2 participants