1.0.0 • Published 8 years ago
styled-components-native-to-plain-codemod v1.0.0
styled-components-native-to-plain 🛠
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
// in
import /* ... */ from 'styled-components/native';
require('styled-components/native');
// out
import /* ... */ from 'styled-components';
require('styled-components');Usage
- Install jscodeshift
npm i -g jscodeshift - Download
sc-native-to-plain.jsfrom this repo or install it likenpm i styled-components-native-to-plain-codemodand take it fromnode_modules/styled-components-native-to-plain-codemod/sc-native-to-plain.js - In root of the project with sources under
/srcfor example call will bejscodemode -t <path-to-codemod>/sc-native-to-plain.js ./src - 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
1.0.0
8 years ago