Chalk to util.styleText
This recipe migrates from the external chalk package to Node.js built-in util.styleText API. It transforms chalk method calls to use the native Node.js styling functionality.
Examples
diff
diff
diff
Usage
Run this codemod with:
sh
Compatibility
- Removes chalk dependency from package.json automatically
- Supports most chalk methods: colors, background colors, and text modifiers
- Unsupported methods: hex(), rgb(), ansi256(), bgAnsi256(), visible() (warnings will be shown)
Limitations
- Complex conditional expressions in some contexts may need manual review