update website [ci skip]

This commit is contained in:
Website Deployment Script 2018-01-22 11:21:10 +00:00
parent 600059484b
commit ef493f4f44

View File

@ -4,12 +4,12 @@
toggler.onclick = function() {
nav.classList.toggle('docsSliderActive');
};
</script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/facebook/metro/edit/master/docs/GettingStarted.md" target="_blank">Edit this Doc</a><h1>Getting Started</h1></header><article><div><p>Install Metro using <code>npm</code>:</p><pre class="prism language-javascript">npm install <span class="token operator">--</span>save<span class="token operator">-</span>dev metro</pre><p>Or via <a href="https://yarnpkg.com/en/package/jest" target="_blank"><code>yarn</code></a>:</p><pre class="prism language-javascript">yarn add <span class="token operator">--</span>dev metro</pre><h2><a class="anchor" name="running-metro"></a>Running <code>metro</code> <a class="hash-link" href="#running-metro">#</a></h2><p>Right now, Metro Bundler cannot run by itself. Instead, some functions are exposed so that the configuration can be passed into it. First, require the module by doing:</p><pre class="prism language-js"><span class="token keyword">const</span> metroBundler <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&#x27;metro&#x27;</span><span class="token punctuation">)</span><span class="token punctuation">;</span></pre><p>Within the object returned, two main methods are given:</p><h3><a class="anchor" name="method-createserverserveroptions"></a>Method <code>createServer(serverOptions)</code> <a class="hash-link" href="#method-createserverserveroptions">#</a></h3><p>Given a set of options (same ones as the <code>build</code> method), a <code>metro-server</code> will be returned. You can then hook this into a proper HTTP(S) server by using its <code>processRequest</code> method:</p><pre class="prism language-js"><span class="token string">&#x27;use strict&#x27;</span><span class="token punctuation">;</span>
</script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/facebook/metro/edit/master/docs/GettingStarted.md" target="_blank">Edit this Doc</a><h1>Getting Started</h1></header><article><div><p>Install Metro using <code>npm</code>:</p><pre class="prism language-javascript">npm install <span class="token operator">--</span>save<span class="token operator">-</span>dev metro metro<span class="token operator">-</span>core</pre><p>Or via <a href="https://yarnpkg.com/en/package/jest" target="_blank"><code>yarn</code></a>:</p><pre class="prism language-javascript">yarn add <span class="token operator">--</span>dev metro metro<span class="token operator">-</span>core</pre><h2><a class="anchor" name="running-metro"></a>Running <code>metro</code> <a class="hash-link" href="#running-metro">#</a></h2><p>Right now, Metro Bundler cannot run by itself. Instead, some functions are exposed so that the configuration can be passed into it. First, require the module by doing:</p><pre class="prism language-js"><span class="token keyword">const</span> metroBundler <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&#x27;metro&#x27;</span><span class="token punctuation">)</span><span class="token punctuation">;</span></pre><p>Within the object returned, two main methods are given:</p><h3><a class="anchor" name="method-createserverserveroptions"></a>Method <code>createServer(serverOptions)</code> <a class="hash-link" href="#method-createserverserveroptions">#</a></h3><p>Given a set of options (same ones as the <code>build</code> method), a <code>metro-server</code> will be returned. You can then hook this into a proper HTTP(S) server by using its <code>processRequest</code> method:</p><pre class="prism language-js"><span class="token string">&#x27;use strict&#x27;</span><span class="token punctuation">;</span>
<span class="token keyword">const</span> http <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&#x27;http&#x27;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">const</span> metroBundler <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&#x27;metro&#x27;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">const</span> TerminalReporter <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&#x27;metro/src/lib/TerminalReporter&#x27;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">const</span> Terminal <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&#x27;metro/src/lib/Terminal&#x27;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">const</span> Terminal <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&#x27;metro-core/src/Terminal&#x27;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">const</span> metroBundlerServer <span class="token operator">=</span> metroBundler<span class="token punctuation">.</span><span class="token function">createServer</span><span class="token punctuation">(</span><span class="token punctuation">{</span>
assetRegistryPath<span class="token punctuation">:</span> __dirname<span class="token punctuation">,</span>