Skip to content

Commit ffa30bc

Browse files
author
Jacob Wenger
committed
Merge pull request #34 from firebase/v1.1.3
v1.1.3
2 parents 84e74db + 5e01358 commit ffa30bc

File tree

7 files changed

+30
-28
lines changed

7 files changed

+30
-28
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## v1.1.3
2+
- Fixes progress bar so it doesn't stick at 100% at the end of long uploads
3+
- Improves error messaging on login / token validation if the CLI version is out of date
4+
15
## v1.1.2
26
- Adds client-side validation of new advanced features with better error messaging
37

lib/api.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ function initApi() {
7676
}
7777

7878
if (urlParts) {
79-
api.adminUrl = process.env['FIREBASE_ADMIN_URL'];
79+
api.adminUrl = process.env['FIREBASE_ADMIN_URL'];
8080
}
8181
}
8282

lib/app.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function getPrompt(argv, schema, onComplete, index, results) {
4343
if (typeof item.beforeValue === 'function') {
4444
item.beforeValue(results);
4545
}
46-
prompt.get(schema[index], function (error, result) {
46+
prompt.get(schema[index], function(error, result) {
4747
if (error) {
4848
console.log(chalk.red('Input Error'));
4949
process.exit(1);
@@ -246,7 +246,7 @@ function uploadSite(settings, directoryRef, argv) {
246246
}
247247
if (bar) {
248248
var uploadedCount = snapshot.hasChild('uploadedCount') ? snapshot.child('uploadedCount').val() : 0;
249-
bar.update(uploadedCount / total);
249+
bar.update(Math.floor(100 * uploadedCount / total) / 100);
250250
}
251251
} else if (status === 'removed') {
252252
console.log(chalk.green('Sucessfully removed'));
@@ -291,7 +291,7 @@ function getSettings(argv) {
291291
settingsJSON = fs.readFileSync(settingsFile);
292292
settings = JSON.parse(settingsJSON);
293293
} catch (err) {
294-
console.log(chalk.red('Initialization Error') +' - Could not read ' +
294+
console.log(chalk.red('Initialization Error') + ' - Could not read ' +
295295
'firebase.json settings file');
296296
process.exit(1);
297297
}
@@ -381,7 +381,7 @@ module.exports = {
381381
process.exit(1);
382382
}
383383
console.log('Writing firebase.json settings file...');
384-
var settingsJSON = JSON.stringify(settings, null, 2) + "\n";
384+
var settingsJSON = JSON.stringify(settings, null, 2) + '\n';
385385
try {
386386
fs.writeFileSync(settingsFile, settingsJSON);
387387
console.log(chalk.green('Successfully initialized app'));
@@ -565,7 +565,7 @@ module.exports = {
565565
}
566566
}
567567

568-
var settingsJSON = JSON.stringify(settings, null, 2) + "\n";
568+
var settingsJSON = JSON.stringify(settings, null, 2) + '\n';
569569
var settingsFile = path.join(projectDir, 'firebase.json');
570570
try {
571571
fs.writeFileSync(settingsFile, settingsJSON);
@@ -606,7 +606,7 @@ module.exports = {
606606
}
607607
var settings = getSettings(argv);
608608
if (typeof(settings.firebase) !== 'string') {
609-
console.log(chalk.red('Initialization Error') +' - Could not read ' +
609+
console.log(chalk.red('Initialization Error') + ' - Could not read ' +
610610
'firebase.json settings file');
611611
process.exit(1);
612612
}
@@ -668,7 +668,7 @@ module.exports = {
668668
}
669669
var settings = getSettings(argv);
670670
if (typeof(settings.firebase) !== 'string') {
671-
console.log(chalk.red('Initialization Error') +' - Could not read ' +
671+
console.log(chalk.red('Initialization Error') + ' - Could not read ' +
672672
'firebase.json settings file');
673673
process.exit(1);
674674
}
@@ -738,7 +738,7 @@ module.exports = {
738738
open: function(argv) {
739739
var settings = getSettings(argv);
740740
if (typeof(settings.firebase) !== 'string') {
741-
console.log(chalk.red('Initialization Error') +' - Could not read ' +
741+
console.log(chalk.red('Initialization Error') + ' - Could not read ' +
742742
'firebase.json settings file');
743743
process.exit(1);
744744
}

lib/auth.js

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ var auth = {
4141
true,
4242
function(statusCode, response) {
4343
if (typeof(callback) === 'function') {
44-
if (response.success) {
45-
setTimeout(callback, 0, null);
46-
} else if (response.minCLI) {
47-
console.log(chalk.red('Outdated CLI Version') + ' - Please update to at ' +
44+
if (typeof(response.error) !== 'undefined') {
45+
console.log(chalk.red(response.error.message) + ' - Please update to at ' +
4846
'least v' + response.minCLI + ' by running ' +
4947
chalk.cyan('npm update -g ' + require('./firebase').name));
5048
process.exit(1);
49+
} else if (response.valid) {
50+
setTimeout(callback, 0, null);
5151
} else {
5252
setTimeout(callback, 0, new Error('Invalid Access Token'));
5353
}
@@ -147,23 +147,21 @@ var auth = {
147147
if (token) {
148148
this.token = token;
149149
this.saveConfig(callback);
150-
} else if (response.minCLI) {
151-
console.log(chalk.red('Outdated CLI Version') + ' - Please update to at least ' +
152-
'v' + response.minCLI + ' by running ' +
153-
chalk.cyan('npm update -g ' + require('./firebase').name));
150+
} else if (typeof(response.error) !== 'undefined') {
151+
console.log(chalk.red(response.error.message) + ' - Please update to at ' +
152+
'least v' + response.minCLI + ' by running ' +
153+
chalk.cyan('npm update -g ' + require('./firebase').name));
154154
process.exit(1);
155-
} else {
156-
if (typeof(callback) === 'function') {
157-
setTimeout(callback, 0, new Error('Email or Password Invalid'));
158-
}
155+
} else if (typeof(callback) === 'function') {
156+
setTimeout(callback, 0, new Error('Email or Password Invalid'));
159157
}
160158
},
161159
saveConfig: function(callback) {
162160
var data = {
163161
email: this.email,
164162
token: this.token
165163
};
166-
var dataString = JSON.stringify(data, null, 2) + "\n";
164+
var dataString = JSON.stringify(data, null, 2) + '\n';
167165
try {
168166
fs.writeFileSync(this.configFile, dataString);
169167
} catch (err) {

lib/help.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ module.exports = {
108108
console.log(helpOverview + helpTemplates + helpFooter);
109109
}, function(error) {
110110
var errTemplates = '\n ';
111-
errTemplates += chalk.red('Error: ') + 'Could not retrieve available templates.\n';
111+
errTemplates += chalk.red('Error: ') + 'Could not retrieve available templates.\n';
112112

113113
console.log(helpOverview + errTemplates + helpFooter);
114114
});
@@ -145,7 +145,7 @@ module.exports = {
145145
'\n' +
146146
' -f, --firebase Overrides the Firebase setting in the firebase.json\n' +
147147
'\n' +
148-
' Deletes the site associated with the Firebase detailed in the firebase.json\n' +
148+
' Deletes the site associated with the Firebase detailed in the firebase.json\n' +
149149
' settings file. The current user must have access to the Firebase, and if\n' +
150150
' the user is not currently logged in, they are prompted to do so - see\n' +
151151
' `firebase login --help` for more details.\n');

lib/upload.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ module.exports = {
6060
if (message) {
6161
params.push('message=' + encodeURIComponent(message));
6262
}
63-
var url = api.uploadUrl + '/upload/' + firebase + '?' + params.join('&')
63+
var url = api.uploadUrl + '/upload/' + firebase + '?' + params.join('&');
6464
var readStream = fs.createReadStream(filename);
6565

6666
var r = request.put({
@@ -94,7 +94,7 @@ module.exports = {
9494
if (message) {
9595
params.push('message=' + encodeURIComponent(message));
9696
}
97-
var url = api.uploadUrl + '/upload/' + firebase + '?' + params.join('&')
97+
var url = api.uploadUrl + '/upload/' + firebase + '?' + params.join('&');
9898
var readStream = fs.createReadStream(filename);
9999

100100
var r = request.put({
@@ -109,4 +109,4 @@ module.exports = {
109109
form.append('site', readStream);
110110
});
111111
}
112-
}
112+
};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "firebase-tools",
33
"preferGlobal": true,
4-
"version": "1.1.2",
4+
"version": "1.1.3",
55
"description": "The Firebase Command Line Tools",
66
"keywords": [
77
"firebase",

0 commit comments

Comments
 (0)