Skip to content

Commit

Permalink
feat(core): Support Firebase v8 (#2624)
Browse files Browse the repository at this point in the history
* feat: update AngularFire to be compatible with Firebase JS SDK v8

Co-authored-by: Sarun Intaralawan <sarunint@sarunint.com>
  • Loading branch information
jamesdaniels and sarunint authored Oct 30, 2020
1 parent 98e5046 commit 082c0de
Show file tree
Hide file tree
Showing 34 changed files with 2,171 additions and 2,859 deletions.
4 changes: 2 additions & 2 deletions docs/auth/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ the Firebase docs for more information on what methods are available.](https://f
```ts
import { Component } from '@angular/core';
import { AngularFireAuth } from '@angular/fire/auth';
import { auth } from 'firebase/app';
import firebase from 'firebase/app';

@Component({
selector: 'app-root',
Expand All @@ -30,7 +30,7 @@ export class AppComponent {
constructor(public auth: AngularFireAuth) {
}
login() {
this.auth.signInWithPopup(new auth.GoogleAuthProvider());
this.auth.signInWithPopup(new firebase.auth.GoogleAuthProvider());
}
logout() {
this.auth.signOut();
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"@angular/platform-browser": "^9.0.0 || ^10.0.0",
"@angular/platform-browser-dynamic": "^9.0.0 || ^10.0.0",
"@angular/router": "^9.0.0 || ^10.0.0",
"firebase": "^7.13.1",
"firebase": "^7.0.0 || ^8.0.0",
"firebase-admin": "^8.10.0",
"firebase-functions": "^3.6.0",
"firebase-tools": "^8.0.0",
Expand All @@ -58,7 +58,7 @@
"inquirer": "^6.2.2",
"inquirer-autocomplete-prompt": "^1.0.1",
"open": "^7.0.3",
"rxfire": "^3.9.7",
"rxfire": "^3.9.7 || ^4.0.0",
"rxjs": "^6.5.3",
"semver": "^7.1.3",
"tslib": "^1.10.0 || ^2.0.0",
Expand All @@ -82,7 +82,7 @@
"@types/gzip-size": "^5.1.1",
"@types/inquirer": "^0.0.44",
"@types/jasmine": "^3.3.13",
"@types/node": "^12.6.2",
"@types/node": "^12.6.2 < 12.12.42",
"@types/request": "0.0.30",
"@types/semver": "^7.1.0",
"codelyzer": "^6.0.0",
Expand Down
34 changes: 17 additions & 17 deletions sample/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,31 @@
},
"private": true,
"dependencies": {
"@angular/animations": "~10.1.3",
"@angular/common": "~10.1.3",
"@angular/compiler": "~10.1.3",
"@angular/core": "~10.1.3",
"@angular/animations": "~10.2.1",
"@angular/common": "~10.2.1",
"@angular/compiler": "~10.2.1",
"@angular/core": "~10.2.1",
"@angular/fire": "../dist/packages-dist",
"@angular/forms": "~10.1.3",
"@angular/platform-browser": "~10.1.3",
"@angular/platform-browser-dynamic": "~10.1.3",
"@angular/platform-server": "~10.1.3",
"@angular/router": "~10.1.3",
"@angular/service-worker": "^10.1.3",
"@angular/forms": "~10.2.1",
"@angular/platform-browser": "~10.2.1",
"@angular/platform-browser-dynamic": "~10.2.1",
"@angular/platform-server": "~10.2.1",
"@angular/router": "~10.2.1",
"@angular/service-worker": "^10.2.1",
"@nguniversal/express-engine": "~10.1.0",
"firebase": "^7.21.1",
"firebase": "^8.0.0",
"first-input-delay": "^0.1.3",
"proxy-polyfill": "^0.3.2",
"rxjs": "~6.6.3",
"tslib": "^2.0.1",
"zone.js": "0.10.2"
"zone.js": "0.10.3"
},
"devDependencies": {
"@angular-devkit/architect": "~0.1001.3",
"@angular-devkit/build-angular": "~0.1001.3",
"@angular/cli": "~10.1.3",
"@angular/compiler-cli": "~10.1.3",
"@angular/language-service": "~10.1.3",
"@angular-devkit/build-angular": "~0.1002.0",
"@angular/cli": "~10.2.0",
"@angular/compiler-cli": "~10.2.1",
"@angular/language-service": "~10.2.1",
"@firebase/app-types": "^0.6.1",
"@nguniversal/builders": "^10.1.0",
"@types/jasmine": "~3.5.0",
Expand All @@ -65,4 +65,4 @@
"tslint": "~6.1.3",
"typescript": "~3.9.7"
}
}
}
Loading

3 comments on commit 082c0de

@sambecker
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has nothing to do with angularfire but do you know why firebase stopped letting you import destructured types, and why they now require everything to be dot-referenced from firebase? Thank you in advance!

@jamesdaniels
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sambecker great question. Ultimately with ES module you can't use default exports and namespaces at the same time, it's weird I know. Firebase v7 had a bunch of work arounds for this & they were getting really messy, ultimately they decided to break when they fixed their package.json so ngcc would stop freaking out about CJS builds. I'm not a fan of default exports in general but it was decided this would be the less drastic API change for now. There is however a modular version of the js sdk on the way, it's being developed in the open on that github repo, so check it out if you're curious. I'll be starting an experimental branch of rxfire & angularfire to support it soon.

@sambecker
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @jamesdaniels for that thoughtful reply! Makes total sense that firebase would make this move as part of a larger migration. Will definitely follow your experimental branch. So glad you updated your library so quickly. Looking at this commit was extremely helpful. Could not find the equivalent direction from Google!

Please sign in to comment.