Skip to content
This repository was archived by the owner on Nov 30, 2022. It is now read-only.

Commit feff8e6

Browse files
davideastmyspivey
authored andcommitted
chore(packaging): Support new @firebase scoped packages (angular#1423)
* fix(deps): add firebase types to peerDeps * fix(deps): Add module deps for Firebase * fix(deps): scoped firebase packaging * chore(deps): Update deps * fix(build): Use Firefox
1 parent 585df13 commit feff8e6

18 files changed

+1914
-329
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ before_script:
2626

2727
script:
2828
- npm run build
29-
- ./node_modules/.bin/karma start --single-run --browsers Chrome --reporters mocha
29+
- ./node_modules/.bin/karma start --single-run --browsers Firefox --reporters mocha
3030
# Run integration test to make sure our typings are correct for user-land.
3131
- node tools/run-typings-test.js
3232

karma.conf.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ module.exports = function(config) {
4141
logLevel: config.LOG_INFO,
4242
autoWatch: true,
4343
reporters: ['mocha'],
44-
browsers: ['Chrome'],
44+
browsers: ['Firefox'],
4545
singleRun: false
4646
})
4747
};

package.json

+17-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angularfire2",
3-
"version": "5.0.0-rc.5-next",
3+
"version": "5.0.0-rc.5.6-next",
44
"description": "The official library of Firebase and Angular.",
55
"private": true,
66
"scripts": {
@@ -34,7 +34,18 @@
3434
"@angular/core": "^5.0.0",
3535
"@angular/platform-browser": "^5.0.0",
3636
"@angular/platform-browser-dynamic": "^5.0.0",
37-
"firebase": "^4.5.0",
37+
"@firebase/app": "^0.1.6",
38+
"@firebase/app-types": "^0.1.1",
39+
"@firebase/auth": "^0.3.2",
40+
"@firebase/auth-types": "^0.1.1",
41+
"@firebase/database": "^0.1.7",
42+
"@firebase/database-types": "^0.1.1",
43+
"@firebase/firestore": "^0.2.3",
44+
"@firebase/firestore-types": "^0.1.1",
45+
"@firebase/messaging-types": "^0.1.1",
46+
"@firebase/storage": "^0.1.6",
47+
"@firebase/storage-types": "^0.1.1",
48+
"firebase": "^4.8.2",
3849
"rxjs": "^5.5.4",
3950
"zone.js": "^0.8.0"
4051
},
@@ -56,9 +67,9 @@
5667
"jasmine": "^2.4.1",
5768
"jasmine-core": "^2.4.1",
5869
"json": "^9.0.3",
59-
"karma": "^0.13.19",
60-
"karma-chrome-launcher": "^0.2.2",
61-
"karma-firefox-launcher": "^0.1.7",
70+
"karma": "^2.0.0",
71+
"karma-chrome-launcher": "^2.2.0",
72+
"karma-firefox-launcher": "^1.1.0",
6273
"karma-jasmine": "^0.3.6",
6374
"karma-mocha-reporter": "^2.0.2",
6475
"karma-systemjs": "^0.10.0",
@@ -71,6 +82,7 @@
7182
"rollup": "^0.35.11",
7283
"rollup-plugin-node-resolve": "^3.0.0",
7384
"rollup-watch": "^2.5.0",
85+
"shelljs": "^0.8.0",
7486
"systemjs": "^0.19.16",
7587
"systemjs-builder": "^0.15.7",
7688
"traceur": "0.0.96",

src/auth/auth.module.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { NgModule, NgZone } from '@angular/core';
22
import { FirebaseApp, AngularFireModule } from 'angularfire2';
33
import { AngularFireAuth } from './auth';
4+
import '@firebase/auth';
45

56
export function _getAngularFireAuth(app: FirebaseApp) {
67
return new AngularFireAuth(app);

src/auth/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"@angular/core": "ANGULAR_VERSION",
2323
"@angular/platform-browser": "ANGULAR_VERSION",
2424
"@angular/platform-browser-dynamic": "ANGULAR_VERSION",
25-
"firebase": "FIREBASE_VERSION",
25+
"@firebase/app": "FIREBASE_APP_VERSION",
26+
"@firebase/auth": "FIREBASE_AUTH_VERSION",
2627
"rxjs": "RXJS_VERSION",
2728
"zone.js": "ZONEJS_VERSION"
2829
},

src/core/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"@angular/core": "ANGULAR_VERSION",
2222
"@angular/platform-browser": "ANGULAR_VERSION",
2323
"@angular/platform-browser-dynamic": "ANGULAR_VERSION",
24-
"firebase": "FIREBASE_VERSION",
24+
"@firebase/app": "FIREBASE_APP_VERSION",
2525
"rxjs": "RXJS_VERSION",
2626
"zone.js": "ZONEJS_VERSION"
2727
},

src/database-deprecated/database.module.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { NgModule } from '@angular/core';
22
import { AngularFireModule, FirebaseApp } from 'angularfire2';
33
import { AngularFireDatabase } from './database';
4+
import '@firebase/database';
45

56
export function _getAngularFireDatabase(app: FirebaseApp) {
67
return new AngularFireDatabase(app);

src/database-deprecated/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"@angular/core": "ANGULAR_VERSION",
2323
"@angular/platform-browser": "ANGULAR_VERSION",
2424
"@angular/platform-browser-dynamic": "ANGULAR_VERSION",
25-
"firebase": "FIREBASE_VERSION",
25+
"@firebase/app": "FIREBASE_APP_VERSION",
26+
"@firebase/database": "FIREBASE_DATABASE_VERSION",
2627
"rxjs": "RXJS_VERSION",
2728
"zone.js": "ZONEJS_VERSION"
2829
},

src/database/database.module.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { NgModule } from '@angular/core';
22
import { AngularFireModule, FirebaseApp } from 'angularfire2';
33
import { AngularFireDatabase } from './database';
4+
import '@firebase/database';
45

56
export function _getAngularFireDatabase(app: FirebaseApp) {
67
return new AngularFireDatabase(app);

src/database/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"@angular/core": "ANGULAR_VERSION",
2323
"@angular/platform-browser": "ANGULAR_VERSION",
2424
"@angular/platform-browser-dynamic": "ANGULAR_VERSION",
25-
"firebase": "FIREBASE_VERSION",
25+
"@firebase/app": "FIREBASE_APP_VERSION",
26+
"@firebase/database": "FIREBASE_DATABASE_VERSION",
2627
"rxjs": "RXJS_VERSION",
2728
"zone.js": "ZONEJS_VERSION"
2829
},

src/firestore/firestore.module.ts

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { InjectionToken, ModuleWithProviders, NgModule } from '@angular/core';
22
import { FirebaseApp, AngularFireModule } from 'angularfire2';
33
import { AngularFirestore } from './firestore';
44
import { from } from 'rxjs/observable/from';
5+
import '@firebase/firestore';
56

67
import { EnablePersistenceToken } from './enable-persistance-token';
78

src/firestore/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
"@angular/core": "ANGULAR_VERSION",
2323
"@angular/platform-browser": "ANGULAR_VERSION",
2424
"@angular/platform-browser-dynamic": "ANGULAR_VERSION",
25-
"firebase": "FIREBASE_VERSION",
26-
"firestore": "FIRESTORE_VERSION",
25+
"@firebase/app": "FIREBASE_APP_VERSION",
26+
"@firebase/firestore": "FIREBASE_FIRESTORE_VERSION",
2727
"rxjs": "RXJS_VERSION",
2828
"zone.js": "ZONEJS_VERSION"
2929
},

src/root.spec.js

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ export * from './packages-dist/database/list/state-changes.spec';
1313
export * from './packages-dist/database/list/audit-trail.spec';
1414
export * from './packages-dist/storage/storage.spec';
1515

16+
// // Since this a deprecated API, we run on it on manual tests only
17+
// // It needs a network connection to run which makes it flaky on Travis
1618
// export * from './packages-dist/database-deprecated/firebase_list_factory.spec';
1719
// export * from './packages-dist/database-deprecated/firebase_object_factory.spec';
1820
// export * from './packages-dist/database-deprecated/firebase_list_observable.spec';

src/storage/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"@angular/core": "ANGULAR_VERSION",
2323
"@angular/platform-browser": "ANGULAR_VERSION",
2424
"@angular/platform-browser-dynamic": "ANGULAR_VERSION",
25-
"firebase": "FIREBASE_VERSION",
25+
"@firebase/app": "FIREBASE_APP_VERSION",
26+
"@firebase/storage": "FIREBASE_STORAGE_VERSION",
2627
"rxjs": "RXJS_VERSION",
2728
"zone.js": "ZONEJS_VERSION"
2829
},

src/storage/storage.module.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { NgModule } from '@angular/core';
22
import { AngularFireModule, FirebaseApp } from 'angularfire2';
33
import { AngularFireStorage } from './storage';
4+
import '@firebase/storage';
45

56
export function _getAngularFireStorage(app: FirebaseApp) {
67
return new AngularFireStorage(app);

test/ng-build/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const fs = require('fs');
22
const { spawn, spawnSync } = require('child_process');
3-
const ng5Pkg = require('./ng5/package.json');
3+
const ng5Pkg = require(`${__dirname}/ng5/package.json`);
44
const pkg = require('../../package.json');
55
const shell = require('shelljs');
66

tools/build.js

+31-1
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,18 @@ const GLOBALS = {
5454
'@angular/core': 'ng.core',
5555
'@angular/compiler': 'ng.compiler',
5656
'@angular/platform-browser': 'ng.platformBrowser',
57+
'firebase/auth': 'firebase',
58+
'firebase/app': 'firebase',
59+
'firebase/database': 'firebase',
60+
'firebase/firestore': 'firebase',
61+
'firebase/storage': 'firebase',
5762
'@firebase/auth': 'firebase',
5863
'@firebase/app': 'firebase',
5964
'@firebase/database': 'firebase',
6065
'@firebase/firestore': 'firebase',
6166
'@firebase/storage': 'firebase',
67+
'@firebase/util': 'firebase',
68+
'@firebase/webchannel-wrapper': 'firebase',
6269
'rxjs/scheduler/queue': 'Rx.Scheduler',
6370
'@angular/core/testing': 'ng.core.testing',
6471
'angularfire2': 'angularfire2',
@@ -72,7 +79,11 @@ const GLOBALS = {
7279
// Map of dependency versions across all packages
7380
const VERSIONS = {
7481
ANGULAR_VERSION: pkg.dependencies['@angular/core'],
75-
FIREBASE_VERSION: pkg.dependencies['firebase'],
82+
FIREBASE_APP_VERSION: pkg.dependencies['@firebase/app'],
83+
FIREBASE_DATABASE_VERSION: pkg.dependencies['@firebase/database'],
84+
FIREBASE_FIRESTORE_VERSION: pkg.dependencies['@firebase/firestore'],
85+
FIREBASE_AUTH_VERSION: pkg.dependencies['@firebase/auth'],
86+
FIREBASE_STORAGE_VERSION: pkg.dependencies['@firebase/storage'],
7687
RXJS_VERSION: pkg.dependencies['rxjs'],
7788
ZONEJS_VERSION: pkg.dependencies['zone.js'],
7889
ANGULARFIRE2_VERSION: pkg.version,
@@ -115,6 +126,15 @@ const DEST_PKG_PATHS = {
115126
storage: `${process.cwd()}/dist/packages-dist/storage/package.json`
116127
};
117128

129+
const FIREBASE_FEATURE_MODULES = {
130+
app: `${process.cwd()}/node_modules/@firebase/app/dist/esm/index.js`,
131+
auth: `${process.cwd()}/node_modules/@firebase/auth/dist/auth.js`,
132+
database: `${process.cwd()}/node_modules/@firebase/database/dist/esm/index.js`,
133+
firestore: `${process.cwd()}/node_modules/@firebase/firestore/dist/esm/index.js`,
134+
storage: `${process.cwd()}/node_modules/@firebase/storage/dist/esm/index.js`,
135+
util: `${process.cwd()}/node_modules/@firebase/util/dist/esm/index.js`,
136+
};
137+
118138
// Constants for running typescript commands
119139
const TSC = 'node_modules/.bin/tsc';
120140
const NGC = 'node_modules/.bin/ngc';
@@ -149,6 +169,16 @@ function generateBundle(entry, { dest, globals, moduleName }) {
149169
});
150170
}
151171

172+
function createFirebaseBundles(featurePaths, globals) {
173+
return Object.keys(featurePaths).map(feature => {
174+
return generateBundle(featurePaths[feature], {
175+
dest: `${process.cwd()}/dist/bundles/${feature}.js`,
176+
globals,
177+
moduleName: `firebase.${feature}`
178+
});
179+
});
180+
}
181+
152182
/**
153183
* Create a UMD bundle given a module name.
154184
* @param {string} name

0 commit comments

Comments
 (0)