Wondering what’s next for npm?Check out our public roadmap! »

    react-navigation-parser

    1.0.0 • Public • Published

    Tiny parser for react-navigation based projects

    Parse react-navigation based project to find containers, routes, transitions etc.

    Getting started

    • Install using npm:
    $ npm i git@github.com:Kureev/react-navigation-parser.git -g
    • Download any react-native project, using react-navigation
    • Run parse-navigation CLI:
    $ parse-navigation path/to/react-navigation-project

    or use it via JS API:

    const parser = require('react-navigation-parser');
    const result = parse('project/folder');

    Example

    For the PocketGear project, tool gives the following output:

    ```json { "containers":{ "/Users//PocketGear/src/components/Home.js":{ "navigationType":"StackNavigator", "routes":[ { "name":"Main", "value":"/Users//PocketGear/src/components/PokemonChooser.js" }, { "name":"StrongAgainst", "value":"/Users//PocketGear/src/components/StrongAgainstList.js" }, { "name":"WeakAgainst", "value":"/Users//PocketGear/src/components/WeakAgainstList.js" }, { "name":"Info", "value":"/Users//PocketGear/src/components/PokemonInfo.js" } ], "component":null, "transitions":[] }, "/Users//PocketGear/src/components/PokemonInfo.js":{ "navigationType":"TabNavigator", "routes":[ { "name":"Details", "value":"/Users//PocketGear/src/components/PokemonDetails.js" }, { "name":"Matches", "value":"/Users//PocketGear/src/components/PokemonMatches.js" }, { "name":"Tools", "value":"/Users//PocketGear/src/components/PokemonTools.js" } ], "component":"PokemonInfo", "transitions":[] } }, "components":{ "/Users//PocketGear/src/components/Appbar.js":{ "component":"Appbar", "transitions":[] }, "/Users//PocketGear/src/components/AppbarShell.js":{ "component":"AppbarShell", "transitions":[] }, "/Users//PocketGear/src/components/Attack.js":{ "component":"Attack", "transitions":[] }, "/Users//PocketGear/src/components/CPCalculator.js":{ "component":"CPCalculator", "transitions":[ "Info" ] }, "/Users//PocketGear/src/components/Evolution.js":{ "component":"Evolution", "transitions":[ "Info" ] }, "/Users//PocketGear/src/components/GridView.js":{ "component":"GridView", "transitions":[] }, "/Users//PocketGear/src/components/Heading.js":{ "component":"Heading", "transitions":[] }, "/Users//PocketGear/src/components/More.js":{ "component":"More", "transitions":[] }, "/Users//PocketGear/src/components/NoResults.js":{ "component":"NoResults", "transitions":[] }, "/Users//PocketGear/src/components/Paragraph.js":{ "component":"Paragraph", "transitions":[] }, "/Users//PocketGear/src/components/Placeholder.js":{ "component":"Placeholder", "transitions":[] }, "/Users//PocketGear/src/components/PokemonChooser.js":{ "component":"PokemonChooser", "transitions":[] }, "/Users//PocketGear/src/components/PokemonDetails.js":{ "component":"PokemonDetails", "transitions":[ "Info" ] }, "/Users//PocketGear/src/components/PokemonList.js":{ "component":"PokemonList", "transitions":[] }, "/Users//PocketGear/src/components/PokemonListCard.js":{ "component":"PokemonListCard", "transitions":[ "Info" ] }, "/Users//PocketGear/src/components/PokemonMatches.js":{ "component":"PokemonMatches", "transitions":[ "Info", "StrongAgainst", "WeakAgainst" ] }, "/Users//PocketGear/src/components/PokemonTools.js":{ "component":"PokemonTools", "transitions":[ "Info" ] }, "/Users//PocketGear/src/components/PokemonTypeLabel.js":{ "component":"PokemonTypeLabel", "transitions":[] }, "/Users//PocketGear/src/components/ProgressBar.js":{ "component":"ProgressBar", "transitions":[] }, "/Users//PocketGear/src/components/SearchBar.js":{ "component":"SearchBar", "transitions":[] }, "/Users//PocketGear/src/components/SpinButton.js":{ "component":"SpinButton", "transitions":[] }, "/Users//PocketGear/src/components/StrongAgainstList.js":{ "component":"StrongAgainstList", "transitions":[] }, "/Users//PocketGear/src/components/TouchableButton.js":{ "component":"TouchableButton", "transitions":[] }, "/Users//PocketGear/src/components/TouchableItem.js":{ "component":"TouchableItem", "transitions":[] }, "/Users//PocketGear/src/components/WeakAgainstList.js":{ "component":"WeakAgainstList", "transitions":[] } }, "routes":{ "Main":"/Users//PocketGear/src/components/PokemonChooser.js", "StrongAgainst":"/Users//PocketGear/src/components/StrongAgainstList.js", "WeakAgainst":"/Users//PocketGear/src/components/WeakAgainstList.js", "Info":"/Users//PocketGear/src/components/PokemonInfo.js", "Details":"/Users//PocketGear/src/components/PokemonDetails.js", "Matches":"/Users//PocketGear/src/components/PokemonMatches.js", "Tools":"/Users//PocketGear/src/components/PokemonTools.js" } } ```

    Capabilities

    • Detect navigation containers with routes
      • StackNavigator
      • DrawerNavigator
      • TabNavigator
    • Detect components
      • export default () => {}
      • export default function Foo() {}
      • export default Foo where Foo is a class that extends React.Component
      • export default class Foo extends React.Component
      • export default connect(x, y)(Foo)
    • Detect transitions
      • this.props.navigate('route', config)
      • navigate('route', config)

    Keywords

    none

    Install

    npm i react-navigation-parser

    DownloadsWeekly Downloads

    1

    Version

    1.0.0

    License

    MIT

    Last publish

    Collaborators

    • avatar