Merge branch 'master' of github.com:FirebasePrivate/firebase-tools into mb-implicit-web

This commit is contained in:
Michael Bleigh
2017-04-03 16:27:27 -07:00
6 changed files with 23 additions and 5 deletions

View File

@@ -10,6 +10,11 @@ var requireAccess = require('./requireAccess');
module.exports = function(options, authScopes) {
return requireAccess(options, authScopes).then(function() {
return new RSVP.Promise(function(resolve, reject) {
if (process.env.FIREBASE_BYPASS_ADMIN_CALLS_FOR_TESTING === 'true') {
// requireAccess() hasn't set the metadataToken, so can't auth.
resolve();
}
var firebaseRef = new Firebase(utils.addSubdomain(api.realtimeOrigin, 'firebase'));
firebaseRef.authWithCustomToken(options.metadataToken, function(err) {
if (err) {

View File

@@ -158,6 +158,10 @@ Command.prototype.runner = function() {
var self = this;
return function() {
var args = _.toArray(arguments);
// always provide at least an empty object for options
if (args.length === 0) {
args.push({});
}
var options = _.last(args);
try {

View File

@@ -73,6 +73,11 @@ var deploy = function(targetNames, options) {
utils.logBullet('starting release process (may take several minutes)...');
return _chain(releases, context, options, payload);
}).then(function() {
// skip talking to deploy server if only deploying functions
if (_.isEqual(targetNames, ['functions'])) {
return {body: {}};
}
return api.request('POST', '/v1/projects/' + encodeURIComponent(projectId) + '/releases', {
data: payload,
auth: true,

View File

@@ -15,6 +15,10 @@ module.exports = function(options, authScopes) {
var projectId = getProjectId(options);
options.project = projectId;
if (process.env.FIREBASE_BYPASS_ADMIN_CALLS_FOR_TESTING === 'true') {
return requireAuth(options, authScopes);
}
return requireAuth(options, authScopes).then(function() {
return getInstanceId(options);
}).then(function(instance) {

View File

@@ -2,7 +2,7 @@
"name": "functions",
"description": "Firebase Functions",
"dependencies": {
"firebase-admin": "^4.1.0",
"firebase-functions": "https://storage.googleapis.com/firebase-preview-drop/node/firebase-functions/firebase-functions-preview.latest.tar.gz"
"firebase-admin": "^4.1.3",
"firebase-functions": "^0.5.2"
}
}

View File

@@ -1,8 +1,8 @@
var functions = require('firebase-functions');
// // Start writing Firebase Functions
// // https://firebase.google.com/functions/write-firebase-functions
// // Create and Deploy Your First Cloud Functions
// // https://firebase.google.com/docs/functions/write-firebase-functions
//
// exports.helloWorld = functions.https.onRequest((request, response) => {
// response.send("Hello from Firebase!");
// })
// });