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-common.git


The following commit(s) were added to refs/heads/master by this push:
     new a31e29b  chore: drop q where possible (#99)
a31e29b is described below

commit a31e29b1a8fd035ba6eec5e0f1f345b9275428c5
Author: エリス <[email protected]>
AuthorDate: Wed Feb 1 11:36:46 2023 +0900

    chore: drop q where possible (#99)
    
    * chore: update comment
---
 spec/PluginManager.spec.js | 3 +--
 src/ActionStack.js         | 5 ++---
 src/PluginManager.js       | 7 +++----
 3 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/spec/PluginManager.spec.js b/spec/PluginManager.spec.js
index 8062b2e..5c91ef2 100644
--- a/spec/PluginManager.spec.js
+++ b/spec/PluginManager.spec.js
@@ -17,7 +17,6 @@
     under the License.
 */
 
-const Q = require('q');
 const fs = require('fs-extra');
 const path = require('path');
 const rewire = require('rewire');
@@ -61,7 +60,7 @@ describe('PluginManager class', function () {
             FAKE_PROJECT = jasmine.createSpyObj('project', ['getInstaller', 
'getUninstaller', 'write']);
             manager = new PluginManager('windows', FAKE_LOCATIONS, 
FAKE_PROJECT);
             actions = jasmine.createSpyObj('actions', ['createAction', 'push', 
'process']);
-            actions.process.and.returnValue(Q.resolve());
+            actions.process.and.returnValue(Promise.resolve());
             PluginManager.__set__('ActionStack', function () { return actions; 
});
         });
 
diff --git a/src/ActionStack.js b/src/ActionStack.js
index fc2c409..94c060a 100644
--- a/src/ActionStack.js
+++ b/src/ActionStack.js
@@ -18,7 +18,6 @@
 */
 
 const events = require('./events');
-const Q = require('q');
 
 class ActionStack {
     constructor () {
@@ -72,13 +71,13 @@ class ActionStack {
                     }
                 }
                 e.message = issue + e.message;
-                return Q.reject(e);
+                return Promise.reject(e);
             }
             this.completed.push(action);
         }
         events.emit('verbose', 'Action stack processing complete.');
 
-        return Q();
+        return Promise.resolve();
     }
 }
 
diff --git a/src/PluginManager.js b/src/PluginManager.js
index 4f12dfa..cfcecc0 100644
--- a/src/PluginManager.js
+++ b/src/PluginManager.js
@@ -17,7 +17,6 @@
        under the License.
 */
 
-const Q = require('q');
 const fs = require('fs-extra');
 const path = require('path');
 
@@ -77,12 +76,12 @@ class PluginManager {
      * @param {Object} [options={}] An installation options. It is expected 
but is not necessary
      *   that options would contain 'variables' inner object with 
'PACKAGE_NAME' field set by caller.
      *
-     * @returns {Promise} Returns a Q promise, either resolved in case of 
success, rejected otherwise.
+     * @returns {Promise}
      */
     doOperation (operation, plugin, options) {
-        if (operation !== PluginManager.INSTALL && operation !== 
PluginManager.UNINSTALL) { return Q.reject(new CordovaError('The parameter is 
incorrect. The opeation must be either "add" or "remove"')); }
+        if (operation !== PluginManager.INSTALL && operation !== 
PluginManager.UNINSTALL) { return Promise.reject(new CordovaError('The 
parameter is incorrect. The opeation must be either "add" or "remove"')); }
 
-        if (!plugin || plugin.constructor.name !== 'PluginInfo') { return 
Q.reject(new CordovaError('The parameter is incorrect. The first parameter 
should be a PluginInfo instance')); }
+        if (!plugin || plugin.constructor.name !== 'PluginInfo') { return 
Promise.reject(new CordovaError('The parameter is incorrect. The first 
parameter should be a PluginInfo instance')); }
 
         // Set default to empty object to play safe when accesing properties
         options = options || {};


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to