|
| 1 | +# Developing React Native Fontawesome |
| 2 | + |
| 3 | +## Tasks |
| 4 | + |
| 5 | +The following commands are available through `npm run` |
| 6 | + |
| 7 | +| Command | Purpose | |
| 8 | +| ------- | ------------------------------------- | |
| 9 | +| dist | Transpile code into `dist/`, to be checked in so the GitHub repo can be sourced directly from a `package.json` file | |
| 10 | +| test | Run tests | |
| 11 | + |
| 12 | +## Set up Development Environment (iOS) |
| 13 | + |
| 14 | +Use guidelines in the [React Native](https://facebook.github.io/react-native/docs/getting-started) development docs |
| 15 | +to get your environment set up in your OS. For Mac OS X, that would look like: |
| 16 | + |
| 17 | +1. `brew install node` # if you don't already have node 8.3 or later |
| 18 | +1. `brew install watchman` # watches filesystem for changes |
| 19 | +1. `npm install -g react-native-cli` # react-native CLI |
| 20 | +1. [Install XCode](https://facebook.github.io/react-native/docs/getting-started#xcode), probably from the App Store. Make sure it's version 9.4 or later. Also set up the XCode Command Line |
| 21 | + Tools. |
| 22 | +1. clone this repo |
| 23 | + |
| 24 | + |
| 25 | +## Launch the Example App |
| 26 | + |
| 27 | +In the `examples/Hello` subdirectory, the following script commands are available: |
| 28 | + |
| 29 | +| Command | Purpose | |
| 30 | +| ------- | ------------------------------------- | |
| 31 | +| start | Start JavaScript bundler, listening on a port | |
| 32 | +| ios | Build the ios XCode project (requires XCode set up) | |
| 33 | +| android | Build the Android project | |
| 34 | +| start-with-cache-reset | Useful when after modifying JavaScript modules, something isn't resolving that you're pretty sure should be there | |
| 35 | +| clean | clean out build cache. Useful when the build isn't working and you're pretty sure it should be | |
| 36 | + |
| 37 | +In one terminal tab: |
| 38 | +1. `cd examples/Hello` |
| 39 | +1. `npm install` |
| 40 | +1. `npm run start` |
| 41 | + |
| 42 | +This will get the JavaScript bundler running and listening for connections from a device or iOS Simulator. |
| 43 | + |
| 44 | +In another terminal tab: |
| 45 | +1 `cd examples/Hello` |
| 46 | +1. `react-native link react-native-svg` # to link the native components in the ios project |
| 47 | +1. `npm run ios` |
| 48 | + |
| 49 | +This will build the project via XCode, launch the iOS Simulator, and when the project builds successfully, |
| 50 | +install the app into the Simulator and have it connect to the JavaScript bundler. When it's all built and loaded, |
| 51 | +it will render the view for the example app--with Font Awesome icons. |
| 52 | + |
| 53 | +### Dealing with Flaky Build Problems |
| 54 | + |
| 55 | +Seems like things don't always go smoothly and you have to [use some hackery](https://github.com/facebook/react-native/issues/21490#issuecomment-427280927) to get the build unjammed. |
| 56 | + |
| 57 | +Try this: |
| 58 | +1. shutdown any instances of the bundler you have running. |
| 59 | +1. `npm run clean` |
| 60 | +1. `npm run start-with-cache-reset` # from the examples/Hello directory |
| 61 | + |
| 62 | +From another terminal tab: |
| 63 | +1. `npm run ios` |
| 64 | + |
| 65 | +## Update Example App to Use a Newer Version of this Component |
| 66 | + |
| 67 | +For now, we're just using the GitHub repo as our source for development versions. This means that when you want to |
| 68 | +test changes to the component using the example app, you'll have to push the component changes to a development branch |
| 69 | +and then update the `package.json` of the example app to pull the component from that branch. |
| 70 | + |
| 71 | +Here's the step-by-step: |
| 72 | + |
| 73 | +1. make changes to this component |
| 74 | +1. `npm run dist` # to transpile via babel into `dist/` |
| 75 | +1. `git commit` # whatever changes you're trying to commit |
| 76 | +1. `git push origin my-dev` # to whatever topic branch you're working on, say "my-dev" |
| 77 | +1. Modify `examples/Hello/package.json` and find the line that looks like this: |
| 78 | +`"@fortawesome/react-native-fontawesome": "^0.0.1"` |
| 79 | +And change it to something like this: |
| 80 | +`"@fortawesome/react-native-fontawesome": "https://github.com/FortAwesome/react-native-fontawesome#my-dev"` |
| 81 | +1. `npm update` or `yarn upgrade` # insist that packages be updated, in this case, that the code from the GitHub branch be pulled down into node_modules |
| 82 | +1. Launch the Example App using the instructions above. |
| 83 | + |
| 84 | +## Releasing a new version |
| 85 | + |
| 86 | +<a name="release"></a> |
| 87 | + |
| 88 | +1. Edit `package.json` and update the version number |
| 89 | +1. Add new contributors to the `contributors` section |
| 90 | +1. Update the `CHANGELOG.md` |
| 91 | +1. `npm run dist` |
| 92 | +1. `npm run test` |
| 93 | +1. `npm run publish` |
| 94 | +1. `git add . && git commit -m 'Release VERSION'` |
| 95 | +1. `git push` |
| 96 | +1. Create a [new release](https://github.com/FortAwesome/react-native-fontawesome/releases/new) with `CHANGELOG` details |
0 commit comments