Skip to content
This repository was archived by the owner on Feb 25, 2020. It is now read-only.

Commit d94cc8f

Browse files
committed
chore: configure bob
1 parent 8b192da commit d94cc8f

24 files changed

+2043
-2101
lines changed

.circleci/config.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ jobs:
4848
- store_artifacts:
4949
path: coverage
5050
destination: coverage
51+
build:
52+
<<: *defaults
53+
steps:
54+
- attach_workspace:
55+
at: ~/project
56+
- run: yarn prepare
5157

5258
workflows:
5359
version: 2
@@ -60,3 +66,6 @@ workflows:
6066
- unit-tests:
6167
requires:
6268
- install-dependencies
69+
- build:
70+
requires:
71+
- install-dependencies

.eslintignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
node_modules/
2-
dist/
3-
jest-setup.js
2+
lib/
43
coverage/

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,6 @@ types/
5454

5555
# Code coverage files
5656
coverage/
57+
58+
# generated by bob
59+
lib/

.release-it.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
{
22
"increment": "conventional:angular",
3-
"changelogCommand": "conventional-changelog -p angular | tail -n +3",
4-
"safeBump": false,
5-
"src": {
3+
"scripts": {
4+
"changelog": "conventional-changelog -p angular | tail -n +3"
5+
},
6+
"git": {
67
"commitMessage": "chore: release %s",
78
"tagName": "v%s"
89
},

babel.config.publish.js

Lines changed: 0 additions & 18 deletions
This file was deleted.

commitlint.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/* eslint-disable import/no-commonjs */
2+
3+
module.exports = {
4+
extends: ['@commitlint/config-conventional'],
5+
};

example/.eslintrc

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
{
2-
"extends": "../.eslintrc",
2+
'extends': '../.eslintrc',
33

4-
"settings": {
5-
"import/core-modules": [ "expo", "@react-navigation/core", "react-navigation-stack" ]
6-
},
4+
'settings':
5+
{
6+
'import/core-modules':
7+
[
8+
'expo',
9+
'@react-navigation/core',
10+
'react-navigation-stack',
11+
'react-native-vector-icons',
12+
'@expo/vector-icons',
13+
],
14+
},
715

8-
"rules": {
9-
"react/prop-types": "off"
10-
}
16+
'rules': { 'react-native/no-inline-styles': 'off' },
1117
}

jest-setup.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,3 @@
33
*/
44

55
// No setup
6-
7-
import React from 'react';

package.json

Lines changed: 48 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,21 @@
22
"name": "@react-navigation/core",
33
"version": "3.3.1",
44
"description": "Core utilities for the react-navigation framework",
5-
"main": "dist/index.js",
6-
"react-native": "dist/index.js",
7-
"module": "dist/index.js",
5+
"main": "lib/commonjs/index.js",
6+
"react-native": "src/index.js",
7+
"module": "lib/module/index.js",
88
"sideEffects": false,
99
"files": [
10-
"dist/",
11-
"src/",
12-
"LICENSE.md",
13-
"README.md"
10+
"src",
11+
"lib"
1412
],
1513
"scripts": {
16-
"pretest": "yarn lint && yarn build",
1714
"test": "jest",
18-
"lint": "eslint .",
19-
"format": "eslint . --fix",
20-
"babel": "babel --extensions '.js,.ts,.tsx' --no-babelrc --config-file=./babel.config.publish.js src --ignore '**/__tests__/**' --copy-files --source-maps --delete-dir-on-start",
21-
"tsc": "tsc",
22-
"build": "yarn babel --out-dir dist && del-cli 'dist/**/__tests__' && yarn tsc --emitDeclarationOnly",
23-
"dev": "yarn babel --watch src --out-dir example/node_modules/@react-navigation/core/dist",
24-
"prepare": "yarn build",
25-
"release": "release-it"
15+
"lint": "eslint --ext .js,.ts,.tsx .",
16+
"typescript": "tsc --noEmit",
17+
"example": "yarn --cwd example",
18+
"bootstrap": "yarn && yarn example",
19+
"prepare": "bob build"
2620
},
2721
"publishConfig": {
2822
"registry": "https://registry.npmjs.org/"
@@ -44,44 +38,38 @@
4438
},
4539
"homepage": "https://github.com/react-navigation/react-navigation-core#readme",
4640
"dependencies": {
47-
"hoist-non-react-statics": "^2.5.5",
41+
"hoist-non-react-statics": "^3.3.0",
4842
"path-to-regexp": "^1.7.0",
49-
"query-string": "^6.2.0",
50-
"react-is": "^16.6.3"
43+
"query-string": "^6.4.2",
44+
"react-is": "^16.8.6"
5145
},
5246
"devDependencies": {
53-
"@babel/cli": "^7.2.3",
54-
"@babel/core": "^7.3.4",
55-
"@babel/plugin-proposal-class-properties": "7.3.4",
56-
"@babel/plugin-proposal-object-rest-spread": "7.3.4",
57-
"@babel/plugin-transform-block-scoping": "7.3.4",
58-
"@babel/plugin-transform-modules-commonjs": "7.2.0",
59-
"@babel/preset-flow": "^7.0.0",
60-
"@babel/preset-react": "^7.0.0",
61-
"@babel/preset-typescript": "^7.3.3",
62-
"@react-navigation/core": "^3.2.1",
63-
"@react-navigation/native": "^3.3.0",
47+
"@babel/cli": "^7.4.3",
48+
"@commitlint/config-conventional": "^7.5.0",
49+
"@react-native-community/bob": "^0.3.4",
50+
"@react-navigation/core": "^3.3.1",
51+
"@react-navigation/native": "^3.4.1",
6452
"babel-core": "7.0.0-bridge.0",
6553
"babel-eslint": "^10.0.1",
66-
"babel-jest": "^24.1.0",
54+
"babel-jest": "^24.7.1",
55+
"commitlint": "^7.5.2",
6756
"conventional-changelog-cli": "^2.0.5",
6857
"del-cli": "^1.1.0",
69-
"eslint": "^4.12.1",
70-
"eslint-config-satya164": "^1.0.1",
58+
"eslint": "^5.16.0",
59+
"eslint-config-satya164": "^2.4.1",
7160
"eslint-plugin-react-native-globals": "^0.1.0",
7261
"husky": "^1.1.2",
73-
"jest": "^24.1.0",
62+
"jest": "^24.7.1",
7463
"jest-expo": "^32.0.0",
75-
"metro-react-native-babel-preset": "^0.49.2",
76-
"prettier": "^1.13.6",
64+
"metro-react-native-babel-preset": "^0.53.1",
65+
"prettier": "^1.17.0",
7766
"react": "16.6.3",
7867
"react-dom": "16.6.3",
7968
"react-native": "^0.58.6",
80-
"react-native-testing-library": "^1.6.2",
81-
"react-test-renderer": "16.6.3",
82-
"release-it": "^7.6.1",
83-
"ts-jest": "^24.0.0",
84-
"typescript": "^3.3.3333"
69+
"react-native-testing-library": "^1.7.0",
70+
"react-test-renderer": "16.8.6",
71+
"release-it": "^10.4.2",
72+
"typescript": "^3.4.3"
8573
},
8674
"peerDependencies": {
8775
"react": "*"
@@ -99,28 +87,30 @@
9987
"node_modules/(?!(jest-)?react-native|react-clone-referenced-element|@react-navigation)"
10088
],
10189
"transform": {
102-
"^.+\\.tsx?$": "ts-jest"
90+
"^.+\\.(js|ts|tsx)$": "babel-jest"
10391
},
104-
"moduleFileExtensions": [
105-
"ts",
106-
"js"
107-
],
10892
"modulePathIgnorePatterns": [
109-
"<rootDir>/example/"
110-
],
111-
"globals": {
112-
"ts-jest": {
113-
"tsConfig": "./tsconfig.test.json",
114-
"diagnostics": {
115-
"ignoreCodes": [
116-
151001
117-
]
118-
}
119-
}
120-
}
93+
"<rootDir>/example/",
94+
"<rootDir>/lib/"
95+
]
12196
},
12297
"prettier": {
12398
"trailingComma": "es5",
12499
"singleQuote": true
100+
},
101+
"husky": {
102+
"hooks": {
103+
"pre-commit": "yarn lint && yarn typescript && yarn test",
104+
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
105+
}
106+
},
107+
"@react-native-community/bob": {
108+
"source": "src",
109+
"output": "lib",
110+
"targets": [
111+
"commonjs",
112+
"module",
113+
"typescript"
114+
]
125115
}
126116
}

src/__tests__/NavigationStateUtils-test.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ describe('StateUtils', () => {
6363
};
6464
expect(() =>
6565
NavigationStateUtils.push(state, { key: 'a', routeName })
66-
).toThrow();
66+
).toThrow('should not push route with duplicated key a');
6767
});
6868

6969
// Pop
@@ -112,7 +112,9 @@ describe('StateUtils', () => {
112112
routes: [{ key: 'a', routeName }, { key: 'b', routeName }],
113113
isTransitioning: false,
114114
};
115-
expect(() => NavigationStateUtils.jumpToIndex(state, 2)).toThrow();
115+
expect(() => NavigationStateUtils.jumpToIndex(state, 2)).toThrow(
116+
'invalid index 2 to jump to'
117+
);
116118
});
117119

118120
it('jumps to new key', () => {
@@ -136,7 +138,9 @@ describe('StateUtils', () => {
136138
routes: [{ key: 'a', routeName }, { key: 'b', routeName }],
137139
isTransitioning: false,
138140
};
139-
expect(() => NavigationStateUtils.jumpTo(state, 'c')).toThrow();
141+
expect(() => NavigationStateUtils.jumpTo(state, 'c')).toThrow(
142+
'invalid index -1 to jump to'
143+
);
140144
});
141145

142146
it('move backwards', () => {
@@ -234,7 +238,7 @@ describe('StateUtils', () => {
234238

235239
expect(() => {
236240
NavigationStateUtils.reset(state, []);
237-
}).toThrow();
241+
}).toThrow('invalid routes to replace');
238242
});
239243

240244
it('Resets routes with index', () => {
@@ -262,6 +266,6 @@ describe('StateUtils', () => {
262266
[{ key: 'x', routeName }, { key: 'y', routeName }],
263267
100
264268
);
265-
}).toThrow();
269+
}).toThrow('invalid index 100 to reset');
266270
});
267271
});

0 commit comments

Comments
 (0)