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

Commit

Permalink
chore: configure lerna with bob
Browse files Browse the repository at this point in the history
  • Loading branch information
satya164 committed Aug 21, 2019
1 parent 14b353b commit 6b9af77
Show file tree
Hide file tree
Showing 27 changed files with 2,143 additions and 94 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@

/coverage/
/types/
/lib/
/dist/
/lib/
/packages/**/lib/

node_modules/
web-build/
web-report/

npm-debug.*
yarn-error.log

*.jks
*.p8
Expand Down
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -451,10 +451,10 @@ Unfortunately it's not possible to verify that the type of children elements are

## Contributing

The project uses a monorepo structure for the packages managed by [yarn workspaces](https://yarnpkg.com/lang/en/docs/workspaces/). To get started with the project, run `yarn` to install the required dependencies for each package:
The project uses a monorepo structure for the packages managed by [yarn workspaces](https://yarnpkg.com/lang/en/docs/workspaces/) and [lerna](https://lerna.js.org). To get started with the project, run `lerna bootstrap` to install the required dependencies for each package:

```sh
yarn
lerna bootstrap
```

While developing, you can run the [example app](/example/) with [Expo](https://expo.io/) to test your changes:
Expand All @@ -476,4 +476,14 @@ To fix formatting errors, run the following:
yarn lint --fix
```

Remember to add tests for your change if possible.
Remember to add tests for your change if possible. To run tests, first build all the files:

```sh
lerna run prepare
```

Then run the tests:

```sh
yarn test
```
8 changes: 8 additions & 0 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"version": "0.0.0",
"packages": [
"packages/*"
],
"npmClient": "yarn",
"useWorkspaces": true
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
"codecov": "^3.5.0",
"commitlint": "^8.0.0",
"core-js": "^3.1.4",
"del-cli": "^2.0.0",
"eslint": "^5.16.0",
"eslint-config-satya164": "^2.4.1",
"husky": "^2.4.0",
"jest": "^24.8.0",
"lerna": "^3.16.4",
"prettier": "^1.18.2",
"typescript": "^3.5.1"
},
Expand Down
24 changes: 23 additions & 1 deletion packages/bottom-tabs/package.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,43 @@
{
"name": "@navigation-ex/bottom-tabs",
"version": "0.0.1",
"main": "src/index",
"license": "MIT",
"main": "lib/commonjs/index.js",
"react-native": "src/index.tsx",
"module": "lib/module/index.js",
"types": "lib/typescript/src/index.d.ts",
"files": [
"src",
"lib"
],
"scripts": {
"prepare": "bob build",
"clean": "del lib"
},
"dependencies": {
"@navigation-ex/core": "^0.0.1",
"@navigation-ex/routers": "^0.0.1",
"react-native-safe-area-view": "^0.14.6"
},
"devDependencies": {
"@react-native-community/bob": "^0.7.0",
"@types/react": "^16.8.24",
"@types/react-native": "^0.60.2",
"del-cli": "^2.0.0",
"react": "16.8.3",
"react-native": "^0.59.8"
},
"peerDependencies": {
"react": "*",
"react-native": "*"
},
"@react-native-community/bob": {
"source": "src",
"output": "lib",
"targets": [
"commonjs",
"module",
"typescript"
]
}
}
3 changes: 3 additions & 0 deletions packages/bottom-tabs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "../../tsconfig"
}
24 changes: 23 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,43 @@
{
"name": "@navigation-ex/core",
"version": "0.0.1",
"main": "src/index",
"license": "MIT",
"main": "lib/commonjs/index.js",
"react-native": "src/index.tsx",
"module": "lib/module/index.js",
"types": "lib/typescript/src/index.d.ts",
"files": [
"src",
"lib"
],
"scripts": {
"prepare": "bob build",
"clean": "del lib"
},
"dependencies": {
"shortid": "^2.2.14",
"use-subscription": "^1.0.0"
},
"devDependencies": {
"@babel/core": "^7.4.5",
"@react-native-community/bob": "^0.7.0",
"@types/react": "^16.8.19",
"@types/shortid": "^0.0.29",
"del-cli": "^2.0.0",
"react": "^16.8.3",
"react-native-testing-library": "^1.9.1",
"react-test-renderer": "^16.8.3"
},
"peerDependencies": {
"react": "^16.8.3"
},
"@react-native-community/bob": {
"source": "src",
"output": "lib",
"targets": [
"commonjs",
"module",
"typescript"
]
}
}
2 changes: 1 addition & 1 deletion packages/core/src/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ export type EventEmitter<EventMap extends { [key: string]: any }> = {
}): EventArg<EventName, EventMap[EventName]>;
};

class PrivateValueStore<A, B, C> {
export class PrivateValueStore<A, B, C> {
/**
* TypeScript requires a type to be actually used to be able to infer it.
* This is a hacky way of storing type in a property without surfacing it in intellisense.
Expand Down
5 changes: 5 additions & 0 deletions packages/core/src/useNavigationBuilder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,13 @@ import {
Router,
RouterFactory,
PartialState,
PrivateValueStore,
} from './types';

// This is to make TypeScript compiler happy
// eslint-disable-next-line babel/no-unused-expressions
PrivateValueStore;

/**
* Compare two arrays with primitive values as the content.
* We need to make sure that both values and order match.
Expand Down
5 changes: 5 additions & 0 deletions packages/core/src/useNavigationHelpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@ import {
NavigationState,
ParamListBase,
Router,
PrivateValueStore,
} from './types';

// This is to make TypeScript compiler happy
// eslint-disable-next-line babel/no-unused-expressions
PrivateValueStore;

type Options<State extends NavigationState, Action extends NavigationAction> = {
onAction: (
action: NavigationAction,
Expand Down
3 changes: 3 additions & 0 deletions packages/core/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "../../tsconfig"
}
24 changes: 23 additions & 1 deletion packages/drawer/package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
{
"name": "@navigation-ex/drawer",
"version": "0.0.1",
"main": "src/index",
"license": "MIT",
"main": "lib/commonjs/index.js",
"react-native": "src/index.tsx",
"module": "lib/module/index.js",
"types": "lib/typescript/src/index.d.ts",
"files": [
"src",
"lib"
],
"scripts": {
"prepare": "bob build",
"clean": "del lib"
},
"dependencies": {
"@navigation-ex/core": "^0.0.1",
"@navigation-ex/routers": "^0.0.1",
"react-native-safe-area-view": "^0.14.6"
},
"devDependencies": {
"@react-native-community/bob": "^0.7.0",
"@types/react": "^16.8.24",
"@types/react-native": "^0.60.2",
"del-cli": "^2.0.0",
"react": "16.8.3",
"react-native": "^0.59.8",
"react-native-gesture-handler": "^1.3.0",
Expand All @@ -20,5 +33,14 @@
"peerDependencies": {
"react": "*",
"react-native": "*"
},
"@react-native-community/bob": {
"source": "src",
"output": "lib",
"targets": [
"commonjs",
"module",
"typescript"
]
}
}
3 changes: 3 additions & 0 deletions packages/drawer/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "../../tsconfig"
}
2 changes: 1 addition & 1 deletion packages/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"eject": "expo eject"
},
"dependencies": {
"@react-native-community/masked-view": "^0.1.1",
"@expo/vector-icons": "10.0.3",
"@react-native-community/masked-view": "^0.1.1",
"expo": "^34.0.1",
"expo-asset": "~6.0.0",
"react": "16.8.3",
Expand Down
16 changes: 0 additions & 16 deletions packages/example/webpack.config.js

This file was deleted.

24 changes: 23 additions & 1 deletion packages/material-bottom-tabs/package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
{
"name": "@navigation-ex/material-bottom-tabs",
"version": "0.0.1",
"main": "src/index",
"license": "MIT",
"main": "lib/commonjs/index.js",
"react-native": "src/index.tsx",
"module": "lib/module/index.js",
"types": "lib/typescript/src/index.d.ts",
"files": [
"src",
"lib"
],
"scripts": {
"prepare": "bob build",
"clean": "del lib"
},
"dependencies": {
"@navigation-ex/core": "^0.0.1",
"@navigation-ex/routers": "^0.0.1"
},
"devDependencies": {
"@react-native-community/bob": "^0.7.0",
"@types/react": "^16.8.24",
"@types/react-native": "^0.60.2",
"@types/react-native-vector-icons": "^6.4.1",
"del-cli": "^2.0.0",
"react": "16.8.3",
"react-native": "^0.59.8",
"react-native-paper": "^3.0.0-alpha.3",
Expand All @@ -21,5 +34,14 @@
"react-native": "*",
"react-native-paper": "^3.0.0-alpha.3",
"react-native-vector-icons": "^6.0.0"
},
"@react-native-community/bob": {
"source": "src",
"output": "lib",
"targets": [
"commonjs",
"module",
"typescript"
]
}
}
3 changes: 3 additions & 0 deletions packages/material-bottom-tabs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "../../tsconfig"
}
28 changes: 25 additions & 3 deletions packages/material-top-tabs/package.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,45 @@
{
"name": "@navigation-ex/material-top-tabs",
"version": "0.0.1",
"main": "src/index",
"license": "MIT",
"main": "lib/commonjs/index.js",
"react-native": "src/index.tsx",
"module": "lib/module/index.js",
"types": "lib/typescript/src/index.d.ts",
"files": [
"src",
"lib"
],
"scripts": {
"prepare": "bob build",
"clean": "del lib"
},
"dependencies": {
"@navigation-ex/core": "^0.0.1",
"@navigation-ex/routers": "^0.0.1"
},
"devDependencies": {
"@react-native-community/bob": "^0.7.0",
"@types/react": "^16.8.24",
"@types/react-native": "^0.60.2",
"del-cli": "^2.0.0",
"react": "16.8.3",
"react-native": "^0.59.8",
"react-native-tab-view": "^2.10.0",
"react-native-reanimated": "^1.1.0"
"react-native-reanimated": "^1.1.0",
"react-native-tab-view": "^2.10.0"
},
"peerDependencies": {
"react": "*",
"react-native": "*",
"react-native-tab-view": "^2.10.0"
},
"@react-native-community/bob": {
"source": "src",
"output": "lib",
"targets": [
"commonjs",
"module",
"typescript"
]
}
}
3 changes: 3 additions & 0 deletions packages/material-top-tabs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "../../tsconfig"
}
Loading

0 comments on commit 6b9af77

Please sign in to comment.