Skip to content

Commit

Permalink
chore(release): bump versions. verify package versions.
Browse files Browse the repository at this point in the history
  • Loading branch information
davideast committed Aug 16, 2017
1 parent ce20cc2 commit c42a0dd
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "angularfire2",
"version": "4.0.0-rc.2-next",
"version": "4.0.0-rc.2",
"description": "The official library of Firebase and Angular.",
"private": true,
"scripts": {
Expand Down
45 changes: 36 additions & 9 deletions tools/build.js
Expand Up @@ -198,6 +198,32 @@ function measure(module, gzip = true) {
return prettySize(bytes, gzip);
}

/**
* Returns each version of each AngularFire module.
* This is used to help ensure each package has the same verison.
*/
function getVersions() {
const paths = [
getDestPackageFile('core'),
getDestPackageFile('auth'),
getDestPackageFile('database')
];
return paths
.map(path => require(path))
.map(pkgs => pkgs.version);
}

function verifyVersions() {
const versions = getVersions();
console.log(versions);
versions.map(version => {
if(version !== pkg.version) {
throw new Error('Versions mistmatch');
process.exit(1);
}
});
}

function buildModule(name, globals) {
const es2015$ = spawnObservable(NGC, TSC_ARGS(name));
const esm$ = spawnObservable(NGC, TSC_ARGS(name, 'esm'));
Expand All @@ -219,14 +245,7 @@ function buildModules(globals) {
return Observable
.forkJoin(core$, Observable.from(copyRootTest()))
.switchMapTo(auth$)
.switchMapTo(db$)
.do(() => {
console.log(`
core.umd.js - ${measure('core')}
auth.umd.js - ${measure('auth')}
database.umd.js - ${measure('database')}
`);
});
.switchMapTo(db$);
}

function buildLibrary(globals) {
Expand All @@ -235,7 +254,15 @@ function buildLibrary(globals) {
.forkJoin(modules$)
.switchMap(() => Observable.from(createTestUmd(globals)))
.switchMap(() => Observable.from(copyNpmIgnore()))
.switchMap(() => Observable.from(copyReadme()));
.switchMap(() => Observable.from(copyReadme()))
.do(() => {
console.log(`
core.umd.js - ${measure('core')}
auth.umd.js - ${measure('auth')}
database.umd.js - ${measure('database')}
`);
verifyVersions();
});
}

buildLibrary(GLOBALS).subscribe(
Expand Down

0 comments on commit c42a0dd

Please sign in to comment.