A jscodeshift codemod for migrating from style attributes to styled-components.
jscodeshift installed globally.
npm install -g jscodeshift
To migrate all jsx
files within the src
directory:
jscodeshift src/**/*.jsx [--similar-components-minimum-common-declarations COUNT] -t https://raw.githubusercontent.com/mon-jai/style-attribute-to-styled-component-codemod/main/codemod.ts
--similar-components-minimum-common-declarations
Specifies the minimum number of common declarations required to determine whether components should be extended from a common base.
You should reformat your code after running the codemod.
- Dynamically computed CSS properties and values are skipped.