Label to Badge codemod

Migrates the deprecated Label component to Badge, and Badge's deprecated isOutline/isEmphasized props to their color replacements — the removals land in 3.0.0. The codemod can be run as soon as your app is on @customerio/pluma-components 2.190.0, where Badge absorbed Label's colors, bold text, and status indicator; migrating ahead of the major is recommended.

What it rewrites

Label → Badge (React Label, Ember PlumaLabel):

  • The component and its pluma import are renamed to Badge/PlumaBadge. If Badge is already imported (React), the Label specifier is dropped and usages reuse the existing local name.
  • A Label without a color gains color="grey" — Label defaulted to a grey square chip, while a bare Badge renders a neutral pill, so the default must become explicit to preserve the rendered output.
  • color="outline" becomes color="neutral-outline".
  • Every other literal color carries over unchanged and renders pixel-identical.

Badge deprecated props:

  • isEmphasized becomes color="accent".
  • isOutline becomes color="neutral-outline".
  • Both together become color="accent-outline".
  • Literal false values are simply removed.

What it flags instead of rewriting

Dynamic expressions are left unchanged and reported as warnings for manual review:

  • A dynamic Label color (e.g. @color={{if @tracked 'outline' 'grey'}}) — "outline" must become "neutral-outline" by hand, and expressions that can yield undefined relied on Label's grey default, which Badge does not share.
  • Dynamic isOutline/isEmphasized bindings.
  • Elements that already combine color with the deprecated props (invalid — throws at runtime).

Running it

Run it through the Pluma CLI from inside your consuming app:

pnx @customerio/pluma-cli@latest upgrade --codemod label-to-badge react ./src
pnx @customerio/pluma-cli@latest upgrade --codemod label-to-badge ember ./app ./addon

Both codemods support dry runs. The React codemod uses jscodeshift flags, so --dry/-d skips writes and -p prints the transformed output:

pnx @customerio/pluma-cli@latest upgrade --codemod label-to-badge react --dry -p ./src

The Ember codemod has its own --dry flag:

pnx @customerio/pluma-cli@latest upgrade --codemod label-to-badge ember --dry ./app

Limitations

  • Only angle-bracket / JSX invocations are handled.
  • LabelProps type imports are not rewritten — replace with BadgeProps manually.
  • React Label aliases (import { Label as X }) keep their local name; the import specifier switches to Badge as X.
  • Ember imports are rewritten for the standard forms — named specifiers from @customerio/pluma-components/ember and the /ember/label subpath default import. Renamed templates whose PlumaLabel import takes any other form are flagged for a manual import update.
  • Label rendered a <span> while Badge currently renders a <div>. Migrated badges inside text flow (paragraphs, headings, links, buttons) are invalid phrasing content until 3.0, where Badge switches to a <span> by default (see the breaking changes); pass as="span" in the interim where it matters.