https://github.com/rip21/styled-components-native-to-plain-codemod
Codemods for the styled-components migrations
https://github.com/rip21/styled-components-native-to-plain-codemod
Last synced: over 1 year ago
JSON representation
Codemods for the styled-components migrations
- Host: GitHub
- URL: https://github.com/rip21/styled-components-native-to-plain-codemod
- Owner: RIP21
- License: mit
- Created: 2018-01-23T11:06:17.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-01-23T11:50:10.000Z (over 8 years ago)
- Last Synced: 2025-03-18T14:18:27.536Z (over 1 year ago)
- Language: JavaScript
- Size: 30.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# styled-components-native-to-plain-codemod ðŸ›
It's a simple codemod to rename all imports and requires from `'styled-components/native'` to `'styled-components'` for
React Native apps.
## Why?
New version (v3) of the styled-components is changed its API so now you can import React Native components directly from
`styled-components` not from `styled-components/native`. This codemod will do everything for you,
so you don't spent time doing that manually
## Input/Output
```javascript
// in
import /* ... */ from 'styled-components/native';
require('styled-components/native');
// out
import /* ... */ from 'styled-components';
require('styled-components');
```
## Usage
1. Install jscodeshift`npm i -g jscodeshift`
2. Download `sc-native-to-plain.js` from this repo or install it like
`npm i styled-components-native-to-plain-codemod` and take it from `node_modules/styled-components-native-to-plain-codemod/sc-native-to-plain.js`
3. In root of the project with sources under `/src` for example call will be
`jscodemode -t /sc-native-to-plain.js ./src`
4. PROFIT!
## IT DOESN'T WORK!!!
If you use regular codestyle such as Prettier or Standard and not crazy one, this will do the trick :)
Take a look at the code (it's pretty straightforward), and add PR for your crazy one to match it as well :D