@tkc-fe/react-native-navigation-crawler
v0.0.4
Published
This package crawls through a React Native project and then optionally maps out the different routes and how they are linked.
Downloads
4
Readme
Introduction
This package will crawl react native packages looking for screens - it will then optionally output a simple HTML site that will allow you to see the different screens relations and open files directly.
Usage
npx @tkc-fe/react-native-navigation-crawler <route-input> <html-output>
Usage Example
npx @tkc-fe/react-native-navigation-crawler ./src/stacks/Drawer.tsx ./crawl-output
Installation
yarn add @tkc-fe/react-native-navigation-crawler
or
npm i @tkc-fe/react-native-navigation-crawler
Example 📕
import ReactRouteCrawler from '@tkc-fe/react-native-navigation-crawler'
const crawler = new ReactRouteCrawler()
const screens = crawler.getComponentScreens(
'./src/stacks/RootStack.tsx', // The route to map screens within.
true // If we should do this recursively.
)
Config ⚙️
// You can also pass different optional paraments for the crawlers setup.
const crawler = new ReactRouteCrawler({
configPath: './tsconfig.json', // The location of the tsconfig -- Default: ./tsconfig.json
sourceFilesGlob: './src/**/*.tsx' // The glob pattern for files -- Default: ./src/**/*.tsx
})