From b17ae5c9651eb0bcd1b8f0b6d78f3f603fd72fe2 Mon Sep 17 00:00:00 2001 From: Chris Raynor Date: Mon, 19 May 2014 14:36:54 -0700 Subject: [PATCH 1/8] improving default ignore rules to ignore dot files in directories other than the root --- lib/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/app.js b/lib/app.js index a4240c909ed..fd4a64f0a38 100644 --- a/lib/app.js +++ b/lib/app.js @@ -19,7 +19,7 @@ var request = require('request'), var defaultSettings = { 'public': '.', - 'ignore': ['firebase.json', '.*', '**/node_modules/**'] + 'ignore': ['firebase.json', '**/.*', '**/node_modules/**'] }; temp.track(); From 83b325227a1ce22cec2320df139c14aa2608f3cd Mon Sep 17 00:00:00 2001 From: Chris Raynor Date: Tue, 20 May 2014 15:40:11 -0700 Subject: [PATCH 2/8] uploading redirects, internal rewrites and custom header settings on deploy --- lib/app.js | 172 +++++++++++++++++++++++++++++++++++------------------ 1 file changed, 114 insertions(+), 58 deletions(-) diff --git a/lib/app.js b/lib/app.js index fd4a64f0a38..19e7022bb64 100644 --- a/lib/app.js +++ b/lib/app.js @@ -50,6 +50,115 @@ function getPrompt(schema, onComplete, idx, results) { }); } +function updateRules(settings, tokens) { + return _when.promise(function(resolve, reject, notify) { + auth.updateRules(settings.firebase, + tokens.personalToken, + settings.rules, + function(statusCode, response) { + if (response.error) { + console.log(chalk.red('Security Rules Error') + ' - ' + + response.error.replace(/\n$/, '')); + process.exit(1); + } + resolve(); + }); + }); +} + +function updateRedirects(firebaseRef, settings) { + return _when.promise(function(resolve, reject, notify) { + var redirects = settings.redirects || null; + firebaseRef.child('hosting/path-redirects').child(settings.firebase).set(redirects, function(err) { + if (err) { + console.log(chalk.red('Redirects Error') + ' - ' + err); + process.exit(1); + } + resolve(); + }); + }); +} + +function updateRewrites(firebaseRef, settings) { + return _when.promise(function(resolve, reject, notify) { + var rewrites = settings.rewrites || null; + firebaseRef.child('hosting/rewrites').child(settings.firebase).set(rewrites, function(err) { + if (err) { + console.log(chalk.red('Rewrites Error') + ' - ' + err); + process.exit(1); + } + resolve(); + }); + }); +} + +function updateHeaders(firebaseRef, settings) { + return _when.promise(function(resolve, reject, notify) { + var headers = settings.headers || null; + firebaseRef.child('hosting/headers').child(settings.firebase).set(headers, function(err) { + if (err) { + console.log(chalk.red('Headers Error') + ' - ' + err); + process.exit(1); + } + resolve(); + }); + }); +} + +function uploadSite(settings, directoryRef, argv) { + return function() { + var bar = null; + var total = 0; + directoryRef.on('value', function(snapshot) { + var status = snapshot.child('status').val(); + if (status === 'deployed') { + var url = api.hostingUrl.replace(/\/\//, util.format('//%s.', settings.firebase)); + console.log(chalk.green('Successfully deployed')); + console.log('Site URL: %s, or use %s', chalk.cyan(url), chalk.bold('firebase open')); + console.log('Hosting Dashboard: %s then view the hosting section of your app', chalk.cyan('https://firebase.com/account')); + process.exit(0); + } else if (status === 'deploying') { + if (!bar && snapshot.hasChild('fileCount')) { + total = snapshot.child('fileCount').val(); + bar = new ProgressBar(chalk.yellow('progress: :percent'), { + total: total + }); + } + if (bar) { + var uploadedCount = snapshot.hasChild('uploadedCount') ? snapshot.child('uploadedCount').val() : 0; + bar.update(uploadedCount / total); + } + } else if (status === 'removed') { + console.log(chalk.green('Sucessfully removed')); + process.exit(0); + } else if (status === 'failed') { + if (bar) { + bar.terminate(); + } + var message = chalk.red('Deploy Failed'); + if (snapshot.hasChild('statusMessage')) { + message += ' - ' + snapshot.child('statusMessage').val(); + } + console.log(message); + process.exit(1); + } + }); + }); + + var message = null; + if (argv.message && (typeof(argv.message) === 'string')) { + message = argv.message; + } + + upload.send(settings.firebase, settings['public'], settings.ignore || defaultSettings.ignore, directoryRef.name(), message, function(err, directory) { + if (err) { + console.log(chalk.red('Deploy Error') + ' - Couldn\'t upload app'); + console.log(err); + process.exit(1); + } + }); +} + module.exports = { init: function(argv) { auth.listFirebases(argv).then(function(res) { @@ -388,65 +497,12 @@ module.exports = { .child('hosting/versions') .child(settings.firebase) .push(); - auth.updateRules(settings.firebase, - tokens.personalToken, - settings.rules, - function(statusCode, response) { - if (response.error) { - console.log(chalk.red('Security Rules Error') + ' - ' + - response.error.replace(/\n$/, '')); - process.exit(1); - } - var bar = null; - var total = 0; - directoryRef.on('value', function(snapshot) { - var status = snapshot.child('status').val(); - if (status === 'deployed') { - var url = api.hostingUrl.replace(/\/\//, util.format('//%s.', settings.firebase)); - console.log(chalk.green('Successfully deployed')); - console.log('Site URL: %s, or use %s', chalk.cyan(url), chalk.bold('firebase open')); - console.log('Hosting Dashboard: %s then view the hosting section of your app', chalk.cyan('https://firebase.com/account')); - process.exit(0); - } else if (status === 'deploying') { - if (!bar && snapshot.hasChild('fileCount')) { - total = snapshot.child('fileCount').val(); - bar = new ProgressBar(chalk.yellow('progress: :percent'), { - total: total - }); - } - if (bar) { - var uploadedCount = snapshot.hasChild('uploadedCount') ? snapshot.child('uploadedCount').val() : 0; - bar.update(uploadedCount / total); - } - } else if (status === 'removed') { - console.log(chalk.green('Sucessfully removed')); - process.exit(0); - } else if (status === 'failed') { - if (bar) { - bar.terminate(); - } - var message = chalk.red('Deploy Failed'); - if (snapshot.hasChild('statusMessage')) { - message += ' - ' + snapshot.child('statusMessage').val(); - } - console.log(message); - process.exit(1); - } - }); - var message = null; - if (argv.message && (typeof(argv.message) === 'string')) { - message = argv.message; - } - - upload.send(settings.firebase, settings['public'], settings.ignore || defaultSettings.ignore, directoryRef.name(), message, function(err, directory) { - if (err) { - console.log(chalk.red('Deploy Error') + ' - Couldn\'t upload app'); - console.log(err); - process.exit(1); - } - }); - }); + _when.join(updateRules(settings, tokens), + updateRedirects(firebaseRef, settings), + updateRewrites(firebaseRef, settings), + updateHeaders(firebaseRef, settings)) + .done(uploadSite(settings, directoryRef, argv)); }); }); }, From 4f36a9ab11aa3a1a5c871065fa73b3db128f9913 Mon Sep 17 00:00:00 2001 From: Chris Raynor Date: Tue, 20 May 2014 16:15:21 -0700 Subject: [PATCH 3/8] adding keywords --- package.json | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 0a224ddbc53..31c162d350e 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,15 @@ "version": "1.0.2", "description": "The Firebase Command Line Tools", "keywords": [ - "firebase" + "firebase", + "hosting", + "ssl", + "cdn", + "cli", + "synchronization", + "real-time", + "websockets", + "cloud" ], "author": "Firebase ", "contributors": [ From 614384c69ce7cb29267318ae870604b3ad189a8a Mon Sep 17 00:00:00 2001 From: Chris Raynor Date: Thu, 22 May 2014 14:45:02 -0700 Subject: [PATCH 4/8] fixing syntax error in deploy --- lib/app.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/app.js b/lib/app.js index d28d1a49f51..b61944a3011 100644 --- a/lib/app.js +++ b/lib/app.js @@ -143,20 +143,20 @@ function uploadSite(settings, directoryRef, argv) { process.exit(1); } }); - }); - - var message = null; - if (argv.message && (typeof(argv.message) === 'string')) { - message = argv.message; - } - upload.send(settings.firebase, settings['public'], settings.ignore || defaultSettings.ignore, directoryRef.name(), message, function(err, directory) { - if (err) { - console.log(chalk.red('Deploy Error') + ' - Couldn\'t upload app'); - console.log(err); - process.exit(1); + var message = null; + if (argv.message && (typeof(argv.message) === 'string')) { + message = argv.message; } - }); + + upload.send(settings.firebase, settings['public'], settings.ignore || defaultSettings.ignore, directoryRef.name(), message, function(err, directory) { + if (err) { + console.log(chalk.red('Deploy Error') + ' - Couldn\'t upload app'); + console.log(err); + process.exit(1); + } + }); + } } module.exports = { From ad1360d08fafe59f770393568e963c35487dcf3c Mon Sep 17 00:00:00 2001 From: Chris Raynor Date: Wed, 4 Jun 2014 18:29:57 -0700 Subject: [PATCH 5/8] documenting v1.1.0 changes --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ef366bb0858..dec41392dd8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## v1.1.0 +- Supports new "redirects", "rewrites", and "headers" parameters in the `firebase.json` to allow greater customization of hosting parameters +- improves default "ignore" rules to specify any dot file, regardless of whether in a sub-directory + ## v1.0.6 - Adds `-s` functionality to all commands for silent mode while scripting - commands will error with non-zero status code instead of waiting for prompt if not enough information supplied - `delete-site` command as a convenience method for removing a site from hosting. Site shows up as 'Site Not Found' as if never deployed to From a6fa75a6c7f46bc1cf2f9350bf374985b3c4b5f3 Mon Sep 17 00:00:00 2001 From: Chris Raynor Date: Wed, 4 Jun 2014 18:30:13 -0700 Subject: [PATCH 6/8] Version bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 66e75734c4b..a94435c58e3 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "firebase-tools", "preferGlobal": true, - "version": "1.0.6", + "version": "1.1.0", "description": "The Firebase Command Line Tools", "keywords": [ "firebase", From 48b89054497607b155e69597d9e2a266d83e37ef Mon Sep 17 00:00:00 2001 From: Chris Raynor Date: Wed, 4 Jun 2014 18:32:00 -0700 Subject: [PATCH 7/8] Changelog formatting --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index dec41392dd8..0ce214578ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ - Supports new "redirects", "rewrites", and "headers" parameters in the `firebase.json` to allow greater customization of hosting parameters - improves default "ignore" rules to specify any dot file, regardless of whether in a sub-directory +- - - + ## v1.0.6 - Adds `-s` functionality to all commands for silent mode while scripting - commands will error with non-zero status code instead of waiting for prompt if not enough information supplied - `delete-site` command as a convenience method for removing a site from hosting. Site shows up as 'Site Not Found' as if never deployed to From b3343fb53fe4d352a96ba831ac6e874c5c1c805f Mon Sep 17 00:00:00 2001 From: Chris Raynor Date: Wed, 9 Jul 2014 17:52:07 -0700 Subject: [PATCH 8/8] Updating changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ce214578ae..b3ad24529f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ ## v1.1.0 -- Supports new "redirects", "rewrites", and "headers" parameters in the `firebase.json` to allow greater customization of hosting parameters +- Supports new advanced features parameters in the `firebase.json` to allow greater customization of hosting parameters - improves default "ignore" rules to specify any dot file, regardless of whether in a sub-directory - - -