fdnhkj / react-native-shared-code

Calculates the percentage of shared code across platforms in your React Native project.
MIT License
45 stars 4 forks source link

Update README.md #4

Closed MattFoley closed 7 years ago

MattFoley commented 7 years ago

Just a note explaining it requires Node 6.x or higher.

MattFoley commented 7 years ago

Hey, and by the way, I couldn't figure out what the find-platform-module-LOC.js file was doing (or maybe just didn't understand how it was working. Would you mind explaining it to me?

fdnhkj commented 7 years ago

The repo can be adapted to support lower versions of node. I would rather go for this option but thanks for noticing it 👍

FYI, you can achieve such warning via engines property in package.json.

Regarding find-platform-module-LOC, the file is responsible of counting (thanks to Babel) all lines of code containing references to React Native's Platform module - important to compute the percentages.

I.e. let's imagine the code below would be processed by find-platform-module-LOC:

1. import {Platform} from 'react-native';
2. if (Platform.OS === 'ios') { // some code... }
3. if (Platform.OS === 'android') { //some other code...}

The result would be 2, because there are two references of React Native's Platform module (in line 2 and 3).