Skip to content

Commit

Permalink
Removing RxFire (#4332)
Browse files Browse the repository at this point in the history
* RxFire is moving to its own repo

* Updating link

Co-authored-by: Feiyang1 <plane1113@gmail.com>
  • Loading branch information
jamesdaniels and Feiyang1 authored Jun 18, 2021
1 parent 1f3bdec commit e689ff6
Show file tree
Hide file tree
Showing 41 changed files with 14 additions and 3,196 deletions.
3 changes: 0 additions & 3 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,6 @@ packages/auth-types @bojeil-google @avolkovi @sam-gc @yuchenshi @firebase/jssdk
packages/testing @avolkovi @sam-gc @yuchenshi @firebase/jssdk-global-approvers
packages/rules-unit-testing @avolkovi @sam-gc @yuchenshi @firebase/jssdk-global-approvers

# RxFire Code
packages/rxfire @davideast @jamesdaniels @firebase/jssdk-global-approvers

# Installations
packages/installations @andirayo @ChaoqunCHEN @firebase/jssdk-global-approvers
packages/installations-types @andirayo @ChaoqunCHEN @firebase/jssdk-global-approvers
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/canary-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,4 @@ jobs:
NPM_TOKEN_UTIL: ${{secrets.NPM_TOKEN_UTIL}}
NPM_TOKEN_WEBCHANNEL_WRAPPER: ${{secrets.NPM_TOKEN_WEBCHANNEL_WRAPPER}}
NPM_TOKEN_FIREBASE: ${{secrets.NPM_TOKEN_FIREBASE}}
NPM_TOKEN_RXFIRE: ${{secrets.NPM_TOKEN_RXFIRE}}
CI: true
1 change: 0 additions & 1 deletion .github/workflows/prerelease-manual-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,5 @@ jobs:
NPM_TOKEN_UTIL: ${{secrets.NPM_TOKEN_UTIL}}
NPM_TOKEN_WEBCHANNEL_WRAPPER: ${{secrets.NPM_TOKEN_WEBCHANNEL_WRAPPER}}
NPM_TOKEN_FIREBASE: ${{secrets.NPM_TOKEN_FIREBASE}}
NPM_TOKEN_RXFIRE: ${{secrets.NPM_TOKEN_RXFIRE}}
CI: true

2 changes: 1 addition & 1 deletion .github/workflows/test-changed-misc.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test rxFire and @firebase/rules-unit-testing
name: Test @firebase/rules-unit-testing

on: pull_request

Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
"performance"
],
"scripts": {
"dev": "lerna run --parallel --scope @firebase/* --scope firebase --scope rxfire dev",
"build": "lerna run --scope @firebase/app-exp build:deps && lerna run --scope @firebase/* --scope firebase --scope rxfire --ignore @firebase/app-exp build",
"dev": "lerna run --parallel --scope @firebase/* --scope firebase dev",
"build": "lerna run --scope @firebase/app-exp build:deps && lerna run --scope @firebase/* --scope firebase --ignore @firebase/app-exp build",
"build:exp": "lerna run --scope @firebase/*-exp --scope @firebase/*-compat --scope firebase-exp build",
"build:release": "lerna run --scope @firebase/app-exp build:deps && lerna run --scope @firebase/* --scope firebase --scope rxfire --ignore @firebase/*-exp --ignore @firebase/*-compat build",
"build:release": "lerna run --scope @firebase/app-exp build:deps && lerna run --scope @firebase/* --scope firebase --ignore @firebase/*-exp --ignore @firebase/*-compat build",
"build:changed": "ts-node-script scripts/ci-test/build_changed.ts",
"link:packages": "lerna exec --scope @firebase/* --scope firebase --scope rxfire -- yarn link",
"link:packages": "lerna exec --scope @firebase/* --scope firebase -- yarn link",
"stage:packages": "./scripts/prepublish.sh",
"repl": "node tools/repl.js",
"release": "ts-node-script scripts/release/cli.ts",
Expand All @@ -46,8 +46,8 @@
"docgen:node": "node scripts/docgen/generate-docs.js --api node",
"docgen": "yarn docgen:js; yarn docgen:node",
"prettier": "prettier --config .prettierrc --write '**/*.{ts,js}'",
"lint": "lerna run --scope @firebase/* --scope rxfire lint",
"lint:fix": "lerna run --scope @firebase/* --scope rxfire lint:fix",
"lint": "lerna run --scope @firebase/* lint",
"lint:fix": "lerna run --scope @firebase/* lint:fix",
"size-report": "ts-node-script scripts/size_report/report_binary_size.ts",
"modular-export-size-report": "ts-node-script scripts/size_report/report_modular_export_binary_size.ts",
"api-report": "lerna run --scope @firebase/*-exp --scope @firebase/firestore --scope @firebase/storage --scope @firebase/storage-types --scope @firebase/database api-report",
Expand Down
6 changes: 4 additions & 2 deletions packages/rules-unit-testing/src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,9 @@ export function initializeAdminApp(options: AdminAppOptions): app.App {
* @param options options object.
*/
export function useEmulators(options: FirebaseEmulatorOptions): void {
if (!(options.database || options.firestore || options.storage || options.hub)) {
if (
!(options.database || options.firestore || options.storage || options.hub)
) {
throw new Error(
"Argument to useEmulators must contain at least one of 'database', 'firestore', 'storage', or 'hub'."
);
Expand Down Expand Up @@ -429,7 +431,7 @@ function getHubHost() {
}

function parseHost(host: string): { hostname: string; port: number } {
const withProtocol = host.startsWith("http") ? host : `http://${host}`;
const withProtocol = host.startsWith('http') ? host : `http://${host}`;
const u = new URL(withProtocol);
return {
hostname: u.hostname,
Expand Down
2 changes: 1 addition & 1 deletion packages/rules-unit-testing/test/database.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ describe('Testing Module Tests', function () {
// TODO: This test cannot be enabled without adding credentials to the test environment
// due to an underlying issue with firebase-admin storage. For now we will run it
// locally but not in CI.
if (process.env.CI !== "true") {
if (process.env.CI !== 'true') {
await firebase.assertSucceeds(
app.storage().bucket().file('/foo/bar.txt').save('Hello, World!')
);
Expand Down
12 changes: 0 additions & 12 deletions packages/rxfire/.eslintrc.js

This file was deleted.

7 changes: 0 additions & 7 deletions packages/rxfire/.gitignore

This file was deleted.

20 changes: 0 additions & 20 deletions packages/rxfire/CHANGELOG.md

This file was deleted.

125 changes: 1 addition & 124 deletions packages/rxfire/README.md
Original file line number Diff line number Diff line change
@@ -1,126 +1,3 @@
# RxFire

Firebase and RxJS for all frameworks.

## What is RxFire?

- **Observable creators** - Observables bindings for most Firebase web libraries.
- **Portable** - Use across any framework or no framework at all.
- **Tree shake-able** - Import only what you need. Shake the rest out with your favorite module bundler like Webpack or Rollup.
- **Combine multiple data sources** - Need to join two Firestore references? Want to combine an image from Cloud Storage with a Firestore document? Super easy with observables and operators.
- **Simplify code-splitting of Firebase** - Using RxFire with Webpack makes it easy to load Firebase features on-demand.

Status: Beta

## Install

```bash
# npm
npm i rxfire firebase rxjs --save
# yarn
yarn add rxfire firebase rxjs
```

Make sure to install Firebase and RxJS individually as they are peer dependencies of RxFire.

## Example use:

```ts
import firebase from 'firebase/app';
import 'firebase/firestore';
import { collectionData } from 'rxfire/firestore';
import { tap } from 'rxjs/operators';

const app = firebase.initializeApp({ /* config */ });
const citiesRef = app.firestore().collection('cities');
citiesRef.where('state', '==', 'CO');

collectionData(citiesRef, 'id')
.pipe(
tap(cities => console.log('This is just an observable!'))
)
.subscribe(cities => { /* update UI */ })
```

## Easily combine multiple Firebase data sources

RxJS provides multiple operators and creation methods for combining observable streams. This makes it easy to combine data from multiple Firebase resources. You can also handle simplify high asynchronous tasks like joins into a flat stream.

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.

```ts
import firebase from 'firebase/app';
import 'firebase/firestore';
import 'firebase/storage';
import { collectionData } from 'rxfire/firestore';
import { getDownloadURL } from 'rxfire/storage';
import { switchMap } from 'rxjs/operators';

const app = firebase.initializeApp({ /* config */ });
const citiesRef = app.firestore().collection('cities');
citiesRef.where('state', '==', 'CO');

collectionData(citiesRef, 'id')
.pipe(
switchMap(cities => {
return combineLatest(...cities.map(c => {
const ref = storage.ref(`/cities/${c.id}.png`);
return getDownloadURL(ref).pipe(map(imageURL => ({ imageURL, ...c })));
}));
})
)
.subscribe(cities => {
cities.forEach(c => console.log(c.imageURL));
});
```

## Understanding RxFire imports

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.

```ts
import firebase from 'firebase/app';
import 'firebase/storage'; // import only the features needed
import { getDownloadURL } from 'rxfire/storage';

const app = firebase.initializeApp({ /* config */ });
const ref = app.storage().ref('data.json');

// Now you can use RxFire!
const url$ = getDownloadURL(ref);
```

RxFire contains multiple entry points for module imports. Each Firebase library is an entry point.

```ts
import { } from 'rxfire/firestore';
import { } from 'rxfire/database';
import { } from 'rxfire/storage';
import { } from 'rxfire/auth';
import { } from 'rxfire/functions';
```

## Simple functions
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.

```ts
import firebase from 'firebase/app';
import 'firebase/storage';
import { getDownloadURL, put /* not used! */ } 'rxfire/storage';

const app = firebase.initializeApp({ /* config */ });
const ref = app.storage().ref('data.json');

const url$ = getDownloadURL(ref);
```
## Documentation
- [Firestore](https://github.com/firebase/firebase-js-sdk/blob/master/packages/rxfire/docs/firestore.md)
- [Authentication](https://github.com/firebase/firebase-js-sdk/blob/master/packages/rxfire/docs/auth.md)
- [Storage](https://github.com/firebase/firebase-js-sdk/blob/master/packages/rxfire/docs/storage.md)
- [Realtime Database](https://github.com/firebase/firebase-js-sdk/blob/master/packages/rxfire/docs/database.md)
## Examples
[Examples](https://github.com/davideast/rxfire-samples): See this example repository for a list of ways to configure and use RxFire.
RxFire has moved to its own repository, you can find it here [firebaseextended/rxfire](https://github.com/firebaseextended/rxfire).
60 changes: 0 additions & 60 deletions packages/rxfire/auth/index.ts

This file was deleted.

6 changes: 0 additions & 6 deletions packages/rxfire/auth/package.json

This file was deleted.

51 changes: 0 additions & 51 deletions packages/rxfire/database/fromRef.ts

This file was deleted.

21 changes: 0 additions & 21 deletions packages/rxfire/database/index.ts

This file was deleted.

Loading

0 comments on commit e689ff6

Please sign in to comment.