Skip to content

Commit

Permalink
chore: replace superspawn with execa
Browse files Browse the repository at this point in the history
  • Loading branch information
erisu committed Oct 31, 2019
1 parent 6e78b1a commit ab6fd6d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
under the License.
*/

const execa = require('execa');
const pify = require('pify');
const which = pify(require('which'));
var superspawn = require('cordova-common').superspawn;
var events = require('cordova-common').events;
var path = require('path');
var fs = require('fs-extra');
Expand Down Expand Up @@ -64,7 +64,7 @@ function installPackage (target, dest, opts) {
.then(_ => npmArgs(target, opts))
.then(args => {
events.emit('verbose', `fetch: Installing ${target} to ${dest}`);
return superspawn.spawn('npm', args, { cwd: dest });
return execa('npm', args, { cwd: dest }).then(data => data.stdout);
})

// Resolve path to installed package
Expand Down Expand Up @@ -185,7 +185,7 @@ module.exports.uninstall = function (target, dest, opts) {

// run npm uninstall, this will remove dependency
// from package.json if --save was used.
return superspawn.spawn('npm', fetchArgs, opts);
return execa('npm', fetchArgs, opts);
})
.catch(function (err) {
throw new CordovaError(err);
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
},
"dependencies": {
"cordova-common": "^3.1.0",
"execa": "^2.0.4",
"fs-extra": "^7.0.1",
"npm-package-arg": "^6.1.0",
"pify": "^4.0.1",
Expand Down
4 changes: 2 additions & 2 deletions spec/fetch.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ describe('negative tests', function () {
.then(function (result) {
fail('Expected promise to be rejected');
}, function (err) {
expect(err.message.code).toBe(1);
expect(err.message.exitCode).toBe(1);
expect(err).toBeDefined();
});
}, 30000);
Expand All @@ -182,7 +182,7 @@ describe('negative tests', function () {
.then(function (result) {
fail('Expected promise to be rejected');
}, function (err) {
expect(err.message.code).toBe(1);
expect(err.message.exitCode).toBe(1);
expect(err).toBeDefined();
});
}, 30000);
Expand Down

0 comments on commit ab6fd6d

Please sign in to comment.