TLDR Web Dev · ARTICLES & TUTORIALS

REFACTORING WITH CODEMODS TO AUTOMATE API CHANGES

martinfowler.com22 min read

Summary from the TLDR Web Dev newsletter

Codemods are automated scripts that use Abstract Syntax Trees (ASTs) to manage large-scale code changes, particularly when dealing with breaking API changes or refactoring legacy code. They automate tasks like removing feature toggles or refactoring complex components. This article provides practical examples in JavaScript and shows how to write codemods, test them effectively, and compose multiple smaller codemods into larger transformations.