Skip to content

Commit d72623d

Browse files
committed
Bump rxfire and don't init by default
1 parent 343dbde commit d72623d

21 files changed

+2887
-3038
lines changed

angular.json

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
},
4242
"defaultProject": "angularfire",
4343
"cli": {
44+
"packageManager": "yarn",
4445
"analytics": "86795b8f-9036-4a53-929c-a7303453d677"
4546
}
4647
}

package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"test:typings": "node ./tools/run-typings-test.js",
1717
"test:build": "bash ./test/ng-build/build.sh",
1818
"test:all": "npm run test:node && npm run test:chrome-headless && npm run test:typings && npm run test:build",
19-
"build": "ttsc -p tsconfig.build.json; node --trace-warnings ./tools/build.js",
19+
"build": "rimraf dist; ttsc -p tsconfig.build.json; node --trace-warnings ./tools/build.js",
2020
"build:jasmine": "tsc -p tsconfig.jasmine.json; cp ./dist/packages-dist/schematics/versions.json ./dist/out-tsc/jasmine/schematics",
2121
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 1"
2222
},
@@ -63,10 +63,11 @@
6363
"inquirer-autocomplete-prompt": "^1.0.1",
6464
"lodash.isequal": "^4.5.0",
6565
"open": "^7.0.3",
66-
"rxfire": "6.0.0-canary.d3cbd88",
66+
"rxfire": "6.0.0-canary.cee1afe",
6767
"rxjs": "~6.6.0",
6868
"semver": "^7.1.3",
6969
"tslib": "^2.1.0",
70+
"webpack": "^5.35.0",
7071
"ws": "^7.2.1",
7172
"xhr2": "^0.1.4",
7273
"zone.js": "~0.11.4"

sample/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"@angular/router": "^12.0.0",
2525
"firebase": "9.0.0-beta.7",
2626
"lodash.isequal": "^4.5.0",
27-
"rxfire": "6.0.0-canary.d3cbd88",
27+
"rxfire": "6.0.0-canary.cee1afe",
2828
"rxjs": "~6.6.0",
2929
"tslib": "^2.1.0",
3030
"zone.js": "~0.11.4"
@@ -47,6 +47,7 @@
4747
"karma-coverage": "~2.0.3",
4848
"karma-jasmine": "~4.0.0",
4949
"karma-jasmine-html-reporter": "^1.5.0",
50+
"ng-packagr": "^12.0.0",
5051
"open": "^7.0.3",
5152
"ts-node": "~9.1.1",
5253
"typescript": "~4.2.3",

sample/src/app/app.component.ts

+7-16
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { ApplicationRef, Component, NgZone } from '@angular/core';
1+
import { ApplicationRef, Component, NgZone, Optional } from '@angular/core';
22
import { FirebaseApp, FirebaseApps } from '@angular/fire/app';
33
import { Auth, AuthInstances, authState } from '@angular/fire/auth';
4-
import { Firestore, FirestoreInstances } from '@angular/fire/firestore';
5-
import { functionInstance$ } from '@angular/fire/functions';
4+
import { Firestore, FirestoreInstances, firestoreInstance$ } from '@angular/fire/firestore';
65
import { debounceTime } from 'rxjs/operators';
6+
import { initializeFirestore$ } from './firestore';
77

88
@Component({
99
selector: 'app-root',
@@ -39,8 +39,8 @@ export class AppComponent {
3939
public auth: Auth, // default Firbase Auth
4040
public apps: FirebaseApps, // all initialized App instances
4141
public authInstances: AuthInstances, // all initialized Auth instances
42-
public firestore: Firestore,
43-
public firestoreInstances: FirestoreInstances,
42+
@Optional() public firestore: Firestore,
43+
@Optional() public firestoreInstances: FirestoreInstances,
4444
appRef: ApplicationRef,
4545
zone: NgZone,
4646
) {
@@ -50,16 +50,7 @@ export class AppComponent {
5050
authState(auth).subscribe(it => console.log('authState', it));
5151
appRef.isStable.pipe(debounceTime(200)).subscribe(it => console.log('isStable', it));
5252
console.log((app as any).container.providers.keys());
53-
zone.runOutsideAngular(() => {
54-
setTimeout(async () => {
55-
const functions = await import('./getFunctions');
56-
functions.getFunctions(app);
57-
}, 5000);
58-
setTimeout(async () => {
59-
const functions = await import('./getFunctions');
60-
functions.getFunctions(app, 'asdf');
61-
}, 10000);
62-
});
63-
functionInstance$.subscribe(it => console.log('$', it));
53+
firestoreInstance$.subscribe(it => console.log('$', it));
54+
initializeFirestore$.subscribe(it => console.log('init', it));
6455
}
6556
}

sample/src/app/app.module.ts

-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ import { initializeAuth } from 'firebase/auth';
77
import { AppRoutingModule } from './app-routing.module';
88
import { AppComponent } from './app.component';
99
import { environment } from '../environments/environment';
10-
import { initializeFirestore } from 'firebase/firestore';
11-
import { provideFirestore } from '@angular/fire/firestore';
1210

1311
@NgModule({
1412
declarations: [
@@ -24,7 +22,6 @@ import { provideFirestore } from '@angular/fire/firestore';
2422
return app;
2523
}),
2624
provideAuth(() => initializeAuth(getApp())),
27-
provideFirestore(() => initializeFirestore(getApp(), {}))
2825
],
2926
providers: [ ],
3027
bootstrap: [AppComponent]
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { getFirestore } from 'firebase/firestore';

sample/src/app/firestore/index.ts

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { Observable } from 'rxjs';
2+
import { shareReplay } from 'rxjs/operators';
3+
4+
export const initializeFirestore$ = new Observable(sub => {
5+
import('./getFirestore').then(({getFirestore}) => {
6+
sub.next(getFirestore());
7+
sub.complete();
8+
});
9+
}).pipe(
10+
shareReplay({ refCount: false })
11+
);

sample/src/app/getFunctions.ts

-1
This file was deleted.

0 commit comments

Comments
 (0)