Skip to content
Permalink
Browse files
Properly install multiple plugins in series
  • Loading branch information
raphinesse committed Mar 31, 2019
1 parent 41c0d6c commit 7e4df8cb87fd5ac8f4304b1d047885a75611d4cf
Showing 2 changed files with 14 additions and 20 deletions.
@@ -18,7 +18,8 @@
"engineStrict": true,
"dependencies": {
"cordova-lib": "^9.0.0",
"nopt": "^4.0.1"
"nopt": "^4.0.1",
"p-each-series": "^1.0.0"
},
"devDependencies": {
"eslint": "^5.15.3",
@@ -19,6 +19,7 @@

// copyright (c) 2013 Andrew Lunny, Adobe Systems

const pEachSeries = require('p-each-series');
const { plugman } = require('cordova-lib');

module.exports = {
@@ -38,34 +39,26 @@ module.exports = {
force: cli_opts.force || false,
nohooks: cli_opts.nohooks || false
};
var p = Promise.resolve();
cli_opts.plugin.forEach(function (pluginSrc) {
p = p.then(function () {
return plugman.install(cli_opts.platform, cli_opts.project, pluginSrc, cli_opts.plugins_dir, opts);
});
});

return p;
return pEachSeries(cli_opts.plugin, pluginSrc =>
plugman.install(cli_opts.platform, cli_opts.project, pluginSrc, cli_opts.plugins_dir, opts)
);
},

uninstall (cli_opts) {
if (!cli_opts.platform || !cli_opts.project || !cli_opts.plugin) {
return console.log(plugman.help());
}

var p = Promise.resolve();
cli_opts.plugin.forEach(function (pluginSrc) {
var opts = {
www_dir: cli_opts.www,
save: cli_opts.save || false,
projectRoot: cli_opts.project
};
p = p.then(function () {
return plugman.uninstall(cli_opts.platform, cli_opts.project, pluginSrc, cli_opts.plugins_dir, opts);
});
});
var opts = {
www_dir: cli_opts.www,
save: cli_opts.save || false,
projectRoot: cli_opts.project
};

return p;
return pEachSeries(cli_opts.plugin, pluginSrc =>
plugman.uninstall(cli_opts.platform, cli_opts.project, pluginSrc, cli_opts.plugins_dir, opts)
);
},

create (cli_opts) {

0 comments on commit 7e4df8c

Please sign in to comment.