Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): Upgrade to exp #2770

Merged
merged 59 commits into from
Aug 19, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
6297299
feat(core): Upgrade to exp
davideast Mar 9, 2021
110c264
feat(analytics): Add Analytics
davideast Mar 9, 2021
aa62620
feat(auth): Add Auth
davideast Mar 9, 2021
ac07108
feat(auth-guard): Add Auth Guard
davideast Mar 9, 2021
4761ba1
feat(database): Add Database
davideast Mar 9, 2021
58fced7
feat(firestore): Add Firestore
davideast Mar 10, 2021
6376d97
feat(functions): Add Functions
davideast Mar 10, 2021
8fce342
feat(messaging): Add Messaging
davideast Mar 10, 2021
daa4c25
feat(performance): Add Performance
davideast Mar 10, 2021
36fb698
feat(rc) Add Remote Config
davideast Mar 11, 2021
13f945e
feat(storage): Add Storage
davideast Mar 11, 2021
c85d200
chore(build): Fix build script and Analytics services
davideast Mar 11, 2021
1868406
Adding compat packages
jamesdaniels Apr 21, 2021
3f4761b
Update actions
jamesdaniels Apr 21, 2021
ee9aac1
Expirimenting with a new configuration style and adding a non-compat …
jamesdaniels Apr 22, 2021
adda7a0
More cleanup
jamesdaniels Apr 22, 2021
fcfc5ec
New DI pattern
jamesdaniels Apr 23, 2021
cd11b58
Nuking the tests for now
jamesdaniels Apr 23, 2021
cd5f171
Upgrade ng deps
jamesdaniels Apr 23, 2021
25e48ca
Getting jasmine working again, cleaning up tests
jamesdaniels Apr 23, 2021
6d4a022
partial compilation mode and updating sample-compat
jamesdaniels Apr 23, 2021
f947321
Adding Firefox and Safari tests, doubt Safari will work in actions
jamesdaniels Apr 23, 2021
fadc178
Trying SafariNative launcher
jamesdaniels Apr 23, 2021
b72a87b
Placeholders for sub-package, reexport rxfire/*
jamesdaniels May 3, 2021
f4ca651
Zone wrapping rxfire exports
jamesdaniels May 17, 2021
59b5934
Getting README rolling
jamesdaniels May 18, 2021
a857610
Don't wait on tests to publish, their red right now
jamesdaniels May 18, 2021
f572bc9
Getting things updated, new DI API
jamesdaniels Jul 26, 2021
343dbde
Cleaning things up
jamesdaniels Jul 27, 2021
d72623d
Bump rxfire and don't init by default
jamesdaniels Jul 27, 2021
1233a1c
Firestore/lite
jamesdaniels Jul 28, 2021
3e5518e
Starting on upgrade guide
jamesdaniels Jul 28, 2021
96fdd27
Trying different syntax
jamesdaniels Jul 28, 2021
fb4f667
Internet says this is right but breaking my preview
jamesdaniels Jul 28, 2021
50cae6c
Try this
jamesdaniels Jul 28, 2021
1c0e1de
How does this look on Github?
jamesdaniels Jul 28, 2021
294b3ea
Getting the table rolling
jamesdaniels Jul 28, 2021
301dc5b
Updating to beta.8
jamesdaniels Aug 4, 2021
6445e29
Wrapping the JS SDK
jamesdaniels Aug 12, 2021
6fb0f6d
Cleanup, upgrade schematic
jamesdaniels Aug 16, 2021
32f57c2
Expose the schematic in the public-api
jamesdaniels Aug 16, 2021
d3a9af2
Public_api
jamesdaniels Aug 16, 2021
1062278
Find and replace on upgrade
jamesdaniels Aug 16, 2021
674ff68
Find and replace on upgrade
jamesdaniels Aug 16, 2021
52247a6
Doc changes
jamesdaniels Aug 16, 2021
ec33419
Fix the reexport types and cleanup
jamesdaniels Aug 17, 2021
6218ba2
Clean up the upgrade schematic a bit
jamesdaniels Aug 17, 2021
ec312e3
Rework the import alias regex
jamesdaniels Aug 17, 2021
c5d4d1f
Adding rxfire to the schematic install
jamesdaniels Aug 17, 2021
2a3bd2a
Write the new content
jamesdaniels Aug 17, 2021
5c5c40e
Merged master
jamesdaniels Aug 19, 2021
7d256b0
Bump husky
jamesdaniels Aug 19, 2021
24c29e3
Lost this fix in the merge conflict
jamesdaniels Aug 19, 2021
fb95678
Spec wasnt pulling from compat
jamesdaniels Aug 19, 2021
c9bbe78
Paths wrong in the spec too
jamesdaniels Aug 19, 2021
591edeb
New scheduler
jamesdaniels Aug 19, 2021
f676c41
Import path
jamesdaniels Aug 19, 2021
bdddf69
Readd ɵkeepUnstableUntilFirstFactory for specs
jamesdaniels Aug 19, 2021
4431934
Next ref, req tests, drop safari
jamesdaniels Aug 19, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Placeholders for sub-package, reexport rxfire/*
  • Loading branch information
jamesdaniels committed May 3, 2021
commit b72a87b2bef7ef8d91fbfff7f8bdc574928ad6c1
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ AngularFire smooths over the rough edges an Angular developer might encounter wh

```ts
import { Component } from '@angular/core';
import { AngularFirestore } from '@angular/fire/firestore';
import { Observable } from 'rxjs';
import { Firestore } from '@angular/fire';
import { Observable, valueChanges } from 'rxjs';
import { collection } from 'firebase/firestore';

@Component({
selector: 'app-root',
Expand All @@ -33,8 +34,8 @@ import { Observable } from 'rxjs';
})
export class MyApp {
item$: Observable<any[]>;
constructor(firestore: AngularFirestore) {
this.item$ = firestore.collection('items').valueChanges();
constructor(firestore: Firestore) {
this.item$ = valueChanges(collection(firestore, 'items'));
}
}
```
Expand All @@ -47,6 +48,7 @@ AngularFire doesn't follow Angular's versioning as Firebase also has breaking ch

| Angular | Firebase | AngularFire |
| --------|----------|--------------|
| 12 | 9 | ^7.0 |
| 11 | 7,8 | ^6.1 |
| 10 | 8 | ^6.0.4 |
| 10 | 7 | ^6.0.3 |
Expand Down Expand Up @@ -77,7 +79,7 @@ Neither AngularFire or Firebase ship with polyfills. To have compatability acros

[Stackblitz Template](https://stackblitz.com/edit/angular-fire-start) - Remember to set your Firebase configuration in `app/app.module.ts`.

[Upgrading to v6.0? Check out our guide.](docs/version-6-upgrade.md)
[Upgrading to v7.0? Check out our guide.](docs/version-7-upgrade.md)

**Having troubles?** Get help on our [Q&A board](https://github.com/angular/angularfire/discussions?discussions_q=category%3AQ%26A), the official [Firebase Mailing List](https://groups.google.com/forum/#!forum/firebase-talk), the [Firebase Community Slack](https://firebase.community/) (`#angularfire2`), the [Angular Community Discord](http://discord.gg/angular) (`#firebase`), [Gitter](https://gitter.im/angular/angularfire2), the [Firebase subreddit](https://www.reddit.com/r/firebase), or [Stack Overflow](https://stackoverflow.com/questions/tagged/angularfire2).

Expand Down
5 changes: 5 additions & 0 deletions docs/version-7-upgrade.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Upgrading to AngularFire 7.0

Intended to be run with Angular 12, AngularFire 7.0 allows you to take full advtange of the new tree-shakable Firebase JS SDK (v9) while also providing a compatible expirience with the prior API.

**TBD**
8 changes: 4 additions & 4 deletions src/analytics/analytics.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function ɵanalyticsInstancesFactory(instances: Analytics[]) {
// Hack: useFactory doesn't allow us to pass a lambda, so let's bind the arugments
// Going this direction to cut down on DI token noise; also making it easier to support
// multiple Firebase Apps
export function ɵboundAuthInstanceFactory(zone: NgZone) {
export function ɵboundAnalyticsInstanceFactory(zone: NgZone) {
const analytics = ɵsmartCacheInstance<FirebaseAnalytics>(CACHE_PREFIX, this);
return new Analytics(analytics);
}
Expand All @@ -47,15 +47,15 @@ const DEFAULT_ANALYTICS_INSTANCE_PROVIDER = {
DEFAULT_ANALYTICS_INSTANCE_PROVIDER,
]
})
export class AngularFireAuthModule {
export class AngularFireAnalyticsModule {
}

export function provideAnalytics(fn: () => FirebaseAnalytics) {
return {
ngModule: AngularFireAuthModule,
ngModule: AngularFireAnalyticsModule,
providers: [{
provide: ANALYTICS_INSTANCES,
useFactory: ɵboundAuthInstanceFactory.bind(fn),
useFactory: ɵboundAnalyticsInstanceFactory.bind(fn),
multi: true,
deps: [
NgZone,
Expand Down
11 changes: 11 additions & 0 deletions src/analytics/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "../../node_modules/ng-packagr/package.schema.json",
"ngPackage": {
"lib": {
"umdModuleIds": {
"rxfire/analytics": "rxfire"
},
"entryFile": "public_api.ts"
}
}
}
1 change: 1 addition & 0 deletions src/analytics/public_api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { Analytics, provideAnalytics, ANALYTICS_INSTANCES } from '@angular/fire';
11 changes: 11 additions & 0 deletions src/app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "../../node_modules/ng-packagr/package.schema.json",
"ngPackage": {
"lib": {
"umdModuleIds": {
"rxfire/app": "rxfire"
},
"entryFile": "public_api.ts"
}
}
}
1 change: 1 addition & 0 deletions src/app/public_api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { FirebaseApp, provideFirebaseApp, FIREBASE_APPS } from '@angular/fire';
11 changes: 11 additions & 0 deletions src/auth/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "../../node_modules/ng-packagr/package.schema.json",
"ngPackage": {
"lib": {
"umdModuleIds": {
"rxfire/auth": "rxfire"
},
"entryFile": "public_api.ts"
}
}
}
2 changes: 2 additions & 0 deletions src/auth/public_api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { Auth, provideAuth, AUTH_INSTANCES } from '@angular/fire';
export * from 'rxfire/auth';
11 changes: 11 additions & 0 deletions src/database/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "../../node_modules/ng-packagr/package.schema.json",
"ngPackage": {
"lib": {
"umdModuleIds": {
"rxfire/database": "rxfire"
},
"entryFile": "public_api.ts"
}
}
}
2 changes: 2 additions & 0 deletions src/database/public_api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { Database, provideDatabase, DATABASE_INSTANCES } from '@angular/fire';
export * from 'rxfire/database';
11 changes: 11 additions & 0 deletions src/firestore/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "../../node_modules/ng-packagr/package.schema.json",
"ngPackage": {
"lib": {
"umdModuleIds": {
"rxfire/firestore": "rxfire"
},
"entryFile": "public_api.ts"
}
}
}
2 changes: 2 additions & 0 deletions src/firestore/public_api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { Firestore, provideFirestore, FIRESTORE_INSTANCES } from '@angular/fire';
export * from 'rxfire/firestore';
11 changes: 11 additions & 0 deletions src/functions/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "../../node_modules/ng-packagr/package.schema.json",
"ngPackage": {
"lib": {
"umdModuleIds": {
"rxfire/functions": "rxfire"
},
"entryFile": "public_api.ts"
}
}
}
2 changes: 2 additions & 0 deletions src/functions/public_api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { Functions, provideFunctions, FUNCTIONS_INSTANCES } from '@angular/fire';
export * from 'rxfire/functions';
11 changes: 11 additions & 0 deletions src/messaging/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "../../node_modules/ng-packagr/package.schema.json",
"ngPackage": {
"lib": {
"umdModuleIds": {
"rxfire/messaging": "rxfire"
},
"entryFile": "public_api.ts"
}
}
}
1 change: 1 addition & 0 deletions src/messaging/public_api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { Messaging, provideMessaging, MESSAGING_INSTANCES } from '@angular/fire';
11 changes: 11 additions & 0 deletions src/performance/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "../../node_modules/ng-packagr/package.schema.json",
"ngPackage": {
"lib": {
"umdModuleIds": {
"rxfire/performance": "rxfire"
},
"entryFile": "public_api.ts"
}
}
}
66 changes: 66 additions & 0 deletions src/performance/performance.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import { NgModule, Optional, NgZone, InjectionToken } from '@angular/core';
import { FirebasePerformance } from 'firebase/performance';

import { ɵsmartCacheInstance, ɵfetchCachedInstance } from '../core';
import { Performance } from './performance';
import { DEFAULT_APP_NAME, FIREBASE_APPS } from '../app/app.module';

export const PERFORMANCE_INSTANCES = new InjectionToken<Performance[]>('angularfire2.performance-instances');

const CACHE_PREFIX = 'Performance';

export function ɵdefaultPerformanceInstanceFactory(_: Performance[]) {
const performance = ɵfetchCachedInstance([CACHE_PREFIX, DEFAULT_APP_NAME].join('.'));
if (performance) {
return new Performance(performance);
}
throw new Error(`No Performance Instance provided for the '${DEFAULT_APP_NAME}' Firebase App - call providePerformance(...) in your providers list.`);
}

export function ɵwrapPerformanceInstanceInInjectable(performance: FirebasePerformance) {
return new Performance(performance);
}

export function ɵperformanceInstancesFactory(instances: Performance[]) {
return instances;
}

// Hack: useFactory doesn't allow us to pass a lambda, so let's bind the arugments
// Going this direction to cut down on DI token noise; also making it easier to support
// multiple Firebase Apps
export function ɵboundPerformanceInstanceFactory(zone: NgZone) {
const performance = ɵsmartCacheInstance<FirebasePerformance>(CACHE_PREFIX, this);
return new Performance(performance);
}

const DEFAULT_PERFORMANCE_INSTANCE_PROVIDER = {
provide: Performance,
useFactory: ɵdefaultPerformanceInstanceFactory,
deps: [
NgZone,
[new Optional(), PERFORMANCE_INSTANCES ],
]
};

@NgModule({
providers: [
DEFAULT_PERFORMANCE_INSTANCE_PROVIDER,
]
})
export class AngularFirePerformanceModule {
}

export function providePerformance(fn: () => FirebasePerformance) {
return {
ngModule: AngularFirePerformanceModule,
providers: [{
provide: PERFORMANCE_INSTANCES,
useFactory: ɵboundPerformanceInstanceFactory.bind(fn),
multi: true,
deps: [
NgZone,
[new Optional(), FIREBASE_APPS ]
]
}]
};
}
11 changes: 11 additions & 0 deletions src/performance/performance.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { FirebasePerformance } from 'firebase/performance';

// see notes in core/firebase.app.module.ts for why we're building the class like this
// tslint:disable-next-line:no-empty-interface
export interface Performance extends FirebasePerformance {}

export class Performance {
constructor(performance: FirebasePerformance) {
return performance;
}
}
2 changes: 2 additions & 0 deletions src/performance/public_api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { Performance, providePerformance, PERFORMANCE_INSTANCES } from '@angular/fire';
export * from 'rxfire/performance';
6 changes: 6 additions & 0 deletions src/public_api.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
export * from './core';
export * from './zones';

export * from './analytics/analytics';
export * from './analytics/analytics.module';

export * from './app/app';
export * from './app/app.module';

Expand All @@ -19,6 +22,9 @@ export * from './functions/functions.module';
export * from './messaging/messaging';
export * from './messaging/messaging.module';

export * from './performance/performance';
export * from './performance/performance.module';

export * from './remote-config/remote-config';
export * from './remote-config/remote-config.module';

Expand Down
11 changes: 11 additions & 0 deletions src/remote-config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "../../node_modules/ng-packagr/package.schema.json",
"ngPackage": {
"lib": {
"umdModuleIds": {
"rxfire/remote-config": "rxfire"
},
"entryFile": "public_api.ts"
}
}
}
2 changes: 2 additions & 0 deletions src/remote-config/public_api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { RemoteConfig, provideRemoteConfig, REMOTE_CONFIG_INSTANCES } from '@angular/fire';
export * from 'rxfire/remote-config';
11 changes: 11 additions & 0 deletions src/storage/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "../../node_modules/ng-packagr/package.schema.json",
"ngPackage": {
"lib": {
"umdModuleIds": {
"rxfire/storage": "rxfire"
},
"entryFile": "public_api.ts"
}
}
}
2 changes: 2 additions & 0 deletions src/storage/public_api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { Storage, provideStorage, STORAGE_INSTANCES } from '@angular/fire';
export * from 'rxfire/storage';
12 changes: 7 additions & 5 deletions tools/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ import firebase from 'firebase/compat/app';

// TODO infer these from the package.json
const MODULES = [
'core', 'compat', 'compat/analytics', 'compat/auth-guard', 'compat/auth',
'compat/database', 'compat/firestore', 'compat/functions', 'compat/remote-config',
'compat/storage', 'compat/messaging', 'compat/performance'
'core', 'compat', 'analytics', 'auth', 'database', 'firestore', 'functions',
'remote-config', 'storage', 'messaging', 'performance', 'compat/analytics',
'compat/auth-guard', 'compat/auth', 'compat/database', 'compat/firestore',
'compat/functions', 'compat/remote-config', 'compat/storage', 'compat/messaging',
'compat/performance'
];
const LAZY_MODULES = ['compat/analytics', 'compat/auth', 'compat/functions', 'compat/messaging', 'compat/remote-config'];
const UMD_NAMES = MODULES.map(m => m === 'core' ? 'angular-fire' : `angular-fire-${m.replace('/', '-')}`);
Expand Down Expand Up @@ -142,15 +144,15 @@ async function buildDocs() {
const buffer = await readFile(`./dist/typedocs/${module}.json`);
const typedoc = JSON.parse(buffer.toString());
if (!typedoc.children) {
console.log('typedoc fail', module);
console.error('typedoc fail', module);
}
// TODO infer the entryPoint from the package.json
const entryPoint = typedoc.children.find((c: any) => c.name === '"public_api"');
const allChildren = [].concat(...typedoc.children.map(child =>
// TODO chop out the working directory and filename
child.children ? child.children.map(c => ({ ...c, path: dirname(child.originalName.split(process.cwd())[1]) })) : []
));
return entryPoint.children
return (entryPoint.children || [])
.filter(c => c.name[0] !== 'ɵ' && c.name[0] !== '_' /* private */)
.map(child => ({ ...allChildren.find(c => child.target === c.id) }))
.reduce((acc, child) => ({ ...acc, [encodeURIComponent(child.name)]: child }), {});
Expand Down