UNPKG

npm

Version:

a package manager for JavaScript

57 lines (51 loc) 4.81 kB
<!doctype html> <html> <title>npm-hook</title> <meta charset="utf-8"> <link rel="stylesheet" type="text/css" href="../../static/style.css"> <link rel="canonical" href="https://www.npmjs.org/doc/cli/npm-hook.html"> <script async=true src="../../static/toc.js"></script> <body> <div id="wrapper"> <h1><a href="../cli/npm-hook.html">npm-hook</a></h1> <p>Manage registry hooks</p> <h2 id="synopsis">SYNOPSIS</h2> <pre><code>npm hook ls [pkg] npm hook add &lt;entity&gt; &lt;url&gt; &lt;secret&gt; npm hook update &lt;id&gt; &lt;url&gt; [secret] npm hook rm &lt;id&gt;</code></pre><h2 id="example">EXAMPLE</h2> <p>Add a hook to watch a package for changes:</p> <pre><code>$ npm hook add lodash https://example.com/ my-shared-secret</code></pre><p>Add a hook to watch packages belonging to the user <code>substack</code>:</p> <pre><code>$ npm hook add ~substack https://example.com/ my-shared-secret</code></pre><p>Add a hook to watch packages in the scope <code>@npm</code></p> <pre><code>$ npm hook add @npm https://example.com/ my-shared-secret</code></pre><p>List all your active hooks:</p> <pre><code>$ npm hook ls</code></pre><p>List your active hooks for the <code>lodash</code> package:</p> <pre><code>$ npm hook ls lodash</code></pre><p>Update an existing hook&#39;s url:</p> <pre><code>$ npm hook update id-deadbeef https://my-new-website.here/</code></pre><p>Remove a hook:</p> <pre><code>$ npm hook rm id-deadbeef</code></pre><h2 id="description">DESCRIPTION</h2> <p>Allows you to manage <a href="https://blog.npmjs.org/post/145260155635/introducing-hooks-get-notifications-of-npm">npm hooks</a>, including adding, removing, listing, and updating.</p> <p>Hooks allow you to configure URL endpoints that will be notified whenever a change happens to any of the supported entity types. Three different types of entities can be watched by hooks: packages, owners, and scopes.</p> <p>To create a package hook, simply reference the package name.</p> <p>To create an owner hook, prefix the owner name with <code>~</code> (as in, <code>~youruser</code>).</p> <p>To create a scope hook, prefix the scope name with <code>@</code> (as in, <code>@yourscope</code>).</p> <p>The hook <code>id</code> used by <code>update</code> and <code>rm</code> are the IDs listed in <code>npm hook ls</code> for that particular hook.</p> <p>The shared secret will be sent along to the URL endpoint so you can verify the request came from your own configured hook.</p> <h2 id="see-also">SEE ALSO</h2> <ul> <li><a href="https://blog.npmjs.org/post/145260155635/introducing-hooks-get-notifications-of-npm">&quot;Introducing Hooks&quot; blog post</a></li> </ul> </div> <table border=0 cellspacing=0 cellpadding=0 id=npmlogo> <tr><td style="width:180px;height:10px;background:rgb(237,127,127)" colspan=18>&nbsp;</td></tr> <tr><td rowspan=4 style="width:10px;height:10px;background:rgb(237,127,127)">&nbsp;</td><td style="width:40px;height:10px;background:#fff" colspan=4>&nbsp;</td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=4>&nbsp;</td><td style="width:40px;height:10px;background:#fff" colspan=4>&nbsp;</td><td rowspan=4 style="width:10px;height:10px;background:rgb(237,127,127)">&nbsp;</td><td colspan=6 style="width:60px;height:10px;background:#fff">&nbsp;</td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=4>&nbsp;</td></tr> <tr><td colspan=2 style="width:20px;height:30px;background:#fff" rowspan=3>&nbsp;</td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=3>&nbsp;</td><td style="width:10px;height:10px;background:#fff" rowspan=3>&nbsp;</td><td style="width:20px;height:10px;background:#fff" rowspan=4 colspan=2>&nbsp;</td><td style="width:10px;height:20px;background:rgb(237,127,127)" rowspan=2>&nbsp;</td><td style="width:10px;height:10px;background:#fff" rowspan=3>&nbsp;</td><td style="width:20px;height:10px;background:#fff" rowspan=3 colspan=2>&nbsp;</td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=3>&nbsp;</td><td style="width:10px;height:10px;background:#fff" rowspan=3>&nbsp;</td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=3>&nbsp;</td></tr> <tr><td style="width:10px;height:10px;background:#fff" rowspan=2>&nbsp;</td></tr> <tr><td style="width:10px;height:10px;background:#fff">&nbsp;</td></tr> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6>&nbsp;</td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)">&nbsp;</td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff">&nbsp;</td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4>&nbsp;</td><td style="width:90px;height:10px;background:#fff" colspan=9>&nbsp;</td></tr> </table> <p id="footer">npm-hook &mdash; npm@6.5.0</p>