Skip to content
This repository was archived by the owner on Mar 9, 2021. It is now read-only.

Commit 3060c7e

Browse files
iMokhlesjamonholmgren
authored andcommitted
feat(boilerplate): Support react-native 0.61.4 (#298 by @iMokhles)
1 parent 667f072 commit 3060c7e

13 files changed

+110
-113
lines changed

.circleci/config.yml

+1-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
defaults: &defaults
77
docker:
88
# Choose the version of Node you want here
9-
- image: circleci/node:10.11
9+
- image: circleci/node:13.5
1010
working_directory: ~/repo
1111

1212
version: 2
@@ -41,10 +41,6 @@ jobs:
4141
- v1-dependencies-{{ checksum "package.json" }}
4242
# fallback to using the latest cache if no exact match is found
4343
- v1-dependencies-
44-
- run:
45-
name: Install React Native CLI and Ignite CLI
46-
command: |
47-
sudo npm i -g ignite-cli@next react-native-cli
4844
- run:
4945
name: Run tests
5046
command: yarn ci:test # this command will be added to/found in your package.json scripts

boilerplate.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ async function install(context) {
134134
// react native link -- must use spawn & stdio: ignore or it hangs!! :(
135135
spinner.text = `▸ linking native libraries`
136136
spinner.start()
137-
await system.spawn('react-native link', { stdio: 'ignore' })
137+
await system.spawn('npx react-native link', { stdio: 'ignore' })
138138
spinner.stop()
139139

140140
// pass long the debug flag if we're running in that mode
@@ -148,7 +148,7 @@ async function install(context) {
148148
// Could be directory, npm@version, or just npm name. Default to passed in values
149149
const boilerplate = parameters.options.b || parameters.options.boilerplate || 'ignite-andross'
150150

151-
await system.spawn(`ignite add ${boilerplate} ${debugFlag}`, { stdio: 'inherit' })
151+
await system.spawn(`npx ignite-cli add ${boilerplate} ${debugFlag}`, { stdio: 'inherit' })
152152

153153
// now run install of Ignite Plugins
154154
await ignite.addModule('react-navigation', { version: '3.11.0' })
@@ -176,37 +176,37 @@ async function install(context) {
176176
' }'
177177
})
178178
if (answers['vector-icons'] === 'react-native-vector-icons') {
179-
await system.spawn(`ignite add [email protected] ${debugFlag}`, {
179+
await system.spawn(`npx ignite-cli add [email protected] ${debugFlag}`, {
180180
stdio: 'inherit'
181181
})
182182
}
183183

184184
if (answers['i18n'] === 'react-native-i18n') {
185-
await system.spawn(`ignite add [email protected] ${debugFlag}`, { stdio: 'inherit' })
185+
await system.spawn(`npx ignite-cli add [email protected] ${debugFlag}`, { stdio: 'inherit' })
186186
}
187187

188188
if (answers['animatable'] === 'react-native-animatable') {
189-
await system.spawn(`ignite add [email protected] ${debugFlag}`, {
189+
await system.spawn(`npx ignite-cli add [email protected] ${debugFlag}`, {
190190
stdio: 'inherit'
191191
})
192192
}
193193

194194
// dev-screens be installed after vector-icons and animatable so that it can
195195
// conditionally patch its PluginExamplesScreen
196196
if (answers['dev-screens'] === 'Yes') {
197-
await system.spawn(`ignite add dev-screens@"2.4.5" ${debugFlag}`, {
197+
await system.spawn(`npx ignite-cli add dev-screens@"2.4.5" ${debugFlag}`, {
198198
stdio: 'inherit'
199199
})
200200
}
201201

202202
if (answers['redux-persist'] === 'Yes') {
203-
await system.spawn(`ignite add [email protected] ${debugFlag}`, {
203+
await system.spawn(`npx ignite-cli add [email protected] ${debugFlag}`, {
204204
stdio: 'inherit'
205205
})
206206
}
207207

208208
if (parameters.options.lint !== false) {
209-
await system.spawn(`ignite add [email protected] ${debugFlag}`, {
209+
await system.spawn(`npx ignite-cli add [email protected] ${debugFlag}`, {
210210
stdio: 'inherit'
211211
})
212212
}
@@ -243,9 +243,9 @@ async function install(context) {
243243
To get started:
244244
245245
cd ${name}
246-
react-native run-ios
247-
react-native run-android${androidInfo}
248-
ignite --help
246+
npx react-native run-ios
247+
npx react-native run-android${androidInfo}
248+
npx ignite-cli --help
249249
250250
${gray(
251251
'Read the walkthrough at https://github.com/infinitered/ignite-andross/blob/master/readme.md#boilerplate-walkthrough'

boilerplate/App/Config/ReactotronConfig.js

+9-6
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,22 @@ import Reactotron from 'reactotron-react-native'
44
import { reactotronRedux as reduxPlugin } from 'reactotron-redux'
55
import sagaPlugin from 'reactotron-redux-saga'
66

7-
if (Config.useReactotron) {
8-
// https://github.com/infinitered/reactotron for more options!
9-
Reactotron
7+
const reactotron = Reactotron
108
.configure({ name: 'Ignite App' })
119
.useReactNative()
1210
.use(reduxPlugin({ onRestore: Immutable }))
1311
.use(sagaPlugin())
14-
.connect()
12+
13+
if (Config.useReactotron) {
14+
// https://github.com/infinitered/reactotron for more options!
15+
16+
reactotron.connect()
1517

1618
// Let's clear Reactotron on every time we load the app
17-
Reactotron.clear()
19+
reactotron.clear()
1820

1921
// Totally hacky, but this allows you to not both importing reactotron-react-native
2022
// on every file. This is just DEV mode, so no big deal.
21-
console.tron = Reactotron
2223
}
24+
export default reactotron
25+
console.tron = reactotron

boilerplate/App/Navigation/AppNavigation.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { createStackNavigator, createAppContainer } from 'react-navigation'
1+
import { createAppContainer } from 'react-navigation'
2+
import { createStackNavigator } from 'react-navigation-stack';
23
import LaunchScreen from '../Containers/LaunchScreen'
34

45
import styles from './Styles/NavigationStyles'

boilerplate/App/Redux/CreateStore.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import Config from '../Config/DebugConfig'
33
import createSagaMiddleware from 'redux-saga'
44
import ScreenTracking from './ScreenTrackingMiddleware'
55
import { appNavigatorMiddleware } from '../Navigation/ReduxNavigation'
6+
import Reactotron from '../Config/ReactotronConfig'
67

78
// creates the store
89
export default (rootReducer, rootSaga) => {
@@ -28,7 +29,10 @@ export default (rootReducer, rootSaga) => {
2829
enhancers.push(applyMiddleware(...middleware))
2930

3031
// if Reactotron is enabled (default for __DEV__), we'll create the store through Reactotron
31-
const createAppropriateStore = Config.useReactotron ? console.tron.createStore : createStore
32+
const createAppropriateStore = createStore
33+
if (Config.useReactotron) {
34+
enhancers.push(Reactotron.createEnhancer())
35+
}
3236
const store = createAppropriateStore(rootReducer, compose(...enhancers))
3337

3438
// kick off root saga

boilerplate/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
1. cd to the repo
1818
2. Run Build for either OS
1919
* for iOS
20-
* run `react-native run-ios`
20+
* run `npx react-native run-ios`
2121
* for Android
2222
* Run Genymotion
23-
* run `react-native run-android`
23+
* run `npx react-native run-android`
2424

2525
## :no_entry_sign: Standard Compliant
2626

boilerplate/package.json.ejs

+34-28
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"version": "0.0.1",
33
"scripts": {
44
"clean": "rm -rf $TMPDIR/react-* && watchman watch-del-all && npm cache clean --force",
5-
"clean:android": "cd android/ && ./gradlew clean && cd .. && react-native run-android",
5+
"clean:android": "cd android/ && ./gradlew clean && cd .. && npx react-native run-android",
66
"newclear": "rm -rf $TMPDIR/react-* && watchman watch-del-all && rm -rf ios/build && rm -rf node_modules/ && npm cache clean --force && npm i",
77
"test:watch": "jest --watch",
88
"updateSnapshot": "jest --updateSnapshot",
@@ -16,21 +16,28 @@
1616
"storybook": "storybook start -p 7007"
1717
},
1818
"dependencies": {
19-
"apisauce": "1.0.3",
20-
"format-json": "1.0.3",
21-
"identity-obj-proxy": "3.0.0",
22-
"lodash": "4.17.15",
23-
"prop-types": "15.7.2",
24-
"querystringify": "2.1.1",
25-
"ramda": "0.26.1",
26-
"react-native-config": "0.11.7",
27-
"react-navigation-redux-helpers": "3.0.2",
28-
"react-native-device-info": "2.1.3",
29-
"react-redux": "6.0.1",
30-
"redux": "4.0.4",
31-
"redux-saga": "1.0.5",
32-
"reduxsauce": "1.1.0",
33-
"seamless-immutable": "7.1.4"
19+
"apisauce": "^1.1.1",
20+
"format-json": "^1.0.3",
21+
"identity-obj-proxy": "^3.0.0",
22+
"lodash": "^4.17.15",
23+
"prop-types": "^15.7.2",
24+
"querystringify": "^2.1.1",
25+
"ramda": "^0.26.1",
26+
"ramdasauce": "^2.1.3",
27+
"react": "16.9.0",
28+
"react-native": "0.61.4",
29+
"react-native-config": "^0.12.0",
30+
"react-native-device-info": "^5.3.0",
31+
"react-native-gesture-handler": "^1.5.0",
32+
"react-navigation": "^4.0.10",
33+
"react-navigation-redux-helpers": "^4.0.1",
34+
"react-navigation-stack": "^1.10.3",
35+
"react-navigation-tabs": "^2.5.6",
36+
"react-redux": "^7.1.3",
37+
"redux": "^4.0.4",
38+
"redux-saga": "^1.1.3",
39+
"reduxsauce": "^1.1.1",
40+
"seamless-immutable": "^7.1.4"
3441
},
3542
"devDependencies": {
3643
"@storybook/addons": "^4.1.11",
@@ -39,18 +46,17 @@
3946
"@storybook/addon-storyshots": "^4.1.11",
4047
"@storybook/channels": "^4.1.11",
4148
"@storybook/react-native": "^4.1.11",
42-
"babel-core": "6.26.3",
43-
"babel-preset-env": "1.7.0",
44-
"babel-preset-react-native": "4.0.1",
45-
"enzyme": "3.10.0",
46-
"enzyme-adapter-react-16": "1.14.0",
47-
"mockery": "2.1.0",
48-
"babel-plugin-ignite-ignore-reactotron": "0.3.0",
49-
"react-devtools-core": "3.6.3",
50-
"react-dom": "16.8.6",
51-
"reactotron-react-native": "2.2.0",
52-
"reactotron-redux": "2.1.3",
53-
"reactotron-redux-saga": "3.0.0"
49+
"@babel/core": "^7.7.2",
50+
"@babel/runtime": "^7.7.2",
51+
"@react-native-community/eslint-config": "^0.0.5",
52+
"babel-jest": "^24.9.0",
53+
"eslint": "^6.6.0",
54+
"jest": "^24.9.0",
55+
"metro-react-native-babel-preset": "^0.57.0",
56+
"react-test-renderer": "16.9.0",
57+
"reactotron-react-native": "^4.0.2",
58+
"reactotron-redux": "^3.1.2",
59+
"reactotron-redux-saga": "^4.2.2"
5460
},
5561
"jest": {
5662
"testMatch": [

lib/patterns.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ const constants = {
77
module.exports = {
88
constants,
99

10-
[constants.PATTERN_IMPORTS]: `import { createStackNavigator, createAppContainer } from 'react-navigation'`,
10+
[constants.PATTERN_IMPORTS]: `import { createAppContainer } from 'react-navigation'`,
1111
[constants.PATTERN_ROUTES]: 'const PrimaryNav'
1212
}

lib/react-native-version.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const { pathOr, is } = require('ramda')
22

33
// the default React Native version for this boilerplate
4-
const REACT_NATIVE_VERSION = '0.59.9'
4+
const REACT_NATIVE_VERSION = '0.61.4'
55

66
// where the version lives under gluegun
77
const pathToVersion = ['parameters', 'options', 'react-native-version']
@@ -15,7 +15,7 @@ const getVersionFromContext = pathOr(REACT_NATIVE_VERSION, pathToVersion)
1515
* Attempts to read it from the command line, and if not there, falls back
1616
* to the version we want for this boilerplate. For example:
1717
*
18-
* $ ignite new Custom --react-native-version 0.44.1
18+
* $ npx ignite-cli new Custom --react-native-version 0.61.1
1919
*
2020
* @param {*} context - The gluegun context.
2121
*/

package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,11 @@
2323
"url": "https://github.com/infinitered/ignite-andross"
2424
},
2525
"scripts": {
26-
"check-ignite": "which ignite # Checking if Ignite CLI is installed globally",
2726
"lint": "standard",
2827
"test": "jest",
2928
"watch": "jest --runInBand --watch",
3029
"coverage": "jest --runInBand --coverage",
31-
"ci:test": "yarn check-ignite && yarn test",
30+
"ci:test": "yarn test",
3231
"ci:publish": "yarn semantic-release",
3332
"semantic-release": "semantic-release"
3433
},

readme.md

+15-15
Original file line numberDiff line numberDiff line change
@@ -21,31 +21,31 @@ Currently includes:
2121
When you've installed the [Ignite CLI](https://github.com/infinitered/ignite), you can get started with this boilerplate like this:
2222

2323
```sh
24-
ignite new MyLatestCreation
24+
npx ignite-cli new MyLatestCreation
2525
```
2626

2727
By default we'll ask you to choose which boilerplate you'd like. If you just want to use this one you can specify it with `--boilerplate` or `-b`:
2828

2929
```sh
30-
ignite new MyLatestCreation --boilerplate andross
30+
npx ignite-cli new MyLatestCreation --boilerplate andross
3131
```
3232

3333
You can also change the React Native version; just keep in mind, we may not have tested this just yet.
3434

3535
```sh
36-
ignite new MyLatestCreation --react-native-version 0.99.0-rc.2
36+
npx ignite-cli new MyLatestCreation --react-native-version 0.99.0-rc.2
3737
```
3838

3939
By default we'll ask you some questions during install as to which features you'd like. If you just want them all, you can skip the questions:
4040

4141
```sh
42-
ignite new MyLatestCreation --max
42+
npx ignite-cli new MyLatestCreation --max
4343
```
4444

4545
If you want very few of these extras:
4646

4747
```sh
48-
ignite new MyLatestCreation --min
48+
npx ignite-cli new MyLatestCreation --min
4949
```
5050

5151
## Boilerplate walkthrough
@@ -63,9 +63,9 @@ Containers are (mostly) full screens, although they can be sections of screens o
6363

6464
To generate a new Container or Screen you can use the following generator commands:
6565

66-
* `ignite g container New` - Will create a `New.js` and also a `Styles/NewStyle.js`.
67-
* `ignite g list New` - The same as the `container` command, but it will give you a walkthrough to generate a ListView screen. Allowing you to even pick `FlatList` or not, grid, and some other options.
68-
* `ignite g screen New` - Will create a `NewScreen.js` and also a `Styles/NewScreenStyle.js`. Important to mention that the `screen` generator will add the `Screen` on the file/class name to make easier to identify.
66+
* `npx ignite-cli g container New` - Will create a `New.js` and also a `Styles/NewStyle.js`.
67+
* `npx ignite-cli g list New` - The same as the `container` command, but it will give you a walkthrough to generate a ListView screen. Allowing you to even pick `FlatList` or not, grid, and some other options.
68+
* `npx ignite-cli g screen New` - Will create a `NewScreen.js` and also a `Styles/NewScreenStyle.js`. Important to mention that the `screen` generator will add the `Screen` on the file/class name to make easier to identify.
6969

7070
Those commands will also add the new container to the navigations file.
7171

@@ -83,10 +83,10 @@ React components go here...pretty self-explanatory. We won't go through each in
8383

8484
To generate a new Component you can use the following generator commands:
8585

86-
* `ignite g component New` - Will create a `New.js` and also a `Styles/NewStyle.js`.
87-
* `ignite g component path/New` - The same as above, but will use a relative path
88-
* `ignite g component --folder path` - An alternative to `ignite g component path/index`
89-
* `ignite g component --folder path new ` - An alternative to `ignite g component relativePath/New`
86+
* `npx ignite-cli g component New` - Will create a `New.js` and also a `Styles/NewStyle.js`.
87+
* `npx ignite-cli g component path/New` - The same as above, but will use a relative path
88+
* `npx ignite-cli g component --folder path` - An alternative to `npx ignite-cli g component path/index`
89+
* `npx ignite-cli g component --folder path new ` - An alternative to `npx ignite-cli g component relativePath/New`
9090

9191
### Storybook
9292

@@ -121,8 +121,8 @@ Contains a preconfigured Redux and Redux-Sagas setup. Review each file carefully
121121

122122
Here again we have generators to help you out. You just have to use one of the following:
123123

124-
* `ignite g redux Amazing` - Will generate and link the redux for `Amazing`.
125-
* `ignite g saga Amazing` - The same as above, but for the Sagas
124+
* `npx ignite-cli g redux Amazing` - Will generate and link the redux for `Amazing`.
125+
* `npx ignite-cli g saga Amazing` - The same as above, but for the Sagas
126126

127127
You can read more about Redux and Redux Sagas in these blog posts:
128128

@@ -155,7 +155,7 @@ Helpers for transforming data between API and your application and vice versa. A
155155

156156
This folder (located as a sibling to `App`) contains sample Jest snapshot and unit tests for your application.
157157

158-
If you would like to have the `ignite generate` command include the generation of tests when available, add
158+
If you would like to have the `npx ignite-cli generate` command include the generation of tests when available, add
159159
`"tests": "jest"` or `"tests": "ava"` to `./ignite/ignite.json`, depending on the test runner you are using.
160160

161161
**Previous Boilerplates**

templates/saga.ejs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* ***********************************************************
22
* A short word on how to use this automagically generated file.
3-
* We're often asked in the ignite gitter channel how to connect
3+
* We're often asked in the Infinite Red Slack channel how to connect
44
* to a to a third party api, so we thought we'd demonstrate - but
55
* you should know you can use sagas for other flow control too.
66
*

0 commit comments

Comments
 (0)