Skip to content

chore(packaging): Support new @firebase scoped packages #1423

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

Merged
merged 5 commits into from
Jan 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ before_script:

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

Expand Down
2 changes: 1 addition & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ module.exports = function(config) {
logLevel: config.LOG_INFO,
autoWatch: true,
reporters: ['mocha'],
browsers: ['Chrome'],
browsers: ['Firefox'],
singleRun: false
})
};
Expand Down
22 changes: 17 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angularfire2",
"version": "5.0.0-rc.5-next",
"version": "5.0.0-rc.5.6-next",
"description": "The official library of Firebase and Angular.",
"private": true,
"scripts": {
Expand Down Expand Up @@ -34,7 +34,18 @@
"@angular/core": "^5.0.0",
"@angular/platform-browser": "^5.0.0",
"@angular/platform-browser-dynamic": "^5.0.0",
"firebase": "^4.5.0",
"@firebase/app": "^0.1.6",
"@firebase/app-types": "^0.1.1",
"@firebase/auth": "^0.3.2",
"@firebase/auth-types": "^0.1.1",
"@firebase/database": "^0.1.7",
"@firebase/database-types": "^0.1.1",
"@firebase/firestore": "^0.2.3",
"@firebase/firestore-types": "^0.1.1",
"@firebase/messaging-types": "^0.1.1",
"@firebase/storage": "^0.1.6",
"@firebase/storage-types": "^0.1.1",
"firebase": "^4.8.2",
"rxjs": "^5.5.4",
"zone.js": "^0.8.0"
},
Expand All @@ -56,9 +67,9 @@
"jasmine": "^2.4.1",
"jasmine-core": "^2.4.1",
"json": "^9.0.3",
"karma": "^0.13.19",
"karma-chrome-launcher": "^0.2.2",
"karma-firefox-launcher": "^0.1.7",
"karma": "^2.0.0",
"karma-chrome-launcher": "^2.2.0",
"karma-firefox-launcher": "^1.1.0",
"karma-jasmine": "^0.3.6",
"karma-mocha-reporter": "^2.0.2",
"karma-systemjs": "^0.10.0",
Expand All @@ -71,6 +82,7 @@
"rollup": "^0.35.11",
"rollup-plugin-node-resolve": "^3.0.0",
"rollup-watch": "^2.5.0",
"shelljs": "^0.8.0",
"systemjs": "^0.19.16",
"systemjs-builder": "^0.15.7",
"traceur": "0.0.96",
Expand Down
1 change: 1 addition & 0 deletions src/auth/auth.module.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { NgModule, NgZone } from '@angular/core';
import { FirebaseApp, AngularFireModule } from 'angularfire2';
import { AngularFireAuth } from './auth';
import '@firebase/auth';

export function _getAngularFireAuth(app: FirebaseApp) {
return new AngularFireAuth(app);
Expand Down
3 changes: 2 additions & 1 deletion src/auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"@angular/core": "ANGULAR_VERSION",
"@angular/platform-browser": "ANGULAR_VERSION",
"@angular/platform-browser-dynamic": "ANGULAR_VERSION",
"firebase": "FIREBASE_VERSION",
"@firebase/app": "FIREBASE_APP_VERSION",
"@firebase/auth": "FIREBASE_AUTH_VERSION",
"rxjs": "RXJS_VERSION",
"zone.js": "ZONEJS_VERSION"
},
Expand Down
2 changes: 1 addition & 1 deletion src/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@angular/core": "ANGULAR_VERSION",
"@angular/platform-browser": "ANGULAR_VERSION",
"@angular/platform-browser-dynamic": "ANGULAR_VERSION",
"firebase": "FIREBASE_VERSION",
"@firebase/app": "FIREBASE_APP_VERSION",
"rxjs": "RXJS_VERSION",
"zone.js": "ZONEJS_VERSION"
},
Expand Down
1 change: 1 addition & 0 deletions src/database-deprecated/database.module.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { NgModule } from '@angular/core';
import { AngularFireModule, FirebaseApp } from 'angularfire2';
import { AngularFireDatabase } from './database';
import '@firebase/database';

export function _getAngularFireDatabase(app: FirebaseApp) {
return new AngularFireDatabase(app);
Expand Down
3 changes: 2 additions & 1 deletion src/database-deprecated/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"@angular/core": "ANGULAR_VERSION",
"@angular/platform-browser": "ANGULAR_VERSION",
"@angular/platform-browser-dynamic": "ANGULAR_VERSION",
"firebase": "FIREBASE_VERSION",
"@firebase/app": "FIREBASE_APP_VERSION",
"@firebase/database": "FIREBASE_DATABASE_VERSION",
"rxjs": "RXJS_VERSION",
"zone.js": "ZONEJS_VERSION"
},
Expand Down
1 change: 1 addition & 0 deletions src/database/database.module.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { NgModule } from '@angular/core';
import { AngularFireModule, FirebaseApp } from 'angularfire2';
import { AngularFireDatabase } from './database';
import '@firebase/database';

export function _getAngularFireDatabase(app: FirebaseApp) {
return new AngularFireDatabase(app);
Expand Down
3 changes: 2 additions & 1 deletion src/database/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"@angular/core": "ANGULAR_VERSION",
"@angular/platform-browser": "ANGULAR_VERSION",
"@angular/platform-browser-dynamic": "ANGULAR_VERSION",
"firebase": "FIREBASE_VERSION",
"@firebase/app": "FIREBASE_APP_VERSION",
"@firebase/database": "FIREBASE_DATABASE_VERSION",
"rxjs": "RXJS_VERSION",
"zone.js": "ZONEJS_VERSION"
},
Expand Down
1 change: 1 addition & 0 deletions src/firestore/firestore.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { NgModule, InjectionToken } from '@angular/core';
import { FirebaseApp, AngularFireModule } from 'angularfire2';
import { AngularFirestore } from './firestore';
import { from } from 'rxjs/observable/from';
import '@firebase/firestore';

export const EnablePersistenceToken = new InjectionToken<boolean>('EnablePersistenceToken');

Expand Down
4 changes: 2 additions & 2 deletions src/firestore/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
"@angular/core": "ANGULAR_VERSION",
"@angular/platform-browser": "ANGULAR_VERSION",
"@angular/platform-browser-dynamic": "ANGULAR_VERSION",
"firebase": "FIREBASE_VERSION",
"firestore": "FIRESTORE_VERSION",
"@firebase/app": "FIREBASE_APP_VERSION",
"@firebase/firestore": "FIREBASE_FIRESTORE_VERSION",
"rxjs": "RXJS_VERSION",
"zone.js": "ZONEJS_VERSION"
},
Expand Down
2 changes: 2 additions & 0 deletions src/root.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ export * from './packages-dist/database/list/state-changes.spec';
export * from './packages-dist/database/list/audit-trail.spec';
export * from './packages-dist/storage/storage.spec';

// // Since this a deprecated API, we run on it on manual tests only
// // It needs a network connection to run which makes it flaky on Travis
// export * from './packages-dist/database-deprecated/firebase_list_factory.spec';
// export * from './packages-dist/database-deprecated/firebase_object_factory.spec';
// export * from './packages-dist/database-deprecated/firebase_list_observable.spec';
Expand Down
3 changes: 2 additions & 1 deletion src/storage/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"@angular/core": "ANGULAR_VERSION",
"@angular/platform-browser": "ANGULAR_VERSION",
"@angular/platform-browser-dynamic": "ANGULAR_VERSION",
"firebase": "FIREBASE_VERSION",
"@firebase/app": "FIREBASE_APP_VERSION",
"@firebase/storage": "FIREBASE_STORAGE_VERSION",
"rxjs": "RXJS_VERSION",
"zone.js": "ZONEJS_VERSION"
},
Expand Down
1 change: 1 addition & 0 deletions src/storage/storage.module.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { NgModule } from '@angular/core';
import { AngularFireModule, FirebaseApp } from 'angularfire2';
import { AngularFireStorage } from './storage';
import '@firebase/storage';

export function _getAngularFireStorage(app: FirebaseApp) {
return new AngularFireStorage(app);
Expand Down
2 changes: 1 addition & 1 deletion test/ng-build/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const fs = require('fs');
const { spawn, spawnSync } = require('child_process');
const ng5Pkg = require('./ng5/package.json');
const ng5Pkg = require(`${__dirname}/ng5/package.json`);
const pkg = require('../../package.json');
const shell = require('shelljs');

Expand Down
32 changes: 31 additions & 1 deletion tools/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,18 @@ const GLOBALS = {
'@angular/core': 'ng.core',
'@angular/compiler': 'ng.compiler',
'@angular/platform-browser': 'ng.platformBrowser',
'firebase/auth': 'firebase',
'firebase/app': 'firebase',
'firebase/database': 'firebase',
'firebase/firestore': 'firebase',
'firebase/storage': 'firebase',
'@firebase/auth': 'firebase',
'@firebase/app': 'firebase',
'@firebase/database': 'firebase',
'@firebase/firestore': 'firebase',
'@firebase/storage': 'firebase',
'@firebase/util': 'firebase',
'@firebase/webchannel-wrapper': 'firebase',
'rxjs/scheduler/queue': 'Rx.Scheduler',
'@angular/core/testing': 'ng.core.testing',
'angularfire2': 'angularfire2',
Expand All @@ -72,7 +79,11 @@ const GLOBALS = {
// Map of dependency versions across all packages
const VERSIONS = {
ANGULAR_VERSION: pkg.dependencies['@angular/core'],
FIREBASE_VERSION: pkg.dependencies['firebase'],
FIREBASE_APP_VERSION: pkg.dependencies['@firebase/app'],
FIREBASE_DATABASE_VERSION: pkg.dependencies['@firebase/database'],
FIREBASE_FIRESTORE_VERSION: pkg.dependencies['@firebase/firestore'],
FIREBASE_AUTH_VERSION: pkg.dependencies['@firebase/auth'],
FIREBASE_STORAGE_VERSION: pkg.dependencies['@firebase/storage'],
RXJS_VERSION: pkg.dependencies['rxjs'],
ZONEJS_VERSION: pkg.dependencies['zone.js'],
ANGULARFIRE2_VERSION: pkg.version,
Expand Down Expand Up @@ -115,6 +126,15 @@ const DEST_PKG_PATHS = {
storage: `${process.cwd()}/dist/packages-dist/storage/package.json`
};

const FIREBASE_FEATURE_MODULES = {
app: `${process.cwd()}/node_modules/@firebase/app/dist/esm/index.js`,
auth: `${process.cwd()}/node_modules/@firebase/auth/dist/auth.js`,
database: `${process.cwd()}/node_modules/@firebase/database/dist/esm/index.js`,
firestore: `${process.cwd()}/node_modules/@firebase/firestore/dist/esm/index.js`,
storage: `${process.cwd()}/node_modules/@firebase/storage/dist/esm/index.js`,
util: `${process.cwd()}/node_modules/@firebase/util/dist/esm/index.js`,
};

// Constants for running typescript commands
const TSC = 'node_modules/.bin/tsc';
const NGC = 'node_modules/.bin/ngc';
Expand Down Expand Up @@ -149,6 +169,16 @@ function generateBundle(entry, { dest, globals, moduleName }) {
});
}

function createFirebaseBundles(featurePaths, globals) {
return Object.keys(featurePaths).map(feature => {
return generateBundle(featurePaths[feature], {
dest: `${process.cwd()}/dist/bundles/${feature}.js`,
globals,
moduleName: `firebase.${feature}`
});
});
}

/**
* Create a UMD bundle given a module name.
* @param {string} name
Expand Down
Loading