@backstage/migrate-avatar-to-custom
Migrates Avatar component usage from the Base UI implementation to the custom implementation introduced in @backstage/ui@0.9.0 (Backstage v1.45.0).
What it transforms
renderprop removal — removes therenderprop and inserts a// TODO(backstage-codemod)comment so you can review custom renderingsize="large"→size="x-large"— the oldlargesize maps to the newx-largetoken- Handles named imports (
import { Avatar } from '@backstage/ui'), aliased imports, and namespace imports (import * as UI from '@backstage/ui')
Installation
bashyarn dlx codemod@latest run @backstage/migrate-avatar-to-custom -t /path/to/target
Usage (from this repo)
bashyarn dlx codemod@latest workflow run \ -w codemods/v1.45.0/migrate-avatar-to-custom/workflow.yaml \ -t /path/to/your/backstage-repo
Development
From the repo root:
bashyarn install yarn workspace @backstage/migrate-avatar-to-custom test
Known limitations
- When a
renderprop is removed, the codemod cannot mechanically migrate the custom rendering logic — review the TODO comment and manually adjust - Namespace imports are supported for detection, but the namespace prefix is preserved as-is