cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CB-14164) Use native Promises instead of Q in plugman
Date Wed, 04 Jul 2018 23:43:00 GMT

    [ https://issues.apache.org/jira/browse/CB-14164?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16533130#comment-16533130
] 

ASF GitHub Bot commented on CB-14164:
-------------------------------------

raphinesse closed pull request #94: CB-14164 Use native Promises instead of Q
URL: https://github.com/apache/cordova-plugman/pull/94
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/main.js b/main.js
index 1a61ac4..3ca613b 100755
--- a/main.js
+++ b/main.js
@@ -23,7 +23,6 @@
 const url = require('url');
 const path = require('path');
 
-const Q = require('q');
 const nopt = require('nopt');
 
 const pkg = require('./package');
@@ -63,14 +62,7 @@ if (cli_opts.plugins_dir || cli_opts.project) {
         path.join(cli_opts.project, 'cordova', 'plugins');
 }
 
-process.on('uncaughtException', function (error) {
-    if (cli_opts.debug) {
-        console.error(error.message, error.stack);
-    } else {
-        console.error(error.message);
-    }
-    process.exit(1);
-});
+process.on('uncaughtException', fail);
 
 // Set up appropriate logging based on events
 if (cli_opts.debug) {
@@ -90,10 +82,16 @@ if (cli_opts.version) {
 } else if (cli_opts.help) {
     console.log(help());
 } else if (plugman.commands[cmd]) {
-    var result = plugman.commands[cmd](cli_opts);
-    if (result && Q.isPromise(result)) {
-        result.done();
-    }
+    Promise.resolve(plugman.commands[cmd](cli_opts))
+        .catch(fail);
 } else {
     console.log(help());
 }
+
+function fail (error) {
+    console.error(error.message);
+    if (cli_opts.debug) {
+        console.error(error.stack);
+    }
+    process.exit(1);
+}
diff --git a/package.json b/package.json
index 16affc1..38456fa 100644
--- a/package.json
+++ b/package.json
@@ -18,8 +18,7 @@
   "engineStrict": true,
   "dependencies": {
     "cordova-lib": "8.0.0",
-    "nopt": "1.0.9",
-    "q": "1.0.1"
+    "nopt": "1.0.9"
   },
   "devDependencies": {
     "eslint": "^4.2.0",


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> Use native Promises instead of Q in plugman
> -------------------------------------------
>
>                 Key: CB-14164
>                 URL: https://issues.apache.org/jira/browse/CB-14164
>             Project: Apache Cordova
>          Issue Type: Sub-task
>          Components: cordova-plugman
>            Reporter: Raphael
>            Assignee: Raphael
>            Priority: Minor
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


Mime
View raw message