Skip to content

Commit 2245ad7

Browse files
authored
Update READMEs (#3551)
1 parent d4721c5 commit 2245ad7

File tree

7 files changed

+22
-61
lines changed

7 files changed

+22
-61
lines changed

packages/component/README.md

-8
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,6 @@
33
_NOTE: This is specifically tailored for Firebase JS SDK usage, if you are not a
44
member of the Firebase team, please avoid using this package_
55

6-
## Installation
7-
8-
You can install this wrapper by running the following in your project:
9-
10-
```bash
11-
$ npm install @firebase/component
12-
```
13-
146
## Usage
157

168
**ES Modules**

packages/firebase/README.md

+16-6
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ For more information, visit:
1414
The Firebase Realtime Database lets you store and query user data, and makes
1515
it available between users in realtime.
1616
- [Cloud Firestore](https://firebase.google.com/docs/firestore/quickstart) -
17-
Cloud Firestore is a flexible, scalable database for mobile, web, and server
17+
Cloud Firestore is a flexible, scalable database for mobile, web, and server
1818
development from Firebase and Google Cloud Platform.
1919
- [Firebase Storage](https://firebase.google.com/docs/storage/web/start) -
2020
Firebase Storage lets you upload and store user generated content, such as
@@ -37,6 +37,10 @@ you should use the
3737
## Get the code (browser)
3838

3939
### Script include
40+
>This brings in all Firebase features. See
41+
>["Include only the features you need"](#include-only-the-features-you-need)
42+
>below for
43+
>how to minimize download size by only including the scripts you need.
4044
4145
Include Firebase in your web application via a `<script>` tag:
4246

@@ -56,12 +60,17 @@ Include Firebase in your web application via a `<script>` tag:
5660
</script>
5761
```
5862

59-
*Note: To get a filled in version of the above code snippet, go to the
63+
_Note: To get a filled in version of the above code snippet, go to the
6064
[Firebase console](https://console.firebase.google.com/) for your app and click on "Add
61-
Firebase to your web app".*
65+
Firebase to your web app"._
6266

6367
### npm bundler (Browserify, Webpack, etc.)
6468

69+
>This brings in all Firebase features. See
70+
>["Include only the features you need"](#include-only-the-features-you-need)
71+
>below for
72+
>how to minimize bundle size by only importing the features you need.
73+
6574
The Firebase JavaScript npm package contains code that can be run in the browser
6675
after combining the modules you use with a package bundler (e.g.,
6776
[Browserify](http://browserify.org/), [Webpack](https://webpack.github.io/)).
@@ -173,11 +182,12 @@ var app = firebase.initializeApp({ ... });
173182
// ...
174183
```
175184

176-
If you are using native ES6 module with --experimental-modules flag, you should do:
185+
If you are using native ES6 module with --experimental-modules flag (or Node 12+)
186+
you should do:
177187

178188
```js
179189
// This import loads the firebase namespace.
180-
import firebase from 'firebase/app';
190+
import * as firebase from 'firebase/app';
181191

182192
// These imports load individual services into the firebase namespace.
183193
import 'firebase/auth';
@@ -186,7 +196,6 @@ import 'firebase/database';
186196

187197
_Known issue for typescript users with --experimental-modules: you have to set allowSyntheticDefaultImports to true in tsconfig.json to pass the type check. Use it with caution since it makes the assumption that all modules have a default export, which might not be the case for the other dependencies you have. And Your code will break if you try to import the default export from a module that doesn't have default export._
188198

189-
190199
Firebase Storage is not included in the server side Firebase npm module.
191200
Instead, you can use the
192201
[`google-cloud` Node.js client](https://github.com/GoogleCloudPlatform/google-cloud-node).
@@ -231,4 +240,5 @@ The Firebase changelog can be found at
231240
[firebase.google.com](https://firebase.google.com/support/release-notes/js).
232241

233242
## Browser/environment compatibility
243+
234244
Please see [Environment Support](https://firebase.google.com/support/guides/environments_js-sdk).

packages/firestore/README.md

-23
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,6 @@ If you are developing a Node.js application that requires administrative access
1010
use the [`@google-cloud/firestore`](https://www.npmjs.com/package/@google-cloud/firestore) Server
1111
SDK with your developer credentials.
1212

13-
## Usage
14-
15-
You can then use the firebase namespace exposed by this package as illustrated
16-
below:
17-
18-
**ES Modules**
19-
20-
```javascript
21-
import firebase from '@firebase/app';
22-
import '@firebase/firestore'
23-
24-
// Do stuff w/ `firebase` and `firebase.firestore`
25-
```
26-
27-
**CommonJS Modules**
28-
29-
```javascript
30-
const firebase = require('@firebase/app').default;
31-
require('@firebase/firestore');
32-
33-
// Do stuff with `firebase` and `firebase.firestore`
34-
```
35-
3613
## Documentation
3714

3815
For comprehensive documentation please see the [Firebase Reference

packages/rxfire/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Make sure to install Firebase and RxJS individually as they are peer dependencie
2626
## Example use:
2727

2828
```ts
29-
import firebase from 'firebase/app';
29+
import * as firebase from 'firebase/app';
3030
import 'firebase/firestore';
3131
import { collectionData } from 'rxfire/firestore';
3232
import { tap } from 'rxjs/operators';
@@ -49,7 +49,7 @@ RxJS provides multiple operators and creation methods for combining observable s
4949
The example below streams a list of "cities" from Firestore and then retrieves their image from a Cloud Storage bucket. Both tasks are asynchronous but RxJS makes it easy to combine these tasks together.
5050

5151
```ts
52-
import firebase from 'firebase/app';
52+
import * as firebase from 'firebase/app';
5353
import 'firebase/firestore';
5454
import 'firebase/storage';
5555
import { collectionData } from 'rxfire/firestore';
@@ -79,7 +79,7 @@ collectionData(citiesRef, 'id')
7979
RxFire is a complementary library to Firebase. It is not meant to wrap the entire Firebase SDK. RxFire's purpose is to simplify async streams from Firebase. You need to import the Firebase SDK and initialize an app before using RxFire.
8080

8181
```ts
82-
import firebase from 'firebase/app';
82+
import * as firebase from 'firebase/app';
8383
import 'firebase/storage'; // import only the features needed
8484
import { getDownloadURL } from 'rxfire/storage';
8585

@@ -104,7 +104,7 @@ import { } from 'rxfire/functions';
104104
RxFire is a set of functions. Most functions create observables and from there you can use regular RxJS operators. Some functions are custom operators. But at the end of the day, it's all just functions. This is important for **tree shaking**. Any unused functions are stripped from your final build if you use a module bundler like Webpack or Rollup.
105105

106106
```ts
107-
import firebase from 'firebase/app';
107+
import * as firebase from 'firebase/app';
108108
import 'firebase/storage';
109109
import { getDownloadURL, put /* not used! */ } 'rxfire/storage';
110110

packages/template/README.md

+1-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,4 @@ Firebase JS SDK. It will give you a couple things OOTB:
77
with the rest of the SDK.
88
- **Isomorphic Testing/Coverage:** Your tests will be run in both Node.js and
99
Browser environments and coverage from both, collected.
10-
- **Links to all of the other packages:** Should your new package need to take
11-
a dependency on any of the other packages in this monorepo (e.g.
12-
`@firebase/app`, `@firebase/util`, etc), all those dependencies are already
13-
set up, you can just remove the ones you don't need.
10+

packages/util/README.md

+1-8
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,6 @@ member of the Firebase team, please avoid using this package_
55

66
This is a wrapper of some Webchannel Features for the Firebase JS SDK.
77

8-
## Installation
9-
10-
You can install this wrapper by running the following in your project:
11-
12-
```bash
13-
$ npm install @firebase/util
14-
```
15-
168
## Usage
179

1810
**ES Modules**
@@ -30,3 +22,4 @@ const utils = require('@firebase/util');
3022

3123
// Do stuff with any of the re-exported `utils`
3224
```
25+

packages/webchannel-wrapper/README.md

-8
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,6 @@ _NOTE: This is specifically tailored for Firebase JS SDK usage, if you are not a
44

55
This is a wrapper of some Webchannel Features for the Firebase JS SDK.
66

7-
## Installation
8-
9-
You can install this wrapper by running the following in your project:
10-
11-
```bash
12-
$ npm install @firebase/webchannel-wrapper
13-
```
14-
157
## Usage
168

179
The following 5 modules are exposed for use:

0 commit comments

Comments
 (0)