codemods
codemods runs structured code transformations to migrate your project between c15t versions. It uses ts-morph to safely rewrite imports, JSX, and config objects.
Usage
Run interactively and pick which codemods to apply:
Preview without writing files:
Available codemods
Each codemod is version-aware — the CLI hides codemods that don't apply to your installed c15t version.
| ID | What it does |
|---|---|
component-renames | Renames CookieBanner → ConsentBanner, ConsentManagerDialog → ConsentDialog, ConsentManagerWidget → ConsentWidget. |
gdpr-types-to-consent-categories | Migrates gdprTypes/initialGDPRTypes to consentCategories. |
translations-to-i18n | Migrates legacy translation config keys to the v2 i18n shape. |
tracking-blocker-to-network-blocker | Migrates trackingBlockerConfig to network blocker rules. |
mode-c15t-to-hosted | Migrates legacy mode: 'c15t' to mode: 'hosted'. |
react-options-to-top-level | Lifts react.theme / react.colorScheme / react.disableAnimation to top-level options. |
ignore-geo-location-to-overrides | Migrates ignoreGeoLocation: true to overrides: { country: 'DE' }. |
offline-add-policy-packs | Adds starter policyPackPresets to offline configs missing policies. |
add-stylesheet-imports | Moves c15t imports into the app CSS entrypoint, including Tailwind 3 and IAB variants. |
active-ui-api | Migrates showPopup / isPrivacyDialogOpen to the unified activeUI API. |
Safety
- All codemods support
--dry-run. - Codemods are idempotent — running twice produces the same result.
- The CLI prints a per-file diff summary so you can review changes before committing.
- Run on a clean git working tree so you can
git diffand revert if needed.