0a1d3dcfe18c4bce9bc3159489dbe9ffcd640cb8
[platform/upstream/nodejs.git] / deps / npm / html / doc / cli / npm-dedupe.html
1 <!doctype html>
2 <html>
3   <title>npm-dedupe</title>
4   <meta http-equiv="content-type" value="text/html;utf-8">
5   <link rel="stylesheet" type="text/css" href="../../static/style.css">
6
7   <body>
8     <div id="wrapper">
9 <h1><a href="../cli/npm-dedupe.html">npm-dedupe</a></h1> <p>Reduce duplication</p>
10
11 <h2 id="SYNOPSIS">SYNOPSIS</h2>
12
13 <pre><code>npm dedupe [package names...]
14 npm ddp [package names...]</code></pre>
15
16 <h2 id="DESCRIPTION">DESCRIPTION</h2>
17
18 <p>Searches the local package tree and attempts to simplify the overall
19 structure by moving dependencies further up the tree, where they can
20 be more effectively shared by multiple dependent packages.</p>
21
22 <p>For example, consider this dependency graph:</p>
23
24 <pre><code>a
25 +-- b &lt;-- depends on c@1.0.x
26 |   `-- c@1.0.3
27 `-- d &lt;-- depends on c@~1.0.9
28     `-- c@1.0.10</code></pre>
29
30 <p>In this case, <code><a href="../cli/npm-dedupe.html">npm-dedupe(1)</a></code> will transform the tree to:</p>
31
32 <pre><code>a
33 +-- b
34 +-- d
35 `-- c@1.0.10</code></pre>
36
37 <p>Because of the hierarchical nature of node&#39;s module lookup, b and d
38 will both get their dependency met by the single c package at the root
39 level of the tree.</p>
40
41 <p>If a suitable version exists at the target location in the tree
42 already, then it will be left untouched, but the other duplicates will
43 be deleted.</p>
44
45 <p>If no suitable version can be found, then a warning is printed, and
46 nothing is done.</p>
47
48 <p>If any arguments are supplied, then they are filters, and only the
49 named packages will be touched.</p>
50
51 <p>Note that this operation transforms the dependency tree, and may
52 result in packages getting updated versions, perhaps from the npm
53 registry.</p>
54
55 <p>This feature is experimental, and may change in future versions.</p>
56
57 <p>The <code>--tag</code> argument will apply to all of the affected dependencies. If a
58 tag with the given name exists, the tagged version is preferred over newer
59 versions.</p>
60
61 <h2 id="SEE-ALSO">SEE ALSO</h2>
62
63 <ul><li><a href="../cli/npm-ls.html">npm-ls(1)</a></li><li><a href="../cli/npm-update.html">npm-update(1)</a></li><li><a href="../cli/npm-install.html">npm-install(1)</a></li></ul>
64 </div>
65 <p id="footer">npm-dedupe &mdash; npm@1.3.15</p>
66 <script>
67 ;(function () {
68 var wrapper = document.getElementById("wrapper")
69 var els = Array.prototype.slice.call(wrapper.getElementsByTagName("*"), 0)
70   .filter(function (el) {
71     return el.parentNode === wrapper
72         && el.tagName.match(/H[1-6]/)
73         && el.id
74   })
75 var l = 2
76   , toc = document.createElement("ul")
77 toc.innerHTML = els.map(function (el) {
78   var i = el.tagName.charAt(1)
79     , out = ""
80   while (i > l) {
81     out += "<ul>"
82     l ++
83   }
84   while (i < l) {
85     out += "</ul>"
86     l --
87   }
88   out += "<li><a href='#" + el.id + "'>" +
89     ( el.innerText || el.text || el.innerHTML)
90     + "</a>"
91   return out
92 }).join("\n")
93 toc.id = "toc"
94 document.body.appendChild(toc)
95 })()
96 </script>