mirror of
https://github.com/zhigang1992/firebase-tools.git
synced 2026-04-29 04:15:24 +08:00
Merge branch 'master' of github.com:FirebasePrivate/firebase-tools into mb-implicit-web
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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!");
|
||||
// })
|
||||
// });
|
||||
|
||||
Reference in New Issue
Block a user