From 02cf7e13c03ff6414abd4b19c4181f01a5c80da1 Mon Sep 17 00:00:00 2001 From: Jeff Cross Date: Thu, 30 Jun 2016 14:53:57 -0700 Subject: [PATCH] chore(package): make firebase a dependency instead of peerDep in published package Fixes #311 --- tools/rewrite-published-package.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tools/rewrite-published-package.js b/tools/rewrite-published-package.js index 9128f4337..41d86e605 100644 --- a/tools/rewrite-published-package.js +++ b/tools/rewrite-published-package.js @@ -6,12 +6,24 @@ var fs = require('fs'); var srcPackage = require('../package.json'); var [MAIN, JSNEXT_MAIN] = ['main', 'jsnext:main'].map(k => srcPackage[k].replace('/dist/', '/')); + +var peerDependencies = Object.assign({}, srcPackage.dependencies); +// See note about including firebase as dependency +delete peerDependencies.firebase; var outPackage = Object.assign({}, srcPackage, { - peerDependencies: srcPackage.dependencies, + peerDependencies, main: MAIN, typings: "angularfire2.d.ts", "jsnext:main": JSNEXT_MAIN, - dependencies: undefined + dependencies: { + /** + * Firebase SDK should be a dependency since it's not required that + * projects will install/use the SDK directly. And since Firebase uses + * semver, the version restriction is more permissive. This means if the user + * has installed Firebase already, npm is more likely to find a matching version. + **/ + firebase: srcPackage.dependencies.firebase + } }); fs.writeFileSync('./dist/package.json', JSON.stringify(outPackage, null, 2));