npm: Upgrade to 1.3.19
[platform/upstream/nodejs.git] / deps / npm / html / doc / api / npm-init.html
1 <!doctype html>
2 <html>
3   <title>npm-init</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>npm <a href="../api/init.html">init</a></h1> <p>Interactively create a package.json file</p>
10
11 <h2 id="SYNOPSIS">SYNOPSIS</h2>
12
13 <pre><code>npm.commands.init(args, callback)</code></pre>
14
15 <h2 id="DESCRIPTION">DESCRIPTION</h2>
16
17 <p>This will ask you a bunch of questions, and then write a package.json for you.</p>
18
19 <p>It attempts to make reasonable guesses about what you want things to be set to,
20 and then writes a package.json file with the options you&#39;ve selected.</p>
21
22 <p>If you already have a package.json file, it&#39;ll read that first, and default to
23 the options in there.</p>
24
25 <p>It is strictly additive, so it does not delete options from your package.json
26 without a really good reason to do so.</p>
27
28 <p>Since this function expects to be run on the command-line, it doesn&#39;t work very
29 well as a programmatically. The best option is to roll your own, and since
30 JavaScript makes it stupid simple to output formatted JSON, that is the
31 preferred method. If you&#39;re sure you want to handle command-line prompting,
32 then go ahead and use this programmatically.</p>
33
34 <h2 id="SEE-ALSO">SEE ALSO</h2>
35
36 <p><a href="../files/package.json.html">package.json(5)</a></p>
37 </div>
38 <p id="footer">npm-init &mdash; npm@1.3.19</p>
39 <script>
40 ;(function () {
41 var wrapper = document.getElementById("wrapper")
42 var els = Array.prototype.slice.call(wrapper.getElementsByTagName("*"), 0)
43   .filter(function (el) {
44     return el.parentNode === wrapper
45         && el.tagName.match(/H[1-6]/)
46         && el.id
47   })
48 var l = 2
49   , toc = document.createElement("ul")
50 toc.innerHTML = els.map(function (el) {
51   var i = el.tagName.charAt(1)
52     , out = ""
53   while (i > l) {
54     out += "<ul>"
55     l ++
56   }
57   while (i < l) {
58     out += "</ul>"
59     l --
60   }
61   out += "<li><a href='#" + el.id + "'>" +
62     ( el.innerText || el.text || el.innerHTML)
63     + "</a>"
64   return out
65 }).join("\n")
66 toc.id = "toc"
67 document.body.appendChild(toc)
68 })()
69 </script>