mirror of https://github.com/nodejs/node.git
23 lines
1.2 KiB
HTML
23 lines
1.2 KiB
HTML
<h1><a href="../api/npm-link.html">npm-link</a></h1> <p>Symlink a package folder</p>
|
|
<h2 id="synopsis">SYNOPSIS</h2>
|
|
<pre><code>npm.commands.link(callback)
|
|
npm.commands.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>
|
|
|