Skip to content

Commit e443e6d

Browse files
committed
Merge remote-tracking branch 'origin/dev' into dev
2 parents bcd5634 + ef9dd6a commit e443e6d

File tree

25 files changed

+313
-65
lines changed

25 files changed

+313
-65
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,3 +320,6 @@ android/.idea/**
320320

321321
#ios
322322
Pods/*
323+
324+
# Jest
325+
.jest/

README.md

Lines changed: 11 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,10 @@
11
# React Native Typescript Boilerplate
22

3-
An opinionated boilerplate to build enterprise iOS / Android React Native apps.
3+
### An opinionated [React Native](https://facebook.github.io/react-native/docs/getting-started) Starter Kit with [React Native Navigation](https://github.com/wix/react-native-navigation) + [Redux](https://github.com/reactjs/redux) + [Eslint](https://github.com/airbnb/javascript) to build iOS / Android apps using TypeScript
44

55
##### Built using Microsft TypeScript & React Native
66

7-
The project has been setup based off instructions from Microsoft's Github TypeScript React Native Starter repo:
8-
https://github.com/Microsoft/TypeScript-React-Native-Starter
9-
10-
- [React Native](https://facebook.github.io/react-native/) - 0.58.1
11-
- [React Native Navigation](https://github.com/wix/react-native-navigation) - 2.x.x
12-
- [Redux](https://github.com/reduxjs/redux)
13-
- [Thunk](https://github.com/reduxjs/redux-thunk)
14-
15-
The project also uses [eslint](https://github.com/airbnb/javascript). Tests cases have been written using [jest](https://github.com/facebook/jest)
7+
The project has been setup based off instructions from [Microsoft's Github TypeScript React Native](https://github.com/Microsoft/TypeScript-React-Native-Starter) Starter repo
168

179
### Table of Contents
1810

@@ -21,8 +13,7 @@ The project also uses [eslint](https://github.com/airbnb/javascript). Tests case
2113
- [Deployment](#deployment)
2214
- [Codepush](#codepush)
2315
- [Lint](#lint)
24-
- [Running Unit Tests](#running-unit-tests)
25-
- [Rename the app](#rename-the-app)
16+
- [Unit Tests](#unit-tests)
2617
- [TODO](#todo)
2718
- [Cheat Sheet](#cheat-sheet)
2819

@@ -43,17 +34,16 @@ The project also uses [eslint](https://github.com/airbnb/javascript). Tests case
4334
│ └── utilities
4435
├── src
4536
│ ├── config App Configuration
46-
│ │ └── defaults
4737
│ ├── constants Screens, Localization
4838
│ ├── navigators Router, Navigation
49-
│ ├── view UI compoments - Screens, Widgets
39+
│ ├── view UI compoments - Screens, Widgets
5040
│ │ ├── elements Custom elements
51-
│ │ ├── icons
41+
│ │ ├── assets
5242
│ │ ├── screens
5343
│ │ ├── styles Typography
5444
│ │ └── widgets Custom components
5545
│ └── utilities
56-
├── tests Unit Tests
46+
├── __tests__ Unit Tests
5747
│ ├── presentation
5848
│ └── redux
5949
├── .babelrc
@@ -122,11 +112,11 @@ Example:
122112

123113
```
124114
appcenter codepush release-react -a AmitM30/rnts-ios -d Staging --description "Code Push !"
125-
appcenter codepush release-react -a AmitM30/rnts-android -d Staging --description "Code Push !"
126115
```
127116

128117
###### Command Options
129118

119+
List apps registered.
130120
`<ownerName>/<appName>`
131121

132122
```
@@ -136,30 +126,9 @@ AmitM30/rnts-ios
136126
```
137127

138128
`<deploymentName>`
139-
iOS Keys:
140129

141130
```
142131
$ appcenter codepush deployment list -a AmitM30/rnts-ios
143-
┌────────────┬───────────────────────────────────────┐
144-
│ Name │ Key │
145-
├────────────┼───────────────────────────────────────┤
146-
│ Staging │ xxxxxx │
147-
├────────────┼───────────────────────────────────────┤
148-
│ Production │ xxxxxx │
149-
└────────────┴───────────────────────────────────────┘
150-
```
151-
152-
Android Keys:
153-
154-
```
155-
$ appcenter codepush deployment list -a AmitM30/rnts-android
156-
┌────────────┬──────────────────────────────────────────────────────────────────┐
157-
│ Name │ Key │
158-
├────────────┼──────────────────────────────────────────────────────────────────┤
159-
│ Staging │ xxxxx-xxxx-xxxx │
160-
├────────────┼──────────────────────────────────────────────────────────────────┤
161-
│ Production │ xxxxx-xxxx-xxxx │
162-
└────────────┴──────────────────────────────────────────────────────────────────┘
163132
```
164133

165134
###### Release History
@@ -176,14 +145,6 @@ Or:
176145
code-push deployment history AmitM30/rnts-ios Staging
177146
```
178147

179-
###### Rollout Percentage
180-
181-
Command:
182-
183-
```
184-
appcenter codepush patch -a AmitM30/rnts-android Staging -t v2 -r 80
185-
```
186-
187148
#### Lint
188149

189150
To run lint on the application:
@@ -219,3 +180,7 @@ npm run test:coverage
219180
##### Items to come here
220181

221182
Test Item
183+
184+
#### TODO
185+
186+
- [ ] Build React app using `shared` business logic
File renamed without changes.

__tests__/views/home.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import React from 'react';
2+
import 'react-native';
3+
import renderer from 'react-test-renderer';
4+
5+
import Home from '../../src/view/screens/home';
6+
// Note: test renderer must be required after react-native.
7+
8+
it('renders correctly with defaults', () => {
9+
const tree = renderer.create(<Home name="Amit" />).toJSON();
10+
expect(tree).toMatchSnapshot();
11+
});

package.json

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@
4040
},
4141
"license": "MIT",
4242
"devDependencies": {
43+
"@babel/plugin-proposal-class-properties": "^7.3.0",
44+
"@babel/preset-env": "^7.3.1",
45+
"@types/jest": "^23.3.13",
46+
"@types/react": "^16.7.21",
47+
"@types/react-native": "^0.57.32",
48+
"@types/react-redux": "^7.0.1",
49+
"@types/react-test-renderer": "^16.0.3",
50+
"@types/redux-logger": "^3.0.6",
4351
"babel-core": "^7.0.0-bridge.0",
4452
"babel-eslint": "^10.0.1",
4553
"babel-jest": "24.0.0",
@@ -54,20 +62,36 @@
5462
"eslint-watch": "^4.0.2",
5563
"jest": "24.0.0",
5664
"metro-react-native-babel-preset": "^0.51.1",
65+
"react-addons-test-utils": "^15.6.2",
66+
"react-native-typescript-transformer": "^1.2.11",
5767
"react-test-renderer": "16.6.3",
58-
"regenerator-runtime": "^0.13.1"
68+
"regenerator-runtime": "^0.13.1",
69+
"ts-jest": "^23.10.5",
70+
"typescript": "^3.2.4"
5971
},
6072
"jest": {
6173
"preset": "react-native",
74+
"moduleFileExtensions": [
75+
"ts",
76+
"tsx",
77+
"js"
78+
],
6279
"transform": {
63-
"^.+\\.js$": "<rootDir>/node_modules/react-native/jest/preprocessor.js"
80+
"^.+\\.(js)$": "<rootDir>/node_modules/babel-jest",
81+
"\\.(ts|tsx)$": "<rootDir>/node_modules/ts-jest/preprocessor.js"
6482
},
83+
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$",
84+
"testPathIgnorePatterns": [
85+
"\\.snap$",
86+
"<rootDir>/node_modules/"
87+
],
6588
"collectCoverageFrom": [
6689
"src/**/*.{js,jsx}",
6790
"!**/node_modules/**",
6891
"!ios/**",
6992
"!android/**"
70-
]
93+
],
94+
"cacheDirectory": ".jest/cache"
7195
},
7296
"engines": {
7397
"node": ">=8.11.0 <=9",

rn-cli.config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module.exports = {
2+
getTransformModulePath() {
3+
return require.resolve('react-native-typescript-transformer');
4+
},
5+
getSourceExts() {
6+
return ['ts', 'tsx'];
7+
}
8+
};
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)