Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var doDelete = function (id) {
var plugin_dir = path.join(plugins_dir, id);
if (!fs.existsSync(plugin_dir)) {
events.emit('verbose', 'Plugin "' + id + '" already removed (' + plugin_dir + ')');
return Promise.resolve();
}
fs.removeSync(plugin_dir);
events.emit('verbose', 'Deleted plugin "' + id + '"');
// remove plugin from node_modules directory
return npmUninstall(id, options.projectRoot, options);
};
.then(function () {
// Finally, Ready to start!
events.emit('log', 'Creating a new cordova project.');
// If symlink, don't fetch
if (opts.link) {
return opts.url;
}
// Use cordova-fetch to obtain npm or git templates
if (opts.template && isRemoteUri(opts.url)) {
const target = opts.url;
events.emit('verbose', 'Using cordova-fetch for ' + target);
return fetch(target, getSelfDestructingTempDir(), {});
} else {
// If assets are not online, resolve as a relative path on local computer
return path.resolve(opts.url);
}
})
.then(function (input_directory) {
return promiseutil.Q_chainmap(targets, function(target) {
if(target in platforms) {
target = 'cordova-'+target;
}
// Edits package.json.
return npmUninstall(target, projectRoot, opts);
});
}
return promiseutil.Q_chainmap(targets, function(target) {
if(target in platforms) {
target = 'cordova-'+target;
}
// Edits package.json.
return npmUninstall(target, projectRoot, opts);
});
}
return promiseutil.Q_chainmap(targets, function (target) {
if (target in platforms) {
target = 'cordova-' + target;
}
// Edits package.json.
return npmUninstall(target, projectRoot, opts);
});
}).then(function () {
function info (plugin) {
var viewArgs = ['view'];
plugin = plugin.shift();
viewArgs.push(plugin);
viewArgs.push('--json');
// check if npm is installed
return fetch.isNpmInstalled()
.then(function () {
return execa('npm', viewArgs)
.then(({ stdout: info }) => {
var pluginInfo = JSON.parse(info);
return pluginInfo;
});
});
}
var doDelete = function(id) {
var plugin_dir = path.join(plugins_dir, id);
if ( !fs.existsSync(plugin_dir) ) {
events.emit('verbose', 'Plugin "'+ id +'" already removed ('+ plugin_dir +')');
return Q();
}
shell.rm('-rf', plugin_dir);
events.emit('verbose', 'Deleted "'+ id +'"');
if(options.fetch) {
//remove plugin from node_modules directory
return npmUninstall(id, options.projectRoot, options);
}
return Q();
};