110255c0b3cb67ba4e15051688a211fe9b30cc3f
[platform/upstream/nodejs.git] / deps / npm / html / doc / api / npm-edit.html
1 <!doctype html>
2 <html>
3   <title>npm-edit</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="../api/npm-edit.html">npm-edit</a></h1> <p>Edit an installed package</p>
10
11 <h2 id="SYNOPSIS">SYNOPSIS</h2>
12
13 <pre><code>npm.commands.edit(package, callback)</code></pre>
14
15 <h2 id="DESCRIPTION">DESCRIPTION</h2>
16
17 <p>Opens the package folder in the default editor (or whatever you&#39;ve
18 configured as the npm <code>editor</code> config -- see <code>npm help config</code>.)</p>
19
20 <p>After it has been edited, the package is rebuilt so as to pick up any
21 changes in compiled packages.</p>
22
23 <p>For instance, you can do <code>npm install connect</code> to install connect
24 into your package, and then <code>npm.commands.edit([&quot;connect&quot;], callback)</code>
25 to make a few changes to your locally installed copy.</p>
26
27 <p>The first parameter is a string array with a single element, the package
28 to open. The package can optionally have a version number attached.</p>
29
30 <p>Since this command opens an editor in a new process, be careful about where
31 and how this is used.</p>
32 </div>
33 <p id="footer">npm-edit &mdash; npm@1.3.15</p>
34 <script>
35 ;(function () {
36 var wrapper = document.getElementById("wrapper")
37 var els = Array.prototype.slice.call(wrapper.getElementsByTagName("*"), 0)
38   .filter(function (el) {
39     return el.parentNode === wrapper
40         && el.tagName.match(/H[1-6]/)
41         && el.id
42   })
43 var l = 2
44   , toc = document.createElement("ul")
45 toc.innerHTML = els.map(function (el) {
46   var i = el.tagName.charAt(1)
47     , out = ""
48   while (i > l) {
49     out += "<ul>"
50     l ++
51   }
52   while (i < l) {
53     out += "</ul>"
54     l --
55   }
56   out += "<li><a href='#" + el.id + "'>" +
57     ( el.innerText || el.text || el.innerHTML)
58     + "</a>"
59   return out
60 }).join("\n")
61 toc.id = "toc"
62 document.body.appendChild(toc)
63 })()
64 </script>