The data contained in this repository can be downloaded to your computer using one of several clients.
Please see the documentation of your version control software client for more information.

Please select the desired protocol below to get the URL.

This URL has Read-Only access.

Statistics
| Branch: | Revision:

main_repo / deps / npm / html / api / link.html @ d46ebffb

History | View | Annotate | Download (2.12 KB)

1
<!doctype html>
2
<html>
3
  <title>link</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/link.html">link</a></h1> <p>Symlink a package folder</p>
10

    
11
<h2 id="SYNOPSIS">SYNOPSIS</h2>
12

    
13
<pre><code>npm.command.link(callback)
14
npm.command.link(packages, callback)</code></pre>
15

    
16
<h2 id="DESCRIPTION">DESCRIPTION</h2>
17

    
18
<p>Package linking is a two-step process.</p>
19

    
20
<p>Without parameters, link will create a globally-installed
21
symbolic link from <code>prefix/package-name</code> to the current folder.</p>
22

    
23
<p>With a parameters, link will create a symlink from the local <code>node_modules</code>
24
folder to the global symlink.</p>
25

    
26
<p>When creating tarballs for <code>npm publish</code>, the linked packages are
27
&quot;snapshotted&quot; to their current state by resolving the symbolic links.</p>
28

    
29
<p>This is
30
handy for installing your own stuff, so that you can work on it and test it
31
iteratively without having to continually rebuild.</p>
32

    
33
<p>For example:</p>
34

    
35
<pre><code>npm.commands.link(cb)           # creates global link from the cwd
36
                                # (say redis package)
37
npm.commands.link(&#39;redis&#39;, cb)  # link-install the package</code></pre>
38

    
39
<p>Now, any changes to the redis package will be reflected in
40
the package in the current working directory</p>
41
</div>
42
<p id="footer">link &mdash; npm@1.2.17</p>
43
<script>
44
;(function () {
45
var wrapper = document.getElementById("wrapper")
46
var els = Array.prototype.slice.call(wrapper.getElementsByTagName("*"), 0)
47
  .filter(function (el) {
48
    return el.parentNode === wrapper
49
        && el.tagName.match(/H[1-6]/)
50
        && el.id
51
  })
52
var l = 2
53
  , toc = document.createElement("ul")
54
toc.innerHTML = els.map(function (el) {
55
  var i = el.tagName.charAt(1)
56
    , out = ""
57
  while (i > l) {
58
    out += "<ul>"
59
    l ++
60
  }
61
  while (i < l) {
62
    out += "</ul>"
63
    l --
64
  }
65
  out += "<li><a href='#" + el.id + "'>" +
66
    ( el.innerText || el.text || el.innerHTML)
67
    + "</a>"
68
  return out
69
}).join("\n")
70
toc.id = "toc"
71
document.body.appendChild(toc)
72
})()
73
</script>
74
</body></html>