Skip to content

Commit 931b9c8

Browse files
author
Scott Prue
committed
Merge branch 'master' into v2.3.0
2 parents 8e5b3d7 + 14879f7 commit 931b9c8

File tree

158 files changed

+40873
-27832
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

158 files changed

+40873
-27832
lines changed

.eslintrc

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

.eslintrc.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
module.exports = {
2+
root: true,
3+
4+
parser: 'babel-eslint',
5+
6+
extends: ['standard', 'standard-react', 'prettier', 'prettier/react'],
7+
plugins: ['babel', 'react', 'prettier'],
8+
9+
settings: {
10+
react: {
11+
version: 'detect'
12+
}
13+
},
14+
15+
env: {
16+
browser: true,
17+
es6: true
18+
},
19+
20+
rules: {
21+
semi: [2, 'never'],
22+
'no-console': 'error',
23+
'prettier/prettier': ['error', {
24+
singleQuote: true,
25+
trailingComma: 'none',
26+
semi: false,
27+
bracketSpacing: true,
28+
jsxBracketSameLine: true,
29+
printWidth: 80,
30+
tabWidth: 2,
31+
useTabs: false
32+
}]
33+
}
34+
};
35+

CONTRIBUTING.md

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ We welcome any type of contribution, not only code. You can help with
99
- **Marketing**: writing blog posts, howto's, printing stickers, ...
1010
- **Community**: presenting the project at meetups, organizing a dedicated meetup for the local community, ...
1111
- **Code**: take a look at the [open issues](issues). Even if you can't write code, commenting on them, showing that you care about a given issue matters. It helps us triage them.
12-
- **Money**: we welcome financial contributions in full transparency on our [open collective](https://opencollective.com/react-redux-firebase).
12+
- **Money**: we welcome financial contributions as detailed in the [financial contributions section](#financial-contributions).
1313

1414
## Your First Contribution
1515

@@ -26,8 +26,7 @@ It is also always helpful to have some context for your pull request. What was t
2626

2727
## Financial contributions
2828

29-
We also welcome financial contributions in full transparency on our [open collective](https://opencollective.com/react-redux-firebase).
30-
Anyone can file an expense. If the expense makes sense for the development of the community, it will be "merged" in the ledger of our open collective by the core contributors and the person who filed the expense will be reimbursed.
29+
Financial contributions are welcomed through either [patreon](https://www.patreon.com/prescottprue) or [open collective](https://opencollective.com/react-redux-firebase).
3130

3231
## Questions
3332

@@ -48,20 +47,3 @@ Thank you to all our backers! [[Become a backer](https://opencollective.com/reac
4847

4948
<a href="https://opencollective.com/react-redux-firebase#backers" target="_blank"><img src="https://opencollective.com/react-redux-firebase/backers.svg?width=890"></a>
5049

51-
52-
### Sponsors
53-
54-
Thank you to all our sponsors! (please ask your company to also support this open source project by [becoming a sponsor](https://opencollective.com/react-redux-firebase#sponsor))
55-
56-
<a href="https://opencollective.com/react-redux-firebase/sponsor/0/website" target="_blank"><img src="https://opencollective.com/react-redux-firebase/sponsor/0/avatar.svg"></a>
57-
<a href="https://opencollective.com/react-redux-firebase/sponsor/1/website" target="_blank"><img src="https://opencollective.com/react-redux-firebase/sponsor/1/avatar.svg"></a>
58-
<a href="https://opencollective.com/react-redux-firebase/sponsor/2/website" target="_blank"><img src="https://opencollective.com/react-redux-firebase/sponsor/2/avatar.svg"></a>
59-
<a href="https://opencollective.com/react-redux-firebase/sponsor/3/website" target="_blank"><img src="https://opencollective.com/react-redux-firebase/sponsor/3/avatar.svg"></a>
60-
<a href="https://opencollective.com/react-redux-firebase/sponsor/4/website" target="_blank"><img src="https://opencollective.com/react-redux-firebase/sponsor/4/avatar.svg"></a>
61-
<a href="https://opencollective.com/react-redux-firebase/sponsor/5/website" target="_blank"><img src="https://opencollective.com/react-redux-firebase/sponsor/5/avatar.svg"></a>
62-
<a href="https://opencollective.com/react-redux-firebase/sponsor/6/website" target="_blank"><img src="https://opencollective.com/react-redux-firebase/sponsor/6/avatar.svg"></a>
63-
<a href="https://opencollective.com/react-redux-firebase/sponsor/7/website" target="_blank"><img src="https://opencollective.com/react-redux-firebase/sponsor/7/avatar.svg"></a>
64-
<a href="https://opencollective.com/react-redux-firebase/sponsor/8/website" target="_blank"><img src="https://opencollective.com/react-redux-firebase/sponsor/8/avatar.svg"></a>
65-
<a href="https://opencollective.com/react-redux-firebase/sponsor/9/website" target="_blank"><img src="https://opencollective.com/react-redux-firebase/sponsor/9/avatar.svg"></a>
66-
67-
<!-- This `CONTRIBUTING.md` is based on @nayafia's template https://github.com/nayafia/contributing-template -->

README.md

Lines changed: 46 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ The [Material Example](https://github.com/prescottprue/react-redux-firebase/tree
1919

2020
## Features
2121

22-
- Out of the box support for authentication (with auto load user profile)
23-
- Full Firebase Platform Support Including Real Time Database, Firestore, and Storage
24-
- Automatic binding/unbinding of listeners through React Higher Order Components (`firebaseConnect` and `firestoreConnect`)
25-
- [Population capability](http://react-redux-firebase.com/docs/populate) (similar to mongoose's `populate` or SQL's `JOIN`)
26-
- Support small data ( using `value` ) or large datasets ( using `child_added`, `child_removed`, `child_changed` )
27-
- Multiple queries types supported including `orderByChild`, `orderByKey`, `orderByValue`, `orderByPriority`, `limitToLast`, `limitToFirst`, `startAt`, `endAt`, `equalTo`
28-
- Tons of examples of integrations including [`redux-thunk`](https://github.com/gaearon/redux-thunk) and [`redux-observable`](https://redux-observable.js.org/)
29-
- Server Side Rendering Support
30-
- [`react-native` support](http://react-redux-firebase.com/docs/integrations/react-native.html) using [native modules](http://react-redux-firebase.com/docs/integrations/react-native.html#native-modules) or [web sdk](http://react-redux-firebase.com/docs/integrations/react-native.html#jsweb)
22+
* Out of the box support for authentication (with auto load user profile)
23+
* Full Firebase Platform Support Including Real Time Database, Firestore, and Storage
24+
* Automatic binding/unbinding of listeners through React Higher Order Components (`firebaseConnect` and `firestoreConnect`)
25+
* [Population capability](http://react-redux-firebase.com/docs/populate) (similar to mongoose's `populate` or SQL's `JOIN`)
26+
* Support small data ( using `value` ) or large datasets ( using `child_added`, `child_removed`, `child_changed` )
27+
* Multiple queries types supported including `orderByChild`, `orderByKey`, `orderByValue`, `orderByPriority`, `limitToLast`, `limitToFirst`, `startAt`, `endAt`, `equalTo`
28+
* Tons of examples of integrations including [`redux-thunk`](https://github.com/gaearon/redux-thunk) and [`redux-observable`](https://redux-observable.js.org/)
29+
* Server Side Rendering Support
30+
* [`react-native` support](http://react-redux-firebase.com/docs/integrations/react-native.html) using [native modules](http://react-redux-firebase.com/docs/integrations/react-native.html#native-modules) or [web sdk](http://react-redux-firebase.com/docs/integrations/react-native.html#jsweb)
3131

3232
## Installation
3333

@@ -43,24 +43,27 @@ If you're not, you can access the library on [unpkg](https://unpkg.com/redux-fir
4343

4444
## Use
4545

46-
Include `reactReduxFirebase` (store enhancer) and `firebaseReducer` (reducer) while creating your redux store:
46+
Include `reactReduxFirebase` (store enhancer) and `firebaseReducer` (reducer) while creating your redux store:
4747

4848
```javascript
4949
import React from 'react'
5050
import { render } from 'react-dom'
5151
import { Provider } from 'react-redux'
5252
import { createStore, combineReducers, compose } from 'redux'
5353
import { reactReduxFirebase, firebaseReducer } from 'react-redux-firebase'
54-
import firebase from 'firebase'
55-
// import { reduxFirestore, firestoreReducer } from 'redux-firestore' // <- needed if using firestore
54+
import firebase from 'firebase/app'
55+
import 'firebase/auth'
56+
import 'firebase/database'
57+
// import 'firebase/storage' // <- needed if using storage
5658
// import 'firebase/firestore' // <- needed if using firestore
5759
// import 'firebase/functions' // <- needed if using httpsCallable
60+
// import { reduxFirestore, firestoreReducer } from 'redux-firestore' // <- needed if using firestore
5861

5962
const firebaseConfig = {}
6063

6164
// react-redux-firebase config
6265
const rrfConfig = {
63-
userProfile: 'users',
66+
userProfile: 'users'
6467
// useFirestoreForProfile: true // Firestore for Profile instead of Realtime DB
6568
}
6669

@@ -73,13 +76,13 @@ firebase.initializeApp(firebaseConfig)
7376

7477
// Add reactReduxFirebase enhancer when making store creator
7578
const createStoreWithFirebase = compose(
76-
reactReduxFirebase(firebase, rrfConfig), // firebase instance as first argument
79+
reactReduxFirebase(firebase, rrfConfig) // firebase instance as first argument
7780
// reduxFirestore(firebase) // <- needed if using firestore
7881
)(createStore)
7982

8083
// Add firebase to reducers
8184
const rootReducer = combineReducers({
82-
firebase: firebaseReducer,
85+
firebase: firebaseReducer
8386
// firestore: firestoreReducer // <- needed if using firestore
8487
})
8588

@@ -92,9 +95,9 @@ const App = () => (
9295
<Provider store={store}>
9396
<Todos />
9497
</Provider>
95-
);
98+
)
9699

97-
render(<App/>, document.getElementById('root'));
100+
render(<App />, document.getElementById('root'))
98101
```
99102

100103
The Firebase instance can then be grabbed from context within your components (`withFirebase` and `firebaseConnect` Higher Order Components provided to help):
@@ -112,13 +115,9 @@ const Todos = ({ firebase }) => {
112115
return (
113116
<div>
114117
<h1>Todos</h1>
115-
<ul>
116-
{todosList}
117-
</ul>
118+
<ul>{todosList}</ul>
118119
<input type="text" ref="newTodo" />
119-
<button onClick={pushSample}>
120-
Add
121-
</button>
120+
<button onClick={pushSample}>Add</button>
122121
</div>
123122
)
124123
}
@@ -142,21 +141,15 @@ const Todos = ({ todos, firebase }) => {
142141
? 'Loading'
143142
: isEmpty(todos)
144143
? 'Todo list is empty'
145-
: Object.keys(todos).map(
146-
(key, id) => (
147-
<TodoItem key={key} id={id} todo={todos[key]}/>
148-
)
149-
)
144+
: Object.keys(todos).map((key, id) => (
145+
<TodoItem key={key} id={id} todo={todos[key]} />
146+
))
150147
return (
151148
<div>
152149
<h1>Todos</h1>
153-
<ul>
154-
{todosList}
155-
</ul>
150+
<ul>{todosList}</ul>
156151
<input type="text" ref="newTodo" />
157-
<button onClick={this.handleAdd}>
158-
Add
159-
</button>
152+
<button onClick={this.handleAdd}>Add</button>
160153
</div>
161154
)
162155
}
@@ -165,8 +158,8 @@ export default compose(
165158
firebaseConnect([
166159
'todos' // { path: '/todos' } // object notation
167160
]),
168-
connect((state) => ({
169-
todos: state.firebase.data.todos,
161+
connect(state => ({
162+
todos: state.firebase.data.todos
170163
// profile: state.firebase.profile // load profile
171164
}))
172165
)(Todos)
@@ -185,19 +178,19 @@ import { firebaseConnect, getVal } from 'react-redux-firebase'
185178

186179
// Component enhancer that loads todo into redux then into the todo prop
187180
const enhance = compose(
188-
firebaseConnect((props) => {
181+
firebaseConnect(props => {
189182
// Set listeners based on props (prop is route parameter from react-router in this case)
190183
return [
191-
{ path: `todos/${props.params.todoId}` }, // create todo listener
184+
{ path: `todos/${props.params.todoId}` } // create todo listener
192185
// `todos/${props.params.todoId}` // equivalent string notation
193186
]
194187
}),
195188
connect(({ firebase }, props) => ({
196-
todo: getVal(firebase, `data/todos/${props.params.todoId}`), // lodash's get can also be used
189+
todo: getVal(firebase, `data/todos/${props.params.todoId}`) // lodash's get can also be used
197190
}))
198191
)
199192

200-
const Todo = ({ todo, firebase, params }) =>
193+
const Todo = ({ todo, firebase, params }) => (
201194
<div>
202195
<input
203196
name="isDone"
@@ -209,12 +202,12 @@ const Todo = ({ todo, firebase, params }) =>
209202
/>
210203
<span>{todo.label}</span>
211204
</div>
205+
)
212206

213207
// Export enhanced component
214208
export default enhance(Todo)
215209
```
216210

217-
218211
**Load Data On Click**
219212

220213
```jsx
@@ -230,15 +223,13 @@ const Todos = ({ firebase }) => {
230223
? 'Loading'
231224
: isEmpty(todos)
232225
? 'Todo list is empty'
233-
: Object.keys(todos).map(
234-
(key, id) => <TodoItem key={key} id={id} todo={todos[key]}/>
235-
)
226+
: Object.keys(todos).map((key, id) => (
227+
<TodoItem key={key} id={id} todo={todos[key]} />
228+
))
236229
return (
237230
<div>
238231
<h1>Todos</h1>
239-
<ul>
240-
{todosList}
241-
</ul>
232+
<ul>{todosList}</ul>
242233
<button onClick={() => firebase.watchEvent('value', 'todos')}>
243234
Load Todos
244235
</button>
@@ -249,8 +240,8 @@ const Todos = ({ firebase }) => {
249240
// Export enhanced component
250241
export default compose(
251242
withFirebase, // or firebaseConnect()
252-
connect((state) => ({
253-
todos: state.firebase.data.todos,
243+
connect(state => ({
244+
todos: state.firebase.data.todos
254245
// profile: state.firebase.profile // load profile
255246
}))
256247
)(Todos)
@@ -265,6 +256,7 @@ If you plan to use Firestore, you should checkout [`redux-firestore`][redux-fire
265256
Currently `react-redux-firebase` still handles auth when using [`redux-firestore`][redux-firestore] - The future plan is to also have auth standalone auth library that will allow the developer to choose which pieces they do/do not want.
266257

267258
## [Docs](http://react-redux-firebase.com)
259+
268260
See full documentation at [react-redux-firebase.com](http://react-redux-firebase.com)
269261

270262
* [Getting Started](http://react-redux-firebase.com/docs/getting_started)
@@ -277,6 +269,7 @@ See full documentation at [react-redux-firebase.com](http://react-redux-firebase
277269
## [Examples](examples)
278270

279271
### Real World Applications
272+
280273
* [fireadmin.io](http://fireadmin.io) - Firebase Instance Management Tool (source [available here](https://github.com/prescottprue/fireadmin))
281274

282275
If you would like a project added to this section please reach out [over gitter][gitter-url]
@@ -299,7 +292,7 @@ A simple example that was created using [create-react-app](https://github.com/fa
299292

300293
#### [Material App Example](examples/complete/material)
301294

302-
An example that user Material UI built on top of the output of [create-react-app](https://github.com/facebookincubator/create-react-app)'s eject command. Shows a list of todo items and allows you to add to them. This is what is deployed to [redux-firebasev3.firebaseapp.com](https://redux-firebasev3.firebaseapp.com/).
295+
An example that user Material UI built on top of the output of [create-react-app](https://github.com/facebookincubator/create-react-app)'s eject command. Shows a list of todo items and allows you to add to them. This is what is deployed to [redux-firebasev3.firebaseapp.com](https://redux-firebasev3.firebaseapp.com/).
303296

304297
## Discussion
305298

@@ -359,15 +352,15 @@ This project exists thanks to all the people who contribute.
359352

360353
Thank you to all our backers! 🙏
361354

362-
* [Reside Network Inc.](https://github.com/reside-eng)
355+
* [Side Inc.](https://github.com/reside-eng)
363356

364357
[npm-image]: https://img.shields.io/npm/v/react-redux-firebase.svg?style=flat-square
365358
[npm-url]: https://npmjs.org/package/react-redux-firebase
366359
[npm-downloads-image]: https://img.shields.io/npm/dm/react-redux-firebase.svg?style=flat-square
367360
[quality-image]: http://npm.packagequality.com/shield/react-redux-firebase.svg?style=flat-square
368361
[quality-url]: https://packagequality.com/#?package=react-redux-firebase
369-
[backers]:https://opencollective.com/react-redux-firebase/backers/badge.svg?style=flat-square&color=blue
370-
[become-a-backer]:https://opencollective.com/react-redux-firebase#backer
362+
[backers]: https://opencollective.com/react-redux-firebase/backers/badge.svg?style=flat-square&color=blue
363+
[become-a-backer]: https://opencollective.com/react-redux-firebase#backer
371364
[travis-image]: https://img.shields.io/travis/prescottprue/react-redux-firebase/master.svg?style=flat-square
372365
[travis-url]: https://travis-ci.org/prescottprue/react-redux-firebase
373366
[daviddm-image]: https://img.shields.io/david/prescottprue/react-redux-firebase.svg?style=flat-square

bin/api-docs-generate.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,17 @@ function generateDocForFile(file) {
6060
})
6161
}
6262

63-
;(async function() {
63+
;(function() {
6464
console.log(
6565
'Generating API documentation (docs/api) from JSDoc comments within src...\n'
6666
)
67-
try {
68-
await Promise.all(files.map(generateDocForFile))
69-
console.log('\nAPI documentation generated successfully!')
70-
process.exit(0)
71-
} catch (err) {
72-
console.log('Error generating API documentation: ', err.message || err)
73-
process.exit(1)
74-
}
67+
Promise.all(files.map(generateDocForFile))
68+
.then(() => {
69+
console.log('\nAPI documentation generated successfully!')
70+
process.exit(0)
71+
})
72+
.catch(err => {
73+
console.log('Error generating API documentation: ', err.message || err)
74+
process.exit(1)
75+
})
7576
})()

0 commit comments

Comments
 (0)