@breadcrum/extract-meta
Version:
Extract various metadata from html
32 lines (31 loc) • 5.8 kB
HTML
<html itemscope itemtype="http://schema.org/Article"><head><title>Using the European npm mirror | Shape Shed</title><meta property="og:title" value="Using the European npm mirror | Shape Shed"><meta description="If you are located in Europe the European npm mirror is fast and reliable. With a few tweaks you can easily publish to the main registry too."><meta name="twitter:description" value="If you are located in Europe the European npm mirror is fast and reliable. With a few tweaks you can easily publish to the main registry too."><meta property="og:description" value="If you are located in Europe the European npm mirror is fast and reliable. With a few tweaks you can easily publish to the main registry too."><meta keywords="JavaScript,Node.js"><meta itemprop="keywords" content="JavaScript,Node.js"><meta charset="utf-8"><meta name="author" content="George Ornbo"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="twitter:card" value="summary"><meta name="twitter:title" value="Using the European npm mirror | Shape Shed"><meta name="twitter:site" value="@shapeshed"><meta name="twitter:creator" value="@shapeshed"><meta name="twitter:domain" value="shapeshed.com"><meta property="og:type" value="article"><meta property="og:site_name" value="Shape Shed"><meta itemprop="isFamilyFriendly" content="true"><meta itemprop="inLanguage" content="en-GB"><link rel="stylesheet" href="/stylesheets/application-7c8a1e57cc84fce606a31bcfe30fcb98.css"><link href="/atom.xml" rel="alternate" title="Shape Shed" type="application/atom+xml"><link rel="author" href="https://plus.google.com/u/0/112147367550950112369/posts"><link rel="publisher" href="https://plus.google.com/u/0/112147367550950112369"></head><body><article><p class="date"> <time datetime="2014-01-09T15:39:41.000Z" data-updated="true" itemprop="datePublished">Thursday, January 09, 2014</time></p><h1 itemprop="headline name">Using the European npm mirror</h1><div itemprop="articleBody"><h2 itemprop="description" class="dropcap">If you are located in Europe the European npm mirror is fast and reliable. With a few tweaks you can easily publish to the main registry too.</h2><p>The mighty <a href="http://mmalecki.com/">Maciej Malecki</a> created a <a href="http://npmjs.eu/">European npm mirror</a> for all the Node.js developers this side of the Atlantic. It is much faster to install packages from and takes some load off the main registry. </p>
<p>Here are some stats™ on installing the yeoman-generator module.</p>
<pre><code>npm install --registry http://registry.npmjs.org yeoman-generator 10.09s user 1.62s system 47% cpu 24.473 total
npm install --registry http://registry.npmjs.eu yeoman-generator 6.10s user 1.11s system 34% cpu 20.903 total</code></pre>
<p>So 6.10 seconds in Europe, 10.09 seconds from the main registry. Four seconds faster.</p>
<p>You can start using the European mirror right away by running a single command.</p>
<pre><code>npm config set registry http://registry.npmjs.eu </code></pre>
<p>This will update your <code>.npmrc</code> to include the following line</p>
<pre><code>registry = http://registry.npmjs.eu/</code></pre>
<p>Now when you run <code>npm install</code> if you haven't disabled verbose logging you'll see the http calls going out to the European mirror.</p>
<pre><code>npm http GET http://registry.npmjs.eu/argparse
npm http GET http://registry.npmjs.eu/glob
.. </code></pre>
<h2>Publishing</h2>
<p>You cannot publish to the European mirror - it is read only. This means there is a little bit of work to do when you want to publish a module. There are a couple of ways to achieve this. You can simply specify the registry when you publish</p>
<pre><code>npm publish --registry http://registry.nodejs.org</code></pre>
<p>Or you can set this in your <code>package.json</code> file</p>
<pre><code>"publishConfig": {
"registry":"http://registry.npmjs.org/"
}</code></pre>
<h2>Conclusion</h2>
<p>If you are in Europe enjoy a faster, sexier npm experience by switching to the European registry! You can also bask in the warm glow of being a good npm citizen by taking some load off the main repository.</p>
<p>Given <a href="https://couchdb.apache.org/">CouchDB</a>'s excellent replication capabilities it would be nice to see more mirrors popping up. You could even write a proxy in front of the mirrors to make sure you always have a service available. </p>
</div><p>Have an update or suggestion for this article? <a href="https://github.com/shapeshed/shapeshed.com/blob/master/src/_posts/using-the-european-npm-mirror.md">You can edit it here and send me a pull request.</a></p></article><footer><h2>About the author</h2><p>George Ornbo is a full-stack developer based in London, UK. He is the author of <a href="http://nodejsbook.io" class="highlight">Sams Teach Yourself Node.js in 24 Hours</a>. He can be found in most of the usual places as shapeshed including <a href="https://twitter.com/shapeshed" class="highlight">Twitter</a> and <a href="https://github.com/shapeshed" class="highlight">GitHub</a>.</p><p> <a href="/" class="highlight">← http://shapeshed.com</a></p></footer><script type="text/javascript">(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-324369-3', 'shapeshed.com');
ga('require', 'linkid', 'linkid.js');
ga('send', 'pageview');
</script><script src="/javascripts/application-cd0edf416a4508b2ef871854ce2169f2.js"></script><script>hljs.initHighlightingOnLoad();</script></body></html>