@cornerstonejs/codemods
v5.5.1
Published
Codemod registry packages for Cornerstone3D migrations
Readme
Cornerstone3D Codemods
Codemod registry packages for Cornerstone3D migrations. These are published to
the Codemod registry so users run them with npx codemod.
Usage
Run the full Cornerstone3D v5 migration:
npx codemod @cornerstonejs/cornerstone3d-5Run only the Generic Viewport migration:
npx codemod @cornerstonejs/cornerstone3d-5-generic-viewportRegistry Packages
This workspace currently includes:
@cornerstonejs/cornerstone3d-5: runs all available Cornerstone3D v5 migration packages in the recommended order.@cornerstonejs/cornerstone3d-5-generic-viewport: migrates removed RenderingEngine viewport accessor APIs.
The Generic Viewport migration changes:
getStackViewports()->getViewports().filter(utilities.viewportSupportsStackCompatibility)getVolumeViewports()->getViewports().filter(utilities.viewportSupportsVolumeCompatibility)getStackViewport(id)->getViewport(id)
For simple variable declarations, getStackViewport(id) also adds a runtime
capability guard.
Development
Validate all registry packages and run fixture tests:
cd packages/codemods
yarn validateValidate only registry workflow metadata:
cd packages/codemods
yarn validate:registryRun only the JSSG fixture tests:
cd packages/codemods
yarn testRun a local registry package against a target checkout:
cd packages/codemods
npx codemod workflow run -w registry/cornerstone3d/5/generic-viewport -t /path/to/project --dry-runRegistry Publishing
The package is intentionally private to npm. Publishing happens through the
Codemod registry packages under packages/codemods/registry.
Publish migration packages before aggregate packages that reference them.
To publish cornerstone3d/5/generic-viewport:
git tag cornerstone3d/5/[email protected]
git push origin cornerstone3d/5/[email protected]To publish cornerstone3d/5:
git tag cornerstone3d/[email protected]
git push origin cornerstone3d/[email protected]Publish Codemod Registry Entry resolves those tags to directories under
packages/codemods/registry/ and publishes them with
codemod/publish-action@v1. Validate Codemod Registry Entries checks pull
requests and pushes to main.
