@backstage/header-tab-to-nav-tab-item
Backstage 1.50.0 migration codemod that renames HeaderTab to HeaderNavTabItem and removes the deprecated matchStrategy property in @backstage/ui.
What it does
Type rename: HeaderTab -> HeaderNavTabItem
In @backstage/ui v0.14.0 (Backstage 1.50.0), the HeaderTab type was replaced by HeaderNavTabItem, a union type supporting both individual tabs and dropdown tab groups (HeaderNavTab | HeaderNavTabGroup).
This codemod renames:
- Import specifiers:
import { HeaderTab }->import { HeaderNavTabItem } import typestatements and inlinetypespecifiers- Aliased imports:
import { HeaderTab as MyTab }->import { HeaderNavTabItem as MyTab } - Re-exports:
export { HeaderTab }->export { HeaderNavTabItem } - Body references (type annotations, generic parameters, etc.)
Property removal: matchStrategy
The matchStrategy property on tab objects was removed. This codemod strips it from object literals when a HeaderTab import from @backstage/ui is detected in the same file.
What is NOT migrated
@backstage/core-components: TheTabtype andHeaderTabsin@backstage/core-componentsare unchanged. This codemod only applies to@backstage/ui.- Namespace imports (
import * as UI from '@backstage/ui'): Detected and a warning is emitted, but not automatically transformed. activeTabIdprop: The newactiveTabIdprop onHeaderthat replaces automatic route-based tab highlighting is not added automatically.
Optional: AI fixup step
Enable with --param aiFixup=true:
- Rewrites namespace imports (
import * as UI) to replaceUI.HeaderTabwithUI.HeaderNavTabItem - Finds remaining
matchStrategyproperties in complex nested structures - Fixes type assertions (
as HeaderTab) and generic type parameters
Installation
bash
Usage (from this repo)
bash
Development
From the repo root:
bash
Or from this package directory:
bash
License
MIT