|
|
|
<!doctype html>
|
|
|
|
<html>
|
|
|
|
<title>link</title>
|
|
|
|
<meta http-equiv="content-type" value="text/html;utf-8">
|
|
|
|
<link rel="stylesheet" type="text/css" href="../style.css">
|
|
|
|
|
|
|
|
<body>
|
|
|
|
<div id="wrapper">
|
|
|
|
<h1><a href="../api/link.html">link</a></h1> <p>Symlink a package folder</p>
|
|
|
|
|
|
|
|
<h2 id="SYNOPSIS">SYNOPSIS</h2>
|
|
|
|
|
|
|
|
<pre><code>npm.command.link(callback)
|
|
|
|
npm.command.link(packages, callback)</code></pre>
|
|
|
|
|
|
|
|
<h2 id="DESCRIPTION">DESCRIPTION</h2>
|
|
|
|
|
|
|
|
<p>Package linking is a two-step process.</p>
|
|
|
|
|
|
|
|
<p>Without parameters, link will create a globally-installed
|
|
|
|
symbolic link from <code>prefix/package-name</code> to the current folder.</p>
|
|
|
|
|
|
|
|
<p>With a parameters, link will create a symlink from the local <code>node_modules</code>
|
|
|
|
folder to the global symlink.</p>
|
|
|
|
|
|
|
|
<p>When creating tarballs for <code>npm publish</code>, the linked packages are
|
|
|
|
"snapshotted" to their current state by resolving the symbolic links.</p>
|
|
|
|
|
|
|
|
<p>This is
|
|
|
|
handy for installing your own stuff, so that you can work on it and test it
|
|
|
|
iteratively without having to continually rebuild.</p>
|
|
|
|
|
|
|
|
<p>For example:</p>
|
|
|
|
|
|
|
|
<pre><code>npm.commands.link(cb) # creates global link from the cwd
|
|
|
|
# (say redis package)
|
|
|
|
npm.commands.link('redis', cb) # link-install the package</code></pre>
|
|
|
|
|
|
|
|
<p>Now, any changes to the redis package will be reflected in
|
|
|
|
the package in the current working directory</p>
|
|
|
|
</div>
|
|
|
|
<p id="footer">link — npm@1.1.44</p>
|
|
|
|
<script>
|
|
|
|
;(function () {
|
|
|
|
var wrapper = document.getElementById("wrapper")
|
|
|
|
var els = Array.prototype.slice.call(wrapper.getElementsByTagName("*"), 0)
|
|
|
|
.filter(function (el) {
|
|
|
|
return el.parentNode === wrapper
|
|
|
|
&& el.tagName.match(/H[1-6]/)
|
|
|
|
&& el.id
|
|
|
|
})
|
|
|
|
var l = 2
|
|
|
|
, toc = document.createElement("ul")
|
|
|
|
toc.innerHTML = els.map(function (el) {
|
|
|
|
var i = el.tagName.charAt(1)
|
|
|
|
, out = ""
|
|
|
|
while (i > l) {
|
|
|
|
out += "<ul>"
|
|
|
|
l ++
|
|
|
|
}
|
|
|
|
while (i < l) {
|
|
|
|
out += "</ul>"
|
|
|
|
l --
|
|
|
|
}
|
|
|
|
out += "<li><a href='#" + el.id + "'>" +
|
|
|
|
( el.innerText || el.text || el.innerHTML)
|
|
|
|
+ "</a>"
|
|
|
|
return out
|
|
|
|
}).join("\n")
|
|
|
|
toc.id = "toc"
|
|
|
|
document.body.appendChild(toc)
|
|
|
|
})()
|
|
|
|
</script>
|
|
|
|
</body></html>
|