chore: drop q where possible (#99)
* chore: update comment
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 @@
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 @@
}
}
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 @@
* @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 || {};