You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by er...@apache.org on 2019/06/18 07:46:25 UTC
[cordova-browser] branch master updated: Remove Q for Native
Promise (#78)
This is an automated email from the ASF dual-hosted git repository.
erisu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-browser.git
The following commit(s) were added to refs/heads/master by this push:
new 9a5eddc Remove Q for Native Promise (#78)
9a5eddc is described below
commit 9a5eddc15b7b70ae33336e2b4bb1af685d7284f9
Author: エリス <er...@users.noreply.github.com>
AuthorDate: Tue Jun 18 16:46:20 2019 +0900
Remove Q for Native Promise (#78)
Co-Authored-By: Raphael von der Grün <ra...@gmail.com>
---
bin/lib/update.js | 18 ++++++++++--------
bin/update | 4 ++--
2 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/bin/lib/update.js b/bin/lib/update.js
index 62e37e1..633b385 100644
--- a/bin/lib/update.js
+++ b/bin/lib/update.js
@@ -17,10 +17,10 @@
under the License.
*/
-var Q = require('q');
var create = require('./create');
var fs = require('fs');
var shell = require('shelljs');
+const { CordovaError } = require('cordova-common');
module.exports.help = function () {
console.log('WARNING : Make sure to back up your project before updating!');
@@ -32,15 +32,17 @@ module.exports.help = function () {
module.exports.run = function (argv) {
var projectPath = argv[2];
+
+ // If the specified project path is not valid then reject promise.
if (!fs.existsSync(projectPath)) {
- // if specified project path is not valid then reject promise
- Q.reject('Browser platform does not exist here: ' + projectPath);
+ return Promise.reject(new CordovaError(`Browser platform does not exist here: ${projectPath}`));
}
- return Q().then(function () {
- console.log('Removing existing browser platform.');
- shellfatal(shell.rm, '-rf', projectPath);
- create.createProject(projectPath);
- });
+
+ console.log('Removing existing browser platform.');
+ shellfatal(shell.rm, '-rf', projectPath);
+
+ // Create Project returns a resolved promise.
+ return create.createProject(projectPath);
};
function shellfatal (shellFunc) {
diff --git a/bin/update b/bin/update
old mode 100644
new mode 100755
index eb515b7..29f4bfe
--- a/bin/update
+++ b/bin/update
@@ -24,9 +24,9 @@ var update = require('./lib/update');
if (['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(process.argv[2]) > -1) {
update.help();
} else {
- update.run(process.argv).done(function () {
+ update.run(process.argv).then(() => {
console.log('Successfully updated browser project.');
- }, function (err) {
+ }, err => {
console.error('Update failed due to', err);
process.exit(2);
});
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org