Skip to content

Calculates the percentage of shared code across platforms in your React Native project.

License

Notifications You must be signed in to change notification settings

fdnhkj/react-native-shared-code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-native-shared-code

Analyses your React Native project and calculates the percentage of

  • shared code across platforms
  • platform specific code

Formula

The formulas are based on the two ways of targeting specific platforms in React Native:

Shared code

![shared code](https://latex.codecogs.com/png.latex?\dpi{150}&space;\fn_phv&space;\frac{.js\ LOC&space;-&space;Platform\ module\ LOC}{Total\ LOC})

Platform specific

![platform specific](https://latex.codecogs.com/png.latex?\dpi{150}&space;\fn_phv&space;\frac{.ios.js|.android.js\ LOC&space;+&space;Platform\ module\ LOC}{Total\ LOC})

Usage

Installation

You can install react-native-shared-code either as a global package or a local module.

Global package

npm install -g react-native-shared-code
react-native-shared-code path-to-react-native-project

Local package

npm install --save-dev react-native-shared-code

Add shared-code script to your package.json

{
  "scripts": {
    "shared-code": "react-native-shared-code"
  }
}

API

  Usage: react-native-shared-code [path] [options]


  Commands:

    [path]     path to React Native project (default value is cwd)

  Options:

    -h, --help    output usage information
    -v, --version output the version number
    -p, --platform platform for which to calculate the shared code percentages.
                   Accepted values are ios, android and windows.
                   By default, it detects index.platform.js for android, ios, windows
    --verbose output debugging info

Author

Fidan Hakaj

Acknowledgments

About

Calculates the percentage of shared code across platforms in your React Native project.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published