-
-
Notifications
You must be signed in to change notification settings - Fork 554
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Docs are now part of repo (source downloaded from [gitbook.com version](https://www.gitbook.com/book/prescottprue/react-redux-firebase/details)) and published to [react-redux-firebase.com](http://react-redux-firebase.com) * docs npm scripts added: * `docs:clean` - cleans docs folders * `docs:prepare` - prepares for doc generation (installs gitbook-cli) * `docs:api` - generates API Reference section of docs from comments in code using [`documentation.js`](http://documentation.js.org/) * `docs:build` - builds docs into gitbook * `docs: watch` - builds docs into gitbook while watching for changes * `docs: publish` - publish docs to `gh-pages` branch (pointed to [react-redux-firebase.com](http://react-redux-firebase.com) using CNAME file)
- Loading branch information
Showing
32 changed files
with
1,537 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,9 +3,9 @@ node_modules | |
examples/**/node_modules | ||
dist | ||
coverage | ||
_book | ||
|
||
# Logs | ||
*.log | ||
|
||
.DS_Store | ||
**/**/.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
react-redux-firebase.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Summary | ||
|
||
* [Read Me](/README.md) | ||
* [Getting Started](/docs/getting_started.md) | ||
* [Auth](/docs/auth.md) | ||
* [Queries](/docs/queries.md) | ||
* [Populate](/docs/populate.md) | ||
* [Storage](/docs/storage.md) | ||
* [Recipes](/docs/recipes/README.md) | ||
* [Upload](/docs/recipes/upload.md) | ||
* [Actions](/docs/recipes/actions.md) | ||
* [Thunks](/docs/recipes/thunks.md) | ||
* [API Reference](/docs/api/README.md) | ||
* [constants](/docs/api/constants.md) | ||
* [firebaseConnect](/docs/api/connect.md) | ||
* [firebaseStateReducer](/docs/api/reducer.md) | ||
* [reactReduxFirebase](/docs/api/compose.md) | ||
* [helpers](/docs/api/helpers.md) | ||
* [Roadmap](/docs/roadmap.md) | ||
* [Contributing](/docs/contributing.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
const exec = require('child_process').exec | ||
const files = [ | ||
{ | ||
src: 'connect.js', | ||
dest: 'connect.md' | ||
}, | ||
{ | ||
src: 'compose.js', | ||
dest: 'compose.md' | ||
}, | ||
{ | ||
src: 'helpers.js', | ||
dest: 'helpers.md' | ||
}, | ||
{ | ||
src: 'reducer.js', | ||
dest: 'reducer.md' | ||
}, | ||
{ | ||
src: 'constants.js', | ||
dest: 'constants.md' | ||
} | ||
] | ||
const pathToDocumentationJs = 'node_modules/documentation/bin/documentation.js' | ||
|
||
const generateDocForFile = (file) => { | ||
return new Promise((resolve, reject) => { | ||
exec(`${pathToDocumentationJs} build src/${file.src} -f md -o docs/api/${file.dest} --shallow`, (error, stdout) => { | ||
if (error !== null) { | ||
return reject(error) | ||
} | ||
resolve(stdout) | ||
}) | ||
}) | ||
} | ||
|
||
(function () { | ||
files.forEach(file => { | ||
generateDocForFile(file) | ||
.then((res) => { | ||
console.log('Successfully generated', file) // eslint-disable-line no-console | ||
}) | ||
.catch((err) => { | ||
console.log('error generating doc: ', err) // eslint-disable-line no-console | ||
}) | ||
}) | ||
})() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"gitbook": ">=3.2.1", | ||
"title": "React Redux Firebase", | ||
"plugins": ["edit-link", "prism", "-highlight", "github", "anchorjs"], | ||
"pluginsConfig": { | ||
"edit-link": { | ||
"base": "https://github.com/prescottprue/react-redux-firebase/tree/master", | ||
"label": "Edit This Page" | ||
}, | ||
"github": { | ||
"url": "https://github.com/prescottprue/react-redux-firebase/" | ||
}, | ||
"theme-default": { | ||
"styles": { | ||
"website": "build/gitbook.css" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Glossary | ||
|
||
## ## `profileDecorator` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Summary | ||
|
||
* [Read Me](/README.md) | ||
* [Getting Started](/docs/getting_started.md) | ||
* [Auth](/docs/auth.md) | ||
* [Queries](/docs/queries.md) | ||
* [Populate](/docs/populate.md) | ||
* [Storage](/docs/storage.md) | ||
* [Recipes](/docs/recipes/README.md) | ||
* [Upload](/docs/recipes/upload.md) | ||
* [Actions](/docs/recipes/actions.md) | ||
* [Thunks](/docs/recipes/thunks.md) | ||
* [API Reference](/docs/api/README.md) | ||
* [constants](/docs/api/constants.md) | ||
* [firebaseConnect](/docs/api/connect.md) | ||
* [firebaseStateReducer](/docs/api/reducer.md) | ||
* [reactReduxFirebase](/docs/api/compose.md) | ||
* [helpers](/docs/api/helpers.md) | ||
* [Roadmap](/docs/roadmap.md) | ||
* [Contributing](/docs/contributing.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# API Reference | ||
|
||
Just like [redux](http://redux.js.org/docs/api/index.html), the react-redux-firebase API surface is small. | ||
|
||
## Top-Level Exports | ||
* [firebaseConnect](/docs/api/connect.md) | ||
* [firebaseStateReducer](/docs/api/reducer.md) | ||
* [reactReduxFirebase](/docs/api/compose.md) | ||
* [constants](/docs/api/constants.md) | ||
* [actionTypes](/docs/api/constants.md) | ||
* [helpers](/docs/api/helpers.md) | ||
|
||
## Importing | ||
|
||
Every function described above is a top-level export. You can import any of them like this: | ||
|
||
### ES6 | ||
```js | ||
import { firebaseConnect } from 'react-redux-firebase' | ||
``` | ||
|
||
### ES5 (CommonJS) | ||
```js | ||
var firebaseConnect = require('react-redux-firebase').firebaseConnect | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<!-- Generated by documentation.js. Update this documentation by updating the source code. --> | ||
|
||
# reactReduxFirebase | ||
|
||
Middleware that handles configuration (placed in redux's `compose` call) | ||
|
||
**Parameters** | ||
|
||
- `fbConfig` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object containing Firebase config including databaseURL | ||
- `fbConfig.apiKey` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Firebase apiKey | ||
- `fbConfig.authDomain` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Firebase auth domain | ||
- `fbConfig.databaseURL` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Firebase database url | ||
- `fbConfig.storageBucket` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Firebase storage bucket | ||
- `config` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Containing react-redux-firebase specific config such as userProfile | ||
- `config.userProfile` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Location on firebase to store user profiles | ||
- `config.enableLogging` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Location on firebase to store user profiles. default: `false` | ||
- `config.profileDecorator` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** Location on firebase to store user profiles. default: `false` | ||
- `config.updateProfileOnLogin` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Whether or not to update profile when logging in. default: `false` | ||
- `config.profileParamsToPopulate` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Whether or not to update profile when logging in. default: `false` | ||
|
||
**Examples** | ||
|
||
_Data_ | ||
|
||
```javascript | ||
import { createStore, compose } from 'redux' | ||
import { reactReduxFirebase } from 'react-redux-firebase' | ||
|
||
// Firebase config | ||
const fbConfig = { | ||
apiKey: '<your-api-key>', | ||
authDomain: '<your-auth-domain>', | ||
databaseURL: '<your-database-url>', | ||
storageBucket: '<your-storage-bucket>' | ||
} | ||
|
||
// React Redux Firebase Config | ||
const config = { | ||
userProfile: 'users' | ||
} | ||
|
||
// Add react-redux-firebase to compose | ||
const createStoreWithFirebase = compose( | ||
reactReduxFirebase(fbConfig, config), | ||
)(createStore) | ||
|
||
// Use Function later to create store | ||
const store = createStoreWithFirebase(rootReducer, initialState) | ||
``` | ||
|
||
Returns **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** That accepts a component a returns a wrapped version of component |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<!-- Generated by documentation.js. Update this documentation by updating the source code. --> | ||
|
||
# firebaseConnect | ||
|
||
**Extends React.Component** | ||
|
||
Higher Order Component that automatically listens/unListens | ||
to provided firebase paths using React's Lifecycle hooks. | ||
|
||
**Parameters** | ||
|
||
- `watchArray` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** Array of objects or strings for paths to sync from Firebase | ||
|
||
**Examples** | ||
|
||
_Basic_ | ||
|
||
```javascript | ||
// this.props.firebase set on App component as firebase object with helpers | ||
import { firebaseConnect } from 'react-redux-firebase' | ||
export default firebaseConnect()(App) | ||
``` | ||
|
||
_Paths_ | ||
|
||
```javascript | ||
import { connect } from 'react-redux' | ||
import { firebaseConnect, helpers } from 'react-redux-firebase' | ||
const { pathToJS } = helpers | ||
|
||
// pass todos list from redux as this.props.todosList | ||
export default connect(({ firebase }) => ({ | ||
profile: pathToJS(firebase, 'profile'), | ||
auth: pathToJS(firebase, 'auth') | ||
}))(App) | ||
``` | ||
|
||
_Data_ | ||
|
||
```javascript | ||
import { connect } from 'react-redux' | ||
import { firebaseConnect, helpers } from 'react-redux-firebase' | ||
const { dataToJS } = helpers | ||
|
||
// sync /todos from firebase into redux | ||
const fbWrapped = firebaseConnect([ | ||
'todos' | ||
])(App) | ||
|
||
// pass todos list from redux as this.props.todosList | ||
export default connect(({ firebase }) => ({ | ||
todosList: dataToJS(firebase, 'todos') | ||
}))(fbWrapped) | ||
``` | ||
|
||
Returns **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** that accepts a component to wrap and returns the wrapped component |
Oops, something went wrong.