Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lucasbento/rn-update-deprecated-modules
Codemod to update import declarations as per react-native > 0.59.x deprecations.
https://github.com/lucasbento/rn-update-deprecated-modules
cli codemod react-native
Last synced: 3 months ago
JSON representation
Codemod to update import declarations as per react-native > 0.59.x deprecations.
- Host: GitHub
- URL: https://github.com/lucasbento/rn-update-deprecated-modules
- Owner: lucasbento
- Created: 2019-04-08T10:56:46.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-03T19:44:28.000Z (about 2 years ago)
- Last Synced: 2024-10-12T13:29:26.329Z (4 months ago)
- Topics: cli, codemod, react-native
- Language: JavaScript
- Size: 1.19 MB
- Stars: 72
- Watchers: 4
- Forks: 2
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-codemods - rn-update-deprecated-modules - Codemod to update import declarations as per react-native > 0.59.x deprecations. (Frameworks / React.js)
README
# Update Deprecated Modules for React Native
This project is intended to be used from version `0.59.x` which started the [Lean Core Hub] initiative that removes modules from the core of react-native into community-maintained projects.
## Installation
Install [jscodeshift]:
```sh
yarn global add jscodeshift
```> This guide assumes that you have [npx] installed, if you wish to use this through a global installation just install it with `yarn global add rn-update-deprecated-modules` and remove `npx` from the example commands.
## Usage
> All arguments specified in [jscodeshift][jscodeshift-args] are accepted.
```sh
npx rn-update-deprecated-modules myFile.js
npx rn-update-deprecated-modules myFile.js mySecondFile.js myThirdFile.js
npx rn-update-deprecated-modules app/**/*.js
npx rn-update-deprecated-modules app/**/*.tsx --parser=tsx
```### Example output
```
~/Documents/Projects/myNiceProject
❯ npx rn-update-deprecated-modules ./app/**/*.js
Processing 50 files...
Spawning 1 worker...
Sending 50 files to free worker...
All done.
Results:
0 errors
588 unmodified
0 skipped
1 ok
Time elapsed: 1.208secondsImport statements updated, run:
yarn add @react-native-community/async-storage
``````diff
-import { AsyncStorage, Image } from 'react-native';
+import { Image } from 'react-native';
+import AsyncStorage from '@react-native-community/async-storage';
```## License
MIT © [Lucas Bento](http://github.com/lucasbento)
[Lean Core Hub]: https://github.com/facebook/react-native/issues/23313
[jscodeshift]: https://github.com/facebook/jscodeshift
[npx]: https://www.npmjs.com/package/npx
[jscodeshift-args]: https://github.com/facebook/jscodeshift#usage-cli