MCPcopy
hub / github.com/bower/bower / uninstall

Function uninstall

lib/commands/uninstall.js:6–42  ·  view source on GitHub ↗
(logger, names, options, config)

Source from the content-addressed store, hash-verified

4var defaultConfig = require('../config');
5
6function uninstall(logger, names, options, config) {
7 if (!names.length) {
8 return new Q();
9 }
10
11 var project;
12
13 options = options || {};
14 config = defaultConfig(config);
15 project = new Project(config, logger);
16
17 return project.getTree(options).spread(function(tree, flattened) {
18 // Uninstall nodes
19 return (
20 project
21 .uninstall(names, options)
22 // Clean out non-shared uninstalled dependencies
23 .then(function(uninstalled) {
24 var names = Object.keys(uninstalled);
25 var children = [];
26
27 // Grab the dependencies of packages that were uninstalled
28 mout.object.forOwn(flattened, function(node) {
29 if (names.indexOf(node.endpoint.name) !== -1) {
30 children.push.apply(
31 children,
32 mout.object.keys(node.dependencies)
33 );
34 }
35 });
36
37 // Clean them!
38 return clean(project, children, uninstalled);
39 })
40 );
41 });
42}
43
44function clean(project, names, removed) {
45 removed = removed || {};

Callers

nothing calls this directly

Calls 2

defaultConfigFunction · 0.85
cleanFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…