Browse Source

Merge pull request #122 from eliperelman/gh-pages

Revert "Updates"
gh-pages
Eli Perelman 8 years ago
committed by GitHub
parent
commit
9f32e719f8
  1. 87
      FAQ.html
  2. 276
      api/index.html
  3. 137
      cli/index.html
  4. 83
      contributing/code-of-conduct.html
  5. 88
      contributing/development.html
  6. 91
      contributing/index.html
  7. 240
      creating-presets.html
  8. 233
      customization/advanced.html
  9. 90
      customization/index.html
  10. 261
      customization/simple.html
  11. 83
      index.html
  12. 83
      installation.html
  13. 107
      learning-resources.html
  14. 720
      middleware/index.html
  15. 71
      middleware/neutrino-middleware-banner/README.md
  16. 71
      middleware/neutrino-middleware-chunk/README.md
  17. 67
      middleware/neutrino-middleware-clean/README.md
  18. 69
      middleware/neutrino-middleware-compile-loader/README.md
  19. 73
      middleware/neutrino-middleware-copy/README.md
  20. 67
      middleware/neutrino-middleware-env/README.md
  21. 138
      middleware/neutrino-middleware-eslint/README.md
  22. 70
      middleware/neutrino-middleware-font-loader/README.md
  23. 61
      middleware/neutrino-middleware-hot/README.md
  24. 60
      middleware/neutrino-middleware-html-loader/README.md
  25. 75
      middleware/neutrino-middleware-html-template/README.md
  26. 70
      middleware/neutrino-middleware-image-loader/README.md
  27. 75
      middleware/neutrino-middleware-loader-merge/README.md
  28. 62
      middleware/neutrino-middleware-minify/README.md
  29. 60
      middleware/neutrino-middleware-named-modules/README.md
  30. 60
      middleware/neutrino-middleware-progress/README.md
  31. 69
      middleware/neutrino-middleware-start-server/README.md
  32. 61
      middleware/neutrino-middleware-style-loader/README.md
  33. 94
      presets/community-presets.html
  34. 87
      presets/index.html
  35. 736
      presets/neutrino-lint-base/index.html
  36. 159
      presets/neutrino-preset-airbnb-base/index.html
  37. 122
      presets/neutrino-preset-jest/index.html
  38. 119
      presets/neutrino-preset-karma/index.html
  39. 129
      presets/neutrino-preset-mocha/index.html
  40. 225
      presets/neutrino-preset-node/index.html
  41. 106
      presets/neutrino-preset-react/index.html
  42. 225
      presets/neutrino-preset-web/index.html
  43. 85
      project-layout.html
  44. 2
      search_index.json
  45. 822
      upgrading-neutrino.html
  46. 103
      usage.html

87
FAQ.html

@ -61,7 +61,7 @@
<link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">
<link rel="next" href="middleware/" />
<link rel="next" href="presets/" />
<link rel="prev" href="project-layout.html" />
@ -158,20 +158,7 @@
</li>
<li class="chapter " data-level="1.6" data-path="middleware/">
<a href="middleware/">
Middleware
</a>
</li>
<li class="chapter " data-level="1.7" data-path="presets/">
<li class="chapter " data-level="1.6" data-path="presets/">
<a href="presets/">
@ -185,7 +172,7 @@
<ul class="articles">
<li class="chapter " data-level="1.7.1" data-path="presets/neutrino-preset-web/">
<li class="chapter " data-level="1.6.1" data-path="presets/neutrino-preset-web/">
<a href="presets/neutrino-preset-web/">
@ -198,7 +185,7 @@
</li>
<li class="chapter " data-level="1.7.2" data-path="presets/neutrino-preset-react/">
<li class="chapter " data-level="1.6.2" data-path="presets/neutrino-preset-react/">
<a href="presets/neutrino-preset-react/">
@ -211,7 +198,7 @@
</li>
<li class="chapter " data-level="1.7.3" data-path="presets/neutrino-preset-node/">
<li class="chapter " data-level="1.6.3" data-path="presets/neutrino-preset-node/">
<a href="presets/neutrino-preset-node/">
@ -224,7 +211,7 @@
</li>
<li class="chapter " data-level="1.7.4" data-path="presets/neutrino-preset-airbnb-base/">
<li class="chapter " data-level="1.6.4" data-path="presets/neutrino-preset-airbnb-base/">
<a href="presets/neutrino-preset-airbnb-base/">
@ -237,7 +224,7 @@
</li>
<li class="chapter " data-level="1.7.5" data-path="presets/neutrino-preset-karma/">
<li class="chapter " data-level="1.6.5" data-path="presets/neutrino-preset-karma/">
<a href="presets/neutrino-preset-karma/">
@ -250,7 +237,7 @@
</li>
<li class="chapter " data-level="1.7.6" data-path="presets/neutrino-preset-mocha/">
<li class="chapter " data-level="1.6.6" data-path="presets/neutrino-preset-mocha/">
<a href="presets/neutrino-preset-mocha/">
@ -263,7 +250,7 @@
</li>
<li class="chapter " data-level="1.7.7" data-path="presets/neutrino-preset-jest/">
<li class="chapter " data-level="1.6.7" data-path="presets/neutrino-preset-jest/">
<a href="presets/neutrino-preset-jest/">
@ -276,7 +263,7 @@
</li>
<li class="chapter " data-level="1.7.8" data-path="presets/community-presets.html">
<li class="chapter " data-level="1.6.8" data-path="presets/community-presets.html">
<a href="presets/community-presets.html">
@ -294,7 +281,7 @@
</li>
<li class="chapter " data-level="1.8" data-path="customization/">
<li class="chapter " data-level="1.7" data-path="customization/">
<a href="customization/">
@ -308,7 +295,7 @@
<ul class="articles">
<li class="chapter " data-level="1.8.1" data-path="customization/simple.html">
<li class="chapter " data-level="1.7.1" data-path="customization/simple.html">
<a href="customization/simple.html">
@ -321,7 +308,7 @@
</li>
<li class="chapter " data-level="1.8.2" data-path="customization/advanced.html">
<li class="chapter " data-level="1.7.2" data-path="customization/advanced.html">
<a href="customization/advanced.html">
@ -339,7 +326,7 @@
</li>
<li class="chapter " data-level="1.9" data-path="creating-presets.html">
<li class="chapter " data-level="1.8" data-path="creating-presets.html">
<a href="creating-presets.html">
@ -353,9 +340,9 @@
<ul class="articles">
<li class="chapter " data-level="1.9.1" data-path="presets/neutrino-lint-base/README.md">
<li class="chapter " data-level="1.8.1" data-path="presets/neutrino-lint-base/">
<span>
<a href="presets/neutrino-lint-base/">
Creating linting presets
@ -371,7 +358,7 @@
</li>
<li class="chapter " data-level="1.10" data-path="learning-resources.html">
<li class="chapter " data-level="1.9" data-path="learning-resources.html">
<a href="learning-resources.html">
@ -384,7 +371,7 @@
</li>
<li class="chapter " data-level="1.11" data-path="api/">
<li class="chapter " data-level="1.10" data-path="api/">
<a href="api/">
@ -397,7 +384,7 @@
</li>
<li class="chapter " data-level="1.12" data-path="cli/">
<li class="chapter " data-level="1.11" data-path="cli/">
<a href="cli/">
@ -410,33 +397,7 @@
</li>
<li class="chapter " data-level="1.13" data-path="upgrading-neutrino.html">
<a href="upgrading-neutrino.html">
Upgrading from v4 to v5
</a>
</li>
<li class="chapter " data-level="1.14" >
<a target="_blank" href="https://github.com/mozilla-neutrino/neutrino-dev/tree/docs-v4/docs">
v4 Documentation
</a>
</li>
<li class="chapter " data-level="1.15" data-path="contributing/">
<li class="chapter " data-level="1.12" data-path="contributing/">
<a href="contributing/">
@ -450,7 +411,7 @@
<ul class="articles">
<li class="chapter " data-level="1.15.1" data-path="contributing/development.html">
<li class="chapter " data-level="1.12.1" data-path="contributing/development.html">
<a href="contributing/development.html">
@ -463,7 +424,7 @@
</li>
<li class="chapter " data-level="1.15.2" data-path="contributing/code-of-conduct.html">
<li class="chapter " data-level="1.12.2" data-path="contributing/code-of-conduct.html">
<a href="contributing/code-of-conduct.html">
@ -609,7 +570,7 @@ entities requiring a name into an object which maps the name to the entity.</p>
</a>
<a href="middleware/" class="navigation navigation-next " aria-label="Next page: Middleware">
<a href="presets/" class="navigation navigation-next " aria-label="Next page: Presets">
<i class="fa fa-angle-right"></i>
</a>
@ -620,7 +581,7 @@ entities requiring a name into an object which maps the name to the entity.</p>
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"FAQ","level":"1.5","depth":1,"next":{"title":"Middleware","level":"1.6","depth":1,"path":"middleware/README.md","ref":"./middleware/README.md","articles":[]},"previous":{"title":"Project Layout","level":"1.4","depth":1,"path":"project-layout.md","ref":"./project-layout.md","articles":[]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"FAQ.md","mtime":"2017-03-15T13:20:51.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-15T14:46:02.288Z"},"basePath":".","book":{"language":""}});
gitbook.page.hasChanged({"page":{"title":"FAQ","level":"1.5","depth":1,"next":{"title":"Presets","level":"1.6","depth":1,"path":"presets/README.md","ref":"presets/README.md","articles":[{"title":"Web","level":"1.6.1","depth":2,"path":"presets/neutrino-preset-web/README.md","ref":"presets/neutrino-preset-web/README.md","articles":[]},{"title":"React","level":"1.6.2","depth":2,"path":"presets/neutrino-preset-react/README.md","ref":"presets/neutrino-preset-react/README.md","articles":[]},{"title":"Node.js","level":"1.6.3","depth":2,"path":"presets/neutrino-preset-node/README.md","ref":"presets/neutrino-preset-node/README.md","articles":[]},{"title":"Airbnb","level":"1.6.4","depth":2,"path":"presets/neutrino-preset-airbnb-base/README.md","ref":"presets/neutrino-preset-airbnb-base/README.md","articles":[]},{"title":"Karma","level":"1.6.5","depth":2,"path":"presets/neutrino-preset-karma/README.md","ref":"presets/neutrino-preset-karma/README.md","articles":[]},{"title":"Mocha","level":"1.6.6","depth":2,"path":"presets/neutrino-preset-mocha/README.md","ref":"presets/neutrino-preset-mocha/README.md","articles":[]},{"title":"Jest","level":"1.6.7","depth":2,"path":"presets/neutrino-preset-jest/README.md","ref":"presets/neutrino-preset-jest/README.md","articles":[]},{"title":"Community presets","level":"1.6.8","depth":2,"path":"presets/community-presets.md","ref":"presets/community-presets.md","articles":[]}]},"previous":{"title":"Project Layout","level":"1.4","depth":1,"path":"project-layout.md","ref":"project-layout.md","articles":[]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"FAQ.md","mtime":"2017-03-06T17:05:48.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-06T17:07:12.452Z"},"basePath":".","book":{"language":""}});
});
</script>
</div>

276
api/index.html

@ -158,20 +158,7 @@
</li>
<li class="chapter " data-level="1.6" data-path="../middleware/">
<a href="../middleware/">
Middleware
</a>
</li>
<li class="chapter " data-level="1.7" data-path="../presets/">
<li class="chapter " data-level="1.6" data-path="../presets/">
<a href="../presets/">
@ -185,7 +172,7 @@
<ul class="articles">
<li class="chapter " data-level="1.7.1" data-path="../presets/neutrino-preset-web/">
<li class="chapter " data-level="1.6.1" data-path="../presets/neutrino-preset-web/">
<a href="../presets/neutrino-preset-web/">
@ -198,7 +185,7 @@
</li>
<li class="chapter " data-level="1.7.2" data-path="../presets/neutrino-preset-react/">
<li class="chapter " data-level="1.6.2" data-path="../presets/neutrino-preset-react/">
<a href="../presets/neutrino-preset-react/">
@ -211,7 +198,7 @@
</li>
<li class="chapter " data-level="1.7.3" data-path="../presets/neutrino-preset-node/">
<li class="chapter " data-level="1.6.3" data-path="../presets/neutrino-preset-node/">
<a href="../presets/neutrino-preset-node/">
@ -224,7 +211,7 @@
</li>
<li class="chapter " data-level="1.7.4" data-path="../presets/neutrino-preset-airbnb-base/">
<li class="chapter " data-level="1.6.4" data-path="../presets/neutrino-preset-airbnb-base/">
<a href="../presets/neutrino-preset-airbnb-base/">
@ -237,7 +224,7 @@
</li>
<li class="chapter " data-level="1.7.5" data-path="../presets/neutrino-preset-karma/">
<li class="chapter " data-level="1.6.5" data-path="../presets/neutrino-preset-karma/">
<a href="../presets/neutrino-preset-karma/">
@ -250,7 +237,7 @@
</li>
<li class="chapter " data-level="1.7.6" data-path="../presets/neutrino-preset-mocha/">
<li class="chapter " data-level="1.6.6" data-path="../presets/neutrino-preset-mocha/">
<a href="../presets/neutrino-preset-mocha/">
@ -263,7 +250,7 @@
</li>
<li class="chapter " data-level="1.7.7" data-path="../presets/neutrino-preset-jest/">
<li class="chapter " data-level="1.6.7" data-path="../presets/neutrino-preset-jest/">
<a href="../presets/neutrino-preset-jest/">
@ -276,7 +263,7 @@
</li>
<li class="chapter " data-level="1.7.8" data-path="../presets/community-presets.html">
<li class="chapter " data-level="1.6.8" data-path="../presets/community-presets.html">
<a href="../presets/community-presets.html">
@ -294,7 +281,7 @@
</li>
<li class="chapter " data-level="1.8" data-path="../customization/">
<li class="chapter " data-level="1.7" data-path="../customization/">
<a href="../customization/">
@ -308,7 +295,7 @@
<ul class="articles">
<li class="chapter " data-level="1.8.1" data-path="../customization/simple.html">
<li class="chapter " data-level="1.7.1" data-path="../customization/simple.html">
<a href="../customization/simple.html">
@ -321,7 +308,7 @@
</li>
<li class="chapter " data-level="1.8.2" data-path="../customization/advanced.html">
<li class="chapter " data-level="1.7.2" data-path="../customization/advanced.html">
<a href="../customization/advanced.html">
@ -339,7 +326,7 @@
</li>
<li class="chapter " data-level="1.9" data-path="../creating-presets.html">
<li class="chapter " data-level="1.8" data-path="../creating-presets.html">
<a href="../creating-presets.html">
@ -353,9 +340,9 @@
<ul class="articles">
<li class="chapter " data-level="1.9.1" data-path="../presets/neutrino-lint-base/README.md">
<li class="chapter " data-level="1.8.1" data-path="../presets/neutrino-lint-base/">
<span>
<a href="../presets/neutrino-lint-base/">
Creating linting presets
@ -371,7 +358,7 @@
</li>
<li class="chapter " data-level="1.10" data-path="../learning-resources.html">
<li class="chapter " data-level="1.9" data-path="../learning-resources.html">
<a href="../learning-resources.html">
@ -384,7 +371,7 @@
</li>
<li class="chapter active" data-level="1.11" data-path="./">
<li class="chapter active" data-level="1.10" data-path="./">
<a href="./">
@ -397,7 +384,7 @@
</li>
<li class="chapter " data-level="1.12" data-path="../cli/">
<li class="chapter " data-level="1.11" data-path="../cli/">
<a href="../cli/">
@ -410,33 +397,7 @@
</li>
<li class="chapter " data-level="1.13" data-path="../upgrading-neutrino.html">
<a href="../upgrading-neutrino.html">
Upgrading from v4 to v5
</a>
</li>
<li class="chapter " data-level="1.14" >
<a target="_blank" href="https://github.com/mozilla-neutrino/neutrino-dev/tree/docs-v4/docs">
v4 Documentation
</a>
</li>
<li class="chapter " data-level="1.15" data-path="../contributing/">
<li class="chapter " data-level="1.12" data-path="../contributing/">
<a href="../contributing/">
@ -450,7 +411,7 @@
<ul class="articles">
<li class="chapter " data-level="1.15.1" data-path="../contributing/development.html">
<li class="chapter " data-level="1.12.1" data-path="../contributing/development.html">
<a href="../contributing/development.html">
@ -463,7 +424,7 @@
</li>
<li class="chapter " data-level="1.15.2" data-path="../contributing/code-of-conduct.html">
<li class="chapter " data-level="1.12.2" data-path="../contributing/code-of-conduct.html">
<a href="../contributing/code-of-conduct.html">
@ -528,174 +489,49 @@
<h1 id="neutrino-api">Neutrino API</h1>
<p>When using Neutrino via the <a href="../cli/">CLI</a>, it creates an instance of the Neutrino API which picks up
any presets and arguments passed on the command line or located in package.json. If you desire, you can also create your
own instance of the Neutrino API and interact with it programmatically.</p>
any presets and arguments passed on the command line. If you desire, you can also create your own
instance of the Neutrino API and interact with it programmatically.</p>
<h2 id="instantiation">Instantiation</h2>
<p>In order to access the Neutrino API, you must require or import it and instantiate it, passing in any
options:</p>
preset names or paths you wish to load:</p>
<p>Using <code>require</code>:</p>
<pre class="language-"><code class="lang-js"><span class="token keyword">const</span> Neutrino <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&apos;neutrino&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">const</span> api <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">Neutrino</span><span class="token punctuation">(</span>options<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">const</span> api <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">Neutrino</span><span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token string">&apos;neutrino-preset-react&apos;</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
<p>Using ES imports:</p>
<pre class="language-"><code class="lang-js"><span class="token keyword">import</span> Neutrino <span class="token keyword">from</span> <span class="token string">&apos;neutrino&apos;</span><span class="token punctuation">;</span>
<span class="token keyword">const</span> api <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">Neutrino</span><span class="token punctuation">(</span>options<span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
<h2 id="api-options">API options</h2>
<p>The Neutrino constructor can accept an object for setting a number of useful options:</p>
<h3 id="optionsroot"><code>options.root</code></h3>
<p>Set the base directory which Neutrino middleware and presets operate on. Typically this is the project directory where
the package.json would be located. If the option is not set, Neutrino defaults it to <code>process.cwd()</code>. If a relative
path is specified, it will be resolved relative to <code>process.cwd()</code>; absolute paths will be used as-is.</p>
<pre class="language-"><code class="lang-js"><span class="token keyword">new</span> <span class="token class-name">Neutrino</span><span class="token punctuation">(</span><span class="token punctuation">{</span>
<span class="token comment" spellcheck="true">// if not specified, defaults to process.cwd()</span>
<span class="token comment" spellcheck="true">// relative, resolves to process.cwd() + ./website</span>
root<span class="token punctuation">:</span> <span class="token string">&apos;./website&apos;</span><span class="token punctuation">,</span>
<span class="token comment" spellcheck="true">// absolute</span>
root<span class="token punctuation">:</span> <span class="token string">&apos;/code/website&apos;</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span>
</code></pre>
<h3 id="optionssource"><code>options.source</code></h3>
<p>Set the directory which contains the application source code. If the option is not set, Neutrino defaults it to <code>src</code>.
If a relative path is specified, it will be resolved relative to <code>options.root</code>; absolute paths will be used as-is.</p>
<pre class="language-"><code class="lang-js"><span class="token keyword">new</span> <span class="token class-name">Neutrino</span><span class="token punctuation">(</span><span class="token punctuation">{</span>
<span class="token comment" spellcheck="true">// if not specified, defaults to options.root + src</span>
<span class="token comment" spellcheck="true">// relative, resolves to options.root + ./lib</span>
source<span class="token punctuation">:</span> <span class="token string">&apos;./lib&apos;</span><span class="token punctuation">,</span>
<span class="token comment" spellcheck="true">// absolute</span>
source<span class="token punctuation">:</span> <span class="token string">&apos;/code/website/lib&apos;</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span>
</code></pre>
<h3 id="optionsoutput"><code>options.output</code></h3>
<p>Set the directory which will be the output of built assets. If the option is not set, Neutrino defaults it to <code>build</code>.
If a relative path is specified, it will be resolved relative to <code>options.root</code>; absolute paths will be used as-is.</p>
<pre class="language-"><code class="lang-js"><span class="token keyword">new</span> <span class="token class-name">Neutrino</span><span class="token punctuation">(</span><span class="token punctuation">{</span>
<span class="token comment" spellcheck="true">// if not specified, defaults to options.root + build</span>
<span class="token comment" spellcheck="true">// relative, resolves to options.root + ./dist</span>
output<span class="token punctuation">:</span> <span class="token string">&apos;./dist&apos;</span><span class="token punctuation">,</span>
<span class="token comment" spellcheck="true">// absolute</span>
output<span class="token punctuation">:</span> <span class="token string">&apos;/code/website/dist&apos;</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span>
</code></pre>
<h3 id="optionstests"><code>options.tests</code></h3>
<p>Set the directory that contains test files. If the option is not set, Neutrino defaults it to <code>test</code>.
If a relative path is specified, it will be resolved relative to <code>options.root</code>; absolute paths will be used as-is.</p>
<pre class="language-"><code class="lang-js"><span class="token keyword">new</span> <span class="token class-name">Neutrino</span><span class="token punctuation">(</span><span class="token punctuation">{</span>
<span class="token comment" spellcheck="true">// if not specified, defaults to options.root + test</span>
<span class="token comment" spellcheck="true">// relative, resolves to options.root + ./testing</span>
tests<span class="token punctuation">:</span> <span class="token string">&apos;./testing&apos;</span><span class="token punctuation">,</span>
<span class="token comment" spellcheck="true">// absolute</span>
tests<span class="token punctuation">:</span> <span class="token string">&apos;/code/website/testing&apos;</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span>
</code></pre>
<h3 id="optionsentry"><code>options.entry</code></h3>
<p>Set the main entry point for the application. If the option is not set, Neutrino defaults it to <code>index.js</code>.
If a relative path is specified, it will be resolved relative to <code>options.source</code>; absolute paths will be used as-is.</p>
<pre class="language-"><code class="lang-js"><span class="token keyword">new</span> <span class="token class-name">Neutrino</span><span class="token punctuation">(</span><span class="token punctuation">{</span>
<span class="token comment" spellcheck="true">// if not specified, defaults to options.source + index.js</span>
<span class="token comment" spellcheck="true">// relative, resolves to options.source + ./entry.js</span>
entry<span class="token punctuation">:</span> <span class="token string">&apos;./entry.js&apos;</span><span class="token punctuation">,</span>
<span class="token comment" spellcheck="true">// absolute</span>
entry<span class="token punctuation">:</span> <span class="token string">&apos;/code/website/lib/entry.js&apos;</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span>
</code></pre>
<h3 id="optionsnodemodules"><code>options.node_modules</code></h3>
<p>Set the directory which contains the Node.js modules of the project. If the option is not set, Neutrino defaults it to
<code>node_modules</code>. If a relative path is specified, it will be resolved relative to <code>options.root</code>; absolute paths will be
used as-is.</p>
<pre class="language-"><code class="lang-js"><span class="token keyword">new</span> <span class="token class-name">Neutrino</span><span class="token punctuation">(</span><span class="token punctuation">{</span>
<span class="token comment" spellcheck="true">// if not specified, defaults to options.root + node_modules</span>
<span class="token comment" spellcheck="true">// relative, resolves to options.root + ./modules</span>
node_modules<span class="token punctuation">:</span> <span class="token string">&apos;./modules&apos;</span><span class="token punctuation">,</span>
<span class="token comment" spellcheck="true">// absolute</span>
node_modules<span class="token punctuation">:</span> <span class="token string">&apos;/code/website/modules&apos;</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span>
</code></pre>
<h2 id="loading-middleware">Loading middleware</h2>
<p>Using the Neutrino API you can load <a href="../middleware/">middleware</a> and presets (which are also just middleware)
using the <code>use</code> method. The <code>use</code> method takes in a middleware function, and optionally any options that should be
passed to the middleware function.</p>
<pre class="language-"><code class="lang-js">api<span class="token punctuation">.</span><span class="token function">use</span><span class="token punctuation">(</span>middleware<span class="token punctuation">,</span> middlewareOptions<span class="token punctuation">)</span>
</code></pre>
<p>Typically presets do not require any additional options, and middleware may, but check with your particular package
for specifics. As an example, if you wanted to require the list of presets and Neutrino options from a package.json:</p>
<pre class="language-"><code class="lang-js"><span class="token keyword">const</span> Neutrino <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&apos;neutrino&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">const</span> pkg <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&apos;./package.json&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">const</span> api <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">Neutrino</span><span class="token punctuation">(</span>pkg<span class="token punctuation">.</span>neutrino<span class="token punctuation">.</span>options<span class="token punctuation">)</span><span class="token punctuation">;</span>
api<span class="token punctuation">.</span><span class="token function">use</span><span class="token punctuation">(</span><span class="token function">require</span><span class="token punctuation">(</span>pkg<span class="token punctuation">.</span>neutrino<span class="token punctuation">.</span>presets<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
<p>You can call <code>.use</code> iteratively for multiple presets:</p>
<pre class="language-"><code class="lang-js">pkg<span class="token punctuation">.</span>neutrino<span class="token punctuation">.</span>presets
<span class="token punctuation">.</span><span class="token function">forEach</span><span class="token punctuation">(</span>preset <span class="token operator">=</span><span class="token operator">&gt;</span> neutrino<span class="token punctuation">.</span><span class="token function">use</span><span class="token punctuation">(</span><span class="token function">require</span><span class="token punctuation">(</span>preset<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">const</span> api <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">Neutrino</span><span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token string">&apos;neutrino-preset-react&apos;</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
<h2 id="environment">Environment</h2>
<p>When using the CLI, environment variables are automatically set based on the command you are using.
When using the API this is not the case, and you <strong>must</strong> set it prior to calling any build commands or
loading any presets if you expect them to build correctly based on their target.</p>
loading any presets.</p>
<pre class="language-"><code class="lang-js">process<span class="token punctuation">.</span>env<span class="token punctuation">.</span>NODE_ENV <span class="token operator">=</span> <span class="token string">&apos;production&apos;</span><span class="token punctuation">;</span>
<span class="token keyword">const</span> api <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">Neutrino</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">// load presets...</span>
api<span class="token punctuation">.</span><span class="token function">build</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
<h2 id="api">API</h2>
<h3 id="constructor">Constructor</h3>
<p>When creating a Neutrino instance, you have the option of providing an object which can be passed as options to
middleware as <code>neutrino.options</code>.</p>
<pre class="language-"><code class="lang-js"><span class="token keyword">const</span> Neutrino <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&apos;neutrino&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">const</span> api <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">Neutrino</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">// or with optional options</span>
<span class="token keyword">const</span> api <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">Neutrino</span><span class="token punctuation">(</span><span class="token punctuation">{</span> jest<span class="token punctuation">:</span> <span class="token punctuation">{</span> bail<span class="token punctuation">:</span> <span class="token boolean">true</span> <span class="token punctuation">}</span> <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
<p>When creating a Neutrino instance, you have the option of providing an array of presets for the API to attempt
to load and merge configurations for. Each preset will attempt to be loaded from the current working directory&apos;s
<code>node_modules</code>, nested within, by name, or relative file path. If it cannot be found, an exception will be thrown.</p>
<p>In addition to any provided presets, Neutrino will also attempt to load configuration data from the package.json
residing in the current working directory. If this package.json contains an object at <code>config.neutrino</code>, this data
will be merged.</p>
<h3 id="config"><code>.config</code></h3>
<p>When constructing a Neutrino instance, a property of <code>.config</code> is set to be a new instance of
<a href="https://github.com/mozilla-neutrino/webpack-chain" target="_blank">webpack-chain</a>. This property is then available to all presets
which subsequently augment it with their specific configuration. All middleware and presets added use this single
<code>.config</code> to store their data, meaning that middleware load order has an effect on which config values take precedence.
Middleware loaded first will have any configuration overridden by later middleware with matching properties.</p>
<h3 id="usemiddleware-middlewareoptions"><code>.use(middleware, middlewareOptions)</code></h3>
<p>Invoke a Neutrino middleware function, optionally providing options which will be passed to the middleware function.
Middleware will be invoked with two arguments:</p>
<ol>
<li>The Neutrino instance</li>
<li>The optional <code>middlewareOptions</code></li>
</ol>
<p>For example, given the following middleware function:</p>
<pre class="language-"><code class="lang-js"><span class="token keyword">function</span> <span class="token function">middleware</span><span class="token punctuation">(</span>neutrino<span class="token punctuation">,</span> options<span class="token punctuation">)</span> <span class="token punctuation">{</span>
neutrino<span class="token punctuation">.</span>config
<span class="token punctuation">.</span><span class="token function">entry</span><span class="token punctuation">(</span><span class="token string">&apos;index&apos;</span><span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">prepend</span><span class="token punctuation">(</span>options<span class="token punctuation">.</span>entryPoint<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
<span class="token comment" spellcheck="true">// Passing this middleware function to Neutrino, along with some options:</span>
neutrino<span class="token punctuation">.</span><span class="token function">use</span><span class="token punctuation">(</span>middleware<span class="token punctuation">,</span> <span class="token punctuation">{</span> entryPoint<span class="token punctuation">:</span> <span class="token string">&apos;babel-polyfill&apos;</span> <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
<a href="https://github.com/mozilla-neutrino/webpack-chain/tree/v1.4.3" target="_blank">webpack-chain</a>. This property is then available to all presets, which
subsequently augment it with their specific options. Every preset added uses this single <code>.config</code> to store their data,
meaning that preset load order has an effect on which config values take precedence. Presets loaded later will override
values set by earlier presets.</p>
<h3 id="startargs"><code>start(args)</code></h3>
<p>The <code>start()</code> method is responsible for creating a development bundle, and when possible, starting a development
server or source watcher. Prior to starting this process, Neutrino will trigger and wait for <code>prestart</code> events to
finish. After it is complete, Neutrino will trigger and wait for <code>start</code> events to finish.</p>
<p>If the Neutrino config contains options for <code>devServer</code>, then a webpack-dev-server will be started, otherwise a Webpack
source watcher will be started.</p>
<p>If the Neutrino config contains options for <code>devServer</code>, then a webpack-dev-server will be started. If it is
configured for Node.js, then a build will be created, otherwise a Webpack source watcher will be started.</p>
<p>Currently any <code>args</code> passed to <code>start()</code> have no effect and will be passed through to any event handlers.</p>
<p>The <code>start</code> method will return a Promise which resolves after the build is done or development watcher has stopped,
and all <code>start</code> events have finished.</p>
@ -717,9 +553,9 @@ will reject if there was a failure during building.</p>
</code></pre>
<h3 id="testargs"><code>test(args)</code></h3>
<p>The <code>test()</code> method is responsible for gathering args needed for testing and triggering relevant events as a signal to
test presets that they may run. Using the <code>test</code> method does nothing other than triggering these events; without
middleware listening for these events, nothing will happen. Prior to starting this process, Neutrino will trigger and
wait for <code>pretest</code> events to finish. After it is complete, Neutrino will trigger and wait for
test presets that they may run. Using the <code>test</code> method does nothing other than triggering these events; without a
preset listening for these events, nothing will happen. Prior to starting this process, Neutrino will trigger and wait
for <code>pretest</code> events to finish. After it is complete, Neutrino will trigger and wait for
<code>test</code> events to finish, in which test runners will do their work.</p>
<p>Any <code>args</code> passed to <code>test()</code> are passed on to the event handles and typically have properties for an array of
<code>files</code> to test, as well as a property for <code>watch</code>ing and rerunning tests.</p>
@ -740,7 +576,8 @@ api
<h3 id="getwebpackoptions"><code>getWebpackOptions()</code></h3>
<p>While tools like webpack-chain provide a convenient API for creating Webpack configurations, this is not a format that
is understandable by Webpack. With <code>getWebpackOptions()</code>, the webpack-chain instance at <code>.config</code> will be converted to
an configuration object readable directly by Webpack.</p>
an options object readable directly by Webpack. This call is cached, so subsequent calls to <code>getWebpackOptions</code> will
result in the config being rendered only once, but the cached value returned afterwards.</p>
<pre class="language-"><code class="lang-js">api<span class="token punctuation">.</span><span class="token function">getWebpackOptions</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment" spellcheck="true">// -&gt; { ... }</span>
</code></pre>
<h3 id="emitforalleventname-payload"><code>emitForAll(eventName, payload)</code></h3>
@ -772,28 +609,13 @@ log the <code>err</code> property and any errors from <code>stats</code> if appl
console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token string">&apos;The build failed!&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
<h3 id="devserver"><code>devServer()</code></h3>
<p>This method is used internally to generate an instance of webpack-dev-server when using <code>start()</code>. It returns a promise
that resolves when the process receives a <code>SIGINT</code> event to stop.</p>
<h3 id="devserver"><code>_devServer</code></h3>
<p>This method is used internally to generate an instance of webpack-dev-server during <code>start()</code>. It returns a promise that
resolves when the process receives a <code>SIGINT</code> event to stop.</p>
<pre class="language-"><code class="lang-js">api
<span class="token punctuation">.</span><span class="token function">devServer</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">_devServer</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">then</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=</span><span class="token operator">&gt;</span> console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token string">&apos;Exiting process...&apos;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
<h3 id="builder"><code>builder()</code></h3>
<p>This method is used internally to generate an instance of a Webpack compiler when using <code>build()</code>. It returns a promise
that resolves when the Webpack build has completed, or rejects if the build fails.</p>
<pre class="language-"><code class="lang-js">api
<span class="token punctuation">.</span><span class="token function">builder</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">then</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=</span><span class="token operator">&gt;</span> console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token string">&apos;Exiting process...&apos;</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token keyword">catch</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=</span><span class="token operator">&gt;</span> console<span class="token punctuation">.</span><span class="token function">error</span><span class="token punctuation">(</span><span class="token string">&apos;Build failed!&apos;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
<h3 id="watcher"><code>watcher()</code></h3>
<p>This method is used internally to generate an instance of a Webpack source watcher when using <code>start()</code>. It returns a promise
that resolves when the process receives a <code>SIGINT</code> event to stop and the watcher has closed.</p>
<pre class="language-"><code class="lang-js">api
<span class="token punctuation">.</span><span class="token function">watcher</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">then</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=</span><span class="token operator">&gt;</span> console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token string">&apos;Exiting process, done watching...&apos;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
</section>
@ -837,7 +659,7 @@ that resolves when the process receives a <code>SIGINT</code> event to stop and
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"API","level":"1.11","depth":1,"next":{"title":"CLI","level":"1.12","depth":1,"path":"cli/README.md","ref":"./cli/README.md","articles":[]},"previous":{"title":"Learning Resources","level":"1.10","depth":1,"path":"learning-resources.md","ref":"./learning-resources.md","articles":[]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"api/README.md","mtime":"2017-03-15T13:20:51.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-15T14:46:02.288Z"},"basePath":"..","book":{"language":""}});
gitbook.page.hasChanged({"page":{"title":"API","level":"1.10","depth":1,"next":{"title":"CLI","level":"1.11","depth":1,"path":"cli/README.md","ref":"cli/README.md","articles":[]},"previous":{"title":"Learning Resources","level":"1.9","depth":1,"path":"learning-resources.md","ref":"learning-resources.md","articles":[]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"api/README.md","mtime":"2017-03-06T16:54:11.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-06T17:07:12.452Z"},"basePath":"..","book":{"language":""}});
});
</script>
</div>

137
cli/index.html

@ -61,7 +61,7 @@
<link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
<link rel="next" href="../upgrading-neutrino.html" />
<link rel="next" href="../contributing/" />
<link rel="prev" href="../api/" />
@ -158,20 +158,7 @@
</li>
<li class="chapter " data-level="1.6" data-path="../middleware/">
<a href="../middleware/">
Middleware
</a>
</li>
<li class="chapter " data-level="1.7" data-path="../presets/">
<li class="chapter " data-level="1.6" data-path="../presets/">
<a href="../presets/">
@ -185,7 +172,7 @@
<ul class="articles">
<li class="chapter " data-level="1.7.1" data-path="../presets/neutrino-preset-web/">
<li class="chapter " data-level="1.6.1" data-path="../presets/neutrino-preset-web/">
<a href="../presets/neutrino-preset-web/">
@ -198,7 +185,7 @@
</li>
<li class="chapter " data-level="1.7.2" data-path="../presets/neutrino-preset-react/">
<li class="chapter " data-level="1.6.2" data-path="../presets/neutrino-preset-react/">
<a href="../presets/neutrino-preset-react/">
@ -211,7 +198,7 @@
</li>
<li class="chapter " data-level="1.7.3" data-path="../presets/neutrino-preset-node/">
<li class="chapter " data-level="1.6.3" data-path="../presets/neutrino-preset-node/">
<a href="../presets/neutrino-preset-node/">
@ -224,7 +211,7 @@
</li>
<li class="chapter " data-level="1.7.4" data-path="../presets/neutrino-preset-airbnb-base/">
<li class="chapter " data-level="1.6.4" data-path="../presets/neutrino-preset-airbnb-base/">
<a href="../presets/neutrino-preset-airbnb-base/">
@ -237,7 +224,7 @@
</li>
<li class="chapter " data-level="1.7.5" data-path="../presets/neutrino-preset-karma/">
<li class="chapter " data-level="1.6.5" data-path="../presets/neutrino-preset-karma/">
<a href="../presets/neutrino-preset-karma/">
@ -250,7 +237,7 @@
</li>
<li class="chapter " data-level="1.7.6" data-path="../presets/neutrino-preset-mocha/">
<li class="chapter " data-level="1.6.6" data-path="../presets/neutrino-preset-mocha/">
<a href="../presets/neutrino-preset-mocha/">
@ -263,7 +250,7 @@
</li>
<li class="chapter " data-level="1.7.7" data-path="../presets/neutrino-preset-jest/">
<li class="chapter " data-level="1.6.7" data-path="../presets/neutrino-preset-jest/">
<a href="../presets/neutrino-preset-jest/">
@ -276,7 +263,7 @@
</li>
<li class="chapter " data-level="1.7.8" data-path="../presets/community-presets.html">
<li class="chapter " data-level="1.6.8" data-path="../presets/community-presets.html">
<a href="../presets/community-presets.html">
@ -294,7 +281,7 @@
</li>
<li class="chapter " data-level="1.8" data-path="../customization/">
<li class="chapter " data-level="1.7" data-path="../customization/">
<a href="../customization/">
@ -308,7 +295,7 @@
<ul class="articles">
<li class="chapter " data-level="1.8.1" data-path="../customization/simple.html">
<li class="chapter " data-level="1.7.1" data-path="../customization/simple.html">
<a href="../customization/simple.html">
@ -321,7 +308,7 @@
</li>
<li class="chapter " data-level="1.8.2" data-path="../customization/advanced.html">
<li class="chapter " data-level="1.7.2" data-path="../customization/advanced.html">
<a href="../customization/advanced.html">
@ -339,7 +326,7 @@
</li>
<li class="chapter " data-level="1.9" data-path="../creating-presets.html">
<li class="chapter " data-level="1.8" data-path="../creating-presets.html">
<a href="../creating-presets.html">
@ -353,9 +340,9 @@
<ul class="articles">
<li class="chapter " data-level="1.9.1" data-path="../presets/neutrino-lint-base/README.md">
<li class="chapter " data-level="1.8.1" data-path="../presets/neutrino-lint-base/">
<span>
<a href="../presets/neutrino-lint-base/">
Creating linting presets
@ -371,7 +358,7 @@
</li>
<li class="chapter " data-level="1.10" data-path="../learning-resources.html">
<li class="chapter " data-level="1.9" data-path="../learning-resources.html">
<a href="../learning-resources.html">
@ -384,7 +371,7 @@
</li>
<li class="chapter " data-level="1.11" data-path="../api/">
<li class="chapter " data-level="1.10" data-path="../api/">
<a href="../api/">
@ -397,7 +384,7 @@
</li>
<li class="chapter active" data-level="1.12" data-path="./">
<li class="chapter active" data-level="1.11" data-path="./">
<a href="./">
@ -410,33 +397,7 @@
</li>
<li class="chapter " data-level="1.13" data-path="../upgrading-neutrino.html">
<a href="../upgrading-neutrino.html">
Upgrading from v4 to v5
</a>
</li>
<li class="chapter " data-level="1.14" >
<a target="_blank" href="https://github.com/mozilla-neutrino/neutrino-dev/tree/docs-v4/docs">
v4 Documentation
</a>
</li>
<li class="chapter " data-level="1.15" data-path="../contributing/">
<li class="chapter " data-level="1.12" data-path="../contributing/">
<a href="../contributing/">
@ -450,7 +411,7 @@
<ul class="articles">
<li class="chapter " data-level="1.15.1" data-path="../contributing/development.html">
<li class="chapter " data-level="1.12.1" data-path="../contributing/development.html">
<a href="../contributing/development.html">
@ -463,7 +424,7 @@
</li>
<li class="chapter " data-level="1.15.2" data-path="../contributing/code-of-conduct.html">
<li class="chapter " data-level="1.12.2" data-path="../contributing/code-of-conduct.html">
<a href="../contributing/code-of-conduct.html">
@ -527,14 +488,7 @@
<section class="normal markdown-section">
<h1 id="neutrino-cli">Neutrino CLI</h1>
<p>Using the command-line interface is the preferred and simplest way of interacting with Neutrino.</p>
<p>When using the Neutrino CLI, you provide a list of presets for the API to attempt to load and merge configurations for.
Each preset will attempt to be loaded from the current working directory&apos;s <code>node_modules</code>, nested within, by name, or
relative file path. If it cannot be found, an exception will be thrown.</p>
<p>In addition to any provided presets, Neutrino will also attempt to load configuration data from the package.json
residing in the current working directory. If this package.json contains an object at <code>neutrino.config</code>, this data
will be merged with the Neutrino configuration after all presets and middleware have been loaded.</p>
<p>Let&apos;s take a look at the CLI usage.</p>
<p>Using the command-line interface is the preferred way of interacting with Neutrino. Let&apos;s take a look at its usage.</p>
<h2 id="-help"><code>--help</code></h2>
<p>Using <code>neutrino --help</code> will bring up the following help guide:</p>
<pre class="language-"><code class="lang-bash">&#x276F; neutrino --help
@ -544,10 +498,9 @@ Commands:
<span class="token function">test</span> <span class="token punctuation">[</span>files<span class="token punctuation">..</span><span class="token punctuation">]</span> Run all suites from the <span class="token function">test</span> directory or provided files
Options:
--inspect Output a string representation of the configuration used by Neutrino and <span class="token keyword">exit</span> <span class="token punctuation">[</span>boolean<span class="token punctuation">]</span>
--presets A list of Neutrino presets used to configure the build <span class="token punctuation">[</span>array<span class="token punctuation">]</span> <span class="token punctuation">[</span>default: <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">]</span>
--version Show version number <span class="token punctuation">[</span>boolean<span class="token punctuation">]</span>
--help Show <span class="token function">help</span> <span class="token punctuation">[</span>boolean<span class="token punctuation">]</span>
--presets A list of Neutrino presets used to configure the build <span class="token punctuation">[</span>array<span class="token punctuation">]</span> <span class="token punctuation">[</span>default: <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">]</span>
--version Show version number <span class="token punctuation">[</span>boolean<span class="token punctuation">]</span>
--help Show <span class="token function">help</span> <span class="token punctuation">[</span>boolean<span class="token punctuation">]</span>
</code></pre>
<h2 id="-version"><code>--version</code></h2>
<p>Using <code>--version</code> will output the current version of the Neutrino CLI to the console and exit.</p>
@ -563,42 +516,14 @@ presets to load. These can be an npm package or a relative path to a module to l
<code>config.presets</code>. Presets passed via the CLI <code>--presets</code> will take precedence over presets defined in
<code>config.presets</code>, meaning that options set by package.json presets can have their values overridden by
<code>--presets</code> presets.</p>
<h2 id="-inspect"><code>--inspect</code></h2>
<p>The <code>--inspect</code> flag can be used to write out a stringified version of the Webpack configuration which has been
accumulated by all middleware. When using the <code>--inspect</code> flag, the Neutrino CLI will still import all presets and
middleware that has been supplied, but will then exit after logging the configuration to stdout. No builds, servers, or
watchers will be started.</p>
<pre class="language-"><code class="lang-bash">&#x276F; neutrino start --inspect --presets neutrino-preset-react neutrino-preset-jest
</code></pre>
<p>This could also be used to help create diffs between configuration changes. Take the following command:</p>
<pre class="language-"><code class="lang-bash">&#x276F; neutrino start --inspect --presets neutrino-preset-react neutrino-preset-jest
</code></pre>
<p>We can capture this inspection to a file, and capture the change by adding a preset override:</p>
<pre class="language-"><code class="lang-bash">&#x276F; neutrino start --inspect --presets neutrino-preset-react neutrino-preset-jest <span class="token operator">&gt;</span> a.config
&#x276F; neutrino start --inspect --presets neutrino-preset-react neutrino-preset-jest override.js <span class="token operator">&gt;</span> b.config
</code></pre>
<p>Using <code>git diff a.config b.config</code>, we get a pretty diff of the configuration change:</p>
<pre class="language-"><code class="lang-diff">diff --git a/a.config b/b.config
index 3356802..d4d82ef 100644
<span class="token coord">--- a/a.config</span>
<span class="token coord">+++ b/b.config</span>
<span class="token coord">@@ -3,6 +3,7 @@</span>
devtool: &apos;source-map&apos;,
entry: {
index: [
<span class="token inserted">+ &apos;babel-polyfill&apos;,</span>
&apos;/node/src/index.js&apos;
]
},
</code></pre>
<h2 id="neutrino-start"><code>neutrino start</code></h2>
<h2 id="neutrino-start">neutrino start</h2>
<p>Using the command <code>neutrino start</code> builds a project in development mode, also starting a development server or source
watcher depending on the preset or config options used. This command sets the <code>NODE_ENV</code> environment variable to
<code>development</code>.</p>
<h2 id="neutrino-build"><code>neutrino build</code></h2>
<h2 id="neutrino-build">neutrino build</h2>
<p>Using the command <code>neutrino build</code> builds a project in production mode, rendering static assets to the configured build
output destination. This command sets the <code>NODE_ENV</code> environment variable to <code>production</code>.</p>
<h2 id="neutrino-test"><code>neutrino test</code></h2>
<h2 id="neutrino-test">neutrino test</h2>
<p>Using the command <code>neutrino test</code> passes execution onto a test runner preset. It is up to the preset being used to
determine how source files are built or provided to tests. See your particular test preset for details. This
command sets the <code>NODE_ENV</code> environment variable to <code>test</code>.</p>
@ -665,7 +590,7 @@ as failing a pull request on continuous integration if any tests fail or if ther
</a>
<a href="../upgrading-neutrino.html" class="navigation navigation-next " aria-label="Next page: Upgrading from v4 to v5">
<a href="../contributing/" class="navigation navigation-next " aria-label="Next page: Contributing">
<i class="fa fa-angle-right"></i>
</a>
@ -676,7 +601,7 @@ as failing a pull request on continuous integration if any tests fail or if ther
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"CLI","level":"1.12","depth":1,"next":{"title":"Upgrading from v4 to v5","level":"1.13","depth":1,"path":"upgrading-neutrino.md","ref":"./upgrading-neutrino.md","articles":[]},"previous":{"title":"API","level":"1.11","depth":1,"path":"api/README.md","ref":"./api/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"cli/README.md","mtime":"2017-03-15T13:20:51.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-15T14:46:02.288Z"},"basePath":"..","book":{"language":""}});
gitbook.page.hasChanged({"page":{"title":"CLI","level":"1.11","depth":1,"next":{"title":"Contributing","level":"1.12","depth":1,"path":"contributing/README.md","ref":"contributing/README.md","articles":[{"title":"Development Process","level":"1.12.1","depth":2,"path":"contributing/development.md","ref":"contributing/development.md","articles":[]},{"title":"Code of Conduct","level":"1.12.2","depth":2,"path":"contributing/code-of-conduct.md","ref":"contributing/code-of-conduct.md","articles":[]}]},"previous":{"title":"API","level":"1.10","depth":1,"path":"api/README.md","ref":"api/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"cli/README.md","mtime":"2017-03-01T15:25:58.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-06T17:07:12.452Z"},"basePath":"..","book":{"language":""}});
});
</script>
</div>

83
contributing/code-of-conduct.html

@ -156,20 +156,7 @@
</li>
<li class="chapter " data-level="1.6" data-path="../middleware/">
<a href="../middleware/">
Middleware
</a>
</li>
<li class="chapter " data-level="1.7" data-path="../presets/">
<li class="chapter " data-level="1.6" data-path="../presets/">
<a href="../presets/">
@ -183,7 +170,7 @@
<ul class="articles">
<li class="chapter " data-level="1.7.1" data-path="../presets/neutrino-preset-web/">
<li class="chapter " data-level="1.6.1" data-path="../presets/neutrino-preset-web/">
<a href="../presets/neutrino-preset-web/">
@ -196,7 +183,7 @@
</li>
<li class="chapter " data-level="1.7.2" data-path="../presets/neutrino-preset-react/">
<li class="chapter " data-level="1.6.2" data-path="../presets/neutrino-preset-react/">
<a href="../presets/neutrino-preset-react/">
@ -209,7 +196,7 @@
</li>
<li class="chapter " data-level="1.7.3" data-path="../presets/neutrino-preset-node/">
<li class="chapter " data-level="1.6.3" data-path="../presets/neutrino-preset-node/">
<a href="../presets/neutrino-preset-node/">
@ -222,7 +209,7 @@
</li>
<li class="chapter " data-level="1.7.4" data-path="../presets/neutrino-preset-airbnb-base/">
<li class="chapter " data-level="1.6.4" data-path="../presets/neutrino-preset-airbnb-base/">
<a href="../presets/neutrino-preset-airbnb-base/">
@ -235,7 +222,7 @@
</li>
<li class="chapter " data-level="1.7.5" data-path="../presets/neutrino-preset-karma/">
<li class="chapter " data-level="1.6.5" data-path="../presets/neutrino-preset-karma/">
<a href="../presets/neutrino-preset-karma/">
@ -248,7 +235,7 @@
</li>
<li class="chapter " data-level="1.7.6" data-path="../presets/neutrino-preset-mocha/">
<li class="chapter " data-level="1.6.6" data-path="../presets/neutrino-preset-mocha/">
<a href="../presets/neutrino-preset-mocha/">
@ -261,7 +248,7 @@
</li>
<li class="chapter " data-level="1.7.7" data-path="../presets/neutrino-preset-jest/">
<li class="chapter " data-level="1.6.7" data-path="../presets/neutrino-preset-jest/">
<a href="../presets/neutrino-preset-jest/">
@ -274,7 +261,7 @@
</li>
<li class="chapter " data-level="1.7.8" data-path="../presets/community-presets.html">
<li class="chapter " data-level="1.6.8" data-path="../presets/community-presets.html">
<a href="../presets/community-presets.html">
@ -292,7 +279,7 @@
</li>
<li class="chapter " data-level="1.8" data-path="../customization/">
<li class="chapter " data-level="1.7" data-path="../customization/">
<a href="../customization/">
@ -306,7 +293,7 @@
<ul class="articles">
<li class="chapter " data-level="1.8.1" data-path="../customization/simple.html">
<li class="chapter " data-level="1.7.1" data-path="../customization/simple.html">
<a href="../customization/simple.html">
@ -319,7 +306,7 @@
</li>
<li class="chapter " data-level="1.8.2" data-path="../customization/advanced.html">
<li class="chapter " data-level="1.7.2" data-path="../customization/advanced.html">
<a href="../customization/advanced.html">
@ -337,7 +324,7 @@
</li>
<li class="chapter " data-level="1.9" data-path="../creating-presets.html">
<li class="chapter " data-level="1.8" data-path="../creating-presets.html">
<a href="../creating-presets.html">
@ -351,9 +338,9 @@
<ul class="articles">
<li class="chapter " data-level="1.9.1" data-path="../presets/neutrino-lint-base/README.md">
<li class="chapter " data-level="1.8.1" data-path="../presets/neutrino-lint-base/">
<span>
<a href="../presets/neutrino-lint-base/">
Creating linting presets
@ -369,7 +356,7 @@
</li>
<li class="chapter " data-level="1.10" data-path="../learning-resources.html">
<li class="chapter " data-level="1.9" data-path="../learning-resources.html">
<a href="../learning-resources.html">
@ -382,7 +369,7 @@
</li>
<li class="chapter " data-level="1.11" data-path="../api/">
<li class="chapter " data-level="1.10" data-path="../api/">
<a href="../api/">
@ -395,7 +382,7 @@
</li>
<li class="chapter " data-level="1.12" data-path="../cli/">
<li class="chapter " data-level="1.11" data-path="../cli/">
<a href="../cli/">
@ -408,33 +395,7 @@
</li>
<li class="chapter " data-level="1.13" data-path="../upgrading-neutrino.html">
<a href="../upgrading-neutrino.html">
Upgrading from v4 to v5
</a>
</li>
<li class="chapter " data-level="1.14" >
<a target="_blank" href="https://github.com/mozilla-neutrino/neutrino-dev/tree/docs-v4/docs">
v4 Documentation
</a>
</li>
<li class="chapter " data-level="1.15" data-path="./">
<li class="chapter " data-level="1.12" data-path="./">
<a href="./">
@ -448,7 +409,7 @@
<ul class="articles">
<li class="chapter " data-level="1.15.1" data-path="development.html">
<li class="chapter " data-level="1.12.1" data-path="development.html">
<a href="development.html">
@ -461,7 +422,7 @@
</li>
<li class="chapter active" data-level="1.15.2" data-path="code-of-conduct.html">
<li class="chapter active" data-level="1.12.2" data-path="code-of-conduct.html">
<a href="code-of-conduct.html">
@ -621,7 +582,7 @@ available at <a href="http://contributor-covenant.org/version/1/4/" target="_bla
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"Code of Conduct","level":"1.15.2","depth":2,"previous":{"title":"Development Process","level":"1.15.1","depth":2,"path":"contributing/development.md","ref":"./contributing/development.md","articles":[]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"contributing/code-of-conduct.md","mtime":"2017-02-17T16:19:42.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-15T14:46:02.288Z"},"basePath":"..","book":{"language":""}});
gitbook.page.hasChanged({"page":{"title":"Code of Conduct","level":"1.12.2","depth":2,"previous":{"title":"Development Process","level":"1.12.1","depth":2,"path":"contributing/development.md","ref":"contributing/development.md","articles":[]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"contributing/code-of-conduct.md","mtime":"2017-02-16T18:32:52.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-06T17:07:12.452Z"},"basePath":"..","book":{"language":""}});
});
</script>
</div>

88
contributing/development.html

@ -158,20 +158,7 @@
</li>
<li class="chapter " data-level="1.6" data-path="../middleware/">
<a href="../middleware/">
Middleware
</a>
</li>
<li class="chapter " data-level="1.7" data-path="../presets/">
<li class="chapter " data-level="1.6" data-path="../presets/">
<a href="../presets/">
@ -185,7 +172,7 @@
<ul class="articles">
<li class="chapter " data-level="1.7.1" data-path="../presets/neutrino-preset-web/">
<li class="chapter " data-level="1.6.1" data-path="../presets/neutrino-preset-web/">
<a href="../presets/neutrino-preset-web/">
@ -198,7 +185,7 @@
</li>
<li class="chapter " data-level="1.7.2" data-path="../presets/neutrino-preset-react/">
<li class="chapter " data-level="1.6.2" data-path="../presets/neutrino-preset-react/">
<a href="../presets/neutrino-preset-react/">
@ -211,7 +198,7 @@
</li>
<li class="chapter " data-level="1.7.3" data-path="../presets/neutrino-preset-node/">
<li class="chapter " data-level="1.6.3" data-path="../presets/neutrino-preset-node/">
<a href="../presets/neutrino-preset-node/">
@ -224,7 +211,7 @@
</li>
<li class="chapter " data-level="1.7.4" data-path="../presets/neutrino-preset-airbnb-base/">
<li class="chapter " data-level="1.6.4" data-path="../presets/neutrino-preset-airbnb-base/">
<a href="../presets/neutrino-preset-airbnb-base/">
@ -237,7 +224,7 @@
</li>
<li class="chapter " data-level="1.7.5" data-path="../presets/neutrino-preset-karma/">
<li class="chapter " data-level="1.6.5" data-path="../presets/neutrino-preset-karma/">
<a href="../presets/neutrino-preset-karma/">
@ -250,7 +237,7 @@
</li>
<li class="chapter " data-level="1.7.6" data-path="../presets/neutrino-preset-mocha/">
<li class="chapter " data-level="1.6.6" data-path="../presets/neutrino-preset-mocha/">
<a href="../presets/neutrino-preset-mocha/">
@ -263,7 +250,7 @@
</li>
<li class="chapter " data-level="1.7.7" data-path="../presets/neutrino-preset-jest/">
<li class="chapter " data-level="1.6.7" data-path="../presets/neutrino-preset-jest/">
<a href="../presets/neutrino-preset-jest/">
@ -276,7 +263,7 @@
</li>
<li class="chapter " data-level="1.7.8" data-path="../presets/community-presets.html">
<li class="chapter " data-level="1.6.8" data-path="../presets/community-presets.html">
<a href="../presets/community-presets.html">
@ -294,7 +281,7 @@
</li>
<li class="chapter " data-level="1.8" data-path="../customization/">
<li class="chapter " data-level="1.7" data-path="../customization/">
<a href="../customization/">
@ -308,7 +295,7 @@
<ul class="articles">
<li class="chapter " data-level="1.8.1" data-path="../customization/simple.html">
<li class="chapter " data-level="1.7.1" data-path="../customization/simple.html">
<a href="../customization/simple.html">
@ -321,7 +308,7 @@
</li>
<li class="chapter " data-level="1.8.2" data-path="../customization/advanced.html">
<li class="chapter " data-level="1.7.2" data-path="../customization/advanced.html">
<a href="../customization/advanced.html">
@ -339,7 +326,7 @@
</li>
<li class="chapter " data-level="1.9" data-path="../creating-presets.html">
<li class="chapter " data-level="1.8" data-path="../creating-presets.html">
<a href="../creating-presets.html">
@ -353,9 +340,9 @@
<ul class="articles">
<li class="chapter " data-level="1.9.1" data-path="../presets/neutrino-lint-base/README.md">
<li class="chapter " data-level="1.8.1" data-path="../presets/neutrino-lint-base/">
<span>
<a href="../presets/neutrino-lint-base/">
Creating linting presets
@ -371,7 +358,7 @@
</li>
<li class="chapter " data-level="1.10" data-path="../learning-resources.html">
<li class="chapter " data-level="1.9" data-path="../learning-resources.html">
<a href="../learning-resources.html">
@ -384,7 +371,7 @@
</li>
<li class="chapter " data-level="1.11" data-path="../api/">
<li class="chapter " data-level="1.10" data-path="../api/">
<a href="../api/">
@ -397,7 +384,7 @@
</li>
<li class="chapter " data-level="1.12" data-path="../cli/">
<li class="chapter " data-level="1.11" data-path="../cli/">
<a href="../cli/">
@ -410,33 +397,7 @@
</li>
<li class="chapter " data-level="1.13" data-path="../upgrading-neutrino.html">
<a href="../upgrading-neutrino.html">
Upgrading from v4 to v5
</a>
</li>
<li class="chapter " data-level="1.14" >
<a target="_blank" href="https://github.com/mozilla-neutrino/neutrino-dev/tree/docs-v4/docs">
v4 Documentation
</a>
</li>
<li class="chapter " data-level="1.15" data-path="./">
<li class="chapter " data-level="1.12" data-path="./">
<a href="./">
@ -450,7 +411,7 @@
<ul class="articles">
<li class="chapter active" data-level="1.15.1" data-path="development.html">
<li class="chapter active" data-level="1.12.1" data-path="development.html">
<a href="development.html">
@ -463,7 +424,7 @@
</li>
<li class="chapter " data-level="1.15.2" data-path="code-of-conduct.html">
<li class="chapter " data-level="1.12.2" data-path="code-of-conduct.html">
<a href="code-of-conduct.html">
@ -527,7 +488,7 @@
<section class="normal markdown-section">
<h1 id="developing-neutrino">Developing Neutrino</h1>
<p>Developing and contributing to Neutrino, its core presets, and middleware is done through our monorepo located at
<p>Developing and contributing to Neutrino and its core presets is done through our monorepo located at
<a href="https://github.com/mozilla-neutrino/neutrino-dev" target="_blank">https://github.com/mozilla-neutrino/neutrino-dev</a>. The code is broken up into a couple different sections:
packages and documentation.</p>
<p><em>Note: In this guide, commands executable from the command line are prepended with <code>&#x276F;</code>. Lines not starting
@ -540,8 +501,7 @@ with this symbol show sample console output from running the previous command.</
<li>git, GitHub account</li>
</ul>
<h2 id="getting-started">Getting started</h2>
<p>The first step to start developing neutrino-dev is
<a href="https://help.github.com/articles/fork-a-repo/" target="_blank">forking the repository to your own GitHub account</a>.</p>
<p>The first step to start developing neutrino-dev is forking the repository to your own GitHub account.</p>
<p><a href="https://github.com/mozilla-neutrino/neutrino-dev/fork" target="_blank">Fork mozilla-neutrino/neutrino-dev on GitHub</a></p>
<p>Once that is done, you can clone your copy of the repository on your computer, replacing <code>USER</code> with the username
of the account you forked the repository to:</p>
@ -682,7 +642,7 @@ the latest changes from the master branch.</p>
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"Development Process","level":"1.15.1","depth":2,"next":{"title":"Code of Conduct","level":"1.15.2","depth":2,"path":"contributing/code-of-conduct.md","ref":"./contributing/code-of-conduct.md","articles":[]},"previous":{"title":"Contributing","level":"1.15","depth":1,"path":"contributing/README.md","ref":"./contributing/README.md","articles":[{"title":"Development Process","level":"1.15.1","depth":2,"path":"contributing/development.md","ref":"./contributing/development.md","articles":[]},{"title":"Code of Conduct","level":"1.15.2","depth":2,"path":"contributing/code-of-conduct.md","ref":"./contributing/code-of-conduct.md","articles":[]}]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"contributing/development.md","mtime":"2017-03-15T13:20:51.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-15T14:46:02.288Z"},"basePath":"..","book":{"language":""}});
gitbook.page.hasChanged({"page":{"title":"Development Process","level":"1.12.1","depth":2,"next":{"title":"Code of Conduct","level":"1.12.2","depth":2,"path":"contributing/code-of-conduct.md","ref":"contributing/code-of-conduct.md","articles":[]},"previous":{"title":"Contributing","level":"1.12","depth":1,"path":"contributing/README.md","ref":"contributing/README.md","articles":[{"title":"Development Process","level":"1.12.1","depth":2,"path":"contributing/development.md","ref":"contributing/development.md","articles":[]},{"title":"Code of Conduct","level":"1.12.2","depth":2,"path":"contributing/code-of-conduct.md","ref":"contributing/code-of-conduct.md","articles":[]}]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"contributing/development.md","mtime":"2017-03-01T15:25:58.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-06T17:07:12.452Z"},"basePath":"..","book":{"language":""}});
});
</script>
</div>

91
contributing/index.html

@ -64,6 +64,8 @@
<link rel="next" href="development.html" />
<link rel="prev" href="../cli/" />
</head>
<body>
@ -156,20 +158,7 @@
</li>
<li class="chapter " data-level="1.6" data-path="../middleware/">
<a href="../middleware/">
Middleware
</a>
</li>
<li class="chapter " data-level="1.7" data-path="../presets/">
<li class="chapter " data-level="1.6" data-path="../presets/">
<a href="../presets/">
@ -183,7 +172,7 @@
<ul class="articles">
<li class="chapter " data-level="1.7.1" data-path="../presets/neutrino-preset-web/">
<li class="chapter " data-level="1.6.1" data-path="../presets/neutrino-preset-web/">
<a href="../presets/neutrino-preset-web/">
@ -196,7 +185,7 @@
</li>
<li class="chapter " data-level="1.7.2" data-path="../presets/neutrino-preset-react/">
<li class="chapter " data-level="1.6.2" data-path="../presets/neutrino-preset-react/">
<a href="../presets/neutrino-preset-react/">
@ -209,7 +198,7 @@
</li>
<li class="chapter " data-level="1.7.3" data-path="../presets/neutrino-preset-node/">
<li class="chapter " data-level="1.6.3" data-path="../presets/neutrino-preset-node/">
<a href="../presets/neutrino-preset-node/">
@ -222,7 +211,7 @@
</li>
<li class="chapter " data-level="1.7.4" data-path="../presets/neutrino-preset-airbnb-base/">
<li class="chapter " data-level="1.6.4" data-path="../presets/neutrino-preset-airbnb-base/">
<a href="../presets/neutrino-preset-airbnb-base/">
@ -235,7 +224,7 @@
</li>
<li class="chapter " data-level="1.7.5" data-path="../presets/neutrino-preset-karma/">
<li class="chapter " data-level="1.6.5" data-path="../presets/neutrino-preset-karma/">
<a href="../presets/neutrino-preset-karma/">
@ -248,7 +237,7 @@
</li>
<li class="chapter " data-level="1.7.6" data-path="../presets/neutrino-preset-mocha/">
<li class="chapter " data-level="1.6.6" data-path="../presets/neutrino-preset-mocha/">
<a href="../presets/neutrino-preset-mocha/">
@ -261,7 +250,7 @@
</li>
<li class="chapter " data-level="1.7.7" data-path="../presets/neutrino-preset-jest/">
<li class="chapter " data-level="1.6.7" data-path="../presets/neutrino-preset-jest/">
<a href="../presets/neutrino-preset-jest/">
@ -274,7 +263,7 @@
</li>
<li class="chapter " data-level="1.7.8" data-path="../presets/community-presets.html">
<li class="chapter " data-level="1.6.8" data-path="../presets/community-presets.html">
<a href="../presets/community-presets.html">
@ -292,7 +281,7 @@
</li>
<li class="chapter " data-level="1.8" data-path="../customization/">
<li class="chapter " data-level="1.7" data-path="../customization/">
<a href="../customization/">
@ -306,7 +295,7 @@
<ul class="articles">
<li class="chapter " data-level="1.8.1" data-path="../customization/simple.html">
<li class="chapter " data-level="1.7.1" data-path="../customization/simple.html">
<a href="../customization/simple.html">
@ -319,7 +308,7 @@
</li>
<li class="chapter " data-level="1.8.2" data-path="../customization/advanced.html">
<li class="chapter " data-level="1.7.2" data-path="../customization/advanced.html">
<a href="../customization/advanced.html">
@ -337,7 +326,7 @@
</li>
<li class="chapter " data-level="1.9" data-path="../creating-presets.html">
<li class="chapter " data-level="1.8" data-path="../creating-presets.html">
<a href="../creating-presets.html">
@ -351,9 +340,9 @@
<ul class="articles">
<li class="chapter " data-level="1.9.1" data-path="../presets/neutrino-lint-base/README.md">
<li class="chapter " data-level="1.8.1" data-path="../presets/neutrino-lint-base/">
<span>
<a href="../presets/neutrino-lint-base/">
Creating linting presets
@ -369,7 +358,7 @@
</li>
<li class="chapter " data-level="1.10" data-path="../learning-resources.html">
<li class="chapter " data-level="1.9" data-path="../learning-resources.html">
<a href="../learning-resources.html">
@ -382,7 +371,7 @@
</li>
<li class="chapter " data-level="1.11" data-path="../api/">
<li class="chapter " data-level="1.10" data-path="../api/">
<a href="../api/">
@ -395,7 +384,7 @@
</li>
<li class="chapter " data-level="1.12" data-path="../cli/">
<li class="chapter " data-level="1.11" data-path="../cli/">
<a href="../cli/">
@ -408,33 +397,7 @@
</li>
<li class="chapter " data-level="1.13" data-path="../upgrading-neutrino.html">
<a href="../upgrading-neutrino.html">
Upgrading from v4 to v5
</a>
</li>
<li class="chapter " data-level="1.14" >
<a target="_blank" href="https://github.com/mozilla-neutrino/neutrino-dev/tree/docs-v4/docs">
v4 Documentation
</a>
</li>
<li class="chapter active" data-level="1.15" data-path="./">
<li class="chapter active" data-level="1.12" data-path="./">
<a href="./">
@ -448,7 +411,7 @@
<ul class="articles">
<li class="chapter " data-level="1.15.1" data-path="development.html">
<li class="chapter " data-level="1.12.1" data-path="development.html">
<a href="development.html">
@ -461,7 +424,7 @@
</li>
<li class="chapter " data-level="1.15.2" data-path="code-of-conduct.html">
<li class="chapter " data-level="1.12.2" data-path="code-of-conduct.html">
<a href="code-of-conduct.html">
@ -630,8 +593,12 @@ always encourage contributors to continue to make proposals.</p>
<a href="../cli/" class="navigation navigation-prev " aria-label="Previous page: CLI">
<i class="fa fa-angle-left"></i>
</a>
<a href="development.html" class="navigation navigation-next navigation-unique" aria-label="Next page: Development Process">
<a href="development.html" class="navigation navigation-next " aria-label="Next page: Development Process">
<i class="fa fa-angle-right"></i>
</a>
@ -642,7 +609,7 @@ always encourage contributors to continue to make proposals.</p>
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"Contributing","level":"1.15","depth":1,"next":{"title":"Development Process","level":"1.15.1","depth":2,"path":"contributing/development.md","ref":"./contributing/development.md","articles":[]},"previous":{"title":"v4 Documentation","level":"1.14","depth":1,"url":"https://github.com/mozilla-neutrino/neutrino-dev/tree/docs-v4/docs","ref":"https://github.com/mozilla-neutrino/neutrino-dev/tree/docs-v4/docs","articles":[]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"contributing/README.md","mtime":"2017-03-15T13:20:51.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-15T14:46:02.288Z"},"basePath":"..","book":{"language":""}});
gitbook.page.hasChanged({"page":{"title":"Contributing","level":"1.12","depth":1,"next":{"title":"Development Process","level":"1.12.1","depth":2,"path":"contributing/development.md","ref":"contributing/development.md","articles":[]},"previous":{"title":"CLI","level":"1.11","depth":1,"path":"cli/README.md","ref":"cli/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"contributing/README.md","mtime":"2017-02-16T21:55:45.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-06T17:07:12.452Z"},"basePath":"..","book":{"language":""}});
});
</script>
</div>

240
creating-presets.html

@ -61,7 +61,7 @@
<link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">
<link rel="next" href="presets/neutrino-lint-base/README.md" />
<link rel="next" href="presets/neutrino-lint-base/" />
<link rel="prev" href="customization/advanced.html" />
@ -158,20 +158,7 @@
</li>
<li class="chapter " data-level="1.6" data-path="middleware/">
<a href="middleware/">
Middleware
</a>
</li>
<li class="chapter " data-level="1.7" data-path="presets/">
<li class="chapter " data-level="1.6" data-path="presets/">
<a href="presets/">
@ -185,7 +172,7 @@
<ul class="articles">
<li class="chapter " data-level="1.7.1" data-path="presets/neutrino-preset-web/">
<li class="chapter " data-level="1.6.1" data-path="presets/neutrino-preset-web/">
<a href="presets/neutrino-preset-web/">
@ -198,7 +185,7 @@
</li>
<li class="chapter " data-level="1.7.2" data-path="presets/neutrino-preset-react/">
<li class="chapter " data-level="1.6.2" data-path="presets/neutrino-preset-react/">
<a href="presets/neutrino-preset-react/">
@ -211,7 +198,7 @@
</li>
<li class="chapter " data-level="1.7.3" data-path="presets/neutrino-preset-node/">
<li class="chapter " data-level="1.6.3" data-path="presets/neutrino-preset-node/">
<a href="presets/neutrino-preset-node/">
@ -224,7 +211,7 @@
</li>
<li class="chapter " data-level="1.7.4" data-path="presets/neutrino-preset-airbnb-base/">
<li class="chapter " data-level="1.6.4" data-path="presets/neutrino-preset-airbnb-base/">
<a href="presets/neutrino-preset-airbnb-base/">
@ -237,7 +224,7 @@
</li>
<li class="chapter " data-level="1.7.5" data-path="presets/neutrino-preset-karma/">
<li class="chapter " data-level="1.6.5" data-path="presets/neutrino-preset-karma/">
<a href="presets/neutrino-preset-karma/">
@ -250,7 +237,7 @@
</li>
<li class="chapter " data-level="1.7.6" data-path="presets/neutrino-preset-mocha/">
<li class="chapter " data-level="1.6.6" data-path="presets/neutrino-preset-mocha/">
<a href="presets/neutrino-preset-mocha/">
@ -263,7 +250,7 @@
</li>
<li class="chapter " data-level="1.7.7" data-path="presets/neutrino-preset-jest/">
<li class="chapter " data-level="1.6.7" data-path="presets/neutrino-preset-jest/">
<a href="presets/neutrino-preset-jest/">
@ -276,7 +263,7 @@
</li>
<li class="chapter " data-level="1.7.8" data-path="presets/community-presets.html">
<li class="chapter " data-level="1.6.8" data-path="presets/community-presets.html">
<a href="presets/community-presets.html">
@ -294,7 +281,7 @@
</li>
<li class="chapter " data-level="1.8" data-path="customization/">
<li class="chapter " data-level="1.7" data-path="customization/">
<a href="customization/">
@ -308,7 +295,7 @@
<ul class="articles">
<li class="chapter " data-level="1.8.1" data-path="customization/simple.html">
<li class="chapter " data-level="1.7.1" data-path="customization/simple.html">
<a href="customization/simple.html">
@ -321,7 +308,7 @@
</li>
<li class="chapter " data-level="1.8.2" data-path="customization/advanced.html">
<li class="chapter " data-level="1.7.2" data-path="customization/advanced.html">
<a href="customization/advanced.html">
@ -339,7 +326,7 @@
</li>
<li class="chapter active" data-level="1.9" data-path="creating-presets.html">
<li class="chapter active" data-level="1.8" data-path="creating-presets.html">
<a href="creating-presets.html">
@ -353,9 +340,9 @@
<ul class="articles">
<li class="chapter " data-level="1.9.1" data-path="presets/neutrino-lint-base/README.md">
<li class="chapter " data-level="1.8.1" data-path="presets/neutrino-lint-base/">
<span>
<a href="presets/neutrino-lint-base/">
Creating linting presets
@ -371,7 +358,7 @@
</li>
<li class="chapter " data-level="1.10" data-path="learning-resources.html">
<li class="chapter " data-level="1.9" data-path="learning-resources.html">
<a href="learning-resources.html">
@ -384,7 +371,7 @@
</li>
<li class="chapter " data-level="1.11" data-path="api/">
<li class="chapter " data-level="1.10" data-path="api/">
<a href="api/">
@ -397,7 +384,7 @@
</li>
<li class="chapter " data-level="1.12" data-path="cli/">
<li class="chapter " data-level="1.11" data-path="cli/">
<a href="cli/">
@ -410,33 +397,7 @@
</li>
<li class="chapter " data-level="1.13" data-path="upgrading-neutrino.html">
<a href="upgrading-neutrino.html">
Upgrading from v4 to v5
</a>
</li>
<li class="chapter " data-level="1.14" >
<a target="_blank" href="https://github.com/mozilla-neutrino/neutrino-dev/tree/docs-v4/docs">
v4 Documentation
</a>
</li>
<li class="chapter " data-level="1.15" data-path="contributing/">
<li class="chapter " data-level="1.12" data-path="contributing/">
<a href="contributing/">
@ -450,7 +411,7 @@
<ul class="articles">
<li class="chapter " data-level="1.15.1" data-path="contributing/development.html">
<li class="chapter " data-level="1.12.1" data-path="contributing/development.html">
<a href="contributing/development.html">
@ -463,7 +424,7 @@
</li>
<li class="chapter " data-level="1.15.2" data-path="contributing/code-of-conduct.html">
<li class="chapter " data-level="1.12.2" data-path="contributing/code-of-conduct.html">
<a href="contributing/code-of-conduct.html">
@ -536,29 +497,26 @@ and dependencies necessary to accomplish those use cases:</p>
<li>You want to support building for more platforms than existing presets support.</li>
</ul>
<h2 id="getting-started">Getting Started</h2>
<p>Neutrino presets are Node.js modules or packages that export a function which accepts a Neutrino instance. We call these
functions &quot;Neutrino middleware&quot;, as they sit between the middle of Neutrino and Webpack, modifying a configuration with
each subsequent middleware call. You can use the Neutrino instance provided to the middleware function to modify
the configuration, provide your own configuration, expose custom options for your preset, listen for build
<p>Neutrino presets are Node.js modules or packages that export a function which accepts a Neutrino instance. You can use
this instance to modify the configuration, provide your own, expose custom options for your preset, listen for build
events, and execute functionality.</p>
<p>Neutrino presets are just Neutrino middleware that encapsulate a specific project need. At a bare minimum, let&apos;s start
by exporting a middleware function for an empty Neutrino preset:</p>
<p>At a bare minimum, let&apos;s start with our package boilerplate for an empty Neutrino preset:</p>
<pre class="language-"><code class="lang-js">module<span class="token punctuation">.</span>exports <span class="token operator">=</span> neutrino <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
<span class="token comment" spellcheck="true">// ...</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
<p>If you are using Babel or Neutrino to build your preset (very meta) with ES modules:</p>
<p>If you are using Babel or Neutrino to build your preset (so meta) with ES modules:</p>
<pre class="language-"><code class="lang-js"><span class="token keyword">export</span> <span class="token keyword">default</span> neutrino <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
<span class="token comment" spellcheck="true">// ...</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
<h2 id="configuring">Configuring</h2>
<p>The Neutrino instance provided to your middleware function has a <code>config</code> property that is an instance of
<a href="https://github.com/mozilla-neutrino/webpack-chain" target="_blank">webpack-chain</a>. We won&apos;t go in-depth of all the configuration
possibilities here, but encourage you to check out the documentation for webpack-chain for instructions on your
particular use cases.</p>
<p>This <code>neutrino.config</code> is an accumulation of all configuration set up to this moment. All Neutrino presets and
middleware interacts with and makes changes through this config, which is all available to your preset.</p>
<p>The Neutrino instance provided to your custom configurator has a <code>config</code> property that is an instance of
<a href="https://github.com/mozilla-neutrino/webpack-chain/tree/v1.4.3" target="_blank">webpack-chain</a>. We won&apos;t go in-depth of all the configuration
possibilities here, but encourage you to check out the documentation for webpack-chain for instruction on your
particular use case.</p>
<p>This <code>neutrino.config</code> is an accumulation of all configuration set up to this moment. Every Neutrino preset interacts
with and makes changes through this config, which is all available to your preset.</p>
<h2 id="events">Events</h2>
<p>Neutrino exposes events for various stages of the build process your preset can hook into <strong>if necessary</strong>.</p>
<ul>
@ -575,17 +533,17 @@ middleware interacts with and makes changes through this config, which is all av
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
<h2 id="including-and-merging-other-presets">Including and merging other presets</h2>
<p>If your preset depends on other Neutrino presets and/or middleware, or you are creating a preset that is a combination
of multiple presets and/or middleware, you can install them as dependencies and simply have Neutrino use them as
middleware. When users install your preset, they will bring along these dependencies defined with your package without
needing to to include your extended presets in their own commands.</p>
<p>If your preset depends on other Neutrino presets, or you are creating a preset that is a combination of multiple
presets, you can install them as dependencies and simply call them from your preset, providing them with your Neutrino
instance. When users install your preset, they will bring along your dependencies defined with your package without
needing also to include your extended presets in their own commands.</p>
<p><em>Example: Define a Neutrino preset which combines Node.js and Mocha presets.</em></p>
<pre class="language-"><code class="lang-js"><span class="token keyword">const</span> node <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&apos;neutrino-preset-node&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">const</span> mocha <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&apos;neutrino-preset-mocha&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
module<span class="token punctuation">.</span>exports <span class="token operator">=</span> neutrino <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
neutrino<span class="token punctuation">.</span><span class="token function">use</span><span class="token punctuation">(</span>node<span class="token punctuation">)</span><span class="token punctuation">;</span>
neutrino<span class="token punctuation">.</span><span class="token function">use</span><span class="token punctuation">(</span>mocha<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token function">node</span><span class="token punctuation">(</span>neutrino<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token function">mocha</span><span class="token punctuation">(</span>neutrino<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">// neutrino.config now contains the accumulation of configuration from</span>
<span class="token comment" spellcheck="true">// the Node.js and Mocha presets</span>
@ -595,8 +553,6 @@ module<span class="token punctuation">.</span>exports <span class="token operato
<p>Let&apos;s create a preset from scratch which allows users to augment their project with
<a href="http://standardjs.com/" target="_blank">JavaScript Standard Style</a>. For this sample preset we are using
<a href="https://yarnpkg.com" target="_blank">Yarn</a> for managing dependencies, but you may use the npm client if you desire.</p>
<p><strong>Important: this preset is not meant to be functional; rather it is used to demonstrate the concepts of creating
presets.</strong></p>
<pre class="language-"><code class="lang-bash"><span class="token comment" spellcheck="true"># Create a new directory for your project and change into it:</span>
<span class="token function">mkdir</span> neutrino-preset-standard-style <span class="token operator">&amp;&amp;</span> <span class="token function">cd</span> neutrino-preset-standard-style
@ -617,26 +573,22 @@ module<span class="token punctuation">.</span>exports <span class="token operato
<span class="token punctuation">.</span><span class="token function">rule</span><span class="token punctuation">(</span><span class="token string">&apos;lint&apos;</span><span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">pre</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">test</span><span class="token punctuation">(</span><span class="token regex">/\.jsx?$/</span><span class="token punctuation">)</span>
<span class="token punctuation">.</span>include
<span class="token punctuation">.</span><span class="token function">add</span><span class="token punctuation">(</span>neutrino<span class="token punctuation">.</span>options<span class="token punctuation">.</span>source<span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">end</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">use</span><span class="token punctuation">(</span><span class="token string">&apos;standard&apos;</span><span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">loader</span><span class="token punctuation">(</span>require<span class="token punctuation">.</span><span class="token function">resolve</span><span class="token punctuation">(</span><span class="token string">&apos;standard-loader&apos;</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">options</span><span class="token punctuation">(</span><span class="token punctuation">{</span> snazzy<span class="token punctuation">:</span> <span class="token boolean">false</span> <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">.</span><span class="token function">include</span><span class="token punctuation">(</span>path<span class="token punctuation">.</span><span class="token function">join</span><span class="token punctuation">(</span>process<span class="token punctuation">.</span><span class="token function">cwd</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token string">&apos;src&apos;</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">loader</span><span class="token punctuation">(</span><span class="token string">&apos;standard&apos;</span><span class="token punctuation">,</span> require<span class="token punctuation">.</span><span class="token function">resolve</span><span class="token punctuation">(</span><span class="token string">&apos;standard-loader&apos;</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>
snazzy<span class="token punctuation">:</span> <span class="token boolean">false</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
<h2 id="custom-data">Custom Data</h2>
<p>If you want to expose custom options for your preset that are not appropriate to be stored in the Neutrino config,
there is a <code>neutrino.options</code> object namespace you can attach to. This way you can document to others how they can
go about affecting how your preset works. In addition, you may also instruct users of your preset to override these
options in either their package.json at <code>neutrino.options</code> or using <code>neutrino.options</code> in their advanced overrides.
You can then merge these options back with your defaults at <code>neutrino.options</code> when needed.</p>
there is a <code>neutrino.custom</code> object namespace you can attach to. This way you can document to others how they can
go about affecting how your preset works.</p>
<p><em>Example:</em></p>
<pre class="language-"><code class="lang-js">module<span class="token punctuation">.</span>exports <span class="token operator">=</span> neutrino <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
neutrino<span class="token punctuation">.</span>options<span class="token punctuation">.</span>standardStyle <span class="token operator">=</span> Object<span class="token punctuation">.</span><span class="token function">assign</span><span class="token punctuation">(</span><span class="token punctuation">{</span>
<pre class="language-"><code class="lang-js">module<span class="token punctuation">.</span>exports <span class="token operator">=</span> neutrino <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
neutrino<span class="token punctuation">.</span>custom<span class="token punctuation">.</span>standardStyle <span class="token operator">=</span> <span class="token punctuation">{</span>
quiet<span class="token punctuation">:</span> <span class="token boolean">false</span><span class="token punctuation">,</span>
logLevel<span class="token punctuation">:</span> <span class="token string">&apos;warn&apos;</span>
<span class="token punctuation">}</span><span class="token punctuation">,</span> neutrino<span class="token punctuation">.</span>options<span class="token punctuation">.</span>standardStyle<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">// ...</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
@ -644,95 +596,7 @@ You can then merge these options back with your defaults at <code>neutrino.optio
<h2 id="working-with-paths">Working with paths</h2>
<p>When working with paths, remember that your preset will be running in the context of a project. You should take care
to define application paths by referencing the current working directory with <code>process.cwd()</code>. For example, if you
wanted to work with the project&apos;s &quot;src&quot; directory, you would merge the path via <code>path.join(process.cwd(), &apos;src&apos;)</code>.</p>
<p>Neutrino provides a number of paths that have been defaulted through <code>neutrino.options</code> or configured by the user.
Please consider using these paths for your preset so they play nice with others.</p>
<h3 id="optionsroot"><code>options.root</code></h3>
<p>Set the base directory which Neutrino middleware and presets operate on. Typically this is the project directory where
the package.json would be located. If the option is not set, Neutrino defaults it to <code>process.cwd()</code>. If a relative
path is specified, it will be resolved relative to <code>process.cwd()</code>; absolute paths will be used as-is.</p>
<pre class="language-"><code class="lang-js">module<span class="token punctuation">.</span>exports <span class="token operator">=</span> neutrino <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
<span class="token comment" spellcheck="true">// if not specified, defaults to process.cwd()</span>
neutrino<span class="token punctuation">.</span>options<span class="token punctuation">.</span>root<span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">// relative, resolves to process.cwd() + ./website</span>
neutrino<span class="token punctuation">.</span>options<span class="token punctuation">.</span>root <span class="token operator">=</span> <span class="token string">&apos;./website&apos;</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">// absolute</span>
neutrino<span class="token punctuation">.</span>options<span class="token punctuation">.</span>root <span class="token operator">=</span> <span class="token string">&apos;/code/website&apos;</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
<h3 id="optionssource"><code>options.source</code></h3>
<p>Set the directory which contains the application source code. If the option is not set, Neutrino defaults it to <code>src</code>.
If a relative path is specified, it will be resolved relative to <code>options.root</code>; absolute paths will be used as-is.</p>
<pre class="language-"><code class="lang-js">module<span class="token punctuation">.</span>exports <span class="token operator">=</span> neutrino <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
<span class="token comment" spellcheck="true">// if not specified, defaults to options.root + src</span>
neutrino<span class="token punctuation">.</span>options<span class="token punctuation">.</span>source<span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">// relative, resolves to options.root + ./lib</span>
neutrino<span class="token punctuation">.</span>options<span class="token punctuation">.</span>source <span class="token operator">=</span> <span class="token string">&apos;./lib&apos;</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">// absolute</span>
neutrino<span class="token punctuation">.</span>options<span class="token punctuation">.</span>source <span class="token operator">=</span> <span class="token string">&apos;/code/website/lib&apos;</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
<h3 id="optionsoutput"><code>options.output</code></h3>
<p>Set the directory which will be the output of built assets. If the option is not set, Neutrino defaults it to <code>build</code>.
If a relative path is specified, it will be resolved relative to <code>options.root</code>; absolute paths will be used as-is.</p>
<pre class="language-"><code class="lang-js">module<span class="token punctuation">.</span>exports <span class="token operator">=</span> neutrino <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
<span class="token comment" spellcheck="true">// if not specified, defaults to options.root + build</span>
neutrino<span class="token punctuation">.</span>options<span class="token punctuation">.</span>output<span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">// relative, resolves to options.root + ./dist</span>
neutrino<span class="token punctuation">.</span>options<span class="token punctuation">.</span>output <span class="token operator">=</span> <span class="token string">&apos;./dist&apos;</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">// absolute</span>
neutrino<span class="token punctuation">.</span>options<span class="token punctuation">.</span>output <span class="token operator">=</span> <span class="token string">&apos;/code/website/dist&apos;</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
<h3 id="optionstests"><code>options.tests</code></h3>
<p>Set the directory that contains test files. If the option is not set, Neutrino defaults it to <code>test</code>.
If a relative path is specified, it will be resolved relative to <code>options.root</code>; absolute paths will be used as-is.</p>
<pre class="language-"><code class="lang-js">module<span class="token punctuation">.</span>exports <span class="token operator">=</span> neutrino <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
<span class="token comment" spellcheck="true">// if not specified, defaults to options.root + test</span>
neutrino<span class="token punctuation">.</span>options<span class="token punctuation">.</span>tests<span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">// relative, resolves to options.root + ./testing</span>
neutrino<span class="token punctuation">.</span>options<span class="token punctuation">.</span>tests <span class="token operator">=</span> <span class="token string">&apos;./testing&apos;</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">// absolute</span>
neutrino<span class="token punctuation">.</span>options<span class="token punctuation">.</span>tests <span class="token operator">=</span> <span class="token string">&apos;/code/website/testing&apos;</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
<h3 id="optionsentry"><code>options.entry</code></h3>
<p>Set the main entry point for the application. If the option is not set, Neutrino defaults it to <code>index.js</code>.
If a relative path is specified, it will be resolved relative to <code>options.source</code>; absolute paths will be used as-is.</p>
<pre class="language-"><code class="lang-js">module<span class="token punctuation">.</span>exports <span class="token operator">=</span> neutrino <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
<span class="token comment" spellcheck="true">// if not specified, defaults to options.source + index.js</span>
neutrino<span class="token punctuation">.</span>options<span class="token punctuation">.</span>entry<span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">// relative, resolves to options.source + ./entry.js</span>
neutrino<span class="token punctuation">.</span>options<span class="token punctuation">.</span>entry <span class="token operator">=</span> <span class="token string">&apos;./entry.js&apos;</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">// absolute</span>
neutrino<span class="token punctuation">.</span>options<span class="token punctuation">.</span>entry <span class="token operator">=</span> <span class="token string">&apos;/code/website/lib/entry.js&apos;</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
<h3 id="optionsnodemodules"><code>options.node_modules</code></h3>
<p>Set the directory which contains the Node.js modules of the project. If the option is not set, Neutrino defaults it to
<code>node_modules</code>. If a relative path is specified, it will be resolved relative to <code>options.root</code>; absolute paths will be
used as-is.</p>
<pre class="language-"><code class="lang-js">module<span class="token punctuation">.</span>exports <span class="token operator">=</span> neutrino <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
<span class="token comment" spellcheck="true">// if not specified, defaults to options.root + node_modules</span>
neutrino<span class="token punctuation">.</span>options<span class="token punctuation">.</span>node_modules<span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">// relative, resolves to options.root + ./modules</span>
neutrino<span class="token punctuation">.</span>options<span class="token punctuation">.</span>node_modules <span class="token operator">=</span> <span class="token string">&apos;./modules&apos;</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">// absolute</span>
neutrino<span class="token punctuation">.</span>options<span class="token punctuation">.</span>node_modules <span class="token operator">=</span> <span class="token string">&apos;/code/website/modules&apos;</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
wanted to work with the project&apos;s &quot;src&quot; directory, you would merge the path via <code>path.join(process.cwd(), &apos;src&apos;)</code></p>
<h2 id="loader-and-babel-modules">Loader and Babel modules</h2>
<p>Because of package conflicts or unknown layout of a project&apos;s <code>node_modules</code> directory, it is usually safer to
define loaders, Babel plugins, and Babel presets to Webpack absolutely than by name. In our sample preset above, while
@ -744,8 +608,8 @@ name of the module off to be required by Webpack or Babel, instead pass the path
<h2 id="publishing">Publishing</h2>
<p>When your preset is ready to be used by others, feel free to publish and distribute! By putting your preset on npm,
GitHub, or another location, you can share the hard work put into abstracting away configuration and save everyone
in the community time and effort. As long as the Neutrino CLI or another preset can require your preset, it puts no
restrictions on where you want to host it.</p>
in the community time and effort. As long as Neutrino can require your preset, it puts no restrictions on where
you want to host it.</p>
</section>
@ -778,7 +642,7 @@ restrictions on where you want to host it.</p>
</a>
<a href="presets/neutrino-lint-base/README.md" class="navigation navigation-next " aria-label="Next page: Creating linting presets">
<a href="presets/neutrino-lint-base/" class="navigation navigation-next " aria-label="Next page: Creating linting presets">
<i class="fa fa-angle-right"></i>
</a>
@ -789,7 +653,7 @@ restrictions on where you want to host it.</p>
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"Creating presets","level":"1.9","depth":1,"next":{"title":"Creating linting presets","level":"1.9.1","depth":2,"path":"presets/neutrino-lint-base/README.md","ref":"./presets/neutrino-lint-base/README.md","articles":[]},"previous":{"title":"Advanced","level":"1.8.2","depth":2,"path":"customization/advanced.md","ref":"./customization/advanced.md","articles":[]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"creating-presets.md","mtime":"2017-03-15T13:20:51.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-15T14:46:02.288Z"},"basePath":".","book":{"language":""}});
gitbook.page.hasChanged({"page":{"title":"Creating presets","level":"1.8","depth":1,"next":{"title":"Creating linting presets","level":"1.8.1","depth":2,"path":"presets/neutrino-lint-base/README.md","ref":"presets/neutrino-lint-base/README.md","articles":[]},"previous":{"title":"Advanced","level":"1.7.2","depth":2,"path":"customization/advanced.md","ref":"customization/advanced.md","articles":[]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"creating-presets.md","mtime":"2017-03-06T16:54:11.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-06T17:07:12.452Z"},"basePath":".","book":{"language":""}});
});
</script>
</div>

233
customization/advanced.html

@ -158,20 +158,7 @@
</li>
<li class="chapter " data-level="1.6" data-path="../middleware/">
<a href="../middleware/">
Middleware
</a>
</li>
<li class="chapter " data-level="1.7" data-path="../presets/">
<li class="chapter " data-level="1.6" data-path="../presets/">
<a href="../presets/">
@ -185,7 +172,7 @@
<ul class="articles">
<li class="chapter " data-level="1.7.1" data-path="../presets/neutrino-preset-web/">
<li class="chapter " data-level="1.6.1" data-path="../presets/neutrino-preset-web/">
<a href="../presets/neutrino-preset-web/">
@ -198,7 +185,7 @@
</li>
<li class="chapter " data-level="1.7.2" data-path="../presets/neutrino-preset-react/">
<li class="chapter " data-level="1.6.2" data-path="../presets/neutrino-preset-react/">
<a href="../presets/neutrino-preset-react/">
@ -211,7 +198,7 @@
</li>
<li class="chapter " data-level="1.7.3" data-path="../presets/neutrino-preset-node/">
<li class="chapter " data-level="1.6.3" data-path="../presets/neutrino-preset-node/">
<a href="../presets/neutrino-preset-node/">
@ -224,7 +211,7 @@
</li>
<li class="chapter " data-level="1.7.4" data-path="../presets/neutrino-preset-airbnb-base/">
<li class="chapter " data-level="1.6.4" data-path="../presets/neutrino-preset-airbnb-base/">
<a href="../presets/neutrino-preset-airbnb-base/">
@ -237,7 +224,7 @@
</li>
<li class="chapter " data-level="1.7.5" data-path="../presets/neutrino-preset-karma/">
<li class="chapter " data-level="1.6.5" data-path="../presets/neutrino-preset-karma/">
<a href="../presets/neutrino-preset-karma/">
@ -250,7 +237,7 @@
</li>
<li class="chapter " data-level="1.7.6" data-path="../presets/neutrino-preset-mocha/">
<li class="chapter " data-level="1.6.6" data-path="../presets/neutrino-preset-mocha/">
<a href="../presets/neutrino-preset-mocha/">
@ -263,7 +250,7 @@
</li>
<li class="chapter " data-level="1.7.7" data-path="../presets/neutrino-preset-jest/">
<li class="chapter " data-level="1.6.7" data-path="../presets/neutrino-preset-jest/">
<a href="../presets/neutrino-preset-jest/">
@ -276,7 +263,7 @@
</li>
<li class="chapter " data-level="1.7.8" data-path="../presets/community-presets.html">
<li class="chapter " data-level="1.6.8" data-path="../presets/community-presets.html">
<a href="../presets/community-presets.html">
@ -294,7 +281,7 @@
</li>
<li class="chapter " data-level="1.8" data-path="./">
<li class="chapter " data-level="1.7" data-path="./">
<a href="./">
@ -308,7 +295,7 @@
<ul class="articles">
<li class="chapter " data-level="1.8.1" data-path="simple.html">
<li class="chapter " data-level="1.7.1" data-path="simple.html">
<a href="simple.html">
@ -321,7 +308,7 @@
</li>
<li class="chapter active" data-level="1.8.2" data-path="advanced.html">
<li class="chapter active" data-level="1.7.2" data-path="advanced.html">
<a href="advanced.html">
@ -339,7 +326,7 @@
</li>
<li class="chapter " data-level="1.9" data-path="../creating-presets.html">
<li class="chapter " data-level="1.8" data-path="../creating-presets.html">
<a href="../creating-presets.html">
@ -353,9 +340,9 @@
<ul class="articles">
<li class="chapter " data-level="1.9.1" data-path="../presets/neutrino-lint-base/README.md">
<li class="chapter " data-level="1.8.1" data-path="../presets/neutrino-lint-base/">
<span>
<a href="../presets/neutrino-lint-base/">
Creating linting presets
@ -371,7 +358,7 @@
</li>
<li class="chapter " data-level="1.10" data-path="../learning-resources.html">
<li class="chapter " data-level="1.9" data-path="../learning-resources.html">
<a href="../learning-resources.html">
@ -384,7 +371,7 @@
</li>
<li class="chapter " data-level="1.11" data-path="../api/">
<li class="chapter " data-level="1.10" data-path="../api/">
<a href="../api/">
@ -397,7 +384,7 @@
</li>
<li class="chapter " data-level="1.12" data-path="../cli/">
<li class="chapter " data-level="1.11" data-path="../cli/">
<a href="../cli/">
@ -410,33 +397,7 @@
</li>
<li class="chapter " data-level="1.13" data-path="../upgrading-neutrino.html">
<a href="../upgrading-neutrino.html">
Upgrading from v4 to v5
</a>
</li>
<li class="chapter " data-level="1.14" >
<a target="_blank" href="https://github.com/mozilla-neutrino/neutrino-dev/tree/docs-v4/docs">
v4 Documentation
</a>
</li>
<li class="chapter " data-level="1.15" data-path="../contributing/">
<li class="chapter " data-level="1.12" data-path="../contributing/">
<a href="../contributing/">
@ -450,7 +411,7 @@
<ul class="articles">
<li class="chapter " data-level="1.15.1" data-path="../contributing/development.html">
<li class="chapter " data-level="1.12.1" data-path="../contributing/development.html">
<a href="../contributing/development.html">
@ -463,7 +424,7 @@
</li>
<li class="chapter " data-level="1.15.2" data-path="../contributing/code-of-conduct.html">
<li class="chapter " data-level="1.12.2" data-path="../contributing/code-of-conduct.html">
<a href="../contributing/code-of-conduct.html">
@ -531,29 +492,21 @@
to the way your Neutrino preset is building your project. If you need more customization than can be afforded by
augmenting your project&apos;s package.json, consider using this advanced configuration guide to modify your build as
needed.</p>
<h2 id="creating-a-project-specific-override">Creating a project-specific override</h2>
<p>Neutrino configurations are backed by <a href="https://github.com/mozilla-neutrino/webpack-chain" target="_blank">webpack-chain</a>, a library for
<h2 id="creating-a-project-specific-preset">Creating a project-specific preset</h2>
<p>Neutrino configurations are backed by <a href="https://github.com/mozilla-neutrino/webpack-chain/tree/v1.4.3" target="_blank">webpack-chain</a>, a library for
making modifications to a Webpack configuration using a fluent or chained API. When your project needs more advanced
build overrides, you will be interacting with this API in order to perform modifications.</p>
<p>First, we need to create a project-specific override to make these changes. This can either be a JS file or a directory
<p>First, we need to create a project-specific preset to make these changes. This can either be a JS file or a directory
with an <code>index.js</code> file. Since Neutrino uses Node.js and Webpack for interacting with presets, it is helpful to
understand that this is a Node.js module. By exporting a middleware function from your module, you will be provided with
a Neutrino instance for modifying the build. Let&apos;s create a file called <code>override.js</code> in the root of our example
project:</p>
<pre class="language-"><code class="lang-js"><span class="token comment" spellcheck="true">// override.js</span>
understand that this is a Node.js module. By exporting a function from your module, you will be provided with a Neutrino
instance for modifying the build. Let&apos;s create a file called <code>neutrino-custom.js</code> in the root of our example project:</p>
<pre class="language-"><code class="lang-js"><span class="token comment" spellcheck="true">// neutrino-custom.js</span>
module<span class="token punctuation">.</span>exports <span class="token operator">=</span> neutrino <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
<span class="token comment" spellcheck="true">// ...</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
<p>The signature of this function is what we call &quot;Neutrino middleware&quot;. If you&apos;re familiar with middleware from the
Express/connect world, this works similarly. When using Express middleware, you provide a function to Express which
receives arguments to modify a request or response along its lifecycle. There can be a number of middleware functions
that Express can load, each one potentially modifying a request or response in succession.</p>
<p>When you customize Neutrino with an override, you export a Neutrino middleware function, except this is typically used
to override Neutrino&apos;s configuration. Every preset or middleware that Neutrino has loaded follows this same middleware
pipeline.</p>
<p>At the moment our custom override isn&apos;t doing anything, but it does get us far enough to be able to tell Neutrino
to use it for additional configuration. Modify your package.json and add <code>override.js</code> as an additional preset.</p>
<p>At the moment our custom configurator isn&apos;t doing anything, but it does get us far enough to be able to tell Neutrino
to use it for additional configuration. Modify your package.json and add <code>neutrino-custom.js</code> as an additional preset.</p>
<p><em>Note: Neutrino will attempt to load this module relative to the current working directory, which should be the root of
your project.</em></p>
<pre class="language-"><code class="lang-json"><span class="token punctuation">{</span>
@ -561,7 +514,7 @@ your project.</em></p>
<span class="token property">&quot;presets&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span>
<span class="token string">&quot;neutrino-preset-react&quot;</span><span class="token punctuation">,</span>
<span class="token string">&quot;neutrino-preset-karma&quot;</span><span class="token punctuation">,</span>
<span class="token string">&quot;override.js&quot;</span>
<span class="token string">&quot;neutrino-custom.js&quot;</span>
<span class="token punctuation">]</span>
<span class="token punctuation">}</span><span class="token punctuation">,</span>
<span class="token property">&quot;scripts&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
@ -569,113 +522,15 @@ your project.</em></p>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
<p>Other than actually changing the build configuration or Neutrino options, that is all the setup necessary for Neutrino
to pick up your custom changes.</p>
<h2 id="overriding-neutrino-options">Overriding Neutrino options</h2>
<p>Neutrino has a number of useful options for customizing its behavior, as well as the behavior of presets and middleware.
You can override these options using an object at <code>neutrino.options</code>.</p>
<p><strong>Important! Some of these options are used by presets and middleware to determine their path locations for building.
Making changes to these in advanced configuration will usually mean needing to set Neutrino options before other presets
are loaded, and overriding build configuration after the presets have loaded. Consider using
<a href="simple.html">simple customization</a> for setting Neutrino options and preset/middleware-specific options.</strong></p>
<h3 id="optionsroot"><code>options.root</code></h3>
<p>Set the base directory which Neutrino middleware and presets operate on. Typically this is the project directory where
the package.json would be located. If the option is not set, Neutrino defaults it to <code>process.cwd()</code>. If a relative
path is specified, it will be resolved relative to <code>process.cwd()</code>; absolute paths will be used as-is.</p>
<pre class="language-"><code class="lang-js">module<span class="token punctuation">.</span>exports <span class="token operator">=</span> neutrino <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
<span class="token comment" spellcheck="true">// if not specified, defaults to process.cwd()</span>
neutrino<span class="token punctuation">.</span>options<span class="token punctuation">.</span>root<span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">// relative, resolves to process.cwd() + ./website</span>
neutrino<span class="token punctuation">.</span>options<span class="token punctuation">.</span>root <span class="token operator">=</span> <span class="token string">&apos;./website&apos;</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">// absolute</span>
neutrino<span class="token punctuation">.</span>options<span class="token punctuation">.</span>root <span class="token operator">=</span> <span class="token string">&apos;/code/website&apos;</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
<h3 id="optionssource"><code>options.source</code></h3>
<p>Set the directory which contains the application source code. If the option is not set, Neutrino defaults it to <code>src</code>.
If a relative path is specified, it will be resolved relative to <code>options.root</code>; absolute paths will be used as-is.</p>
<pre class="language-"><code class="lang-js">module<span class="token punctuation">.</span>exports <span class="token operator">=</span> neutrino <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
<span class="token comment" spellcheck="true">// if not specified, defaults to options.root + src</span>
neutrino<span class="token punctuation">.</span>options<span class="token punctuation">.</span>source<span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">// relative, resolves to options.root + ./lib</span>
neutrino<span class="token punctuation">.</span>options<span class="token punctuation">.</span>source <span class="token operator">=</span> <span class="token string">&apos;./lib&apos;</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">// absolute</span>
neutrino<span class="token punctuation">.</span>options<span class="token punctuation">.</span>source <span class="token operator">=</span> <span class="token string">&apos;/code/website/lib&apos;</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
<h3 id="optionsoutput"><code>options.output</code></h3>
<p>Set the directory which will be the output of built assets. If the option is not set, Neutrino defaults it to <code>build</code>.
If a relative path is specified, it will be resolved relative to <code>options.root</code>; absolute paths will be used as-is.</p>
<pre class="language-"><code class="lang-js">module<span class="token punctuation">.</span>exports <span class="token operator">=</span> neutrino <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
<span class="token comment" spellcheck="true">// if not specified, defaults to options.root + build</span>
neutrino<span class="token punctuation">.</span>options<span class="token punctuation">.</span>output<span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">// relative, resolves to options.root + ./dist</span>
neutrino<span class="token punctuation">.</span>options<span class="token punctuation">.</span>output <span class="token operator">=</span> <span class="token string">&apos;./dist&apos;</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">// absolute</span>
neutrino<span class="token punctuation">.</span>options<span class="token punctuation">.</span>output <span class="token operator">=</span> <span class="token string">&apos;/code/website/dist&apos;</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
<h3 id="optionstests"><code>options.tests</code></h3>
<p>Set the directory that contains test files. If the option is not set, Neutrino defaults it to <code>test</code>.
If a relative path is specified, it will be resolved relative to <code>options.root</code>; absolute paths will be used as-is.</p>
<pre class="language-"><code class="lang-js">module<span class="token punctuation">.</span>exports <span class="token operator">=</span> neutrino <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
<span class="token comment" spellcheck="true">// if not specified, defaults to options.root + test</span>
neutrino<span class="token punctuation">.</span>options<span class="token punctuation">.</span>tests<span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">// relative, resolves to options.root + ./testing</span>
neutrino<span class="token punctuation">.</span>options<span class="token punctuation">.</span>tests <span class="token operator">=</span> <span class="token string">&apos;./testing&apos;</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">// absolute</span>
neutrino<span class="token punctuation">.</span>options<span class="token punctuation">.</span>tests <span class="token operator">=</span> <span class="token string">&apos;/code/website/testing&apos;</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
<h3 id="optionsentry"><code>options.entry</code></h3>
<p>Set the main entry point for the application. If the option is not set, Neutrino defaults it to <code>index.js</code>.
If a relative path is specified, it will be resolved relative to <code>options.source</code>; absolute paths will be used as-is.</p>
<pre class="language-"><code class="lang-js">module<span class="token punctuation">.</span>exports <span class="token operator">=</span> neutrino <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
<span class="token comment" spellcheck="true">// if not specified, defaults to options.source + index.js</span>
neutrino<span class="token punctuation">.</span>options<span class="token punctuation">.</span>entry<span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">// relative, resolves to options.source + ./entry.js</span>
neutrino<span class="token punctuation">.</span>options<span class="token punctuation">.</span>entry <span class="token operator">=</span> <span class="token string">&apos;./entry.js&apos;</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">// absolute</span>
neutrino<span class="token punctuation">.</span>options<span class="token punctuation">.</span>entry <span class="token operator">=</span> <span class="token string">&apos;/code/website/lib/entry.js&apos;</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
<h3 id="optionsnodemodules"><code>options.node_modules</code></h3>
<p>Set the directory which contains the Node.js modules of the project. If the option is not set, Neutrino defaults it to
<code>node_modules</code>. If a relative path is specified, it will be resolved relative to <code>options.root</code>; absolute paths will be
used as-is.</p>
<pre class="language-"><code class="lang-js">module<span class="token punctuation">.</span>exports <span class="token operator">=</span> neutrino <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
<span class="token comment" spellcheck="true">// if not specified, defaults to options.root + node_modules</span>
neutrino<span class="token punctuation">.</span>options<span class="token punctuation">.</span>node_modules<span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">// relative, resolves to options.root + ./modules</span>
neutrino<span class="token punctuation">.</span>options<span class="token punctuation">.</span>node_modules <span class="token operator">=</span> <span class="token string">&apos;./modules&apos;</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">// absolute</span>
neutrino<span class="token punctuation">.</span>options<span class="token punctuation">.</span>node_modules <span class="token operator">=</span> <span class="token string">&apos;/code/website/modules&apos;</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
<h3 id="middleware-or-preset-options">Middleware or preset options</h3>
<p>Some middleware and presets also have their own custom options. Consult the documentation for the package for specific
details on its customization.</p>
<h2 id="overriding-build-configuration">Overriding build configuration</h2>
<p>Other than actually changing the config, that is all the setup necessary for Neutrino to pick up your custom changes.</p>
<h2 id="configuring">Configuring</h2>
<p>The Neutrino instance provided to your custom configurator has a <code>config</code> property that is an instance of
<a href="https://github.com/mozilla-neutrino/webpack-chain" target="_blank">webpack-chain</a>. We won&apos;t go in-depth of all the configuration
<a href="https://github.com/mozilla-neutrino/webpack-chain/tree/v1.4.3" target="_blank">webpack-chain</a>. We won&apos;t go in-depth of all the configuration
possibilities here, but encourage you to check out the documentation for webpack-chain for instruction on your
particular use case. Just know that you can use webpack-chain to modify any part of the underlying Webpack configuration
using its API.</p>
<p>This <code>neutrino.config</code> is an accumulation of all configuration up to this moment. All Neutrino middleware and presets
interact with and make changes through this config, which is all available to you. For example, if you are using the
presets <code>neutrino-preset-react</code> and <code>neutrino-preset-karma</code>, any config set can be extended, manipulated, or removed.</p>
particular use case.</p>
<p>This <code>neutrino.config</code> is an accumulation of all configuration set up to this moment. Every Neutrino preset interacts
with and makes changes through this config, which is all available to you. For example, if you are using the presets
<code>neutrino-preset-react</code> and <code>neutrino-preset-karma</code>, any options set can be extended, manipulated, or removed.</p>
<p><em>Example: Neutrino&apos;s React preset adds <code>.jsx</code> as a module extension. Let&apos;s remove it.</em></p>
<pre class="language-"><code class="lang-js">module<span class="token punctuation">.</span>exports <span class="token operator">=</span> neutrino <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
neutrino<span class="token punctuation">.</span>config<span class="token punctuation">.</span>resolve<span class="token punctuation">.</span>extensions<span class="token punctuation">.</span><span class="token keyword">delete</span><span class="token punctuation">(</span><span class="token string">&apos;.jsx&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
@ -686,16 +541,16 @@ v4.2. This preset has a rule named &quot;compile&quot; and a loader named &quot;
<pre class="language-"><code class="lang-js">module<span class="token punctuation">.</span>exports <span class="token operator">=</span> neutrino <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
neutrino<span class="token punctuation">.</span>config<span class="token punctuation">.</span>module
<span class="token punctuation">.</span><span class="token function">rule</span><span class="token punctuation">(</span><span class="token string">&apos;compile&apos;</span><span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">loader</span><span class="token punctuation">(</span><span class="token string">&apos;babel&apos;</span><span class="token punctuation">,</span> options <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
options<span class="token punctuation">.</span>presets<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span><span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">]</span><span class="token punctuation">.</span>targets<span class="token punctuation">.</span>node <span class="token operator">=</span> <span class="token number">4.2</span><span class="token punctuation">;</span>
<span class="token punctuation">.</span><span class="token function">loader</span><span class="token punctuation">(</span><span class="token string">&apos;babel&apos;</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token punctuation">{</span> options <span class="token punctuation">}</span><span class="token punctuation">)</span> <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
options<span class="token punctuation">.</span>presets<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span><span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">]</span><span class="token punctuation">.</span>targets<span class="token punctuation">.</span>node <span class="token operator">=</span> <span class="token number">4.2</span><span class="token punctuation">;</span>
<span class="token keyword">return</span> options<span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">return</span> <span class="token punctuation">{</span> options <span class="token punctuation">}</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
<p>Presets can also have their own custom data in addition to the Neutrino config. See your respective preset for details.
Again, rather than reiterate the documentation for <a href="https://github.com/mozilla-neutrino/webpack-chain" target="_blank">webpack-chain</a>
here, please refer to its documentation for all ways you can modify a config instance to solve your use cases.</p>
Again, rather than reiterate the documentation for <a href="https://github.com/mozilla-neutrino/webpack-chain/tree/v1.4.3" target="_blank">webpack-chain</a> here,
please refer to its documentation for all ways you can modify a config instance to solve your use cases.</p>
</section>
@ -739,7 +594,7 @@ here, please refer to its documentation for all ways you can modify a config ins
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"Advanced","level":"1.8.2","depth":2,"next":{"title":"Creating presets","level":"1.9","depth":1,"path":"creating-presets.md","ref":"./creating-presets.md","articles":[{"title":"Creating linting presets","level":"1.9.1","depth":2,"path":"presets/neutrino-lint-base/README.md","ref":"./presets/neutrino-lint-base/README.md","articles":[]}]},"previous":{"title":"Simple","level":"1.8.1","depth":2,"path":"customization/simple.md","ref":"./customization/simple.md","articles":[]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"customization/advanced.md","mtime":"2017-03-15T13:20:51.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-15T14:46:02.288Z"},"basePath":"..","book":{"language":""}});
gitbook.page.hasChanged({"page":{"title":"Advanced","level":"1.7.2","depth":2,"next":{"title":"Creating presets","level":"1.8","depth":1,"path":"creating-presets.md","ref":"creating-presets.md","articles":[{"title":"Creating linting presets","level":"1.8.1","depth":2,"path":"presets/neutrino-lint-base/README.md","ref":"presets/neutrino-lint-base/README.md","articles":[]}]},"previous":{"title":"Simple","level":"1.7.1","depth":2,"path":"customization/simple.md","ref":"customization/simple.md","articles":[]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"customization/advanced.md","mtime":"2017-03-06T16:54:11.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-06T17:07:12.452Z"},"basePath":"..","book":{"language":""}});
});
</script>
</div>

90
customization/index.html

@ -158,20 +158,7 @@
</li>
<li class="chapter " data-level="1.6" data-path="../middleware/">
<a href="../middleware/">
Middleware
</a>
</li>
<li class="chapter " data-level="1.7" data-path="../presets/">
<li class="chapter " data-level="1.6" data-path="../presets/">
<a href="../presets/">
@ -185,7 +172,7 @@
<ul class="articles">
<li class="chapter " data-level="1.7.1" data-path="../presets/neutrino-preset-web/">
<li class="chapter " data-level="1.6.1" data-path="../presets/neutrino-preset-web/">
<a href="../presets/neutrino-preset-web/">
@ -198,7 +185,7 @@
</li>
<li class="chapter " data-level="1.7.2" data-path="../presets/neutrino-preset-react/">
<li class="chapter " data-level="1.6.2" data-path="../presets/neutrino-preset-react/">
<a href="../presets/neutrino-preset-react/">
@ -211,7 +198,7 @@
</li>
<li class="chapter " data-level="1.7.3" data-path="../presets/neutrino-preset-node/">
<li class="chapter " data-level="1.6.3" data-path="../presets/neutrino-preset-node/">
<a href="../presets/neutrino-preset-node/">
@ -224,7 +211,7 @@
</li>
<li class="chapter " data-level="1.7.4" data-path="../presets/neutrino-preset-airbnb-base/">
<li class="chapter " data-level="1.6.4" data-path="../presets/neutrino-preset-airbnb-base/">
<a href="../presets/neutrino-preset-airbnb-base/">
@ -237,7 +224,7 @@
</li>
<li class="chapter " data-level="1.7.5" data-path="../presets/neutrino-preset-karma/">
<li class="chapter " data-level="1.6.5" data-path="../presets/neutrino-preset-karma/">
<a href="../presets/neutrino-preset-karma/">
@ -250,7 +237,7 @@
</li>
<li class="chapter " data-level="1.7.6" data-path="../presets/neutrino-preset-mocha/">
<li class="chapter " data-level="1.6.6" data-path="../presets/neutrino-preset-mocha/">
<a href="../presets/neutrino-preset-mocha/">
@ -263,7 +250,7 @@
</li>
<li class="chapter " data-level="1.7.7" data-path="../presets/neutrino-preset-jest/">
<li class="chapter " data-level="1.6.7" data-path="../presets/neutrino-preset-jest/">
<a href="../presets/neutrino-preset-jest/">
@ -276,7 +263,7 @@
</li>
<li class="chapter " data-level="1.7.8" data-path="../presets/community-presets.html">
<li class="chapter " data-level="1.6.8" data-path="../presets/community-presets.html">
<a href="../presets/community-presets.html">
@ -294,7 +281,7 @@
</li>
<li class="chapter active" data-level="1.8" data-path="./">
<li class="chapter active" data-level="1.7" data-path="./">
<a href="./">
@ -308,7 +295,7 @@
<ul class="articles">
<li class="chapter " data-level="1.8.1" data-path="simple.html">
<li class="chapter " data-level="1.7.1" data-path="simple.html">
<a href="simple.html">
@ -321,7 +308,7 @@
</li>
<li class="chapter " data-level="1.8.2" data-path="advanced.html">
<li class="chapter " data-level="1.7.2" data-path="advanced.html">
<a href="advanced.html">
@ -339,7 +326,7 @@
</li>
<li class="chapter " data-level="1.9" data-path="../creating-presets.html">
<li class="chapter " data-level="1.8" data-path="../creating-presets.html">
<a href="../creating-presets.html">
@ -353,9 +340,9 @@
<ul class="articles">
<li class="chapter " data-level="1.9.1" data-path="../presets/neutrino-lint-base/README.md">
<li class="chapter " data-level="1.8.1" data-path="../presets/neutrino-lint-base/">
<span>
<a href="../presets/neutrino-lint-base/">
Creating linting presets
@ -371,7 +358,7 @@
</li>
<li class="chapter " data-level="1.10" data-path="../learning-resources.html">
<li class="chapter " data-level="1.9" data-path="../learning-resources.html">
<a href="../learning-resources.html">
@ -384,7 +371,7 @@
</li>
<li class="chapter " data-level="1.11" data-path="../api/">
<li class="chapter " data-level="1.10" data-path="../api/">
<a href="../api/">
@ -397,7 +384,7 @@
</li>
<li class="chapter " data-level="1.12" data-path="../cli/">
<li class="chapter " data-level="1.11" data-path="../cli/">
<a href="../cli/">
@ -410,33 +397,7 @@
</li>
<li class="chapter " data-level="1.13" data-path="../upgrading-neutrino.html">
<a href="../upgrading-neutrino.html">
Upgrading from v4 to v5
</a>
</li>
<li class="chapter " data-level="1.14" >
<a target="_blank" href="https://github.com/mozilla-neutrino/neutrino-dev/tree/docs-v4/docs">
v4 Documentation
</a>
</li>
<li class="chapter " data-level="1.15" data-path="../contributing/">
<li class="chapter " data-level="1.12" data-path="../contributing/">
<a href="../contributing/">
@ -450,7 +411,7 @@
<ul class="articles">
<li class="chapter " data-level="1.15.1" data-path="../contributing/development.html">
<li class="chapter " data-level="1.12.1" data-path="../contributing/development.html">
<a href="../contributing/development.html">
@ -463,7 +424,7 @@
</li>
<li class="chapter " data-level="1.15.2" data-path="../contributing/code-of-conduct.html">
<li class="chapter " data-level="1.12.2" data-path="../contributing/code-of-conduct.html">
<a href="../contributing/code-of-conduct.html">
@ -531,11 +492,10 @@
to the way your Neutrino preset is building your project. Neutrino provides two ways you can augment a preset in the
context of a project without resorting to creating and publishing an entirely independent preset.</p>
<h3 id="simple-customization">Simple Customization</h3>
<p>By defining an object within your package.json at <code>neutrino</code>, Neutrino will merge this information with that provided by
your presets or middleware, overriding the configuration and options with your own preferences.</p>
<p>By defining a configuration object within your package.json, Neutrino will merge this information with that provided by
your preset, effectively overriding those options with your custom data.</p>
<h3 id="advanced-customization">Advanced Customization</h3>
<p>You can also create a configuration override directly in your project which can extend the presets and middleware you
are using.</p>
<p>You can also create a configuration override directly in your project which can extend the presets you are using.</p>
<hr>
<p>Continue for details on each technique.</p>
@ -581,7 +541,7 @@ are using.</p>
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"Customization","level":"1.8","depth":1,"next":{"title":"Simple","level":"1.8.1","depth":2,"path":"customization/simple.md","ref":"./customization/simple.md","articles":[]},"previous":{"title":"Community presets","level":"1.7.8","depth":2,"path":"presets/community-presets.md","ref":"./presets/community-presets.md","articles":[]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"customization/README.md","mtime":"2017-03-15T13:20:51.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-15T14:46:02.288Z"},"basePath":"..","book":{"language":""}});
gitbook.page.hasChanged({"page":{"title":"Customization","level":"1.7","depth":1,"next":{"title":"Simple","level":"1.7.1","depth":2,"path":"customization/simple.md","ref":"customization/simple.md","articles":[]},"previous":{"title":"Community presets","level":"1.6.8","depth":2,"path":"presets/community-presets.md","ref":"presets/community-presets.md","articles":[]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"customization/README.md","mtime":"2017-02-16T18:32:52.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-06T17:07:12.452Z"},"basePath":"..","book":{"language":""}});
});
</script>
</div>

261
customization/simple.html

@ -158,20 +158,7 @@
</li>
<li class="chapter " data-level="1.6" data-path="../middleware/">
<a href="../middleware/">
Middleware
</a>
</li>
<li class="chapter " data-level="1.7" data-path="../presets/">
<li class="chapter " data-level="1.6" data-path="../presets/">
<a href="../presets/">
@ -185,7 +172,7 @@
<ul class="articles">
<li class="chapter " data-level="1.7.1" data-path="../presets/neutrino-preset-web/">
<li class="chapter " data-level="1.6.1" data-path="../presets/neutrino-preset-web/">
<a href="../presets/neutrino-preset-web/">
@ -198,7 +185,7 @@
</li>
<li class="chapter " data-level="1.7.2" data-path="../presets/neutrino-preset-react/">
<li class="chapter " data-level="1.6.2" data-path="../presets/neutrino-preset-react/">
<a href="../presets/neutrino-preset-react/">
@ -211,7 +198,7 @@
</li>
<li class="chapter " data-level="1.7.3" data-path="../presets/neutrino-preset-node/">
<li class="chapter " data-level="1.6.3" data-path="../presets/neutrino-preset-node/">
<a href="../presets/neutrino-preset-node/">
@ -224,7 +211,7 @@
</li>
<li class="chapter " data-level="1.7.4" data-path="../presets/neutrino-preset-airbnb-base/">
<li class="chapter " data-level="1.6.4" data-path="../presets/neutrino-preset-airbnb-base/">
<a href="../presets/neutrino-preset-airbnb-base/">
@ -237,7 +224,7 @@
</li>
<li class="chapter " data-level="1.7.5" data-path="../presets/neutrino-preset-karma/">
<li class="chapter " data-level="1.6.5" data-path="../presets/neutrino-preset-karma/">
<a href="../presets/neutrino-preset-karma/">
@ -250,7 +237,7 @@
</li>
<li class="chapter " data-level="1.7.6" data-path="../presets/neutrino-preset-mocha/">
<li class="chapter " data-level="1.6.6" data-path="../presets/neutrino-preset-mocha/">
<a href="../presets/neutrino-preset-mocha/">
@ -263,7 +250,7 @@
</li>
<li class="chapter " data-level="1.7.7" data-path="../presets/neutrino-preset-jest/">
<li class="chapter " data-level="1.6.7" data-path="../presets/neutrino-preset-jest/">
<a href="../presets/neutrino-preset-jest/">
@ -276,7 +263,7 @@
</li>
<li class="chapter " data-level="1.7.8" data-path="../presets/community-presets.html">
<li class="chapter " data-level="1.6.8" data-path="../presets/community-presets.html">
<a href="../presets/community-presets.html">
@ -294,7 +281,7 @@
</li>
<li class="chapter " data-level="1.8" data-path="./">
<li class="chapter " data-level="1.7" data-path="./">
<a href="./">
@ -308,7 +295,7 @@
<ul class="articles">
<li class="chapter active" data-level="1.8.1" data-path="simple.html">
<li class="chapter active" data-level="1.7.1" data-path="simple.html">
<a href="simple.html">
@ -321,7 +308,7 @@
</li>
<li class="chapter " data-level="1.8.2" data-path="advanced.html">
<li class="chapter " data-level="1.7.2" data-path="advanced.html">
<a href="advanced.html">
@ -339,7 +326,7 @@
</li>
<li class="chapter " data-level="1.9" data-path="../creating-presets.html">
<li class="chapter " data-level="1.8" data-path="../creating-presets.html">
<a href="../creating-presets.html">
@ -353,9 +340,9 @@
<ul class="articles">
<li class="chapter " data-level="1.9.1" data-path="../presets/neutrino-lint-base/README.md">
<li class="chapter " data-level="1.8.1" data-path="../presets/neutrino-lint-base/">
<span>
<a href="../presets/neutrino-lint-base/">
Creating linting presets
@ -371,7 +358,7 @@
</li>
<li class="chapter " data-level="1.10" data-path="../learning-resources.html">
<li class="chapter " data-level="1.9" data-path="../learning-resources.html">
<a href="../learning-resources.html">
@ -384,7 +371,7 @@
</li>
<li class="chapter " data-level="1.11" data-path="../api/">
<li class="chapter " data-level="1.10" data-path="../api/">
<a href="../api/">
@ -397,7 +384,7 @@
</li>
<li class="chapter " data-level="1.12" data-path="../cli/">
<li class="chapter " data-level="1.11" data-path="../cli/">
<a href="../cli/">
@ -410,33 +397,7 @@
</li>
<li class="chapter " data-level="1.13" data-path="../upgrading-neutrino.html">
<a href="../upgrading-neutrino.html">
Upgrading from v4 to v5
</a>
</li>
<li class="chapter " data-level="1.14" >
<a target="_blank" href="https://github.com/mozilla-neutrino/neutrino-dev/tree/docs-v4/docs">
v4 Documentation
</a>
</li>
<li class="chapter " data-level="1.15" data-path="../contributing/">
<li class="chapter " data-level="1.12" data-path="../contributing/">
<a href="../contributing/">
@ -450,7 +411,7 @@
<ul class="articles">
<li class="chapter " data-level="1.15.1" data-path="../contributing/development.html">
<li class="chapter " data-level="1.12.1" data-path="../contributing/development.html">
<a href="../contributing/development.html">
@ -463,7 +424,7 @@
</li>
<li class="chapter " data-level="1.15.2" data-path="../contributing/code-of-conduct.html">
<li class="chapter " data-level="1.12.2" data-path="../contributing/code-of-conduct.html">
<a href="../contributing/code-of-conduct.html">
@ -529,17 +490,14 @@
<h1 id="simple-neutrino-customization">Simple Neutrino Customization</h1>
<p>No two JavaScript projects are ever the same, and as such there may be times when you will need to make modifications
to the way your Neutrino preset is building your project. By defining a configuration object within your package.json,
Neutrino will merge this information with those provided by your presets, overriding those options with your custom
configuration.</p>
<p><em>Note: Using package.json for customization tends to be quite verbose for anything more than simple overrides. If this
is not to your liking, consider moving your overrides to their own file using
<a href="advanced.html">Advanced Customization</a>.</em></p>
Neutrino will merge this information with that provided by your preset, effectively overriding those options with your
custom data.</p>
<h2 id="prepare-packagejson">Prepare package.json</h2>
<p>First, you will need to define a <code>neutrino</code> section within your package.json. You
<p>First, you will need to define a <code>config</code> section within your package.json. You
<a href="../usage.html#using-multiple-presets">may have already done this</a> if you
specified your presets through <code>neutrino</code> as opposed to flags through <code>scripts</code>:</p>
specified your presets through the <code>config</code> as opposed to flags through <code>scripts</code>:</p>
<pre class="language-"><code class="lang-json"><span class="token punctuation">{</span>
<span class="token property">&quot;neutrino&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;config&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;presets&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span>
<span class="token string">&quot;neutrino-preset-react&quot;</span><span class="token punctuation">,</span>
<span class="token string">&quot;neutrino-preset-karma&quot;</span>
@ -551,138 +509,26 @@ specified your presets through <code>neutrino</code> as opposed to flags through
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
<h2 id="overriding-neutrino-options">Overriding Neutrino options</h2>
<p>Neutrino has a number of useful options for customizing its behavior, as well as the behavior of presets and middleware.
You can override these options using an object at <code>neutrino.options</code>:</p>
<h3 id="optionsroot"><code>options.root</code></h3>
<p>Set the base directory which Neutrino middleware and presets operate on. Typically this is the project directory where
the package.json would be located. If the option is not set, Neutrino defaults it to <code>process.cwd()</code>. If a relative
path is specified, it will be resolved relative to <code>process.cwd()</code>; absolute paths will be used as-is.</p>
<pre class="language-"><code class="lang-js"><span class="token punctuation">{</span>
<span class="token string">&quot;neutrino&quot;</span><span class="token punctuation">:</span> <span class="token punctuation">{</span>
<span class="token string">&quot;options&quot;</span><span class="token punctuation">:</span> <span class="token punctuation">{</span>
<span class="token comment" spellcheck="true">// if not specified, defaults to process.cwd()</span>
<span class="token comment" spellcheck="true">// relative, resolves to process.cwd() + ./website</span>
<span class="token string">&quot;root&quot;</span><span class="token punctuation">:</span> <span class="token string">&quot;./website&quot;</span><span class="token punctuation">,</span>
<span class="token comment" spellcheck="true">// absolute</span>
<span class="token string">&quot;root&quot;</span><span class="token punctuation">:</span> <span class="token string">&quot;/code/website&quot;</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
<h3 id="optionssource"><code>options.source</code></h3>
<p>Set the directory which contains the application source code. If the option is not set, Neutrino defaults it to <code>src</code>.
If a relative path is specified, it will be resolved relative to <code>options.root</code>; absolute paths will be used as-is.</p>
<pre class="language-"><code class="lang-js"><span class="token punctuation">{</span>
<span class="token string">&quot;neutrino&quot;</span><span class="token punctuation">:</span> <span class="token punctuation">{</span>
<span class="token string">&quot;options&quot;</span><span class="token punctuation">:</span> <span class="token punctuation">{</span>
<span class="token comment" spellcheck="true">// if not specified, defaults to options.root + src</span>
<span class="token comment" spellcheck="true">// relative, resolves to options.root + ./lib</span>
<span class="token string">&quot;source&quot;</span><span class="token punctuation">:</span> <span class="token string">&quot;./lib&quot;</span><span class="token punctuation">,</span>
<span class="token comment" spellcheck="true">// absolute</span>
<span class="token string">&quot;source&quot;</span><span class="token punctuation">:</span> <span class="token string">&quot;/code/website/lib&quot;</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
<h3 id="optionsoutput"><code>options.output</code></h3>
<p>Set the directory which will be the output of built assets. If the option is not set, Neutrino defaults it to <code>build</code>.
If a relative path is specified, it will be resolved relative to <code>options.root</code>; absolute paths will be used as-is.</p>
<pre class="language-"><code class="lang-js"><span class="token punctuation">{</span>
<span class="token string">&quot;neutrino&quot;</span><span class="token punctuation">:</span> <span class="token punctuation">{</span>
<span class="token string">&quot;options&quot;</span><span class="token punctuation">:</span> <span class="token punctuation">{</span>
<span class="token comment" spellcheck="true">// if not specified, defaults to options.root + build</span>
<span class="token comment" spellcheck="true">// relative, resolves to options.root + ./dist</span>
<span class="token string">&quot;output&quot;</span><span class="token punctuation">:</span> <span class="token string">&quot;./dist&quot;</span><span class="token punctuation">,</span>
<span class="token comment" spellcheck="true">// absolute</span>
<span class="token string">&quot;output&quot;</span><span class="token punctuation">:</span> <span class="token string">&quot;/code/website/dist&quot;</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
<h3 id="optionstests"><code>options.tests</code></h3>
<p>Set the directory that contains test files. If the option is not set, Neutrino defaults it to <code>test</code>.
If a relative path is specified, it will be resolved relative to <code>options.root</code>; absolute paths will be used as-is.</p>
<pre class="language-"><code class="lang-js"><span class="token punctuation">{</span>
<span class="token string">&quot;neutrino&quot;</span><span class="token punctuation">:</span> <span class="token punctuation">{</span>
<span class="token string">&quot;options&quot;</span><span class="token punctuation">:</span> <span class="token punctuation">{</span>
<span class="token comment" spellcheck="true">// if not specified, defaults to options.root + test</span>
<span class="token comment" spellcheck="true">// relative, resolves to options.root + ./testing</span>
<span class="token string">&quot;tests&quot;</span><span class="token punctuation">:</span> <span class="token string">&quot;./testing&quot;</span><span class="token punctuation">,</span>
<span class="token comment" spellcheck="true">// absolute</span>
<span class="token string">&quot;tests&quot;</span><span class="token punctuation">:</span> <span class="token string">&quot;/code/website/testing&quot;</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
<h3 id="optionsentry"><code>options.entry</code></h3>
<p>Set the main entry point for the application. If the option is not set, Neutrino defaults it to <code>index.js</code>.
If a relative path is specified, it will be resolved relative to <code>options.source</code>; absolute paths will be used as-is.</p>
<pre class="language-"><code class="lang-js"><span class="token punctuation">{</span>
<span class="token string">&quot;neutrino&quot;</span><span class="token punctuation">:</span> <span class="token punctuation">{</span>
<span class="token string">&quot;options&quot;</span><span class="token punctuation">:</span> <span class="token punctuation">{</span>
<span class="token comment" spellcheck="true">// if not specified, defaults to options.source + index.js</span>
<span class="token comment" spellcheck="true">// relative, resolves to options.source + ./entry.js</span>
<span class="token string">&quot;entry&quot;</span><span class="token punctuation">:</span> <span class="token string">&quot;./entry.js&quot;</span><span class="token punctuation">,</span>
<span class="token comment" spellcheck="true">// absolute</span>
<span class="token string">&quot;entry&quot;</span><span class="token punctuation">:</span> <span class="token string">&quot;/code/website/lib/entry.js&quot;</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
<h3 id="optionsnodemodules"><code>options.node_modules</code></h3>
<p>Set the directory which contains the Node.js modules of the project. If the option is not set, Neutrino defaults it to
<code>node_modules</code>. If a relative path is specified, it will be resolved relative to <code>options.root</code>; absolute paths will be
used as-is.</p>
<pre class="language-"><code class="lang-js"><span class="token punctuation">{</span>
<span class="token string">&quot;neutrino&quot;</span><span class="token punctuation">:</span> <span class="token punctuation">{</span>
<span class="token string">&quot;options&quot;</span><span class="token punctuation">:</span> <span class="token punctuation">{</span>
<span class="token comment" spellcheck="true">// if not specified, defaults to options.root + node_modules</span>
<span class="token comment" spellcheck="true">// relative, resolves to options.root + ./modules</span>
<span class="token string">&quot;node_modules&quot;</span><span class="token punctuation">:</span> <span class="token string">&quot;./modules&quot;</span>
<span class="token comment" spellcheck="true">// absolute</span>
<span class="token string">&quot;node_modules&quot;</span><span class="token punctuation">:</span> <span class="token string">&quot;/code/website/modules&quot;</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
<h3 id="middleware-or-preset-options">Middleware or preset options</h3>
<p>Some middleware and presets also have their own custom options. Consult the documentation for the package for specific
details on its customization.</p>
<h2 id="overriding-build-configuration">Overriding build configuration</h2>
<p>Add a new property to <code>neutrino</code> named <code>config</code>. This will be an object where we can provide configuration data:</p>
<p>Add a new property to <code>config</code> named <code>neutrino</code>. This will be an object where we can provide configuration data:</p>
<pre class="language-"><code class="lang-json"><span class="token punctuation">{</span>
<span class="token property">&quot;neutrino&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;config&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;presets&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
<span class="token property">&quot;config&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;neutrino&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
<p>Populate this object with configuration overrides. This is not a Webpack configuration, but rather a Neutrino-compatible
object based on <a href="https://github.com/mozilla-neutrino/webpack-chain" target="_blank">webpack-chain</a>. A schematic of what this structure
looks like is located on the <a href="https://github.com/mozilla-neutrino/webpack-chain#merging-config" target="_blank">webpack-chain docs</a>.</p>
object based on <a href="https://github.com/mozilla-neutrino/webpack-chain/tree/v1.4.3" target="_blank">webpack-chain</a>.</p>
<h2 id="usage">Usage</h2>
<h3 id="entries">Entries</h3>
<p>Add files to named entry points, or define new entry points. This is a key named <code>entry</code>, with a value being an object.
This maps to points to enter the application. At this point the application starts executing.</p>
<p><em>Example: Define an entry point named <code>vendor</code> that bundles React packages separately from the application code.</em></p>
<pre class="language-"><code class="lang-json"><span class="token punctuation">{</span>
<span class="token property">&quot;neutrino&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;config&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;config&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;neutrino&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;entry&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;vendor&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span>
<span class="token string">&quot;react&quot;</span><span class="token punctuation">,</span>
@ -704,17 +550,17 @@ module is created. They can apply loaders to the module, or modify the parser. <
<p>Using <code>module.rule.loader</code> allows to you define the Webpack loader and its options for processing a particular rule.
This loader is usually a <code>dependency</code> or <code>devDependency</code> of your project. Each <code>loader</code> object can specify a property
for the string <code>loader</code> and an <code>options</code> object.</p>
<p><em>Example: Add LESS loading to the project, by overriding the <code>style</code> rule.</em></p>
<p><em>Example: Add LESS loading to the project, by extending the <code>css</code> rule.</em></p>
<pre class="language-"><code class="lang-json"><span class="token punctuation">{</span>
<span class="token property">&quot;dependencies&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;less&quot;</span><span class="token operator">:</span> <span class="token string">&quot;^2.7.2&quot;</span><span class="token punctuation">,</span>
<span class="token property">&quot;less-loader&quot;</span><span class="token operator">:</span> <span class="token string">&quot;^2.2.3&quot;</span>
<span class="token punctuation">}</span><span class="token punctuation">,</span>
<span class="token property">&quot;neutrino&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;config&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;config&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;neutrino&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;module&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;rule&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;style&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;css&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;test&quot;</span><span class="token operator">:</span> <span class="token string">&quot;\\.less$&quot;</span><span class="token punctuation">,</span>
<span class="token property">&quot;loader&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;less&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
@ -737,8 +583,8 @@ assets, and anything else you bundle or load with Webpack. This option can be an
<a href="https://webpack.js.org/configuration/output/" target="_blank">Webpack accepts</a>.</p>
<p><em>Example: Change the public path of the application.</em></p>
<pre class="language-"><code class="lang-json"><span class="token punctuation">{</span>
<span class="token property">&quot;neutrino&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;config&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;config&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;neutrino&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;output&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;publicPath&quot;</span><span class="token operator">:</span> <span class="token string">&quot;https://cdn.example.com/assets/&quot;</span>
<span class="token punctuation">}</span>
@ -750,8 +596,8 @@ assets, and anything else you bundle or load with Webpack. This option can be an
<p>Use <code>node</code> to customize the Node.js environment using polyfills or mocks:</p>
<p><em>Example: mock the <code>__filename</code> and <code>__dirname</code> Node.js globals.</em></p>
<pre class="language-"><code class="lang-json"><span class="token punctuation">{</span>
<span class="token property">&quot;neutrino&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;config&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;config&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;neutrino&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;node&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;__filename&quot;</span><span class="token operator">:</span> <span class="token string">&quot;mock&quot;</span><span class="token punctuation">,</span>
<span class="token property">&quot;__dirname&quot;</span><span class="token operator">:</span> <span class="token string">&quot;mock&quot;</span>
@ -764,8 +610,8 @@ assets, and anything else you bundle or load with Webpack. This option can be an
<p>Use <code>devServer</code> to customize webpack-dev-server and change its behavior in various ways.</p>
<p><em>Example: gzip the application when serving and listen on port 9000.</em></p>
<pre class="language-"><code class="lang-json"><span class="token punctuation">{</span>
<span class="token property">&quot;neutrino&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;config&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;config&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;neutrino&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;devServer&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;compress&quot;</span><span class="token operator">:</span> <span class="token boolean">true</span><span class="token punctuation">,</span>
<span class="token property">&quot;port&quot;</span><span class="token operator">:</span> <span class="token number">9000</span>
@ -776,12 +622,12 @@ assets, and anything else you bundle or load with Webpack. This option can be an
</code></pre>
<h3 id="resolve">Resolve</h3>
<p>Use <code>resolve</code> to change how modules are resolved. When using <code>resolve.extensions</code> and <code>resolve.modules</code>, these should be
specified as arrays, and will be merged with their respective definitions used in inherited presets. See the
webpack-chain docs for more details on this structure.</p>
specified as arrays, and will be merged with their respective definitions used in inherited presets. Any additional
properties attached to <code>resolve</code> not defined below will be set on the final module configuration.</p>
<p><em>Example: Add <code>.mjs</code> as a resolving extension and specify modules are located in a <code>custom_modules</code> directory.</em></p>
<pre class="language-"><code class="lang-json"><span class="token punctuation">{</span>
<span class="token property">&quot;neutrino&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;config&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;config&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;neutrino&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;resolve&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;extensions&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span><span class="token string">&quot;.mjs&quot;</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
<span class="token property">&quot;modules&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span><span class="token string">&quot;custom_modules&quot;</span><span class="token punctuation">]</span>
@ -793,11 +639,12 @@ webpack-chain docs for more details on this structure.</p>
<h3 id="resolveloader">ResolveLoader</h3>
<p>Use <code>resolveLoader</code> to change how loader packages are resolved. When using <code>resolveLoader.extensions</code> and
<code>resolveLoader.modules</code>, these should be specified as arrays, and will be merged with their respective definitions used
in inherited presets. See the webpack-chain docs for more details on this structure.</p>
in inherited presets. Any additional properties attached to <code>resolveLoader</code> not defined below will be set on the final
module configuration.</p>
<p><em>Example: Add <code>.loader.js</code> as a loader extension and specify modules are located in a <code>web_loaders</code> directory.</em></p>
<pre class="language-"><code class="lang-json"><span class="token punctuation">{</span>
<span class="token property">&quot;neutrino&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;config&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;config&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;neutrino&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;resolve&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;extensions&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span><span class="token string">&quot;.loader.js&quot;</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
<span class="token property">&quot;modules&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span><span class="token string">&quot;web_loaders&quot;</span><span class="token punctuation">]</span>
@ -807,11 +654,11 @@ in inherited presets. See the webpack-chain docs for more details on this struct
<span class="token punctuation">}</span>
</code></pre>
<h3 id="additional-configuration">Additional configuration</h3>
<p>Any top-level properties you set on <code>neutrino.config</code> will be added to the configuration.</p>
<p>Any top-level properties you set on <code>config.neutrino</code> will be added to the configuration.</p>
<p><em>Example: Change the Webpack performance options to error when exceeding performance budgets.</em></p>
<pre class="language-"><code class="lang-json"><span class="token punctuation">{</span>
<span class="token property">&quot;neutrino&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;config&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;config&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;neutrino&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;performance&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;hints&quot;</span><span class="token operator">:</span> <span class="token string">&quot;error&quot;</span>
<span class="token punctuation">}</span>
@ -866,7 +713,7 @@ basis. In the event that you need more customization than what is afforded throu
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"Simple","level":"1.8.1","depth":2,"next":{"title":"Advanced","level":"1.8.2","depth":2,"path":"customization/advanced.md","ref":"./customization/advanced.md","articles":[]},"previous":{"title":"Customization","level":"1.8","depth":1,"path":"customization/README.md","ref":"./customization/README.md","articles":[{"title":"Simple","level":"1.8.1","depth":2,"path":"customization/simple.md","ref":"./customization/simple.md","articles":[]},{"title":"Advanced","level":"1.8.2","depth":2,"path":"customization/advanced.md","ref":"./customization/advanced.md","articles":[]}]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"customization/simple.md","mtime":"2017-03-15T13:20:51.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-15T14:46:02.288Z"},"basePath":"..","book":{"language":""}});
gitbook.page.hasChanged({"page":{"title":"Simple","level":"1.7.1","depth":2,"next":{"title":"Advanced","level":"1.7.2","depth":2,"path":"customization/advanced.md","ref":"customization/advanced.md","articles":[]},"previous":{"title":"Customization","level":"1.7","depth":1,"path":"customization/README.md","ref":"customization/README.md","articles":[{"title":"Simple","level":"1.7.1","depth":2,"path":"customization/simple.md","ref":"customization/simple.md","articles":[]},{"title":"Advanced","level":"1.7.2","depth":2,"path":"customization/advanced.md","ref":"customization/advanced.md","articles":[]}]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"customization/simple.md","mtime":"2017-03-06T16:54:11.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-06T17:07:12.452Z"},"basePath":"..","book":{"language":""}});
});
</script>
</div>

83
index.html

@ -156,20 +156,7 @@
</li>
<li class="chapter " data-level="1.6" data-path="middleware/">
<a href="middleware/">
Middleware
</a>
</li>
<li class="chapter " data-level="1.7" data-path="presets/">
<li class="chapter " data-level="1.6" data-path="presets/">
<a href="presets/">
@ -183,7 +170,7 @@
<ul class="articles">
<li class="chapter " data-level="1.7.1" data-path="presets/neutrino-preset-web/">
<li class="chapter " data-level="1.6.1" data-path="presets/neutrino-preset-web/">
<a href="presets/neutrino-preset-web/">
@ -196,7 +183,7 @@
</li>
<li class="chapter " data-level="1.7.2" data-path="presets/neutrino-preset-react/">
<li class="chapter " data-level="1.6.2" data-path="presets/neutrino-preset-react/">
<a href="presets/neutrino-preset-react/">
@ -209,7 +196,7 @@
</li>
<li class="chapter " data-level="1.7.3" data-path="presets/neutrino-preset-node/">
<li class="chapter " data-level="1.6.3" data-path="presets/neutrino-preset-node/">
<a href="presets/neutrino-preset-node/">
@ -222,7 +209,7 @@
</li>
<li class="chapter " data-level="1.7.4" data-path="presets/neutrino-preset-airbnb-base/">
<li class="chapter " data-level="1.6.4" data-path="presets/neutrino-preset-airbnb-base/">
<a href="presets/neutrino-preset-airbnb-base/">
@ -235,7 +222,7 @@
</li>
<li class="chapter " data-level="1.7.5" data-path="presets/neutrino-preset-karma/">
<li class="chapter " data-level="1.6.5" data-path="presets/neutrino-preset-karma/">
<a href="presets/neutrino-preset-karma/">
@ -248,7 +235,7 @@
</li>
<li class="chapter " data-level="1.7.6" data-path="presets/neutrino-preset-mocha/">
<li class="chapter " data-level="1.6.6" data-path="presets/neutrino-preset-mocha/">
<a href="presets/neutrino-preset-mocha/">
@ -261,7 +248,7 @@
</li>
<li class="chapter " data-level="1.7.7" data-path="presets/neutrino-preset-jest/">
<li class="chapter " data-level="1.6.7" data-path="presets/neutrino-preset-jest/">
<a href="presets/neutrino-preset-jest/">
@ -274,7 +261,7 @@
</li>
<li class="chapter " data-level="1.7.8" data-path="presets/community-presets.html">
<li class="chapter " data-level="1.6.8" data-path="presets/community-presets.html">
<a href="presets/community-presets.html">
@ -292,7 +279,7 @@
</li>
<li class="chapter " data-level="1.8" data-path="customization/">
<li class="chapter " data-level="1.7" data-path="customization/">
<a href="customization/">
@ -306,7 +293,7 @@
<ul class="articles">
<li class="chapter " data-level="1.8.1" data-path="customization/simple.html">
<li class="chapter " data-level="1.7.1" data-path="customization/simple.html">
<a href="customization/simple.html">
@ -319,7 +306,7 @@
</li>
<li class="chapter " data-level="1.8.2" data-path="customization/advanced.html">
<li class="chapter " data-level="1.7.2" data-path="customization/advanced.html">
<a href="customization/advanced.html">
@ -337,7 +324,7 @@
</li>
<li class="chapter " data-level="1.9" data-path="creating-presets.html">
<li class="chapter " data-level="1.8" data-path="creating-presets.html">
<a href="creating-presets.html">
@ -351,9 +338,9 @@
<ul class="articles">
<li class="chapter " data-level="1.9.1" data-path="presets/neutrino-lint-base/README.md">
<li class="chapter " data-level="1.8.1" data-path="presets/neutrino-lint-base/">
<span>
<a href="presets/neutrino-lint-base/">
Creating linting presets
@ -369,7 +356,7 @@
</li>
<li class="chapter " data-level="1.10" data-path="learning-resources.html">
<li class="chapter " data-level="1.9" data-path="learning-resources.html">
<a href="learning-resources.html">
@ -382,7 +369,7 @@
</li>
<li class="chapter " data-level="1.11" data-path="api/">
<li class="chapter " data-level="1.10" data-path="api/">
<a href="api/">
@ -395,7 +382,7 @@
</li>
<li class="chapter " data-level="1.12" data-path="cli/">
<li class="chapter " data-level="1.11" data-path="cli/">
<a href="cli/">
@ -408,33 +395,7 @@
</li>
<li class="chapter " data-level="1.13" data-path="upgrading-neutrino.html">
<a href="upgrading-neutrino.html">
Upgrading from v4 to v5
</a>
</li>
<li class="chapter " data-level="1.14" >
<a target="_blank" href="https://github.com/mozilla-neutrino/neutrino-dev/tree/docs-v4/docs">
v4 Documentation
</a>
</li>
<li class="chapter " data-level="1.15" data-path="contributing/">
<li class="chapter " data-level="1.12" data-path="contributing/">
<a href="contributing/">
@ -448,7 +409,7 @@
<ul class="articles">
<li class="chapter " data-level="1.15.1" data-path="contributing/development.html">
<li class="chapter " data-level="1.12.1" data-path="contributing/development.html">
<a href="contributing/development.html">
@ -461,7 +422,7 @@
</li>
<li class="chapter " data-level="1.15.2" data-path="contributing/code-of-conduct.html">
<li class="chapter " data-level="1.12.2" data-path="contributing/code-of-conduct.html">
<a href="contributing/code-of-conduct.html">
@ -581,7 +542,7 @@ for details on installation, getting started, usage, and customizing.</p>
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"Introduction","level":"1.1","depth":1,"next":{"title":"Installation","level":"1.2","depth":1,"path":"installation.md","ref":"./installation.md","articles":[]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"README.md","mtime":"2017-02-24T16:48:53.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-15T14:46:02.288Z"},"basePath":".","book":{"language":""}});
gitbook.page.hasChanged({"page":{"title":"Introduction","level":"1.1","depth":1,"next":{"title":"Installation","level":"1.2","depth":1,"path":"installation.md","ref":"installation.md","articles":[]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"README.md","mtime":"2017-03-01T15:25:58.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-06T17:07:12.452Z"},"basePath":".","book":{"language":""}});
});
</script>
</div>

83
installation.html

@ -158,20 +158,7 @@
</li>
<li class="chapter " data-level="1.6" data-path="middleware/">
<a href="middleware/">
Middleware
</a>
</li>
<li class="chapter " data-level="1.7" data-path="presets/">
<li class="chapter " data-level="1.6" data-path="presets/">
<a href="presets/">
@ -185,7 +172,7 @@
<ul class="articles">
<li class="chapter " data-level="1.7.1" data-path="presets/neutrino-preset-web/">
<li class="chapter " data-level="1.6.1" data-path="presets/neutrino-preset-web/">
<a href="presets/neutrino-preset-web/">
@ -198,7 +185,7 @@
</li>
<li class="chapter " data-level="1.7.2" data-path="presets/neutrino-preset-react/">
<li class="chapter " data-level="1.6.2" data-path="presets/neutrino-preset-react/">
<a href="presets/neutrino-preset-react/">
@ -211,7 +198,7 @@
</li>
<li class="chapter " data-level="1.7.3" data-path="presets/neutrino-preset-node/">
<li class="chapter " data-level="1.6.3" data-path="presets/neutrino-preset-node/">
<a href="presets/neutrino-preset-node/">
@ -224,7 +211,7 @@
</li>
<li class="chapter " data-level="1.7.4" data-path="presets/neutrino-preset-airbnb-base/">
<li class="chapter " data-level="1.6.4" data-path="presets/neutrino-preset-airbnb-base/">
<a href="presets/neutrino-preset-airbnb-base/">
@ -237,7 +224,7 @@
</li>
<li class="chapter " data-level="1.7.5" data-path="presets/neutrino-preset-karma/">
<li class="chapter " data-level="1.6.5" data-path="presets/neutrino-preset-karma/">
<a href="presets/neutrino-preset-karma/">
@ -250,7 +237,7 @@
</li>
<li class="chapter " data-level="1.7.6" data-path="presets/neutrino-preset-mocha/">
<li class="chapter " data-level="1.6.6" data-path="presets/neutrino-preset-mocha/">
<a href="presets/neutrino-preset-mocha/">
@ -263,7 +250,7 @@
</li>
<li class="chapter " data-level="1.7.7" data-path="presets/neutrino-preset-jest/">
<li class="chapter " data-level="1.6.7" data-path="presets/neutrino-preset-jest/">
<a href="presets/neutrino-preset-jest/">
@ -276,7 +263,7 @@
</li>
<li class="chapter " data-level="1.7.8" data-path="presets/community-presets.html">
<li class="chapter " data-level="1.6.8" data-path="presets/community-presets.html">
<a href="presets/community-presets.html">
@ -294,7 +281,7 @@
</li>
<li class="chapter " data-level="1.8" data-path="customization/">
<li class="chapter " data-level="1.7" data-path="customization/">
<a href="customization/">
@ -308,7 +295,7 @@
<ul class="articles">
<li class="chapter " data-level="1.8.1" data-path="customization/simple.html">
<li class="chapter " data-level="1.7.1" data-path="customization/simple.html">
<a href="customization/simple.html">
@ -321,7 +308,7 @@
</li>
<li class="chapter " data-level="1.8.2" data-path="customization/advanced.html">
<li class="chapter " data-level="1.7.2" data-path="customization/advanced.html">
<a href="customization/advanced.html">
@ -339,7 +326,7 @@
</li>
<li class="chapter " data-level="1.9" data-path="creating-presets.html">
<li class="chapter " data-level="1.8" data-path="creating-presets.html">
<a href="creating-presets.html">
@ -353,9 +340,9 @@
<ul class="articles">
<li class="chapter " data-level="1.9.1" data-path="presets/neutrino-lint-base/README.md">
<li class="chapter " data-level="1.8.1" data-path="presets/neutrino-lint-base/">
<span>
<a href="presets/neutrino-lint-base/">
Creating linting presets
@ -371,7 +358,7 @@
</li>
<li class="chapter " data-level="1.10" data-path="learning-resources.html">
<li class="chapter " data-level="1.9" data-path="learning-resources.html">
<a href="learning-resources.html">
@ -384,7 +371,7 @@
</li>
<li class="chapter " data-level="1.11" data-path="api/">
<li class="chapter " data-level="1.10" data-path="api/">
<a href="api/">
@ -397,7 +384,7 @@
</li>
<li class="chapter " data-level="1.12" data-path="cli/">
<li class="chapter " data-level="1.11" data-path="cli/">
<a href="cli/">
@ -410,33 +397,7 @@
</li>
<li class="chapter " data-level="1.13" data-path="upgrading-neutrino.html">
<a href="upgrading-neutrino.html">
Upgrading from v4 to v5
</a>
</li>
<li class="chapter " data-level="1.14" >
<a target="_blank" href="https://github.com/mozilla-neutrino/neutrino-dev/tree/docs-v4/docs">
v4 Documentation
</a>
</li>
<li class="chapter " data-level="1.15" data-path="contributing/">
<li class="chapter " data-level="1.12" data-path="contributing/">
<a href="contributing/">
@ -450,7 +411,7 @@
<ul class="articles">
<li class="chapter " data-level="1.15.1" data-path="contributing/development.html">
<li class="chapter " data-level="1.12.1" data-path="contributing/development.html">
<a href="contributing/development.html">
@ -463,7 +424,7 @@
</li>
<li class="chapter " data-level="1.15.2" data-path="contributing/code-of-conduct.html">
<li class="chapter " data-level="1.12.2" data-path="contributing/code-of-conduct.html">
<a href="contributing/code-of-conduct.html">
@ -591,7 +552,7 @@ you wish to install.</p>
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"Installation","level":"1.2","depth":1,"next":{"title":"Usage","level":"1.3","depth":1,"path":"usage.md","ref":"./usage.md","articles":[]},"previous":{"title":"Introduction","level":"1.1","depth":1,"path":"README.md","ref":"./README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"installation.md","mtime":"2017-02-20T16:07:00.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-15T14:46:02.288Z"},"basePath":".","book":{"language":""}});
gitbook.page.hasChanged({"page":{"title":"Installation","level":"1.2","depth":1,"next":{"title":"Usage","level":"1.3","depth":1,"path":"usage.md","ref":"usage.md","articles":[]},"previous":{"title":"Introduction","level":"1.1","depth":1,"path":"README.md","ref":"README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"installation.md","mtime":"2017-02-21T13:04:40.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-06T17:07:12.452Z"},"basePath":".","book":{"language":""}});
});
</script>
</div>

107
learning-resources.html

@ -64,7 +64,7 @@
<link rel="next" href="api/" />
<link rel="prev" href="presets/neutrino-lint-base/README.md" />
<link rel="prev" href="presets/neutrino-lint-base/" />
</head>
@ -158,20 +158,7 @@
</li>
<li class="chapter " data-level="1.6" data-path="middleware/">
<a href="middleware/">
Middleware
</a>
</li>
<li class="chapter " data-level="1.7" data-path="presets/">
<li class="chapter " data-level="1.6" data-path="presets/">
<a href="presets/">
@ -185,7 +172,7 @@
<ul class="articles">
<li class="chapter " data-level="1.7.1" data-path="presets/neutrino-preset-web/">
<li class="chapter " data-level="1.6.1" data-path="presets/neutrino-preset-web/">
<a href="presets/neutrino-preset-web/">
@ -198,7 +185,7 @@
</li>
<li class="chapter " data-level="1.7.2" data-path="presets/neutrino-preset-react/">
<li class="chapter " data-level="1.6.2" data-path="presets/neutrino-preset-react/">
<a href="presets/neutrino-preset-react/">
@ -211,7 +198,7 @@
</li>
<li class="chapter " data-level="1.7.3" data-path="presets/neutrino-preset-node/">
<li class="chapter " data-level="1.6.3" data-path="presets/neutrino-preset-node/">
<a href="presets/neutrino-preset-node/">
@ -224,7 +211,7 @@
</li>
<li class="chapter " data-level="1.7.4" data-path="presets/neutrino-preset-airbnb-base/">
<li class="chapter " data-level="1.6.4" data-path="presets/neutrino-preset-airbnb-base/">
<a href="presets/neutrino-preset-airbnb-base/">
@ -237,7 +224,7 @@
</li>
<li class="chapter " data-level="1.7.5" data-path="presets/neutrino-preset-karma/">
<li class="chapter " data-level="1.6.5" data-path="presets/neutrino-preset-karma/">
<a href="presets/neutrino-preset-karma/">
@ -250,7 +237,7 @@
</li>
<li class="chapter " data-level="1.7.6" data-path="presets/neutrino-preset-mocha/">
<li class="chapter " data-level="1.6.6" data-path="presets/neutrino-preset-mocha/">
<a href="presets/neutrino-preset-mocha/">
@ -263,7 +250,7 @@
</li>
<li class="chapter " data-level="1.7.7" data-path="presets/neutrino-preset-jest/">
<li class="chapter " data-level="1.6.7" data-path="presets/neutrino-preset-jest/">
<a href="presets/neutrino-preset-jest/">
@ -276,7 +263,7 @@
</li>
<li class="chapter " data-level="1.7.8" data-path="presets/community-presets.html">
<li class="chapter " data-level="1.6.8" data-path="presets/community-presets.html">
<a href="presets/community-presets.html">
@ -294,7 +281,7 @@
</li>
<li class="chapter " data-level="1.8" data-path="customization/">
<li class="chapter " data-level="1.7" data-path="customization/">
<a href="customization/">
@ -308,7 +295,7 @@
<ul class="articles">
<li class="chapter " data-level="1.8.1" data-path="customization/simple.html">
<li class="chapter " data-level="1.7.1" data-path="customization/simple.html">
<a href="customization/simple.html">
@ -321,7 +308,7 @@
</li>
<li class="chapter " data-level="1.8.2" data-path="customization/advanced.html">
<li class="chapter " data-level="1.7.2" data-path="customization/advanced.html">
<a href="customization/advanced.html">
@ -339,7 +326,7 @@
</li>
<li class="chapter " data-level="1.9" data-path="creating-presets.html">
<li class="chapter " data-level="1.8" data-path="creating-presets.html">
<a href="creating-presets.html">
@ -353,9 +340,9 @@
<ul class="articles">
<li class="chapter " data-level="1.9.1" data-path="presets/neutrino-lint-base/README.md">
<li class="chapter " data-level="1.8.1" data-path="presets/neutrino-lint-base/">
<span>
<a href="presets/neutrino-lint-base/">
Creating linting presets
@ -371,7 +358,7 @@
</li>
<li class="chapter active" data-level="1.10" data-path="learning-resources.html">
<li class="chapter active" data-level="1.9" data-path="learning-resources.html">
<a href="learning-resources.html">
@ -384,7 +371,7 @@
</li>
<li class="chapter " data-level="1.11" data-path="api/">
<li class="chapter " data-level="1.10" data-path="api/">
<a href="api/">
@ -397,7 +384,7 @@
</li>
<li class="chapter " data-level="1.12" data-path="cli/">
<li class="chapter " data-level="1.11" data-path="cli/">
<a href="cli/">
@ -410,33 +397,7 @@
</li>
<li class="chapter " data-level="1.13" data-path="upgrading-neutrino.html">
<a href="upgrading-neutrino.html">
Upgrading from v4 to v5
</a>
</li>
<li class="chapter " data-level="1.14" >
<a target="_blank" href="https://github.com/mozilla-neutrino/neutrino-dev/tree/docs-v4/docs">
v4 Documentation
</a>
</li>
<li class="chapter " data-level="1.15" data-path="contributing/">
<li class="chapter " data-level="1.12" data-path="contributing/">
<a href="contributing/">
@ -450,7 +411,7 @@
<ul class="articles">
<li class="chapter " data-level="1.15.1" data-path="contributing/development.html">
<li class="chapter " data-level="1.12.1" data-path="contributing/development.html">
<a href="contributing/development.html">
@ -463,7 +424,7 @@
</li>
<li class="chapter " data-level="1.15.2" data-path="contributing/code-of-conduct.html">
<li class="chapter " data-level="1.12.2" data-path="contributing/code-of-conduct.html">
<a href="contributing/code-of-conduct.html">
@ -531,20 +492,14 @@
tutorials, screencasts, videos, starter repos, and more. If you would like to submit a resource for the benefit of the
community, file an issue or submit a pull request.</p>
<h2 id="blog-posts--tutorials">Blog Posts &amp; Tutorials</h2>
<ul>
<li><a href="https://davidwalsh.name/neutrino" target="_blank">Modern JavaScript Apps with Neutrino</a> by <a href="https://twitter.com/eliperelman" target="_blank">@eliperelman</a></li>
<li><a href="https://hacks.mozilla.org/2017/02/using-neutrino-for-modern-javascript-development/" target="_blank">Using Neutrino to jump-start modern JavaScript development</a> by <a href="https://twitter.com/eliperelman" target="_blank">@eliperelman</a></li>
<li><a href="https://davidwalsh.name/neutrino-linting" target="_blank">Custom Neutrino Linting</a> by <a href="https://twitter.com/davidwalshblog" target="_blank">@davidwalshblog</a></li>
</ul>
<p><a href="https://davidwalsh.name/neutrino" target="_blank">Modern JavaScript Apps with Neutrino</a> by <a href="https://twitter.com/eliperelman" target="_blank">@eliperelman</a></p>
<h2 id="screencasts--videos">Screencasts &amp; Videos</h2>
<h2 id="starter-kit-repositories">Starter Kit Repositories</h2>
<ul>
<li><a href="https://github.com/mozilla-neutrino/node-starter" target="_blank">mozilla-neutrino/node-starter</a></li>
<li><a href="https://github.com/mozilla-neutrino/express-starter" target="_blank">mozilla-neutrino/express-starter</a></li>
<li><a href="https://github.com/mozilla-neutrino/react-starter" target="_blank">mozilla-neutrino/react-starter</a></li>
<li><a href="https://github.com/mozilla-neutrino/web-starter" target="_blank">mozilla-neutrino/web-starter</a></li>
<li><a href="https://github.com/jerolimov/feathers-starter" target="_blank">jerolimov/feathers-starter</a></li>
</ul>
<h2 id="starter-repositories">Starter Repositories</h2>
<p><a href="https://github.com/mozilla-neutrino/node-starter" target="_blank">Node.js Quickstart Kit</a></p>
<p><a href="https://github.com/mozilla-neutrino/express-starter" target="_blank">Express Quickstart Kit</a></p>
<p><a href="https://github.com/mozilla-neutrino/react-starter" target="_blank">React Quickstart Kit</a></p>
<p><a href="https://github.com/mozilla-neutrino/web-starter" target="_blank">Web Quickstart Kit</a></p>
<p><a href="https://github.com/jerolimov/feathers-starter" target="_blank">jerolimov/feathers-starter</a></p>
</section>
@ -572,7 +527,7 @@ community, file an issue or submit a pull request.</p>
<a href="presets/neutrino-lint-base/README.md" class="navigation navigation-prev " aria-label="Previous page: Creating linting presets">
<a href="presets/neutrino-lint-base/" class="navigation navigation-prev " aria-label="Previous page: Creating linting presets">
<i class="fa fa-angle-left"></i>
</a>
@ -588,7 +543,7 @@ community, file an issue or submit a pull request.</p>
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"Learning Resources","level":"1.10","depth":1,"next":{"title":"API","level":"1.11","depth":1,"path":"api/README.md","ref":"./api/README.md","articles":[]},"previous":{"title":"Creating linting presets","level":"1.9.1","depth":2,"path":"presets/neutrino-lint-base/README.md","ref":"./presets/neutrino-lint-base/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"learning-resources.md","mtime":"2017-03-15T13:20:51.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-15T14:46:02.288Z"},"basePath":".","book":{"language":""}});
gitbook.page.hasChanged({"page":{"title":"Learning Resources","level":"1.9","depth":1,"next":{"title":"API","level":"1.10","depth":1,"path":"api/README.md","ref":"api/README.md","articles":[]},"previous":{"title":"Creating linting presets","level":"1.8.1","depth":2,"path":"presets/neutrino-lint-base/README.md","ref":"presets/neutrino-lint-base/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"learning-resources.md","mtime":"2017-03-01T15:25:58.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-06T17:07:12.452Z"},"basePath":".","book":{"language":""}});
});
</script>
</div>

720
middleware/index.html

@ -1,720 +0,0 @@
<!DOCTYPE HTML>
<html lang="" >
<head>
<meta charset="UTF-8">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>Middleware · Neutrino</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="description" content="">
<meta name="generator" content="GitBook 3.2.2">
<link rel="stylesheet" href="../gitbook/style.css">
<link rel="stylesheet" href="../gitbook/gitbook-plugin-prism/prism.css">
<link rel="stylesheet" href="../gitbook/gitbook-plugin-npmsearchlist/styles.css">
<link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
<link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
<meta name="HandheldFriendly" content="true"/>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
<link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
<link rel="next" href="../presets/" />
<link rel="prev" href="../FAQ.html" />
</head>
<body>
<div class="book">
<div class="book-summary">
<div id="book-search-input" role="search">
<input type="text" placeholder="Type to search" />
</div>
<nav role="navigation">
<ul class="summary">
<li class="chapter " data-level="1.1" data-path="../">
<a href="../">
Introduction
</a>
</li>
<li class="chapter " data-level="1.2" data-path="../installation.html">
<a href="../installation.html">
Installation
</a>
</li>
<li class="chapter " data-level="1.3" data-path="../usage.html">
<a href="../usage.html">
Usage
</a>
</li>
<li class="chapter " data-level="1.4" data-path="../project-layout.html">
<a href="../project-layout.html">
Project Layout
</a>
</li>
<li class="chapter " data-level="1.5" data-path="../FAQ.html">
<a href="../FAQ.html">
FAQ
</a>
</li>
<li class="chapter active" data-level="1.6" data-path="./">
<a href="./">
Middleware
</a>
</li>
<li class="chapter " data-level="1.7" data-path="../presets/">
<a href="../presets/">
Presets
</a>
<ul class="articles">
<li class="chapter " data-level="1.7.1" data-path="../presets/neutrino-preset-web/">
<a href="../presets/neutrino-preset-web/">
Web
</a>
</li>
<li class="chapter " data-level="1.7.2" data-path="../presets/neutrino-preset-react/">
<a href="../presets/neutrino-preset-react/">
React
</a>
</li>
<li class="chapter " data-level="1.7.3" data-path="../presets/neutrino-preset-node/">
<a href="../presets/neutrino-preset-node/">
Node.js
</a>
</li>
<li class="chapter " data-level="1.7.4" data-path="../presets/neutrino-preset-airbnb-base/">
<a href="../presets/neutrino-preset-airbnb-base/">
Airbnb
</a>
</li>
<li class="chapter " data-level="1.7.5" data-path="../presets/neutrino-preset-karma/">
<a href="../presets/neutrino-preset-karma/">
Karma
</a>
</li>
<li class="chapter " data-level="1.7.6" data-path="../presets/neutrino-preset-mocha/">
<a href="../presets/neutrino-preset-mocha/">
Mocha
</a>
</li>
<li class="chapter " data-level="1.7.7" data-path="../presets/neutrino-preset-jest/">
<a href="../presets/neutrino-preset-jest/">
Jest
</a>
</li>
<li class="chapter " data-level="1.7.8" data-path="../presets/community-presets.html">
<a href="../presets/community-presets.html">
Community presets
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.8" data-path="../customization/">
<a href="../customization/">
Customization
</a>
<ul class="articles">
<li class="chapter " data-level="1.8.1" data-path="../customization/simple.html">
<a href="../customization/simple.html">
Simple
</a>
</li>
<li class="chapter " data-level="1.8.2" data-path="../customization/advanced.html">
<a href="../customization/advanced.html">
Advanced
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.9" data-path="../creating-presets.html">
<a href="../creating-presets.html">
Creating presets
</a>
<ul class="articles">
<li class="chapter " data-level="1.9.1" data-path="../presets/neutrino-lint-base/README.md">
<span>
Creating linting presets
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.10" data-path="../learning-resources.html">
<a href="../learning-resources.html">
Learning Resources
</a>
</li>
<li class="chapter " data-level="1.11" data-path="../api/">
<a href="../api/">
API
</a>
</li>
<li class="chapter " data-level="1.12" data-path="../cli/">
<a href="../cli/">
CLI
</a>
</li>
<li class="chapter " data-level="1.13" data-path="../upgrading-neutrino.html">
<a href="../upgrading-neutrino.html">
Upgrading from v4 to v5
</a>
</li>
<li class="chapter " data-level="1.14" >
<a target="_blank" href="https://github.com/mozilla-neutrino/neutrino-dev/tree/docs-v4/docs">
v4 Documentation
</a>
</li>
<li class="chapter " data-level="1.15" data-path="../contributing/">
<a href="../contributing/">
Contributing
</a>
<ul class="articles">
<li class="chapter " data-level="1.15.1" data-path="../contributing/development.html">
<a href="../contributing/development.html">
Development Process
</a>
</li>
<li class="chapter " data-level="1.15.2" data-path="../contributing/code-of-conduct.html">
<a href="../contributing/code-of-conduct.html">
Code of Conduct
</a>
</li>
</ul>
</li>
<li class="divider"></li>
<li>
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
Published with GitBook
</a>
</li>
</ul>
</nav>
</div>
<div class="book-body">
<div class="body-inner">
<div class="book-header" role="navigation">
<!-- Title -->
<h1>
<i class="fa fa-circle-o-notch fa-spin"></i>
<a href=".." >Middleware</a>
</h1>
</div>
<div class="page-wrapper" tabindex="-1" role="main">
<div class="page-inner">
<div id="book-search-results">
<div class="search-noresults">
<section class="normal markdown-section">
<h1 id="middleware">Middleware</h1>
<p>The basic unit of interacting with Neutrino is middleware. In Neutrino, middleware are functions
that are provided a Neutrino instance for the intent of modifying configuration, listening for
events, getting build metadata, or augmenting with custom functionality. At its simplest, a middleware
function accepts a Neutrino instance argument and does nothing:</p>
<pre class="language-"><code class="lang-js"><span class="token keyword">function</span> <span class="token function">middleware</span><span class="token punctuation">(</span>neutrino<span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span>
</code></pre>
<p>A middleware function can also optionally accept an <code>options</code> argument which will be fed back into
the middleware function when used.</p>
<pre class="language-"><code class="lang-js"><span class="token keyword">function</span> <span class="token function">middleware</span><span class="token punctuation">(</span>neutrino<span class="token punctuation">,</span> options<span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span>
</code></pre>
<p>The signature of this function is what we call &quot;Neutrino middleware&quot;. If you&apos;re familiar with middleware from the
Express/connect world, this works similarly. When using Express middleware, you provide a function to Express which
receives arguments to modify a request or response along its lifecycle. There can be a number of middleware functions
that Express can load, each one potentially modifying a request or response in succession.</p>
<p>Neutrino will execute middleware similarly, where each middleware function successively interacts with Neutrino along
the lifecycle. This is done by plugging in the middleware to Neutrino via the <code>use()</code> method.</p>
<pre class="language-"><code class="lang-js"><span class="token keyword">const</span> api <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">Neutrino</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
api<span class="token punctuation">.</span><span class="token function">use</span><span class="token punctuation">(</span>middleware<span class="token punctuation">)</span><span class="token punctuation">;</span>
api<span class="token punctuation">.</span><span class="token function">use</span><span class="token punctuation">(</span>middleware<span class="token punctuation">,</span> options<span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
<p>To use a concrete example, let&apos;s create middleware that adds an environment plugin:</p>
<pre class="language-"><code class="lang-js"><span class="token keyword">const</span> Neutrino <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&apos;neutrino&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">const</span> <span class="token punctuation">{</span> EnvironmentPlugin <span class="token punctuation">}</span> <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&apos;webpack&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">const</span> api <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">Neutrino</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">function</span> <span class="token function">env</span><span class="token punctuation">(</span>neutrino<span class="token punctuation">,</span> additionalVars <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
neutrino<span class="token punctuation">.</span>config
<span class="token punctuation">.</span><span class="token function">plugin</span><span class="token punctuation">(</span><span class="token string">&apos;env&apos;</span><span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">use</span><span class="token punctuation">(</span>EnvironmentPlugin<span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token string">&apos;NODE_ENV&apos;</span><span class="token punctuation">,</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>additionalVars<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
api<span class="token punctuation">.</span><span class="token function">use</span><span class="token punctuation">(</span>env<span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment" spellcheck="true">// or:</span>
api<span class="token punctuation">.</span><span class="token function">use</span><span class="token punctuation">(</span>env<span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token string">&apos;SECRET_KEY&apos;</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
<h2 id="loading-middleware">Loading middleware</h2>
<p>Additional middleware can also be loaded from a middleware function. This makes their composition simpler for
consumers.</p>
<pre class="language-"><code class="lang-js"><span class="token comment" spellcheck="true">// neutrino-middleware-env</span>
<span class="token keyword">const</span> <span class="token punctuation">{</span> EnvironmentPlugin <span class="token punctuation">}</span> <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&apos;webpack&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
module<span class="token punctuation">.</span>exports <span class="token operator">=</span> <span class="token punctuation">(</span>neutrino<span class="token punctuation">,</span> additionalVars <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">)</span> <span class="token operator">=</span><span class="token operator">&gt;</span> neutrino<span class="token punctuation">.</span>config
<span class="token punctuation">.</span><span class="token function">plugin</span><span class="token punctuation">(</span><span class="token string">&apos;env&apos;</span><span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">use</span><span class="token punctuation">(</span>EnvironmentPlugin<span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token string">&apos;NODE_ENV&apos;</span><span class="token punctuation">,</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>additionalVars<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
<pre class="language-"><code class="lang-js"><span class="token comment" spellcheck="true">// react preset (which is also middleware)</span>
<span class="token keyword">const</span> env <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&apos;./neutrino-middleware-env&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
module<span class="token punctuation">.</span>exports <span class="token operator">=</span> neutrino <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
neutrino<span class="token punctuation">.</span><span class="token function">use</span><span class="token punctuation">(</span>env<span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token string">&apos;SECRET_KEY&apos;</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
neutrino<span class="token punctuation">.</span><span class="token function">use</span><span class="token punctuation">(</span><span class="token comment" spellcheck="true">/* next middleware */</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
neutrino<span class="token punctuation">.</span><span class="token function">use</span><span class="token punctuation">(</span><span class="token comment" spellcheck="true">/* next middleware */</span><span class="token punctuation">)</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
<h2 id="configuring">Configuring</h2>
<p>If your middleware requires configuration <em>outside</em> of the options necessary for <em>running</em> the middleware,
use a closure technique for simplifying this for your middleware consumers. In short, your module will provide a
function to consumers which, when executed, will return a Neutrino middleware function. Describing this in code:</p>
<pre class="language-"><code class="lang-js">module<span class="token punctuation">.</span>exports <span class="token operator">=</span> <span class="token keyword">function</span> <span class="token function">wrapper</span><span class="token punctuation">(</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>args<span class="token punctuation">)</span> <span class="token punctuation">{</span>
<span class="token keyword">return</span> <span class="token keyword">function</span> <span class="token function">middleware</span><span class="token punctuation">(</span>neutrino<span class="token punctuation">,</span> options<span class="token punctuation">)</span> <span class="token punctuation">{</span>
<span class="token comment" spellcheck="true">// do something with neutrino, options, and args</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
<p>Let&apos;s create a contrived example using our <code>env</code> middleware. Let&apos;s use a closure to let the consumer provide an
alternate plugin name when creating the middleware:</p>
<pre class="language-"><code class="lang-js"><span class="token comment" spellcheck="true">// neutrino-middleware-env</span>
<span class="token keyword">const</span> <span class="token punctuation">{</span> EnvironmentPlugin <span class="token punctuation">}</span> <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&apos;webpack&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
module<span class="token punctuation">.</span>exports <span class="token operator">=</span> <span class="token punctuation">(</span>pluginName <span class="token operator">=</span> <span class="token string">&apos;env&apos;</span><span class="token punctuation">)</span> <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">(</span>neutrino<span class="token punctuation">,</span> additionalVars <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">)</span> <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
neutrino<span class="token punctuation">.</span>config
<span class="token punctuation">.</span><span class="token function">plugin</span><span class="token punctuation">(</span>pluginName<span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">use</span><span class="token punctuation">(</span>EnvironmentPlugin<span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token string">&apos;NODE_ENV&apos;</span><span class="token punctuation">,</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>additionalVars<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
<pre class="language-"><code class="lang-js"><span class="token comment" spellcheck="true">// react preset (which is also middleware)</span>
<span class="token keyword">const</span> env <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&apos;./neutrino-middleware-env&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
module<span class="token punctuation">.</span>exports <span class="token operator">=</span> neutrino <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
neutrino<span class="token punctuation">.</span><span class="token function">use</span><span class="token punctuation">(</span><span class="token function">env</span><span class="token punctuation">(</span><span class="token string">&apos;ENV-PLUGIN&apos;</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token string">&apos;SECRET_KEY&apos;</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
<h2 id="distributing">Distributing</h2>
<p>If you would like your middleware to be used by others, feel free to publish and distribute! By putting your middleware
on npm, GitHub, or another location, you can share the hard work put into abstracting away Neutrino and Webpack
interactions and save everyone in the community time and effort. As long as the Neutrino CLI, other middleware, or
presets can require your middleware, it puts no restrictions on where you want to host it.</p>
<h2 id="core-middleware">Core middleware</h2>
<p>Neutrino maintains a number of core middleware packages which aid in creating the various preset packages we also
distribute. Continue onward for documentation on these various middleware packages.</p>
</section>
</div>
<div class="search-results">
<div class="has-results">
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
<ul class="search-results-list"></ul>
</div>
<div class="no-results">
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
</div>
</div>
</div>
</div>
</div>
</div>
<a href="../FAQ.html" class="navigation navigation-prev " aria-label="Previous page: FAQ">
<i class="fa fa-angle-left"></i>
</a>
<a href="../presets/" class="navigation navigation-next " aria-label="Next page: Presets">
<i class="fa fa-angle-right"></i>
</a>
</div>
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"Middleware","level":"1.6","depth":1,"next":{"title":"Presets","level":"1.7","depth":1,"path":"presets/README.md","ref":"./presets/README.md","articles":[{"title":"Web","level":"1.7.1","depth":2,"path":"presets/neutrino-preset-web/README.md","ref":"./presets/neutrino-preset-web/README.md","articles":[]},{"title":"React","level":"1.7.2","depth":2,"path":"presets/neutrino-preset-react/README.md","ref":"./presets/neutrino-preset-react/README.md","articles":[]},{"title":"Node.js","level":"1.7.3","depth":2,"path":"presets/neutrino-preset-node/README.md","ref":"./presets/neutrino-preset-node/README.md","articles":[]},{"title":"Airbnb","level":"1.7.4","depth":2,"path":"presets/neutrino-preset-airbnb-base/README.md","ref":"./presets/neutrino-preset-airbnb-base/README.md","articles":[]},{"title":"Karma","level":"1.7.5","depth":2,"path":"presets/neutrino-preset-karma/README.md","ref":"./presets/neutrino-preset-karma/README.md","articles":[]},{"title":"Mocha","level":"1.7.6","depth":2,"path":"presets/neutrino-preset-mocha/README.md","ref":"./presets/neutrino-preset-mocha/README.md","articles":[]},{"title":"Jest","level":"1.7.7","depth":2,"path":"presets/neutrino-preset-jest/README.md","ref":"./presets/neutrino-preset-jest/README.md","articles":[]},{"title":"Community presets","level":"1.7.8","depth":2,"path":"presets/community-presets.md","ref":"./presets/community-presets.md","articles":[]}]},"previous":{"title":"FAQ","level":"1.5","depth":1,"path":"FAQ.md","ref":"./FAQ.md","articles":[]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"middleware/README.md","mtime":"2017-03-15T13:20:51.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-15T14:46:02.288Z"},"basePath":"..","book":{"language":""}});
});
</script>
</div>
<script src="../gitbook/gitbook.js"></script>
<script src="../gitbook/theme.js"></script>
<script src="../gitbook/gitbook-plugin-edit-link/plugin.js"></script>
<script src="../gitbook/gitbook-plugin-github/plugin.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/3.1.1/anchor.min.js"></script>
<script src="../gitbook/gitbook-plugin-anchorjs/anchor-style.js"></script>
<script src="../gitbook/gitbook-plugin-npmsearchlist/script.js"></script>
<script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
<script src="../gitbook/gitbook-plugin-search/search.js"></script>
<script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
<script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
<script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
<script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
</body>
</html>

71
middleware/neutrino-middleware-banner/README.md

@ -1,71 +0,0 @@
# Neutrino Banner Middleware
[![NPM version][npm-image]][npm-url] [![NPM downloads][npm-downloads]][npm-url] [![Join Slack][slack-image]][slack-url]
`neutrino-middleware-banner` is Neutrino middleware for injecting string content into source code files.
## Requirements
- Node.js v6.9+
- Yarn or npm client
- Neutrino v5
## Installation
`neutrino-middleware-banner` can be installed via the Yarn or npm clients.
#### Yarn
```bash
❯ yarn add neutrino-middleware-banner
```
#### npm
```bash
❯ npm install --save neutrino-middleware-banner
```
## Usage
`neutrino-middleware-banner` can be consumed from the Neutrino API, middleware, or presets. Require this package
and plug it into Neutrino:
```js
const banner = require('neutrino-middleware-banner');
// Use with default options
neutrino.use(banner);
// Also accepts options for Webpack's BannerPlugin
// https://webpack.js.org/plugins/banner-plugin/
// Usage shows the default values of this middleware:
neutrino.use(banner, {
banner: `require('source-map-support').install();`,
raw: true,
entryOnly: true
});
```
## Customization
`neutrino-middleware-banner` creates some conventions to make overriding the configuration easier once you are ready to
make changes.
### Plugins
The following is a list of plugins and their identifiers which can be overridden:
- `banner`: Injects string content into application source code.
## Contributing
This preset is part of the [neutrino-dev](https://github.com/mozilla-neutrino/neutrino-dev) repository, a monorepo
containing all resources for developing Neutrino and its core presets. Follow the
[contributing guide](../../contributing/README.md) for details.
[npm-image]: https://img.shields.io/npm/v/neutrino-middleware-banner.svg
[npm-downloads]: https://img.shields.io/npm/dt/neutrino-middleware-banner.svg
[npm-url]: https://npmjs.org/package/neutrino-middleware-banner
[slack-image]: https://neutrino-slack.herokuapp.com/badge.svg
[slack-url]: https://neutrino-slack.herokuapp.com/

71
middleware/neutrino-middleware-chunk/README.md

@ -1,71 +0,0 @@
# Neutrino Chunk Middleware
[![NPM version][npm-image]][npm-url] [![NPM downloads][npm-downloads]][npm-url] [![Join Slack][slack-image]][slack-url]
`neutrino-middleware-chunk` is Neutrino middleware for optimizing Webpack bundles via `CommonsChunkPlugin`.
## Requirements
- Node.js v6.9+
- Yarn or npm client
- Neutrino v5
## Installation
`neutrino-middleware-chunk` can be installed via the Yarn or npm clients.
#### Yarn
```bash
❯ yarn add neutrino-middleware-chunk
```
#### npm
```bash
❯ npm install --save neutrino-middleware-chunk
```
## Usage
`neutrino-middleware-chunk` can be consumed from the Neutrino API, middleware, or presets. Require this package
and plug it into Neutrino:
```js
const chunk = require('neutrino-middleware-chunk');
// Use with default options
neutrino.use(chunk);
// Also accepts options for Webpack's CommonsChunkPlugin
// https://webpack.js.org/plugins/commons-chunk-plugin/
// Usage shows the default values of this middleware:
neutrino.use(chunk, {
minChunks: Infinity,
names: ['vendor', 'manifest']
});
```
## Customization
`neutrino-middleware-chunk` creates some conventions to make overriding the configuration easier once you are ready to
make changes.
### Plugins
The following is a list of plugins and their identifiers which can be overridden:
- `chunk`: Creates a separate file (known as a chunk), consisting of common modules shared between multiple entry
points.
## Contributing
This preset is part of the [neutrino-dev](https://github.com/mozilla-neutrino/neutrino-dev) repository, a monorepo
containing all resources for developing Neutrino and its core presets. Follow the
[contributing guide](../../contributing/README.md) for details.
[npm-image]: https://img.shields.io/npm/v/neutrino-middleware-chunk.svg
[npm-downloads]: https://img.shields.io/npm/dt/neutrino-middleware-chunk.svg
[npm-url]: https://npmjs.org/package/neutrino-middleware-chunk
[slack-image]: https://neutrino-slack.herokuapp.com/badge.svg
[slack-url]: https://neutrino-slack.herokuapp.com/

67
middleware/neutrino-middleware-clean/README.md

@ -1,67 +0,0 @@
# Neutrino Clean Middleware
[![NPM version][npm-image]][npm-url] [![NPM downloads][npm-downloads]][npm-url] [![Join Slack][slack-image]][slack-url]
`neutrino-middleware-clean` is Neutrino middleware for removing directories before building.
## Requirements
- Node.js v6.9+
- Yarn or npm client
- Neutrino v5
## Installation
`neutrino-middleware-clean` can be installed via the Yarn or npm clients.
#### Yarn
```bash
❯ yarn add neutrino-middleware-clean
```
#### npm
```bash
❯ npm install --save neutrino-middleware-clean
```
## Usage
`neutrino-middleware-clean` can be consumed from the Neutrino API, middleware, or presets. Require this package
and plug it into Neutrino:
```js
const clean = require('neutrino-middleware-clean');
// Use with default options
neutrino.use(clean);
// Usage shows the default values of this middleware:
neutrino.use(clean, {
paths: [],
root: neutrino.options.root
});
```
## Customization
`neutrino-middleware-clean` creates some conventions to make overriding the configuration easier once you are ready to
make changes.
### Plugins
The following is a list of plugins and their identifiers which can be overridden:
- `clean`: Removes directories before building.
## Contributing
This preset is part of the [neutrino-dev](https://github.com/mozilla-neutrino/neutrino-dev) repository, a monorepo
containing all resources for developing Neutrino and its core presets. Follow the
[contributing guide](../../contributing/README.md) for details.
[npm-image]: https://img.shields.io/npm/v/neutrino-middleware-clean.svg
[npm-downloads]: https://img.shields.io/npm/dt/neutrino-middleware-clean.svg
[npm-url]: https://npmjs.org/package/neutrino-middleware-clean
[slack-image]: https://neutrino-slack.herokuapp.com/badge.svg
[slack-url]: https://neutrino-slack.herokuapp.com/

69
middleware/neutrino-middleware-compile-loader/README.md

@ -1,69 +0,0 @@
# Neutrino Compile Loader Middleware
[![NPM version][npm-image]][npm-url] [![NPM downloads][npm-downloads]][npm-url] [![Join Slack][slack-image]][slack-url]
`neutrino-middleware-compile-loader` is Neutrino middleware for compiling source code with Babel.
## Requirements
- Node.js v6.9+
- Yarn or npm client
- Neutrino v5
## Installation
`neutrino-middleware-compile-loader` can be installed via the Yarn or npm clients.
#### Yarn
```bash
❯ yarn add neutrino-middleware-compile-loader
```
#### npm
```bash
❯ npm install --save neutrino-middleware-compile-loader
```
## Usage
`neutrino-middleware-compile-loader` can be consumed from the Neutrino API, middleware, or presets. Require this package
and plug it into Neutrino:
```js
const compile = require('neutrino-middleware-compile-loader');
neutrino.use(compile, {
include: [],
exclude: [],
babel: {}
});
```
- `include` should be an array of paths to include in the compilation. Maps to Webpack's
[`Rule.include`](https://webpack.js.org/configuration/module/#rule-include)
- `babel` is a [Babel configuration object](https://babeljs.io/docs/usage/api/#options), consumed by babel-loader. Use
this to set properties such as `presets`, `plugins`, and `env`.
## Customization
`neutrino-middleware-compile-loader` creates some conventions to make overriding the configuration easier once you are
ready to make changes.
### Rules
The following is a list of rules and their identifiers which can be overridden:
- `compile`: Compiles JS and JSX files from the `src` directory using Babel. Contains a single loader named `babel`.
## Contributing
This preset is part of the [neutrino-dev](https://github.com/mozilla-neutrino/neutrino-dev) repository, a monorepo
containing all resources for developing Neutrino and its core presets. Follow the
[contributing guide](../../contributing/README.md) for details.
[npm-image]: https://img.shields.io/npm/v/neutrino-middleware-compile-loader.svg
[npm-downloads]: https://img.shields.io/npm/dt/neutrino-middleware-compile-loader.svg
[npm-url]: https://npmjs.org/package/neutrino-middleware-compile-loader
[slack-image]: https://neutrino-slack.herokuapp.com/badge.svg
[slack-url]: https://neutrino-slack.herokuapp.com/

73
middleware/neutrino-middleware-copy/README.md

@ -1,73 +0,0 @@
# Neutrino Copy Middleware
[![NPM version][npm-image]][npm-url] [![NPM downloads][npm-downloads]][npm-url] [![Join Slack][slack-image]][slack-url]
`neutrino-middleware-copy` is Neutrino middleware for copying files during building.
## Requirements
- Node.js v6.9+
- Yarn or npm client
- Neutrino v5
## Installation
`neutrino-middleware-copy` can be installed via the Yarn or npm clients.
#### Yarn
```bash
❯ yarn add neutrino-middleware-copy
```
#### npm
```bash
❯ npm install --save neutrino-middleware-copy
```
## Usage
`neutrino-middleware-copy` can be consumed from the Neutrino API, middleware, or presets. Require this package
and plug it into Neutrino:
```js
const copy = require('neutrino-middleware-copy');
// Use with default options
neutrino.use(copy);
// Usage shows the default values of this middleware:
neutrino.use(copy, {
patterns: [],
options: {}
});
```
The `patterns` and `options` are defined from the [CopyWebpackPlugin](https://github.com/kevlened/copy-webpack-plugin).
See their docs for details on valid values to specify.
- `patterns`: An array of patterns specifying copy operations.
- `options`: An object specifying copy options.
## Customization
`neutrino-middleware-copy` creates some conventions to make overriding the configuration easier once you are ready to
make changes.
### Plugins
The following is a list of plugins and their identifiers which can be overridden:
- `copy`: Copy files during building.
## Contributing
This preset is part of the [neutrino-dev](https://github.com/mozilla-neutrino/neutrino-dev) repository, a monorepo
containing all resources for developing Neutrino and its core presets. Follow the
[contributing guide](../../contributing/README.md) for details.
[npm-image]: https://img.shields.io/npm/v/neutrino-middleware-copy.svg
[npm-downloads]: https://img.shields.io/npm/dt/neutrino-middleware-copy.svg
[npm-url]: https://npmjs.org/package/neutrino-middleware-copy
[slack-image]: https://neutrino-slack.herokuapp.com/badge.svg
[slack-url]: https://neutrino-slack.herokuapp.com/

67
middleware/neutrino-middleware-env/README.md

@ -1,67 +0,0 @@
# Neutrino Environment Middleware
[![NPM version][npm-image]][npm-url] [![NPM downloads][npm-downloads]][npm-url] [![Join Slack][slack-image]][slack-url]
`neutrino-middleware-env` is Neutrino middleware for injecting environment variable definitions into
source code at `process.env`. Always injects `process.env.NODE_ENV`, unless overridden.
## Requirements
- Node.js v6.9+
- Yarn or npm client
- Neutrino v5
## Installation
`neutrino-middleware-env` can be installed via the Yarn or npm clients.
#### Yarn
```bash
❯ yarn add neutrino-middleware-env
```
#### npm
```bash
❯ npm install --save neutrino-middleware-env
```
## Usage
`neutrino-middleware-env` can be consumed from the Neutrino API, middleware, or presets. Require this package
and plug it into Neutrino:
```js
const env = require('neutrino-middleware-env');
// Use with default options
neutrino.use(env);
// Usage with additional environment variables
neutrino.use(env, ['SECRET_KEY']);
```
This middleware optionally accepts an array of environment variables to additionally inject into source code.
## Customization
`neutrino-middleware-env` creates some conventions to make overriding the configuration easier once you are ready to
make changes.
### Plugins
The following is a list of plugins and their identifiers which can be overridden:
- `env`: Inject environment variables into source code at `process.env`.
## Contributing
This preset is part of the [neutrino-dev](https://github.com/mozilla-neutrino/neutrino-dev) repository, a monorepo
containing all resources for developing Neutrino and its core presets. Follow the
[contributing guide](../../contributing/README.md) for details.
[npm-image]: https://img.shields.io/npm/v/neutrino-middleware-env.svg
[npm-downloads]: https://img.shields.io/npm/dt/neutrino-middleware-env.svg
[npm-url]: https://npmjs.org/package/neutrino-middleware-env
[slack-image]: https://neutrino-slack.herokuapp.com/badge.svg
[slack-url]: https://neutrino-slack.herokuapp.com/

138
middleware/neutrino-middleware-eslint/README.md

@ -1,138 +0,0 @@
# Neutrino ESLint Middleware
[![NPM version][npm-image]][npm-url] [![NPM downloads][npm-downloads]][npm-url] [![Join Slack][slack-image]][slack-url]
`neutrino-middleware-eslint` is Neutrino middleware for linting source code using ESLint and eslint-loader.
## Requirements
- Node.js v6.9+
- Yarn or npm client
- Neutrino v5
## Installation
`neutrino-middleware-eslint` can be installed via the Yarn or npm clients.
#### Yarn
```bash
❯ yarn add neutrino-middleware-eslint
```
#### npm
```bash
❯ npm install --save neutrino-middleware-eslint
```
## Usage
`neutrino-middleware-eslint` can be consumed from the Neutrino API, middleware, or presets. Require this package
and plug it into Neutrino:
```js
const eslint = require('neutrino-middleware-eslint');
// Usage shows default values
neutrino.use(eslint, {
test: /\.(js|jsx)$/,
include: [], /* Should specify either include or exclude */
exclude: [], /* Should specify either include or exclude */
eslint: {
failOnError: process.env.NODE_ENV !== 'development',
emitWarning: process.env.NODE_ENV !== 'development',
emitError: process.env.NODE_ENV !== 'development',
cwd: neutrino.options.root,
useEslintrc: false,
root: true,
plugins: ['babel'],
baseConfig: {},
envs: ['es6'],
parser: 'babel-eslint',
parserOptions: {
ecmaVersion: 2017,
sourceType: 'module',
ecmaFeatures: {
objectLiteralDuplicateProperties: false,
generators: true,
impliedStrict: true
}
},
settings: {},
globals: ['process'],
rules: {}
}
});
```
- `test`: Test which files should be linted.
- `include`: An array of paths to include in linting. Maps to Webpack's
[`Rule.include`](https://webpack.js.org/configuration/module/#rule-include)
- `exclude`: An array of paths to exclude from linting. Maps to Webpack's
[`Rule.exclude`](https://webpack.js.org/configuration/module/#rule-exclude)
- `eslint`: An ESLint CLIEngine configuration object for configuring ESLint. Use this to configure rules,
plugins, and other [ESLint options](http://eslint.org/docs/user-guide/configuring).
## Customization
`neutrino-middleware-eslint` creates some conventions to make overriding the configuration easier once you are ready to
make changes.
### Rules
The following is a list of rules and their identifiers which can be overridden:
- `lint`: By default, lints JS and JSX files from included directories using ESLint. Contains a single loader named
`eslint`.
## Information
This middleware will show errors and warnings in the console during development, and will cause a failure when
creating a build bundle.
---
If you want your preset or middleware to also extend from another **ESLint configuration or preset** that you have made
a dependency, you must use `baseConfig.extends` rather than just `extends`. This is a limitation of ESLint, not this
middleware.
---
This middleware only configures a target environment for `es6`, leaving other build middleware free to add their own
target environments. If your middleware puts restrictions on which environments it is capable of running, please
document that clearly in your middleware.
## eslintrc Config
`neutrino-middleware-eslint` also provides a method for getting the ESLint configuration suitable for use in an eslintrc
file. Typically this is used for providing hints or fix solutions to the development environment, e.g. IDEs and text
editors. Doing this requires [creating an instance of the Neutrino API](../../api/README.md) and providing the presets uses.
If you keep this information in `neutrino.presets` in package.json, this should be relatively straightforward. By
providing all the presets used to Neutrino, you can ensure all the linting options used across all presets will be
merged together for your development environment, without the need for copying, duplication, or loss of organization and
separation.
_Example: Create a .eslintrc.js file in the root of the project._
```js
// .eslintrc.js
const Neutrino = require('neutrino');
const pkg = require('./package.json');
const api = new Neutrino();
pkg.neutrino.presets.map(preset => neutrino.use(preset));
module.exports = api.eslintrc();
```
## Contributing
This preset is part of the [neutrino-dev](https://github.com/mozilla-neutrino/neutrino-dev) repository, a monorepo
containing all resources for developing Neutrino and its core presets. Follow the
[contributing guide](../../contributing/README.md) for details.
[npm-image]: https://img.shields.io/npm/v/neutrino-middleware-eslint.svg
[npm-downloads]: https://img.shields.io/npm/dt/neutrino-middleware-eslint.svg
[npm-url]: https://npmjs.org/package/neutrino-middleware-eslint
[slack-image]: https://neutrino-slack.herokuapp.com/badge.svg
[slack-url]: https://neutrino-slack.herokuapp.com/

70
middleware/neutrino-middleware-font-loader/README.md

@ -1,70 +0,0 @@
# Neutrino Font Loader Middleware
[![NPM version][npm-image]][npm-url] [![NPM downloads][npm-downloads]][npm-url] [![Join Slack][slack-image]][slack-url]
`neutrino-middleware-font-loader` is Neutrino middleware for loading and importing font files from modules.
## Requirements
- Node.js v6.9+
- Yarn or npm client
- Neutrino v5
## Installation
`neutrino-middleware-font-loader` can be installed via the Yarn or npm clients.
#### Yarn
```bash
❯ yarn add neutrino-middleware-font-loader
```
#### npm
```bash
❯ npm install --save neutrino-middleware-font-loader
```
## Usage
`neutrino-middleware-font-loader` can be consumed from the Neutrino API, middleware, or presets. Require this package
and plug it into Neutrino:
```js
const fonts = require('neutrino-middleware-font-loader');
// Use with default options
neutrino.use(fonts);
// Usage showing default options
neutrino.use(fonts, {
limit: '10000'
});
```
- `limit`: Return a Data URL if the file is smaller than a byte limit.
## Customization
`neutrino-middleware-font-loader` creates some conventions to make overriding the configuration easier once you are
ready to make changes.
### Rules
The following is a list of rules and their identifiers which can be overridden:
- `woff`: Allows importing WOFF font files from modules. Contains a single loader named `url`.
- `ttf`: Allows importing TTF font files from modules. Contains a single loader named `url`.
- `eot`: Allows importing EOT font files from modules. Contains a single loader named `file`.
## Contributing
This preset is part of the [neutrino-dev](https://github.com/mozilla-neutrino/neutrino-dev) repository, a monorepo
containing all resources for developing Neutrino and its core presets. Follow the
[contributing guide](../../contributing/README.md) for details.
[npm-image]: https://img.shields.io/npm/v/neutrino-middleware-font-loader.svg
[npm-downloads]: https://img.shields.io/npm/dt/neutrino-middleware-font-loader.svg
[npm-url]: https://npmjs.org/package/neutrino-middleware-font-loader
[slack-image]: https://neutrino-slack.herokuapp.com/badge.svg
[slack-url]: https://neutrino-slack.herokuapp.com/

61
middleware/neutrino-middleware-hot/README.md

@ -1,61 +0,0 @@
# Neutrino Hot Middleware
[![NPM version][npm-image]][npm-url] [![NPM downloads][npm-downloads]][npm-url] [![Join Slack][slack-image]][slack-url]
`neutrino-middleware-hot` is Neutrino middleware for enabled Hot Module Replacement with Webpack's
`HotModuleReplacementPlugin`. This middleware is usually only added during development.
## Requirements
- Node.js v6.9+
- Yarn or npm client
- Neutrino v5
## Installation
`neutrino-middleware-hot` can be installed via the Yarn or npm clients.
#### Yarn
```bash
❯ yarn add neutrino-middleware-hot
```
#### npm
```bash
❯ npm install --save neutrino-middleware-hot
```
## Usage
`neutrino-middleware-hot` can be consumed from the Neutrino API, middleware, or presets. Require this package
and plug it into Neutrino:
```js
const hot = require('neutrino-middleware-hot');
neutrino.use(hot);
```
## Customization
`neutrino-middleware-hot` creates some conventions to make overriding the configuration easier once you are ready to
make changes.
### Plugins
The following is a list of plugins and their identifiers which can be overridden:
- `hot`: Enables hot module replacement.
## Contributing
This preset is part of the [neutrino-dev](https://github.com/mozilla-neutrino/neutrino-dev) repository, a monorepo
containing all resources for developing Neutrino and its core presets. Follow the
[contributing guide](../../contributing/README.md) for details.
[npm-image]: https://img.shields.io/npm/v/neutrino-middleware-hot.svg
[npm-downloads]: https://img.shields.io/npm/dt/neutrino-middleware-hot.svg
[npm-url]: https://npmjs.org/package/neutrino-middleware-hot
[slack-image]: https://neutrino-slack.herokuapp.com/badge.svg
[slack-url]: https://neutrino-slack.herokuapp.com/

60
middleware/neutrino-middleware-html-loader/README.md

@ -1,60 +0,0 @@
# Neutrino HTML Loader Middleware
[![NPM version][npm-image]][npm-url] [![NPM downloads][npm-downloads]][npm-url] [![Join Slack][slack-image]][slack-url]
`neutrino-middleware-html-loader` is Neutrino middleware for loading and importing HTML files from modules.
## Requirements
- Node.js v6.9+
- Yarn or npm client
- Neutrino v5
## Installation
`neutrino-middleware-html-loader` can be installed via the Yarn or npm clients.
#### Yarn
```bash
❯ yarn add neutrino-middleware-html-loader
```
#### npm
```bash
❯ npm install --save neutrino-middleware-html-loader
```
## Usage
`neutrino-middleware-html-loader` can be consumed from the Neutrino API, middleware, or presets. Require this package
and plug it into Neutrino:
```js
const html = require('neutrino-middleware-html-loader');
neutrino.use(html);
```
## Customization
`neutrino-middleware-html-loader` creates some conventions to make overriding the configuration easier once you are
ready to make changes.
### Rules
The following is a list of rules and their identifiers which can be overridden:
- `html`: Allows importing HTML files from modules. Contains a single loader named `file`.
## Contributing
This preset is part of the [neutrino-dev](https://github.com/mozilla-neutrino/neutrino-dev) repository, a monorepo
containing all resources for developing Neutrino and its core presets. Follow the
[contributing guide](../../contributing/README.md) for details.
[npm-image]: https://img.shields.io/npm/v/neutrino-middleware-html-loader.svg
[npm-downloads]: https://img.shields.io/npm/dt/neutrino-middleware-html-loader.svg
[npm-url]: https://npmjs.org/package/neutrino-middleware-html-loader
[slack-image]: https://neutrino-slack.herokuapp.com/badge.svg
[slack-url]: https://neutrino-slack.herokuapp.com/

75
middleware/neutrino-middleware-html-template/README.md

@ -1,75 +0,0 @@
# Neutrino HTML Template Middleware
[![NPM version][npm-image]][npm-url] [![NPM downloads][npm-downloads]][npm-url] [![Join Slack][slack-image]][slack-url]
`neutrino-middleware-html-template` is Neutrino middleware for automatically creating HTML files for configured
entry-points.
## Requirements
- Node.js v6.9+
- Yarn or npm client
- Neutrino v5
## Installation
`neutrino-middleware-html-template` can be installed via the Yarn or npm clients.
#### Yarn
```bash
❯ yarn add neutrino-middleware-html-template
```
#### npm
```bash
❯ npm install --save neutrino-middleware-html-template
```
## Usage
`neutrino-middleware-html-template` can be consumed from the Neutrino API, middleware, or presets. Require this package
and plug it into Neutrino:
```js
const template = require('neutrino-middleware-html-template');
// Usage shows default values
// Accepts options specified by HtmlWebpackTemplate
// https://github.com/jaketrent/html-webpack-template
neutrino.use(template, {
inject: false,
appMountId: 'root',
xhtml: true,
mobile: true,
minify: {
useShortDoctype: true,
keepClosingSlash: true,
collapseWhitespace: true,
preserveLineBreaks: true
}
});
```
## Customization
`neutrino-middleware-html-template` creates some conventions to make overriding the configuration easier once you are ready to
make changes.
### Plugins
The following is a list of plugins and their identifiers which can be overridden:
- `html`: Automatically generates HTML files for configured entry-points.
## Contributing
This preset is part of the [neutrino-dev](https://github.com/mozilla-neutrino/neutrino-dev) repository, a monorepo
containing all resources for developing Neutrino and its core presets. Follow the
[contributing guide](../../contributing/README.md) for details.
[npm-image]: https://img.shields.io/npm/v/neutrino-middleware-html-template.svg
[npm-downloads]: https://img.shields.io/npm/dt/neutrino-middleware-html-template.svg
[npm-url]: https://npmjs.org/package/neutrino-middleware-html-template
[slack-image]: https://neutrino-slack.herokuapp.com/badge.svg
[slack-url]: https://neutrino-slack.herokuapp.com/

70
middleware/neutrino-middleware-image-loader/README.md

@ -1,70 +0,0 @@
# Neutrino Image Loader Middleware
[![NPM version][npm-image]][npm-url] [![NPM downloads][npm-downloads]][npm-url] [![Join Slack][slack-image]][slack-url]
`neutrino-middleware-image-loader` is Neutrino middleware for loading and importing image files from modules.
## Requirements
- Node.js v6.9+
- Yarn or npm client
- Neutrino v5
## Installation
`neutrino-middleware-image-loader` can be installed via the Yarn or npm clients.
#### Yarn
```bash
❯ yarn add neutrino-middleware-image-loader
```
#### npm
```bash
❯ npm install --save neutrino-middleware-image-loader
```
## Usage
`neutrino-middleware-image-loader` can be consumed from the Neutrino API, middleware, or presets. Require this package
and plug it into Neutrino:
```js
const images = require('neutrino-middleware-image-loader');
// Use with default options
neutrino.use(images);
// Usage showing default options
neutrino.use(images, {
limit: 8192
});
```
- `limit`: Return a Data URL if the file is smaller than a byte limit.
## Customization
`neutrino-middleware-image-loader` creates some conventions to make overriding the configuration easier once you are
ready to make changes.
### Rules
The following is a list of rules and their identifiers which can be overridden:
- `img`: Allows importing JPEG, PNG, and GIF files from modules. Contains a single loader named `url`.
- `svg`: Allows importing SVG files from modules. Contains a single loader named `url`.
- `ico`: Allows importing ICO files from modules. Contains a single loader named `url`.
## Contributing
This preset is part of the [neutrino-dev](https://github.com/mozilla-neutrino/neutrino-dev) repository, a monorepo
containing all resources for developing Neutrino and its core presets. Follow the
[contributing guide](../../contributing/README.md) for details.
[npm-image]: https://img.shields.io/npm/v/neutrino-middleware-image-loader.svg
[npm-downloads]: https://img.shields.io/npm/dt/neutrino-middleware-image-loader.svg
[npm-url]: https://npmjs.org/package/neutrino-middleware-image-loader
[slack-image]: https://neutrino-slack.herokuapp.com/badge.svg
[slack-url]: https://neutrino-slack.herokuapp.com/

75
middleware/neutrino-middleware-loader-merge/README.md

@ -1,75 +0,0 @@
# Neutrino Loader Merge Middleware
[![NPM version][npm-image]][npm-url] [![NPM downloads][npm-downloads]][npm-url] [![Join Slack][slack-image]][slack-url]
`neutrino-middleware-loader-merge` is Neutrino middleware for easily performing a deep merge of options into
a named rule and named loader in a Neutrino configuration.
## Requirements
- Node.js v6.9+
- Yarn or npm client
- Neutrino v5
## Installation
`neutrino-middleware-loader-merge` can be installed via the Yarn or npm clients.
#### Yarn
```bash
❯ yarn add neutrino-middleware-loader-merge
```
#### npm
```bash
❯ npm install --save neutrino-middleware-loader-merge
```
## Usage
`neutrino-middleware-loader-merge` can be consumed from the Neutrino API, middleware, or presets. Require this package
and plug it into Neutrino:
```js
const loaderMerge = require('neutrino-middleware-loader-merge');
neutrino.use(loaderMerge('compile', 'babel'), {
plugins: ['object-rest-spread']
});
// Equivalent to:
neutrino.config.module
.rule('compile')
.use('babel')
.tap(options => require('deepmerge')(options, {
plugins: ['object-rest-spread']
}));
```
This middleware is a factory intended to be invoked with a rule name and a loader name for which to extend the options.
Upon invoking, it will return a middleware function to be provided to Neutrino's `use()` method.
```js
const middleware = loaderMerge(ruleName, loaderName);
neutrino.use(middleware, options);
```
## Customization
`neutrino-middleware-loader-merge` does not create any of its own conventions; it is only middleware
for extending the options for a rule loader which has create its own conventions.
## Contributing
This preset is part of the [neutrino-dev](https://github.com/mozilla-neutrino/neutrino-dev) repository, a monorepo
containing all resources for developing Neutrino and its core presets. Follow the
[contributing guide](../../contributing/README.md) for details.
[npm-image]: https://img.shields.io/npm/v/neutrino-middleware-loader-merge.svg
[npm-downloads]: https://img.shields.io/npm/dt/neutrino-middleware-loader-merge.svg
[npm-url]: https://npmjs.org/package/neutrino-middleware-loader-merge
[slack-image]: https://neutrino-slack.herokuapp.com/badge.svg
[slack-url]: https://neutrino-slack.herokuapp.com/

62
middleware/neutrino-middleware-minify/README.md

@ -1,62 +0,0 @@
# Neutrino Minify Middleware
[![NPM version][npm-image]][npm-url] [![NPM downloads][npm-downloads]][npm-url] [![Join Slack][slack-image]][slack-url]
`neutrino-middleware-minify` is Neutrino middleware for minifying source code using
[`BabiliWebpackPlugin`](https://www.npmjs.com/package/babili-webpack-plugin). This middleware is usually only
added during production builds.
## Requirements
- Node.js v6.9+
- Yarn or npm client
- Neutrino v5
## Installation
`neutrino-middleware-minify` can be installed via the Yarn or npm clients.
#### Yarn
```bash
❯ yarn add neutrino-middleware-minify
```
#### npm
```bash
❯ npm install --save neutrino-middleware-minify
```
## Usage
`neutrino-middleware-minify` can be consumed from the Neutrino API, middleware, or presets. Require this package
and plug it into Neutrino:
```js
const minify = require('neutrino-middleware-minify');
neutrino.use(minify);
```
## Customization
`neutrino-middleware-minify` creates some conventions to make overriding the configuration easier once you are ready to
make changes.
### Plugins
The following is a list of plugins and their identifiers which can be overridden:
- `minify`: Minifies source code using `BabiliWebpackPlugin`.
## Contributing
This preset is part of the [neutrino-dev](https://github.com/mozilla-neutrino/neutrino-dev) repository, a monorepo
containing all resources for developing Neutrino and its core presets. Follow the
[contributing guide](../../contributing/README.md) for details.
[npm-image]: https://img.shields.io/npm/v/neutrino-middleware-minify.svg
[npm-downloads]: https://img.shields.io/npm/dt/neutrino-middleware-minify.svg
[npm-url]: https://npmjs.org/package/neutrino-middleware-minify
[slack-image]: https://neutrino-slack.herokuapp.com/badge.svg
[slack-url]: https://neutrino-slack.herokuapp.com/

60
middleware/neutrino-middleware-named-modules/README.md

@ -1,60 +0,0 @@
# Neutrino Named Modules Middleware
[![NPM version][npm-image]][npm-url] [![NPM downloads][npm-downloads]][npm-url] [![Join Slack][slack-image]][slack-url]
`neutrino-middleware-named-modules` is Neutrino middleware for enabling named modules output via `NamedModulesPlugin`.
## Requirements
- Node.js v6.9+
- Yarn or npm client
- Neutrino v5
## Installation
`neutrino-middleware-named-modules` can be installed via the Yarn or npm clients.
#### Yarn
```bash
❯ yarn add neutrino-middleware-named-modules
```
#### npm
```bash
❯ npm install --save neutrino-middleware-named-modules
```
## Usage
`neutrino-middleware-named-modules` can be consumed from the Neutrino API, middleware, or presets. Require this package
and plug it into Neutrino:
```js
const namedModules = require('neutrino-middleware-named-modules');
neutrino.use(namedModules);
```
## Customization
`neutrino-middleware-named-modules` creates some conventions to make overriding the configuration easier once you are
ready to make changes.
### Plugins
The following is a list of plugins and their identifiers which can be overridden:
- `named-modules`: Enables named modules for improved debugging and console output.
## Contributing
This preset is part of the [neutrino-dev](https://github.com/mozilla-neutrino/neutrino-dev) repository, a monorepo
containing all resources for developing Neutrino and its core presets. Follow the
[contributing guide](../../contributing/README.md) for details.
[npm-image]: https://img.shields.io/npm/v/neutrino-middleware-named-modules.svg
[npm-downloads]: https://img.shields.io/npm/dt/neutrino-middleware-named-modules.svg
[npm-url]: https://npmjs.org/package/neutrino-middleware-named-modules
[slack-image]: https://neutrino-slack.herokuapp.com/badge.svg
[slack-url]: https://neutrino-slack.herokuapp.com/

60
middleware/neutrino-middleware-progress/README.md

@ -1,60 +0,0 @@
# Neutrino Progress Middleware
[![NPM version][npm-image]][npm-url] [![NPM downloads][npm-downloads]][npm-url] [![Join Slack][slack-image]][slack-url]
`neutrino-middleware-progress` is Neutrino middleware for displaying a progress bar showing the progress of a build.
## Requirements
- Node.js v6.9+
- Yarn or npm client
- Neutrino v5
## Installation
`neutrino-middleware-progress` can be installed via the Yarn or npm clients.
#### Yarn
```bash
❯ yarn add neutrino-middleware-progress
```
#### npm
```bash
❯ npm install --save neutrino-middleware-progress
```
## Usage
`neutrino-middleware-progress` can be consumed from the Neutrino API, middleware, or presets. Require this package
and plug it into Neutrino:
```js
const progress = require('neutrino-middleware-progress');
neutrino.use(progress);
```
## Customization
`neutrino-middleware-progress` creates some conventions to make overriding the configuration easier once you are ready to
make changes.
### Plugins
The following is a list of plugins and their identifiers which can be overridden:
- `progress`: Displays a bar showing progression of build.
## Contributing
This preset is part of the [neutrino-dev](https://github.com/mozilla-neutrino/neutrino-dev) repository, a monorepo
containing all resources for developing Neutrino and its core presets. Follow the
[contributing guide](../../contributing/README.md) for details.
[npm-image]: https://img.shields.io/npm/v/neutrino-middleware-progress.svg
[npm-downloads]: https://img.shields.io/npm/dt/neutrino-middleware-progress.svg
[npm-url]: https://npmjs.org/package/neutrino-middleware-progress
[slack-image]: https://neutrino-slack.herokuapp.com/badge.svg
[slack-url]: https://neutrino-slack.herokuapp.com/

69
middleware/neutrino-middleware-start-server/README.md

@ -1,69 +0,0 @@
# Neutrino Start Server Middleware
[![NPM version][npm-image]][npm-url] [![NPM downloads][npm-downloads]][npm-url] [![Join Slack][slack-image]][slack-url]
`neutrino-middleware-start-server` is Neutrino middleware for starting a Node.js server for a file upon
completion of a build.
## Requirements
- Node.js v6.9+
- Yarn or npm client
- Neutrino v5
## Installation
`neutrino-middleware-start-server` can be installed via the Yarn or npm clients.
#### Yarn
```bash
❯ yarn add neutrino-middleware-start-server
```
#### npm
```bash
❯ npm install --save neutrino-middleware-start-server
```
## Usage
`neutrino-middleware-start-server` can be consumed from the Neutrino API, middleware, or presets. Require this package
and plug it into Neutrino:
```js
const server = require('neutrino-middleware-start-server');
// Use with default options, starting the server
// for the main entry point, neutrino.options.entry
neutrino.use(server);
// Usage with custom server file to start
neutrino.use(server, { name: 'custom.js' });
```
By default this middleware will start a server with the single entry point configured in Neutrino.
This middleware optionally accepts an object with a `name` property for a path to a module which to start the server.
## Customization
`neutrino-middleware-start-server` creates some conventions to make overriding the configuration easier once you are ready to
make changes.
### Plugins
The following is a list of plugins and their identifiers which can be overridden:
- `start-server`: Start a Node.js for a configured entry point or specified file.
## Contributing
This preset is part of the [neutrino-dev](https://github.com/mozilla-neutrino/neutrino-dev) repository, a monorepo
containing all resources for developing Neutrino and its core presets. Follow the
[contributing guide](../../contributing/README.md) for details.
[npm-image]: https://img.shields.io/npm/v/neutrino-middleware-start-server.svg
[npm-downloads]: https://img.shields.io/npm/dt/neutrino-middleware-start-server.svg
[npm-url]: https://npmjs.org/package/neutrino-middleware-start-server
[slack-image]: https://neutrino-slack.herokuapp.com/badge.svg
[slack-url]: https://neutrino-slack.herokuapp.com/

61
middleware/neutrino-middleware-style-loader/README.md

@ -1,61 +0,0 @@
# Neutrino Style Loader Middleware
[![NPM version][npm-image]][npm-url] [![NPM downloads][npm-downloads]][npm-url] [![Join Slack][slack-image]][slack-url]
`neutrino-middleware-style-loader` is Neutrino middleware for loading and importing stylesheets from modules.
## Requirements
- Node.js v6.9+
- Yarn or npm client
- Neutrino v5
## Installation
`neutrino-middleware-style-loader` can be installed via the Yarn or npm clients.
#### Yarn
```bash
❯ yarn add neutrino-middleware-style-loader
```
#### npm
```bash
❯ npm install --save neutrino-middleware-style-loader
```
## Usage
`neutrino-middleware-style-loader` can be consumed from the Neutrino API, middleware, or presets. Require this package
and plug it into Neutrino:
```js
const styles = require('neutrino-middleware-style-loader');
neutrino.use(styles);
```
## Customization
`neutrino-middleware-style-loader` creates some conventions to make overriding the configuration easier once you are
ready to make changes.
### Rules
The following is a list of rules and their identifiers which can be overridden:
- `css`: Allows importing CSS stylesheets from modules. Contains two loaders named `style` and `css` which use
`style-loader` and `css-loader`, respectively.
## Contributing
This preset is part of the [neutrino-dev](https://github.com/mozilla-neutrino/neutrino-dev) repository, a monorepo
containing all resources for developing Neutrino and its core presets. Follow the
[contributing guide](../../contributing/README.md) for details.
[npm-image]: https://img.shields.io/npm/v/neutrino-middleware-style-loader.svg
[npm-downloads]: https://img.shields.io/npm/dt/neutrino-middleware-style-loader.svg
[npm-url]: https://npmjs.org/package/neutrino-middleware-style-loader
[slack-image]: https://neutrino-slack.herokuapp.com/badge.svg
[slack-url]: https://neutrino-slack.herokuapp.com/

94
presets/community-presets.html

@ -158,20 +158,7 @@
</li>
<li class="chapter " data-level="1.6" data-path="../middleware/">
<a href="../middleware/">
Middleware
</a>
</li>
<li class="chapter " data-level="1.7" data-path="./">
<li class="chapter " data-level="1.6" data-path="./">
<a href="./">
@ -185,7 +172,7 @@
<ul class="articles">
<li class="chapter " data-level="1.7.1" data-path="neutrino-preset-web/">
<li class="chapter " data-level="1.6.1" data-path="neutrino-preset-web/">
<a href="neutrino-preset-web/">
@ -198,7 +185,7 @@
</li>
<li class="chapter " data-level="1.7.2" data-path="neutrino-preset-react/">
<li class="chapter " data-level="1.6.2" data-path="neutrino-preset-react/">
<a href="neutrino-preset-react/">
@ -211,7 +198,7 @@
</li>
<li class="chapter " data-level="1.7.3" data-path="neutrino-preset-node/">
<li class="chapter " data-level="1.6.3" data-path="neutrino-preset-node/">
<a href="neutrino-preset-node/">
@ -224,7 +211,7 @@
</li>
<li class="chapter " data-level="1.7.4" data-path="neutrino-preset-airbnb-base/">
<li class="chapter " data-level="1.6.4" data-path="neutrino-preset-airbnb-base/">
<a href="neutrino-preset-airbnb-base/">
@ -237,7 +224,7 @@
</li>
<li class="chapter " data-level="1.7.5" data-path="neutrino-preset-karma/">
<li class="chapter " data-level="1.6.5" data-path="neutrino-preset-karma/">
<a href="neutrino-preset-karma/">
@ -250,7 +237,7 @@
</li>
<li class="chapter " data-level="1.7.6" data-path="neutrino-preset-mocha/">
<li class="chapter " data-level="1.6.6" data-path="neutrino-preset-mocha/">
<a href="neutrino-preset-mocha/">
@ -263,7 +250,7 @@
</li>
<li class="chapter " data-level="1.7.7" data-path="neutrino-preset-jest/">
<li class="chapter " data-level="1.6.7" data-path="neutrino-preset-jest/">
<a href="neutrino-preset-jest/">
@ -276,7 +263,7 @@
</li>
<li class="chapter active" data-level="1.7.8" data-path="community-presets.html">
<li class="chapter active" data-level="1.6.8" data-path="community-presets.html">
<a href="community-presets.html">
@ -294,7 +281,7 @@
</li>
<li class="chapter " data-level="1.8" data-path="../customization/">
<li class="chapter " data-level="1.7" data-path="../customization/">
<a href="../customization/">
@ -308,7 +295,7 @@
<ul class="articles">
<li class="chapter " data-level="1.8.1" data-path="../customization/simple.html">
<li class="chapter " data-level="1.7.1" data-path="../customization/simple.html">
<a href="../customization/simple.html">
@ -321,7 +308,7 @@
</li>
<li class="chapter " data-level="1.8.2" data-path="../customization/advanced.html">
<li class="chapter " data-level="1.7.2" data-path="../customization/advanced.html">
<a href="../customization/advanced.html">
@ -339,7 +326,7 @@
</li>
<li class="chapter " data-level="1.9" data-path="../creating-presets.html">
<li class="chapter " data-level="1.8" data-path="../creating-presets.html">
<a href="../creating-presets.html">
@ -353,9 +340,9 @@
<ul class="articles">
<li class="chapter " data-level="1.9.1" data-path="neutrino-lint-base/README.md">
<li class="chapter " data-level="1.8.1" data-path="neutrino-lint-base/">
<span>
<a href="neutrino-lint-base/">
Creating linting presets
@ -371,7 +358,7 @@
</li>
<li class="chapter " data-level="1.10" data-path="../learning-resources.html">
<li class="chapter " data-level="1.9" data-path="../learning-resources.html">
<a href="../learning-resources.html">
@ -384,7 +371,7 @@
</li>
<li class="chapter " data-level="1.11" data-path="../api/">
<li class="chapter " data-level="1.10" data-path="../api/">
<a href="../api/">
@ -397,7 +384,7 @@
</li>
<li class="chapter " data-level="1.12" data-path="../cli/">
<li class="chapter " data-level="1.11" data-path="../cli/">
<a href="../cli/">
@ -410,33 +397,7 @@
</li>
<li class="chapter " data-level="1.13" data-path="../upgrading-neutrino.html">
<a href="../upgrading-neutrino.html">
Upgrading from v4 to v5
</a>
</li>
<li class="chapter " data-level="1.14" >
<a target="_blank" href="https://github.com/mozilla-neutrino/neutrino-dev/tree/docs-v4/docs">
v4 Documentation
</a>
</li>
<li class="chapter " data-level="1.15" data-path="../contributing/">
<li class="chapter " data-level="1.12" data-path="../contributing/">
<a href="../contributing/">
@ -450,7 +411,7 @@
<ul class="articles">
<li class="chapter " data-level="1.15.1" data-path="../contributing/development.html">
<li class="chapter " data-level="1.12.1" data-path="../contributing/development.html">
<a href="../contributing/development.html">
@ -463,7 +424,7 @@
</li>
<li class="chapter " data-level="1.15.2" data-path="../contributing/code-of-conduct.html">
<li class="chapter " data-level="1.12.2" data-path="../contributing/code-of-conduct.html">
<a href="../contributing/code-of-conduct.html">
@ -533,17 +494,6 @@
<li>Contain the <code>neutrino-preset</code> keyword in package.json</li>
<li>Not be deprecated</li>
</ul>
<p>In addition, your preset should also:</p>
<ul>
<li>Have a relevant description</li>
<li>Use <code>neutrino</code> as a <code>peerDependency</code> to mark which versions of Neutrino your preset supports:</li>
</ul>
<pre class="language-"><code class="lang-json"><span class="token punctuation">{</span>
<span class="token property">&quot;peerDependencies&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;neutrino&quot;</span><span class="token operator">:</span> <span class="token string">&quot;^5.0.0&quot;</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
<p>It should also have a relevant description. If you prefer, you can also add your preset to the
<a href="https://github.com/mozilla-neutrino/neutrino-dev/wiki/Community-Presets" target="_blank">neutrino-dev wiki</a>.</p>
<p><div class="npmsearchlist" data-query="keywords:neutrino-preset+not:deprecated"></div></p>
@ -590,7 +540,7 @@
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"Community presets","level":"1.7.8","depth":2,"next":{"title":"Customization","level":"1.8","depth":1,"path":"customization/README.md","ref":"./customization/README.md","articles":[{"title":"Simple","level":"1.8.1","depth":2,"path":"customization/simple.md","ref":"./customization/simple.md","articles":[]},{"title":"Advanced","level":"1.8.2","depth":2,"path":"customization/advanced.md","ref":"./customization/advanced.md","articles":[]}]},"previous":{"title":"Jest","level":"1.7.7","depth":2,"path":"presets/neutrino-preset-jest/README.md","ref":"./presets/neutrino-preset-jest/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"presets/community-presets.md","mtime":"2017-03-15T13:20:51.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-15T14:46:02.288Z"},"basePath":"..","book":{"language":""}});
gitbook.page.hasChanged({"page":{"title":"Community presets","level":"1.6.8","depth":2,"next":{"title":"Customization","level":"1.7","depth":1,"path":"customization/README.md","ref":"customization/README.md","articles":[{"title":"Simple","level":"1.7.1","depth":2,"path":"customization/simple.md","ref":"customization/simple.md","articles":[]},{"title":"Advanced","level":"1.7.2","depth":2,"path":"customization/advanced.md","ref":"customization/advanced.md","articles":[]}]},"previous":{"title":"Jest","level":"1.6.7","depth":2,"path":"presets/neutrino-preset-jest/README.md","ref":"presets/neutrino-preset-jest/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"presets/community-presets.md","mtime":"2017-03-01T15:25:58.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-06T17:07:12.452Z"},"basePath":"..","book":{"language":""}});
});
</script>
</div>

87
presets/index.html

@ -64,7 +64,7 @@
<link rel="next" href="neutrino-preset-web/" />
<link rel="prev" href="../middleware/" />
<link rel="prev" href="../FAQ.html" />
</head>
@ -158,20 +158,7 @@
</li>
<li class="chapter " data-level="1.6" data-path="../middleware/">
<a href="../middleware/">
Middleware
</a>
</li>
<li class="chapter active" data-level="1.7" data-path="./">
<li class="chapter active" data-level="1.6" data-path="./">
<a href="./">
@ -185,7 +172,7 @@
<ul class="articles">
<li class="chapter " data-level="1.7.1" data-path="neutrino-preset-web/">
<li class="chapter " data-level="1.6.1" data-path="neutrino-preset-web/">
<a href="neutrino-preset-web/">
@ -198,7 +185,7 @@
</li>
<li class="chapter " data-level="1.7.2" data-path="neutrino-preset-react/">
<li class="chapter " data-level="1.6.2" data-path="neutrino-preset-react/">
<a href="neutrino-preset-react/">
@ -211,7 +198,7 @@
</li>
<li class="chapter " data-level="1.7.3" data-path="neutrino-preset-node/">
<li class="chapter " data-level="1.6.3" data-path="neutrino-preset-node/">
<a href="neutrino-preset-node/">
@ -224,7 +211,7 @@
</li>
<li class="chapter " data-level="1.7.4" data-path="neutrino-preset-airbnb-base/">
<li class="chapter " data-level="1.6.4" data-path="neutrino-preset-airbnb-base/">
<a href="neutrino-preset-airbnb-base/">
@ -237,7 +224,7 @@
</li>
<li class="chapter " data-level="1.7.5" data-path="neutrino-preset-karma/">
<li class="chapter " data-level="1.6.5" data-path="neutrino-preset-karma/">
<a href="neutrino-preset-karma/">
@ -250,7 +237,7 @@
</li>
<li class="chapter " data-level="1.7.6" data-path="neutrino-preset-mocha/">
<li class="chapter " data-level="1.6.6" data-path="neutrino-preset-mocha/">
<a href="neutrino-preset-mocha/">
@ -263,7 +250,7 @@
</li>
<li class="chapter " data-level="1.7.7" data-path="neutrino-preset-jest/">
<li class="chapter " data-level="1.6.7" data-path="neutrino-preset-jest/">
<a href="neutrino-preset-jest/">
@ -276,7 +263,7 @@
</li>
<li class="chapter " data-level="1.7.8" data-path="community-presets.html">
<li class="chapter " data-level="1.6.8" data-path="community-presets.html">
<a href="community-presets.html">
@ -294,7 +281,7 @@
</li>
<li class="chapter " data-level="1.8" data-path="../customization/">
<li class="chapter " data-level="1.7" data-path="../customization/">
<a href="../customization/">
@ -308,7 +295,7 @@
<ul class="articles">
<li class="chapter " data-level="1.8.1" data-path="../customization/simple.html">
<li class="chapter " data-level="1.7.1" data-path="../customization/simple.html">
<a href="../customization/simple.html">
@ -321,7 +308,7 @@
</li>
<li class="chapter " data-level="1.8.2" data-path="../customization/advanced.html">
<li class="chapter " data-level="1.7.2" data-path="../customization/advanced.html">
<a href="../customization/advanced.html">
@ -339,7 +326,7 @@
</li>
<li class="chapter " data-level="1.9" data-path="../creating-presets.html">
<li class="chapter " data-level="1.8" data-path="../creating-presets.html">
<a href="../creating-presets.html">
@ -353,9 +340,9 @@
<ul class="articles">
<li class="chapter " data-level="1.9.1" data-path="neutrino-lint-base/README.md">
<li class="chapter " data-level="1.8.1" data-path="neutrino-lint-base/">
<span>
<a href="neutrino-lint-base/">
Creating linting presets
@ -371,7 +358,7 @@
</li>
<li class="chapter " data-level="1.10" data-path="../learning-resources.html">
<li class="chapter " data-level="1.9" data-path="../learning-resources.html">
<a href="../learning-resources.html">
@ -384,7 +371,7 @@
</li>
<li class="chapter " data-level="1.11" data-path="../api/">
<li class="chapter " data-level="1.10" data-path="../api/">
<a href="../api/">
@ -397,7 +384,7 @@
</li>
<li class="chapter " data-level="1.12" data-path="../cli/">
<li class="chapter " data-level="1.11" data-path="../cli/">
<a href="../cli/">
@ -410,33 +397,7 @@
</li>
<li class="chapter " data-level="1.13" data-path="../upgrading-neutrino.html">
<a href="../upgrading-neutrino.html">
Upgrading from v4 to v5
</a>
</li>
<li class="chapter " data-level="1.14" >
<a target="_blank" href="https://github.com/mozilla-neutrino/neutrino-dev/tree/docs-v4/docs">
v4 Documentation
</a>
</li>
<li class="chapter " data-level="1.15" data-path="../contributing/">
<li class="chapter " data-level="1.12" data-path="../contributing/">
<a href="../contributing/">
@ -450,7 +411,7 @@
<ul class="articles">
<li class="chapter " data-level="1.15.1" data-path="../contributing/development.html">
<li class="chapter " data-level="1.12.1" data-path="../contributing/development.html">
<a href="../contributing/development.html">
@ -463,7 +424,7 @@
</li>
<li class="chapter " data-level="1.15.2" data-path="../contributing/code-of-conduct.html">
<li class="chapter " data-level="1.12.2" data-path="../contributing/code-of-conduct.html">
<a href="../contributing/code-of-conduct.html">
@ -574,7 +535,7 @@ presets.</p>
<a href="../middleware/" class="navigation navigation-prev " aria-label="Previous page: Middleware">
<a href="../FAQ.html" class="navigation navigation-prev " aria-label="Previous page: FAQ">
<i class="fa fa-angle-left"></i>
</a>
@ -590,7 +551,7 @@ presets.</p>
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"Presets","level":"1.7","depth":1,"next":{"title":"Web","level":"1.7.1","depth":2,"path":"presets/neutrino-preset-web/README.md","ref":"./presets/neutrino-preset-web/README.md","articles":[]},"previous":{"title":"Middleware","level":"1.6","depth":1,"path":"middleware/README.md","ref":"./middleware/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"presets/README.md","mtime":"2017-02-28T18:54:16.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-15T14:46:02.288Z"},"basePath":"..","book":{"language":""}});
gitbook.page.hasChanged({"page":{"title":"Presets","level":"1.6","depth":1,"next":{"title":"Web","level":"1.6.1","depth":2,"path":"presets/neutrino-preset-web/README.md","ref":"presets/neutrino-preset-web/README.md","articles":[]},"previous":{"title":"FAQ","level":"1.5","depth":1,"path":"FAQ.md","ref":"FAQ.md","articles":[]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"presets/README.md","mtime":"2017-03-01T15:25:58.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-06T17:07:12.452Z"},"basePath":"..","book":{"language":""}});
});
</script>
</div>

736
presets/neutrino-lint-base/index.html

@ -0,0 +1,736 @@
<!DOCTYPE HTML>
<html lang="" >
<head>
<meta charset="UTF-8">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>Creating linting presets · Neutrino</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="description" content="">
<meta name="generator" content="GitBook 3.2.2">
<link rel="stylesheet" href="../../gitbook/style.css">
<link rel="stylesheet" href="../../gitbook/gitbook-plugin-prism/prism.css">
<link rel="stylesheet" href="../../gitbook/gitbook-plugin-npmsearchlist/styles.css">
<link rel="stylesheet" href="../../gitbook/gitbook-plugin-search/search.css">
<link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
<meta name="HandheldFriendly" content="true"/>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
<link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">
<link rel="next" href="../../learning-resources.html" />
<link rel="prev" href="../../creating-presets.html" />
</head>
<body>
<div class="book">
<div class="book-summary">
<div id="book-search-input" role="search">
<input type="text" placeholder="Type to search" />
</div>
<nav role="navigation">
<ul class="summary">
<li class="chapter " data-level="1.1" data-path="../../">
<a href="../../">
Introduction
</a>
</li>
<li class="chapter " data-level="1.2" data-path="../../installation.html">
<a href="../../installation.html">
Installation
</a>
</li>
<li class="chapter " data-level="1.3" data-path="../../usage.html">
<a href="../../usage.html">
Usage
</a>
</li>
<li class="chapter " data-level="1.4" data-path="../../project-layout.html">
<a href="../../project-layout.html">
Project Layout
</a>
</li>
<li class="chapter " data-level="1.5" data-path="../../FAQ.html">
<a href="../../FAQ.html">
FAQ
</a>
</li>
<li class="chapter " data-level="1.6" data-path="../">
<a href="../">
Presets
</a>
<ul class="articles">
<li class="chapter " data-level="1.6.1" data-path="../neutrino-preset-web/">
<a href="../neutrino-preset-web/">
Web
</a>
</li>
<li class="chapter " data-level="1.6.2" data-path="../neutrino-preset-react/">
<a href="../neutrino-preset-react/">
React
</a>
</li>
<li class="chapter " data-level="1.6.3" data-path="../neutrino-preset-node/">
<a href="../neutrino-preset-node/">
Node.js
</a>
</li>
<li class="chapter " data-level="1.6.4" data-path="../neutrino-preset-airbnb-base/">
<a href="../neutrino-preset-airbnb-base/">
Airbnb
</a>
</li>
<li class="chapter " data-level="1.6.5" data-path="../neutrino-preset-karma/">
<a href="../neutrino-preset-karma/">
Karma
</a>
</li>
<li class="chapter " data-level="1.6.6" data-path="../neutrino-preset-mocha/">
<a href="../neutrino-preset-mocha/">
Mocha
</a>
</li>
<li class="chapter " data-level="1.6.7" data-path="../neutrino-preset-jest/">
<a href="../neutrino-preset-jest/">
Jest
</a>
</li>
<li class="chapter " data-level="1.6.8" data-path="../community-presets.html">
<a href="../community-presets.html">
Community presets
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.7" data-path="../../customization/">
<a href="../../customization/">
Customization
</a>
<ul class="articles">
<li class="chapter " data-level="1.7.1" data-path="../../customization/simple.html">
<a href="../../customization/simple.html">
Simple
</a>
</li>
<li class="chapter " data-level="1.7.2" data-path="../../customization/advanced.html">
<a href="../../customization/advanced.html">
Advanced
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.8" data-path="../../creating-presets.html">
<a href="../../creating-presets.html">
Creating presets
</a>
<ul class="articles">
<li class="chapter active" data-level="1.8.1" data-path="./">
<a href="./">
Creating linting presets
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.9" data-path="../../learning-resources.html">
<a href="../../learning-resources.html">
Learning Resources
</a>
</li>
<li class="chapter " data-level="1.10" data-path="../../api/">
<a href="../../api/">
API
</a>
</li>
<li class="chapter " data-level="1.11" data-path="../../cli/">
<a href="../../cli/">
CLI
</a>
</li>
<li class="chapter " data-level="1.12" data-path="../../contributing/">
<a href="../../contributing/">
Contributing
</a>
<ul class="articles">
<li class="chapter " data-level="1.12.1" data-path="../../contributing/development.html">
<a href="../../contributing/development.html">
Development Process
</a>
</li>
<li class="chapter " data-level="1.12.2" data-path="../../contributing/code-of-conduct.html">
<a href="../../contributing/code-of-conduct.html">
Code of Conduct
</a>
</li>
</ul>
</li>
<li class="divider"></li>
<li>
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
Published with GitBook
</a>
</li>
</ul>
</nav>
</div>
<div class="book-body">
<div class="body-inner">
<div class="book-header" role="navigation">
<!-- Title -->
<h1>
<i class="fa fa-circle-o-notch fa-spin"></i>
<a href="../.." >Creating linting presets</a>
</h1>
</div>
<div class="page-wrapper" tabindex="-1" role="main">
<div class="page-inner">
<div id="book-search-results">
<div class="search-noresults">
<section class="normal markdown-section">
<h1 id="neutrino-lint-base">Neutrino Lint Base</h1>
<p><a href="https://npmjs.org/package/neutrino-lint-base" target="_blank"><img src="https://img.shields.io/npm/v/neutrino-lint-base.svg" alt="NPM version"></a> <a href="https://npmjs.org/package/neutrino-lint-base" target="_blank"><img src="https://img.shields.io/npm/dt/neutrino-lint-base.svg" alt="NPM downloads"></a> <a href="https://neutrino-slack.herokuapp.com/" target="_blank"><img src="https://neutrino-slack.herokuapp.com/badge.svg" alt="Join Slack"></a></p>
<p><code>neutrino-lint-base</code> is an abstract Neutrino preset base that makes creating ESLint-based presets simpler. By creating
a linting preset that extends from <code>neutrino-lint-base</code>, the development overhead and dependencies needed can be
significantly reduced. Use it as a baseline to create your own linting presets easier and more quickly.</p>
<h2 id="features">Features</h2>
<ul>
<li>Quickly and easily create your own Neutrino linting presets</li>
<li>Modern Babel knowledge supporting ES modules, JSX (when used with React preset), Web and Node.js apps</li>
<li>Highly visible during development, fails compilation when building for production</li>
<li>Easily extensible to customize your project as needed</li>
</ul>
<h2 id="development-requirements">Development Requirements</h2>
<ul>
<li>Node.js v6.9+</li>
<li>Yarn or npm client</li>
<li>Neutrino v4</li>
</ul>
<h2 id="installation">Installation</h2>
<p><code>neutrino-lint-base</code> can be installed via the Yarn or npm clients.</p>
<h4 id="yarn">Yarn</h4>
<pre class="language-"><code class="lang-bash">&#x276F; yarn add neutrino-lint-base
</code></pre>
<h4 id="npm">npm</h4>
<pre class="language-"><code class="lang-bash">&#x276F; npm <span class="token function">install</span> --save neutrino-lint-base
</code></pre>
<p>Your project should also install any dependencies needed to operate based on options passed to <code>eslint-loader</code> or
ESLint&apos;s CLIEngine.</p>
<h2 id="project-layout">Project Layout</h2>
<p><code>neutrino-lint-base</code> follows the standard <a href="../../project-layout.html">project layout</a> specified by Neutrino. This
means that by default all project source code should live in a directory named <code>src</code> in the root of the
project. The <code>.js</code> or <code>.jsx</code> files in this directory are the ones that will be linted by your preset.</p>
<h2 id="creating-the-preset">Creating the preset</h2>
<p>Your preset will follow the same guidelines for normally creating Neutrino presets, with your preset extending
<code>neutrino-lint-base</code>. This starts out by having your package module export a function which accepts a Neutrino instance:</p>
<pre class="language-"><code class="lang-js">module<span class="token punctuation">.</span>exports <span class="token operator">=</span> neutrino <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
<span class="token comment" spellcheck="true">// ...</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
<p>The next step is to <code>require</code>, or <code>import</code> if your package supports it, <code>neutrino-lint-base</code> and execute it with
Neutrino. This will add the lint base&apos;s configuration to Neutrino for your preset to extend further:</p>
<pre class="language-"><code class="lang-js"><span class="token keyword">const</span> lint <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&apos;neutrino-lint-base&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
module<span class="token punctuation">.</span>exports <span class="token operator">=</span> neutrino <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
<span class="token function">lint</span><span class="token punctuation">(</span>neutrino<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">// ...</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
<p>Now comes the core of your own preset. By extending from <code>neutrino-lint-base</code>&apos;s &quot;lint&quot; rule and &quot;eslint&quot; loader, you
can manipulate the options as you desire. Consider using a package such as
<a href="https://www.npmjs.com/package/deepmerge" target="_blank"><code>deepmerge</code></a> to make extending these options easier:</p>
<p><em>Example: Create a preset that shuts off semicolons from being required by ESLint.</em></p>
<pre class="language-"><code class="lang-js"><span class="token keyword">const</span> lint <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&apos;neutrino-lint-base&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">const</span> merge <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&apos;deepmerge&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
module<span class="token punctuation">.</span>exports <span class="token operator">=</span> neutrino <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
<span class="token function">lint</span><span class="token punctuation">(</span>neutrino<span class="token punctuation">)</span><span class="token punctuation">;</span>
neutrino<span class="token punctuation">.</span>config<span class="token punctuation">.</span>module
<span class="token punctuation">.</span><span class="token function">rule</span><span class="token punctuation">(</span><span class="token string">&apos;lint&apos;</span><span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">loader</span><span class="token punctuation">(</span><span class="token string">&apos;eslint&apos;</span><span class="token punctuation">,</span> props <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token function">merge</span><span class="token punctuation">(</span>props<span class="token punctuation">,</span> <span class="token punctuation">{</span>
options<span class="token punctuation">:</span> <span class="token punctuation">{</span>
rules<span class="token punctuation">:</span> <span class="token punctuation">{</span>
semi<span class="token punctuation">:</span> <span class="token string">&apos;off&apos;</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
<p><em>Example: Create a preset that lints a project using the Airbnb base ESLint rules.</em></p>
<pre class="language-"><code class="lang-js"><span class="token keyword">const</span> lint <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&apos;neutrino-lint-base&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">const</span> merge <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&apos;deepmerge&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
module<span class="token punctuation">.</span>exports <span class="token operator">=</span> neutrino <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
<span class="token function">lint</span><span class="token punctuation">(</span>neutrino<span class="token punctuation">)</span><span class="token punctuation">;</span>
neutrino<span class="token punctuation">.</span>config<span class="token punctuation">.</span>module
<span class="token punctuation">.</span><span class="token function">rule</span><span class="token punctuation">(</span><span class="token string">&apos;lint&apos;</span><span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">loader</span><span class="token punctuation">(</span><span class="token string">&apos;eslint&apos;</span><span class="token punctuation">,</span> props <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token function">merge</span><span class="token punctuation">(</span>props<span class="token punctuation">,</span> <span class="token punctuation">{</span>
options<span class="token punctuation">:</span> <span class="token punctuation">{</span>
baseConfig<span class="token punctuation">:</span> <span class="token punctuation">{</span>
<span class="token keyword">extends</span><span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token string">&apos;airbnb-base&apos;</span><span class="token punctuation">]</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
<p>Visit the <a href="../../creating-presets.html">creating presets</a> documentation for more detailed information on creating your own
custom preset.</p>
<h2 id="customization">Customization</h2>
<p><code>neutrino-lint-base</code> creates some conventions to make overriding the configuration easier once you are ready to
make changes.</p>
<h3 id="rules">Rules</h3>
<p>The following is a list of rules and their identifiers which can be overridden:</p>
<ul>
<li><code>lint</code>: Lints JS and JSX files from the <code>src</code> directory using ESLint. Contains a single loader named <code>eslint</code>.</li>
</ul>
<h2 id="information">Information</h2>
<p>The lint base will show errors and warnings in the console during development, and will cause a failure when
creating a build bundle.</p>
<hr>
<p>If you want your preset to also extend from another ESLint configuration that you have made a dependency, you must use
<code>baseConfig.extends</code> rather than just <code>extends</code>. This is a limitation of ESLint, not this lint base.</p>
<pre class="language-"><code class="lang-js"><span class="token keyword">const</span> lint <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&apos;neutrino-lint-base&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">const</span> merge <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&apos;deepmerge&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
module<span class="token punctuation">.</span>exports <span class="token operator">=</span> neutrino <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
<span class="token function">lint</span><span class="token punctuation">(</span>neutrino<span class="token punctuation">)</span><span class="token punctuation">;</span>
neutrino<span class="token punctuation">.</span>config<span class="token punctuation">.</span>module
<span class="token punctuation">.</span><span class="token function">rule</span><span class="token punctuation">(</span><span class="token string">&apos;lint&apos;</span><span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">loader</span><span class="token punctuation">(</span><span class="token string">&apos;eslint&apos;</span><span class="token punctuation">,</span> props <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token function">merge</span><span class="token punctuation">(</span>props<span class="token punctuation">,</span> <span class="token punctuation">{</span>
options<span class="token punctuation">:</span> <span class="token punctuation">{</span>
baseConfig<span class="token punctuation">:</span> <span class="token punctuation">{</span>
<span class="token keyword">extends</span><span class="token punctuation">:</span> <span class="token punctuation">[</span>
<span class="token string">&apos;YOUR_ESLINT_CONFIGURATION_BASE_A&apos;</span><span class="token punctuation">,</span>
<span class="token string">&apos;YOUR_ESLINT_CONFIGURATION_BASE_B&apos;</span>
<span class="token punctuation">]</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
<hr>
<p>The linting base only configures a target environment for <code>es6</code>, leaving other build presets free to add their own
target environments. If your preset puts restrictions on which environments it is capable of running, please document
that clearly in your preset.</p>
<p>For specifics on what options are configured when using this linting base, please
<a href="https://github.com/mozilla-neutrino/neutrino-dev/blob/master/packages/neutrino-lint-base/src/index.js" target="_blank">view the source</a>.</p>
<h2 id="eslintrc-config">eslintrc Config</h2>
<p><code>neutrino-lint-base</code> also provides a method for getting the ESLint configuration suitable for use in an eslintrc file.
Typically this is used for providing hints or fix solutions to the development environment, e.g. IDEs and text editors.
Doing this requires <a href="../../api/">creating an instance of the Neutrino API</a> and providing the presets uses. If you
keep this information in <code>config.presets</code> in package.json, this should be relatively straightforward. By providing
all the presets used to Neutrino, you can ensure all the linting options used across all those preset will be merged
together for your development environment, without the need for copying, duplication, or loss of organization and
separation.</p>
<p><em>Example: Create a .eslintrc.js file in the root of the project.</em></p>
<pre class="language-"><code class="lang-js"><span class="token comment" spellcheck="true">// .eslintrc.js</span>
<span class="token keyword">const</span> Neutrino <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&apos;neutrino&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">const</span> pkg <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&apos;./package.json&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">const</span> api <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">Neutrino</span><span class="token punctuation">(</span>pkg<span class="token punctuation">.</span>config<span class="token punctuation">.</span>presets<span class="token punctuation">)</span><span class="token punctuation">;</span>
module<span class="token punctuation">.</span>exports <span class="token operator">=</span> api<span class="token punctuation">.</span>custom<span class="token punctuation">.</span><span class="token function">eslintrc</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
<hr>
<h2 id="contributing">Contributing</h2>
<p>This preset is part of the <a href="https://github.com/mozilla-neutrino/neutrino-dev" target="_blank">neutrino-dev</a> repository, a monorepo
containing all resources for developing Neutrino and its core presets. Follow the
<a href="../../contributing/">contributing guide</a> for details.</p>
</section>
</div>
<div class="search-results">
<div class="has-results">
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
<ul class="search-results-list"></ul>
</div>
<div class="no-results">
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
</div>
</div>
</div>
</div>
</div>
</div>
<a href="../../creating-presets.html" class="navigation navigation-prev " aria-label="Previous page: Creating presets">
<i class="fa fa-angle-left"></i>
</a>
<a href="../../learning-resources.html" class="navigation navigation-next " aria-label="Next page: Learning Resources">
<i class="fa fa-angle-right"></i>
</a>
</div>
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"Creating linting presets","level":"1.8.1","depth":2,"next":{"title":"Learning Resources","level":"1.9","depth":1,"path":"learning-resources.md","ref":"learning-resources.md","articles":[]},"previous":{"title":"Creating presets","level":"1.8","depth":1,"path":"creating-presets.md","ref":"creating-presets.md","articles":[{"title":"Creating linting presets","level":"1.8.1","depth":2,"path":"presets/neutrino-lint-base/README.md","ref":"presets/neutrino-lint-base/README.md","articles":[]}]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"presets/neutrino-lint-base/README.md","mtime":"2017-03-01T15:25:58.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-06T17:07:12.452Z"},"basePath":"../..","book":{"language":""}});
});
</script>
</div>
<script src="../../gitbook/gitbook.js"></script>
<script src="../../gitbook/theme.js"></script>
<script src="../../gitbook/gitbook-plugin-edit-link/plugin.js"></script>
<script src="../../gitbook/gitbook-plugin-github/plugin.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/3.1.1/anchor.min.js"></script>
<script src="../../gitbook/gitbook-plugin-anchorjs/anchor-style.js"></script>
<script src="../../gitbook/gitbook-plugin-npmsearchlist/script.js"></script>
<script src="../../gitbook/gitbook-plugin-search/search-engine.js"></script>
<script src="../../gitbook/gitbook-plugin-search/search.js"></script>
<script src="../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
<script src="../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
<script src="../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
<script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
</body>
</html>

159
presets/neutrino-preset-airbnb-base/index.html

@ -158,20 +158,7 @@
</li>
<li class="chapter " data-level="1.6" data-path="../../middleware/">
<a href="../../middleware/">
Middleware
</a>
</li>
<li class="chapter " data-level="1.7" data-path="../">
<li class="chapter " data-level="1.6" data-path="../">
<a href="../">
@ -185,7 +172,7 @@
<ul class="articles">
<li class="chapter " data-level="1.7.1" data-path="../neutrino-preset-web/">
<li class="chapter " data-level="1.6.1" data-path="../neutrino-preset-web/">
<a href="../neutrino-preset-web/">
@ -198,7 +185,7 @@
</li>
<li class="chapter " data-level="1.7.2" data-path="../neutrino-preset-react/">
<li class="chapter " data-level="1.6.2" data-path="../neutrino-preset-react/">
<a href="../neutrino-preset-react/">
@ -211,7 +198,7 @@
</li>
<li class="chapter " data-level="1.7.3" data-path="../neutrino-preset-node/">
<li class="chapter " data-level="1.6.3" data-path="../neutrino-preset-node/">
<a href="../neutrino-preset-node/">
@ -224,7 +211,7 @@
</li>
<li class="chapter active" data-level="1.7.4" data-path="./">
<li class="chapter active" data-level="1.6.4" data-path="./">
<a href="./">
@ -237,7 +224,7 @@
</li>
<li class="chapter " data-level="1.7.5" data-path="../neutrino-preset-karma/">
<li class="chapter " data-level="1.6.5" data-path="../neutrino-preset-karma/">
<a href="../neutrino-preset-karma/">
@ -250,7 +237,7 @@
</li>
<li class="chapter " data-level="1.7.6" data-path="../neutrino-preset-mocha/">
<li class="chapter " data-level="1.6.6" data-path="../neutrino-preset-mocha/">
<a href="../neutrino-preset-mocha/">
@ -263,7 +250,7 @@
</li>
<li class="chapter " data-level="1.7.7" data-path="../neutrino-preset-jest/">
<li class="chapter " data-level="1.6.7" data-path="../neutrino-preset-jest/">
<a href="../neutrino-preset-jest/">
@ -276,7 +263,7 @@
</li>
<li class="chapter " data-level="1.7.8" data-path="../community-presets.html">
<li class="chapter " data-level="1.6.8" data-path="../community-presets.html">
<a href="../community-presets.html">
@ -294,7 +281,7 @@
</li>
<li class="chapter " data-level="1.8" data-path="../../customization/">
<li class="chapter " data-level="1.7" data-path="../../customization/">
<a href="../../customization/">
@ -308,7 +295,7 @@
<ul class="articles">
<li class="chapter " data-level="1.8.1" data-path="../../customization/simple.html">
<li class="chapter " data-level="1.7.1" data-path="../../customization/simple.html">
<a href="../../customization/simple.html">
@ -321,7 +308,7 @@
</li>
<li class="chapter " data-level="1.8.2" data-path="../../customization/advanced.html">
<li class="chapter " data-level="1.7.2" data-path="../../customization/advanced.html">
<a href="../../customization/advanced.html">
@ -339,7 +326,7 @@
</li>
<li class="chapter " data-level="1.9" data-path="../../creating-presets.html">
<li class="chapter " data-level="1.8" data-path="../../creating-presets.html">
<a href="../../creating-presets.html">
@ -353,9 +340,9 @@
<ul class="articles">
<li class="chapter " data-level="1.9.1" data-path="../neutrino-lint-base/README.md">
<li class="chapter " data-level="1.8.1" data-path="../neutrino-lint-base/">
<span>
<a href="../neutrino-lint-base/">
Creating linting presets
@ -371,7 +358,7 @@
</li>
<li class="chapter " data-level="1.10" data-path="../../learning-resources.html">
<li class="chapter " data-level="1.9" data-path="../../learning-resources.html">
<a href="../../learning-resources.html">
@ -384,7 +371,7 @@
</li>
<li class="chapter " data-level="1.11" data-path="../../api/">
<li class="chapter " data-level="1.10" data-path="../../api/">
<a href="../../api/">
@ -397,7 +384,7 @@
</li>
<li class="chapter " data-level="1.12" data-path="../../cli/">
<li class="chapter " data-level="1.11" data-path="../../cli/">
<a href="../../cli/">
@ -410,33 +397,7 @@
</li>
<li class="chapter " data-level="1.13" data-path="../../upgrading-neutrino.html">
<a href="../../upgrading-neutrino.html">
Upgrading from v4 to v5
</a>
</li>
<li class="chapter " data-level="1.14" >
<a target="_blank" href="https://github.com/mozilla-neutrino/neutrino-dev/tree/docs-v4/docs">
v4 Documentation
</a>
</li>
<li class="chapter " data-level="1.15" data-path="../../contributing/">
<li class="chapter " data-level="1.12" data-path="../../contributing/">
<a href="../../contributing/">
@ -450,7 +411,7 @@
<ul class="articles">
<li class="chapter " data-level="1.15.1" data-path="../../contributing/development.html">
<li class="chapter " data-level="1.12.1" data-path="../../contributing/development.html">
<a href="../../contributing/development.html">
@ -463,7 +424,7 @@
</li>
<li class="chapter " data-level="1.15.2" data-path="../../contributing/code-of-conduct.html">
<li class="chapter " data-level="1.12.2" data-path="../../contributing/code-of-conduct.html">
<a href="../../contributing/code-of-conduct.html">
@ -541,7 +502,7 @@ config, following the <a href="https://github.com/airbnb/javascript" target="_bl
<ul>
<li>Node.js v6.9+</li>
<li>Yarn or npm client</li>
<li>Neutrino v5, Neutrino build preset</li>
<li>Neutrino v4, Neutrino build preset</li>
</ul>
<h2 id="installation">Installation</h2>
<p><code>neutrino-preset-airbnb-base</code> can be installed via the Yarn or npm clients. Inside your project, make sure
@ -567,16 +528,6 @@ linting <strong>before</strong> your build preset. For example, if you are build
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
<p>Or if you have set up Neutrino with <code>neutrino.presets</code> in your package.json:</p>
<pre class="language-"><code class="lang-json"><span class="token punctuation">{</span>
<span class="token property">&quot;neutrino&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;presets&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span>
<span class="token string">&quot;neutrino-preset-airbnb-base&quot;</span><span class="token punctuation">,</span>
<span class="token string">&quot;neutrino-preset-web&quot;</span>
<span class="token punctuation">]</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
<p>Start the app, then check your console for any linting errors. If everything is successful, you should see no errors in
the console. ESLint errors visible during development are reported, but will still continue to build and serve your
project.</p>
@ -629,6 +580,13 @@ Build completed <span class="token keyword">in</span> 1.287s
&#x2716; 4 problems <span class="token punctuation">(</span>3 errors, 1 warning<span class="token punctuation">)</span>
@ multi ./src/index.js
./src/index.js
Module build failed: Error: Module failed because of a eslint error.
at lint <span class="token punctuation">(</span>/Users/eli/code/neutrino-dev/packages/neutrino-preset-airbnb-base/node_modules/eslint-loader/index.js:115:17<span class="token punctuation">)</span>
at Object.module.exports <span class="token punctuation">(</span>/Users/eli/code/neutrino-dev/packages/neutrino-preset-airbnb-base/node_modules/eslint-loader/index.js:181:3<span class="token punctuation">)</span>
@ multi ./src/index.js
error Command failed with <span class="token keyword">exit</span> code 1.
</code></pre>
<h2 id="customizing">Customizing</h2>
@ -638,21 +596,20 @@ make changes.</p>
<h3 id="rules">Rules</h3>
<p>The following is a list of rules and their identifiers which can be overridden:</p>
<ul>
<li><code>lint</code>: Lints JS and JSX files from the <code>src</code> directory using ESLint. Contains a single loader named <code>eslint</code>. This is
inherited from <code>neutrino-middleware-eslint</code>.</li>
<li><code>lint</code>: Lints JS and JSX files from the <code>src</code> directory using ESLint. Contains a single loader named <code>eslint</code>.</li>
</ul>
<h3 id="simple-customization">Simple customization</h3>
<p>By following the <a href="../../customization/simple.html">customization guide</a> and knowing the rule and loader IDs above,
you can override and augment the linting configuration directly from package.json. <em>Note: Using the simple customization
approach for linting changes can be quite verbose. Consider using advanced configuration below if this bothers you.</em></p>
approach for linting changes can be verbose.</em></p>
<p><em>Example: Turn off semicolons from being required as defined by the Airbnb rules.</em></p>
<pre class="language-"><code class="lang-json"><span class="token punctuation">{</span>
<span class="token property">&quot;neutrino&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;config&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;config&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;neutrino&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;module&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;rule&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;lint&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;use&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;loader&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;eslint&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;options&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;rules&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
@ -672,57 +629,37 @@ approach for linting changes can be quite verbose. Consider using advanced confi
project.</p>
<h3 id="advanced-configuration">Advanced configuration</h3>
<p>By following the <a href="../../customization/advanced.html">customization guide</a> and knowing the rule and loader IDs above,
you can override and augment the build by creating a JS module which overrides the config. This preset is also
Neutrino middleware, making it easy to compose and extend the configuration.</p>
you can override and augment the build by creating a JS module which overrides the config.</p>
<p><em>Example: Turn off semicolons from being required as defined by the Airbnb rules.</em></p>
<pre class="language-"><code class="lang-js"><span class="token comment" spellcheck="true">// If using as middleware, remove from presets and .use it from your override:</span>
<span class="token keyword">const</span> airbnb <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&apos;neutrino-preset-airbnb-base&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
module<span class="token punctuation">.</span>exports <span class="token operator">=</span> neutrino <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
neutrino<span class="token punctuation">.</span><span class="token function">use</span><span class="token punctuation">(</span>airbnb<span class="token punctuation">,</span> <span class="token punctuation">{</span>
rules<span class="token punctuation">:</span> <span class="token punctuation">{</span>
semi<span class="token punctuation">:</span> <span class="token string">&apos;off&apos;</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
<pre class="language-"><code class="lang-js"><span class="token comment" spellcheck="true">// If using as a preset from the CLI or configured in package.json,</span>
<span class="token comment" spellcheck="true">// override its configuration directly:</span>
<span class="token keyword">const</span> merge <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&apos;deepmerge&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<pre class="language-"><code class="lang-js"><span class="token keyword">const</span> merge <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&apos;deepmerge&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
module<span class="token punctuation">.</span>exports <span class="token operator">=</span> neutrino <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
neutrino<span class="token punctuation">.</span>config<span class="token punctuation">.</span>module
<span class="token punctuation">.</span><span class="token function">rule</span><span class="token punctuation">(</span><span class="token string">&apos;lint&apos;</span><span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">use</span><span class="token punctuation">(</span><span class="token string">&apos;eslint&apos;</span><span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">tap</span><span class="token punctuation">(</span>options <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token function">merge</span><span class="token punctuation">(</span>options<span class="token punctuation">,</span> <span class="token punctuation">{</span>
rules<span class="token punctuation">:</span> <span class="token punctuation">{</span>
semi<span class="token punctuation">:</span> <span class="token string">&apos;off&apos;</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">.</span><span class="token function">loader</span><span class="token punctuation">(</span><span class="token string">&apos;eslint&apos;</span><span class="token punctuation">,</span> props <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token function">merge</span><span class="token punctuation">(</span>props<span class="token punctuation">,</span> <span class="token punctuation">{</span>
options<span class="token punctuation">:</span> <span class="token punctuation">{</span>
rules<span class="token punctuation">:</span> <span class="token punctuation">{</span>
semi<span class="token punctuation">:</span> <span class="token string">&apos;off&apos;</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
<h2 id="eslintrc-config">eslintrc Config</h2>
<p><code>neutrino-lint-airbnb-base</code> also provides a method for getting the ESLint configuration suitable for use in an eslintrc
file. Typically this is used for providing hints or fix solutions to the development environment, e.g. IDEs and text
editors. Doing this requires <a href="../../api/">creating an instance of the Neutrino API</a> and providing the presets uses.
If you keep this information in <code>neutrino.presets</code> in package.json, this should be relatively straightforward. By
If you keep this information in <code>config.presets</code> in package.json, this should be relatively straightforward. By
providing all the presets used to Neutrino, you can ensure all the linting options used across all those preset will be
merged together for your development environment, without the need for copying, duplication, or loss of organization and
separation. This is inherited from <code>neutrino-middleware-eslint</code>.</p>
separation.</p>
<p><em>Example: Create a .eslintrc.js file in the root of the project.</em></p>
<pre class="language-"><code class="lang-js"><span class="token comment" spellcheck="true">// .eslintrc.js</span>
<span class="token keyword">const</span> Neutrino <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&apos;neutrino&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">const</span> pkg <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&apos;./package.json&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">const</span> api <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">Neutrino</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">// If the Airbnb preset is not included in pkg.neutrino.presets,</span>
<span class="token comment" spellcheck="true">// use it manually:</span>
api<span class="token punctuation">.</span><span class="token function">use</span><span class="token punctuation">(</span><span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&apos;neutrino-preset-airbnb-base&apos;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">// Add the rest of the presets:</span>
pkg<span class="token punctuation">.</span>neutrino<span class="token punctuation">.</span>presets<span class="token punctuation">.</span><span class="token function">map</span><span class="token punctuation">(</span>preset <span class="token operator">=</span><span class="token operator">&gt;</span> api<span class="token punctuation">.</span><span class="token function">use</span><span class="token punctuation">(</span>preset<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">const</span> api <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">Neutrino</span><span class="token punctuation">(</span>pkg<span class="token punctuation">.</span>config<span class="token punctuation">.</span>presets<span class="token punctuation">)</span><span class="token punctuation">;</span>
module<span class="token punctuation">.</span>exports <span class="token operator">=</span> api<span class="token punctuation">.</span><span class="token function">eslintrc</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
module<span class="token punctuation">.</span>exports <span class="token operator">=</span> api<span class="token punctuation">.</span>custom<span class="token punctuation">.</span><span class="token function">eslintrc</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
<h2 id="contributing">Contributing</h2>
<p>This preset is part of the <a href="https://github.com/mozilla-neutrino/neutrino-dev" target="_blank">neutrino-dev</a> repository, a monorepo
@ -771,7 +708,7 @@ containing all resources for developing Neutrino and its core presets. Follow th
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"Airbnb","level":"1.7.4","depth":2,"next":{"title":"Karma","level":"1.7.5","depth":2,"path":"presets/neutrino-preset-karma/README.md","ref":"./presets/neutrino-preset-karma/README.md","articles":[]},"previous":{"title":"Node.js","level":"1.7.3","depth":2,"path":"presets/neutrino-preset-node/README.md","ref":"./presets/neutrino-preset-node/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"presets/neutrino-preset-airbnb-base/README.md","mtime":"2017-03-15T13:20:51.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-15T14:46:02.288Z"},"basePath":"../..","book":{"language":""}});
gitbook.page.hasChanged({"page":{"title":"Airbnb","level":"1.6.4","depth":2,"next":{"title":"Karma","level":"1.6.5","depth":2,"path":"presets/neutrino-preset-karma/README.md","ref":"presets/neutrino-preset-karma/README.md","articles":[]},"previous":{"title":"Node.js","level":"1.6.3","depth":2,"path":"presets/neutrino-preset-node/README.md","ref":"presets/neutrino-preset-node/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"presets/neutrino-preset-airbnb-base/README.md","mtime":"2017-03-01T15:25:58.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-06T17:07:12.452Z"},"basePath":"../..","book":{"language":""}});
});
</script>
</div>

122
presets/neutrino-preset-jest/index.html

@ -158,20 +158,7 @@
</li>
<li class="chapter " data-level="1.6" data-path="../../middleware/">
<a href="../../middleware/">
Middleware
</a>
</li>
<li class="chapter " data-level="1.7" data-path="../">
<li class="chapter " data-level="1.6" data-path="../">
<a href="../">
@ -185,7 +172,7 @@
<ul class="articles">
<li class="chapter " data-level="1.7.1" data-path="../neutrino-preset-web/">
<li class="chapter " data-level="1.6.1" data-path="../neutrino-preset-web/">
<a href="../neutrino-preset-web/">
@ -198,7 +185,7 @@
</li>
<li class="chapter " data-level="1.7.2" data-path="../neutrino-preset-react/">
<li class="chapter " data-level="1.6.2" data-path="../neutrino-preset-react/">
<a href="../neutrino-preset-react/">
@ -211,7 +198,7 @@
</li>
<li class="chapter " data-level="1.7.3" data-path="../neutrino-preset-node/">
<li class="chapter " data-level="1.6.3" data-path="../neutrino-preset-node/">
<a href="../neutrino-preset-node/">
@ -224,7 +211,7 @@
</li>
<li class="chapter " data-level="1.7.4" data-path="../neutrino-preset-airbnb-base/">
<li class="chapter " data-level="1.6.4" data-path="../neutrino-preset-airbnb-base/">
<a href="../neutrino-preset-airbnb-base/">
@ -237,7 +224,7 @@
</li>
<li class="chapter " data-level="1.7.5" data-path="../neutrino-preset-karma/">
<li class="chapter " data-level="1.6.5" data-path="../neutrino-preset-karma/">
<a href="../neutrino-preset-karma/">
@ -250,7 +237,7 @@
</li>
<li class="chapter " data-level="1.7.6" data-path="../neutrino-preset-mocha/">
<li class="chapter " data-level="1.6.6" data-path="../neutrino-preset-mocha/">
<a href="../neutrino-preset-mocha/">
@ -263,7 +250,7 @@
</li>
<li class="chapter active" data-level="1.7.7" data-path="./">
<li class="chapter active" data-level="1.6.7" data-path="./">
<a href="./">
@ -276,7 +263,7 @@
</li>
<li class="chapter " data-level="1.7.8" data-path="../community-presets.html">
<li class="chapter " data-level="1.6.8" data-path="../community-presets.html">
<a href="../community-presets.html">
@ -294,7 +281,7 @@
</li>
<li class="chapter " data-level="1.8" data-path="../../customization/">
<li class="chapter " data-level="1.7" data-path="../../customization/">
<a href="../../customization/">
@ -308,7 +295,7 @@
<ul class="articles">
<li class="chapter " data-level="1.8.1" data-path="../../customization/simple.html">
<li class="chapter " data-level="1.7.1" data-path="../../customization/simple.html">
<a href="../../customization/simple.html">
@ -321,7 +308,7 @@
</li>
<li class="chapter " data-level="1.8.2" data-path="../../customization/advanced.html">
<li class="chapter " data-level="1.7.2" data-path="../../customization/advanced.html">
<a href="../../customization/advanced.html">
@ -339,7 +326,7 @@
</li>
<li class="chapter " data-level="1.9" data-path="../../creating-presets.html">
<li class="chapter " data-level="1.8" data-path="../../creating-presets.html">
<a href="../../creating-presets.html">
@ -353,9 +340,9 @@
<ul class="articles">
<li class="chapter " data-level="1.9.1" data-path="../neutrino-lint-base/README.md">
<li class="chapter " data-level="1.8.1" data-path="../neutrino-lint-base/">
<span>
<a href="../neutrino-lint-base/">
Creating linting presets
@ -371,7 +358,7 @@
</li>
<li class="chapter " data-level="1.10" data-path="../../learning-resources.html">
<li class="chapter " data-level="1.9" data-path="../../learning-resources.html">
<a href="../../learning-resources.html">
@ -384,7 +371,7 @@
</li>
<li class="chapter " data-level="1.11" data-path="../../api/">
<li class="chapter " data-level="1.10" data-path="../../api/">
<a href="../../api/">
@ -397,7 +384,7 @@
</li>
<li class="chapter " data-level="1.12" data-path="../../cli/">
<li class="chapter " data-level="1.11" data-path="../../cli/">
<a href="../../cli/">
@ -410,33 +397,7 @@
</li>
<li class="chapter " data-level="1.13" data-path="../../upgrading-neutrino.html">
<a href="../../upgrading-neutrino.html">
Upgrading from v4 to v5
</a>
</li>
<li class="chapter " data-level="1.14" >
<a target="_blank" href="https://github.com/mozilla-neutrino/neutrino-dev/tree/docs-v4/docs">
v4 Documentation
</a>
</li>
<li class="chapter " data-level="1.15" data-path="../../contributing/">
<li class="chapter " data-level="1.12" data-path="../../contributing/">
<a href="../../contributing/">
@ -450,7 +411,7 @@
<ul class="articles">
<li class="chapter " data-level="1.15.1" data-path="../../contributing/development.html">
<li class="chapter " data-level="1.12.1" data-path="../../contributing/development.html">
<a href="../../contributing/development.html">
@ -463,7 +424,7 @@
</li>
<li class="chapter " data-level="1.15.2" data-path="../../contributing/code-of-conduct.html">
<li class="chapter " data-level="1.12.2" data-path="../../contributing/code-of-conduct.html">
<a href="../../contributing/code-of-conduct.html">
@ -541,7 +502,7 @@
<ul>
<li>Node.js v6.9+</li>
<li>Yarn or npm client</li>
<li>Neutrino v5, Neutrino build preset</li>
<li>Neutrino v4, Neutrino build preset</li>
</ul>
<h2 id="installation">Installation</h2>
<p><code>neutrino-preset-jest</code> can be installed via the Yarn or npm clients. Inside your project, make sure
@ -589,16 +550,6 @@ let&apos;s pretend this is a Node.js project:</p>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
<p>Or if you have set up Neutrino with <code>neutrino.presets</code> in your package.json:</p>
<pre class="language-"><code class="lang-json"><span class="token punctuation">{</span>
<span class="token property">&quot;neutrino&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;presets&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span>
<span class="token string">&quot;neutrino-preset-node&quot;</span><span class="token punctuation">,</span>
<span class="token string">&quot;neutrino-preset-jest&quot;</span>
<span class="token punctuation">]</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
<p>Run the tests, and view the results in your console:</p>
<h4 id="yarn">Yarn</h4>
<pre class="language-"><code class="lang-bash">&#x276F; yarn <span class="token function">test</span>
@ -632,24 +583,25 @@ Ran all <span class="token function">test</span> suites.
<p>For more details on specific Jest usage, please refer to their <a href="https://facebook.github.io/jest/" target="_blank">documentation</a>.</p>
<h2 id="executing-single-tests">Executing single tests</h2>
<p>By default this preset will execute every test file located in your test directory ending in the appropriate file
extension. Use the command line <a href="../../cli/#neutrino-test"><code>files</code> parameters</a> to execute individual tests.</p>
extension.
Use the command line <a href="../../cli/#neutrino-test"><code>files</code> parameters</a> to execute individual tests.</p>
<h2 id="watching-for-changes">Watching for changes</h2>
<p><code>neutrino-preset-jest</code> can watch for changes on your source directory and subsequently re-run tests. Simply use the
<code>--watch</code> flag with your <code>neutrino test</code> command.</p>
<h2 id="coverage-reporting">Coverage reporting</h2>
<p>Jest has an integrated coverage reporter, which requires no configuration. To collect test coverage information and
generate a report:</p>
generate report run:</p>
<pre class="language-"><code class="lang-bash">&#x276F; neutrino <span class="token function">test</span> --coverage
</code></pre>
<p>You can also edit your package.json file and create a separate command for generating a coverage report, which can be
very helpful during continuous integration of your project:</p>
<p>You can also edit your package.json file and create a separate command for generating coverage report, which can be
very helpful during continues integration of your project:</p>
<pre class="language-"><code class="lang-json"><span class="token punctuation">{</span>
<span class="token property">&quot;scripts&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;coverage&quot;</span><span class="token operator">:</span> <span class="token string">&quot;neutrino test --coverage&quot;</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
<p>See the <a href="https://facebook.github.io/jest/docs/configuration.html#collectcoveragefrom-array" target="_blank">Jests documentation</a> for
<p>See the <a href="https://facebook.github.io/jest/docs/configuration.html#collectcoveragefrom-array" target="_blank">Jest&apos;s documentation</a> for
more configuration options for generating coverage reports.</p>
<h2 id="customizing">Customizing</h2>
<p>To override the test configuration, start with the documentation on <a href="../../customization/">customization</a>.
@ -665,16 +617,12 @@ Contains a single loader named <code>babel</code>.</li>
<p>By following the <a href="../../customization/simple.html">customization guide</a> and knowing the rule, and loader IDs above,
you can override and augment the build directly from package.json.</p>
<p>Jest configuration settings can also be modified directly from package.json, but it is not required.
<code>neutrino-preset-jest</code> will import Jest configuration from your package.json&apos;s <code>jest</code> object or <code>neutrino.options.jest</code>;
the format is defined on the <a href="https://facebook.github.io/jest/docs/configuration.html" target="_blank">Jest documentation site</a>.</p>
<code>neutrino-preset-jest</code> will import Jest configuration from your package.json&apos;s <code>jest</code> object; the format is
defined on the <a href="https://facebook.github.io/jest/docs/configuration.html" target="_blank">Jest documentation site</a>.</p>
<p><em>Example: Turn off bailing on test failures.</em></p>
<pre class="language-"><code class="lang-json"><span class="token punctuation">{</span>
<span class="token property">&quot;neutrino&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;options&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;jest&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;bail&quot;</span><span class="token operator">:</span> <span class="token boolean">false</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token property">&quot;jest&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;bail&quot;</span><span class="token operator">:</span> <span class="token boolean">false</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
@ -683,11 +631,11 @@ the format is defined on the <a href="https://facebook.github.io/jest/docs/confi
you can override and augment testing by creating a JS module which overrides the config. </p>
<p>You can also modify Jest settings by overriding with any options Jest accepts. In a standalone Jest project this is
typically done in the package.json file, but <code>neutrino-preset-jest</code> allows advanced configuration through this
mechanism as well. This is stored in the <code>neutrino.options.jest</code> object, and takes the same configuration options as
mechanism as well. This is stored in the <code>neutrino.custom.jest</code> object, and takes the same configuration options as
outlined in the <a href="https://facebook.github.io/jest/docs/configuration.html" target="_blank">Jest documentation</a>.</p>
<p><em>Example: Create a global <code>__DEV__</code> variable set to <code>true</code> in all test environments.</em></p>
<pre class="language-"><code class="lang-js">module<span class="token punctuation">.</span>exports <span class="token operator">=</span> neutrino <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
neutrino<span class="token punctuation">.</span>options<span class="token punctuation">.</span>jest<span class="token punctuation">.</span>globals <span class="token operator">=</span> <span class="token punctuation">{</span>
neutrino<span class="token punctuation">.</span>custom<span class="token punctuation">.</span>jest<span class="token punctuation">.</span>globals <span class="token operator">=</span> <span class="token punctuation">{</span>
__DEV__<span class="token punctuation">:</span> <span class="token boolean">true</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
@ -739,7 +687,7 @@ containing all resources for developing Neutrino and its core presets. Follow th
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"Jest","level":"1.7.7","depth":2,"next":{"title":"Community presets","level":"1.7.8","depth":2,"path":"presets/community-presets.md","ref":"./presets/community-presets.md","articles":[]},"previous":{"title":"Mocha","level":"1.7.6","depth":2,"path":"presets/neutrino-preset-mocha/README.md","ref":"./presets/neutrino-preset-mocha/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"presets/neutrino-preset-jest/README.md","mtime":"2017-03-15T13:20:51.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-15T14:46:02.288Z"},"basePath":"../..","book":{"language":""}});
gitbook.page.hasChanged({"page":{"title":"Jest","level":"1.6.7","depth":2,"next":{"title":"Community presets","level":"1.6.8","depth":2,"path":"presets/community-presets.md","ref":"presets/community-presets.md","articles":[]},"previous":{"title":"Mocha","level":"1.6.6","depth":2,"path":"presets/neutrino-preset-mocha/README.md","ref":"presets/neutrino-preset-mocha/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"presets/neutrino-preset-jest/README.md","mtime":"2017-03-01T15:25:58.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-06T17:07:12.452Z"},"basePath":"../..","book":{"language":""}});
});
</script>
</div>

119
presets/neutrino-preset-karma/index.html

@ -158,20 +158,7 @@
</li>
<li class="chapter " data-level="1.6" data-path="../../middleware/">
<a href="../../middleware/">
Middleware
</a>
</li>
<li class="chapter " data-level="1.7" data-path="../">
<li class="chapter " data-level="1.6" data-path="../">
<a href="../">
@ -185,7 +172,7 @@
<ul class="articles">
<li class="chapter " data-level="1.7.1" data-path="../neutrino-preset-web/">
<li class="chapter " data-level="1.6.1" data-path="../neutrino-preset-web/">
<a href="../neutrino-preset-web/">
@ -198,7 +185,7 @@
</li>
<li class="chapter " data-level="1.7.2" data-path="../neutrino-preset-react/">
<li class="chapter " data-level="1.6.2" data-path="../neutrino-preset-react/">
<a href="../neutrino-preset-react/">
@ -211,7 +198,7 @@
</li>
<li class="chapter " data-level="1.7.3" data-path="../neutrino-preset-node/">
<li class="chapter " data-level="1.6.3" data-path="../neutrino-preset-node/">
<a href="../neutrino-preset-node/">
@ -224,7 +211,7 @@
</li>
<li class="chapter " data-level="1.7.4" data-path="../neutrino-preset-airbnb-base/">
<li class="chapter " data-level="1.6.4" data-path="../neutrino-preset-airbnb-base/">
<a href="../neutrino-preset-airbnb-base/">
@ -237,7 +224,7 @@
</li>
<li class="chapter active" data-level="1.7.5" data-path="./">
<li class="chapter active" data-level="1.6.5" data-path="./">
<a href="./">
@ -250,7 +237,7 @@
</li>
<li class="chapter " data-level="1.7.6" data-path="../neutrino-preset-mocha/">
<li class="chapter " data-level="1.6.6" data-path="../neutrino-preset-mocha/">
<a href="../neutrino-preset-mocha/">
@ -263,7 +250,7 @@
</li>
<li class="chapter " data-level="1.7.7" data-path="../neutrino-preset-jest/">
<li class="chapter " data-level="1.6.7" data-path="../neutrino-preset-jest/">
<a href="../neutrino-preset-jest/">
@ -276,7 +263,7 @@
</li>
<li class="chapter " data-level="1.7.8" data-path="../community-presets.html">
<li class="chapter " data-level="1.6.8" data-path="../community-presets.html">
<a href="../community-presets.html">
@ -294,7 +281,7 @@
</li>
<li class="chapter " data-level="1.8" data-path="../../customization/">
<li class="chapter " data-level="1.7" data-path="../../customization/">
<a href="../../customization/">
@ -308,7 +295,7 @@
<ul class="articles">
<li class="chapter " data-level="1.8.1" data-path="../../customization/simple.html">
<li class="chapter " data-level="1.7.1" data-path="../../customization/simple.html">
<a href="../../customization/simple.html">
@ -321,7 +308,7 @@
</li>
<li class="chapter " data-level="1.8.2" data-path="../../customization/advanced.html">
<li class="chapter " data-level="1.7.2" data-path="../../customization/advanced.html">
<a href="../../customization/advanced.html">
@ -339,7 +326,7 @@
</li>
<li class="chapter " data-level="1.9" data-path="../../creating-presets.html">
<li class="chapter " data-level="1.8" data-path="../../creating-presets.html">
<a href="../../creating-presets.html">
@ -353,9 +340,9 @@
<ul class="articles">
<li class="chapter " data-level="1.9.1" data-path="../neutrino-lint-base/README.md">
<li class="chapter " data-level="1.8.1" data-path="../neutrino-lint-base/">
<span>
<a href="../neutrino-lint-base/">
Creating linting presets
@ -371,7 +358,7 @@
</li>
<li class="chapter " data-level="1.10" data-path="../../learning-resources.html">
<li class="chapter " data-level="1.9" data-path="../../learning-resources.html">
<a href="../../learning-resources.html">
@ -384,7 +371,7 @@
</li>
<li class="chapter " data-level="1.11" data-path="../../api/">
<li class="chapter " data-level="1.10" data-path="../../api/">
<a href="../../api/">
@ -397,7 +384,7 @@
</li>
<li class="chapter " data-level="1.12" data-path="../../cli/">
<li class="chapter " data-level="1.11" data-path="../../cli/">
<a href="../../cli/">
@ -410,33 +397,7 @@
</li>
<li class="chapter " data-level="1.13" data-path="../../upgrading-neutrino.html">
<a href="../../upgrading-neutrino.html">
Upgrading from v4 to v5
</a>
</li>
<li class="chapter " data-level="1.14" >
<a target="_blank" href="https://github.com/mozilla-neutrino/neutrino-dev/tree/docs-v4/docs">
v4 Documentation
</a>
</li>
<li class="chapter " data-level="1.15" data-path="../../contributing/">
<li class="chapter " data-level="1.12" data-path="../../contributing/">
<a href="../../contributing/">
@ -450,7 +411,7 @@
<ul class="articles">
<li class="chapter " data-level="1.15.1" data-path="../../contributing/development.html">
<li class="chapter " data-level="1.12.1" data-path="../../contributing/development.html">
<a href="../../contributing/development.html">
@ -463,7 +424,7 @@
</li>
<li class="chapter " data-level="1.15.2" data-path="../../contributing/code-of-conduct.html">
<li class="chapter " data-level="1.12.2" data-path="../../contributing/code-of-conduct.html">
<a href="../../contributing/code-of-conduct.html">
@ -541,7 +502,7 @@
<ul>
<li>Node.js v6.9+</li>
<li>Yarn or npm client</li>
<li>Neutrino v5, Neutrino build preset</li>
<li>Neutrino v4, Neutrino build preset</li>
</ul>
<h2 id="installation">Installation</h2>
<p><code>neutrino-preset-karma</code> can be installed via the Yarn or npm clients. Inside your project, make sure
@ -579,16 +540,6 @@ let&apos;s pretend this is a React project:</p>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
<p>Or if you have set up Neutrino with <code>neutrino.presets</code> in your package.json:</p>
<pre class="language-"><code class="lang-json"><span class="token punctuation">{</span>
<span class="token property">&quot;neutrino&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;presets&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span>
<span class="token string">&quot;neutrino-preset-react&quot;</span><span class="token punctuation">,</span>
<span class="token string">&quot;neutrino-preset-karma&quot;</span>
<span class="token punctuation">]</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
<p>Run the tests, and view the results in your console:</p>
<h4 id="yarn">Yarn</h4>
<pre class="language-"><code class="lang-bash">&#x276F; yarn <span class="token function">test</span>
@ -630,7 +581,8 @@ SUMMARY:
<a href="https://karma-runner.github.io/1.0/index.html" target="_blank">documentation</a>.</p>
<h2 id="executing-single-tests">Executing single tests</h2>
<p>By default this preset will execute every test file located in your test directory ending in the appropriate file
extension. Use the command line <a href="../../cli/#neutrino-test"><code>files</code> parameters</a> to execute individual tests.</p>
extension.
Use the command line <a href="../../cli/#neutrino-test"><code>files</code> parameters</a> to execute individual tests.</p>
<h2 id="watching-for-changes">Watching for changes</h2>
<p><code>neutrino-preset-karma</code> can watch for changes on your source directory and subsequently re-run tests. Simply use the
<code>--watch</code> flag with your <code>neutrino test</code> command.</p>
@ -649,32 +601,19 @@ browsers you are testing against.</p>
<code>neutrino-preset-karma</code> creates some conventions to make overriding the configuration easier once you are ready to make
changes.</p>
<h3 id="simple-customization">Simple customization</h3>
<p>By following the <a href="../../customization/simple.html">customization guide</a> you can override and augment the test configuration
directly from package.json. <code>neutrino-preset-karma</code> will import Karma configuration from your package.json&apos;s
<code>neutrino.options.karma</code> object if defined. The format is defined on the
<a href="http://karma-runner.github.io/1.0/config/configuration-file.html" target="_blank">Karma documentation site</a>.</p>
<p><em>Example: Change the duration Karma waits for a browser to reconnect (in ms).</em></p>
<pre class="language-"><code class="lang-js"><span class="token punctuation">{</span>
<span class="token string">&quot;neutrino&quot;</span><span class="token punctuation">:</span> <span class="token punctuation">{</span>
<span class="token string">&quot;options&quot;</span><span class="token punctuation">:</span> <span class="token punctuation">{</span>
<span class="token string">&quot;karma&quot;</span><span class="token punctuation">:</span> <span class="token punctuation">{</span>
<span class="token string">&quot;browserDisconnectTimeout&quot;</span><span class="token punctuation">:</span> <span class="token number">5000</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
<p>It is not currently possible to override <code>neutrino-preset-karma</code> settings from the package.json using simple
customization. Please use the advanced configuration for changes.</p>
<h3 id="advanced-configuration">Advanced configuration</h3>
<p>By following the <a href="../../customization/advanced.html">customization guide</a> you can override and augment testing by creating a
JS module which overrides the config. </p>
<p>You can also modify Karma settings by overriding with any options Karma accepts. In a standalone Karma project this is
typically done in a <code>karma.conf.js</code> file, but <code>neutrino-preset-karma</code> unifies advanced configuration through a preset
override module. When needing to make changes to Karma-specific settings, this is stored in the <code>neutrino.options.karma</code>
override module. When needing to make changes to Karma-specific settings, this is stored in the <code>neutrino.custom.karma</code>
object, and takes the same configuration options as outlined in the
<a href="https://karma-runner.github.io/1.0/config/configuration-file.html" target="_blank">Karma documentation</a>.</p>
<p><em>Example: Change the duration Karma waits for a browser to reconnect (in ms).</em></p>
<pre class="language-"><code class="lang-js">module<span class="token punctuation">.</span>exports <span class="token operator">=</span> neutrino <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
neutrino<span class="token punctuation">.</span>options<span class="token punctuation">.</span>karma<span class="token punctuation">.</span>browserDisconnectTimeout <span class="token operator">=</span> <span class="token number">5000</span><span class="token punctuation">;</span>
neutrino<span class="token punctuation">.</span>custom<span class="token punctuation">.</span>karma<span class="token punctuation">.</span>browserDisconnectTimeout <span class="token operator">=</span> <span class="token number">5000</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
<h2 id="contributing">Contributing</h2>
@ -724,7 +663,7 @@ containing all resources for developing Neutrino and its core presets. Follow th
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"Karma","level":"1.7.5","depth":2,"next":{"title":"Mocha","level":"1.7.6","depth":2,"path":"presets/neutrino-preset-mocha/README.md","ref":"./presets/neutrino-preset-mocha/README.md","articles":[]},"previous":{"title":"Airbnb","level":"1.7.4","depth":2,"path":"presets/neutrino-preset-airbnb-base/README.md","ref":"./presets/neutrino-preset-airbnb-base/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"presets/neutrino-preset-karma/README.md","mtime":"2017-03-15T13:20:51.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-15T14:46:02.288Z"},"basePath":"../..","book":{"language":""}});
gitbook.page.hasChanged({"page":{"title":"Karma","level":"1.6.5","depth":2,"next":{"title":"Mocha","level":"1.6.6","depth":2,"path":"presets/neutrino-preset-mocha/README.md","ref":"presets/neutrino-preset-mocha/README.md","articles":[]},"previous":{"title":"Airbnb","level":"1.6.4","depth":2,"path":"presets/neutrino-preset-airbnb-base/README.md","ref":"presets/neutrino-preset-airbnb-base/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"presets/neutrino-preset-karma/README.md","mtime":"2017-02-16T21:55:45.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-06T17:07:12.452Z"},"basePath":"../..","book":{"language":""}});
});
</script>
</div>

129
presets/neutrino-preset-mocha/index.html

@ -158,20 +158,7 @@
</li>
<li class="chapter " data-level="1.6" data-path="../../middleware/">
<a href="../../middleware/">
Middleware
</a>
</li>
<li class="chapter " data-level="1.7" data-path="../">
<li class="chapter " data-level="1.6" data-path="../">
<a href="../">
@ -185,7 +172,7 @@
<ul class="articles">
<li class="chapter " data-level="1.7.1" data-path="../neutrino-preset-web/">
<li class="chapter " data-level="1.6.1" data-path="../neutrino-preset-web/">
<a href="../neutrino-preset-web/">
@ -198,7 +185,7 @@
</li>
<li class="chapter " data-level="1.7.2" data-path="../neutrino-preset-react/">
<li class="chapter " data-level="1.6.2" data-path="../neutrino-preset-react/">
<a href="../neutrino-preset-react/">
@ -211,7 +198,7 @@
</li>
<li class="chapter " data-level="1.7.3" data-path="../neutrino-preset-node/">
<li class="chapter " data-level="1.6.3" data-path="../neutrino-preset-node/">
<a href="../neutrino-preset-node/">
@ -224,7 +211,7 @@
</li>
<li class="chapter " data-level="1.7.4" data-path="../neutrino-preset-airbnb-base/">
<li class="chapter " data-level="1.6.4" data-path="../neutrino-preset-airbnb-base/">
<a href="../neutrino-preset-airbnb-base/">
@ -237,7 +224,7 @@
</li>
<li class="chapter " data-level="1.7.5" data-path="../neutrino-preset-karma/">
<li class="chapter " data-level="1.6.5" data-path="../neutrino-preset-karma/">
<a href="../neutrino-preset-karma/">
@ -250,7 +237,7 @@
</li>
<li class="chapter active" data-level="1.7.6" data-path="./">
<li class="chapter active" data-level="1.6.6" data-path="./">
<a href="./">
@ -263,7 +250,7 @@
</li>
<li class="chapter " data-level="1.7.7" data-path="../neutrino-preset-jest/">
<li class="chapter " data-level="1.6.7" data-path="../neutrino-preset-jest/">
<a href="../neutrino-preset-jest/">
@ -276,7 +263,7 @@
</li>
<li class="chapter " data-level="1.7.8" data-path="../community-presets.html">
<li class="chapter " data-level="1.6.8" data-path="../community-presets.html">
<a href="../community-presets.html">
@ -294,7 +281,7 @@
</li>
<li class="chapter " data-level="1.8" data-path="../../customization/">
<li class="chapter " data-level="1.7" data-path="../../customization/">
<a href="../../customization/">
@ -308,7 +295,7 @@
<ul class="articles">
<li class="chapter " data-level="1.8.1" data-path="../../customization/simple.html">
<li class="chapter " data-level="1.7.1" data-path="../../customization/simple.html">
<a href="../../customization/simple.html">
@ -321,7 +308,7 @@
</li>
<li class="chapter " data-level="1.8.2" data-path="../../customization/advanced.html">
<li class="chapter " data-level="1.7.2" data-path="../../customization/advanced.html">
<a href="../../customization/advanced.html">
@ -339,7 +326,7 @@
</li>
<li class="chapter " data-level="1.9" data-path="../../creating-presets.html">
<li class="chapter " data-level="1.8" data-path="../../creating-presets.html">
<a href="../../creating-presets.html">
@ -353,9 +340,9 @@
<ul class="articles">
<li class="chapter " data-level="1.9.1" data-path="../neutrino-lint-base/README.md">
<li class="chapter " data-level="1.8.1" data-path="../neutrino-lint-base/">
<span>
<a href="../neutrino-lint-base/">
Creating linting presets
@ -371,7 +358,7 @@
</li>
<li class="chapter " data-level="1.10" data-path="../../learning-resources.html">
<li class="chapter " data-level="1.9" data-path="../../learning-resources.html">
<a href="../../learning-resources.html">
@ -384,7 +371,7 @@
</li>
<li class="chapter " data-level="1.11" data-path="../../api/">
<li class="chapter " data-level="1.10" data-path="../../api/">
<a href="../../api/">
@ -397,7 +384,7 @@
</li>
<li class="chapter " data-level="1.12" data-path="../../cli/">
<li class="chapter " data-level="1.11" data-path="../../cli/">
<a href="../../cli/">
@ -410,33 +397,7 @@
</li>
<li class="chapter " data-level="1.13" data-path="../../upgrading-neutrino.html">
<a href="../../upgrading-neutrino.html">
Upgrading from v4 to v5
</a>
</li>
<li class="chapter " data-level="1.14" >
<a target="_blank" href="https://github.com/mozilla-neutrino/neutrino-dev/tree/docs-v4/docs">
v4 Documentation
</a>
</li>
<li class="chapter " data-level="1.15" data-path="../../contributing/">
<li class="chapter " data-level="1.12" data-path="../../contributing/">
<a href="../../contributing/">
@ -450,7 +411,7 @@
<ul class="articles">
<li class="chapter " data-level="1.15.1" data-path="../../contributing/development.html">
<li class="chapter " data-level="1.12.1" data-path="../../contributing/development.html">
<a href="../../contributing/development.html">
@ -463,7 +424,7 @@
</li>
<li class="chapter " data-level="1.15.2" data-path="../../contributing/code-of-conduct.html">
<li class="chapter " data-level="1.12.2" data-path="../../contributing/code-of-conduct.html">
<a href="../../contributing/code-of-conduct.html">
@ -539,7 +500,7 @@
<ul>
<li>Node.js v6.9+</li>
<li>Yarn or npm client</li>
<li>Neutrino v5, Neutrino build preset</li>
<li>Neutrino v4, Neutrino build preset</li>
</ul>
<h2 id="installation">Installation</h2>
<p><code>neutrino-preset-mocha</code> can be installed via the Yarn or npm clients. Inside your project, make sure
@ -577,16 +538,6 @@ let&apos;s pretend this is a Node.js project:</p>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
<p>Or if you have set up Neutrino with <code>neutrino.presets</code> in your package.json:</p>
<pre class="language-"><code class="lang-json"><span class="token punctuation">{</span>
<span class="token property">&quot;neutrino&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;presets&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span>
<span class="token string">&quot;neutrino-preset-node&quot;</span><span class="token punctuation">,</span>
<span class="token string">&quot;neutrino-preset-mocha&quot;</span>
<span class="token punctuation">]</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
<p>Run the tests, and view the results in your console:</p>
<h4 id="yarn">Yarn</h4>
<pre class="language-"><code class="lang-bash">&#x276F; yarn <span class="token function">test</span>
@ -622,37 +573,11 @@ changes.</p>
<h3 id="rules">Rules</h3>
<p>The following is a list of rules and their identifiers which can be overridden:</p>
<ul>
<li><code>compile</code>: Compiles JS files from the <code>test</code> directory using Babel. Contains a single loader named <code>babel</code>. Adopts
Babel configuration from other presets that have been loaded.</li>
<li><code>compile</code>: Compiles JS files from the <code>test</code> directory using Babel. Contains a single loader named <code>babel</code>.</li>
</ul>
<h3 id="simple-customization">Simple customization</h3>
<p>By following the <a href="../../customization/simple.html">customization guide</a> you can override and augment the test configuration
directly from package.json. <code>neutrino-preset-mocha</code> will import Mocha configuration from your package.json&apos;s
<code>neutrino.options.mocha</code> object if defined. The format is defined on the
<a href="https://mochajs.org/#usage" target="_blank">Mocha documentation site</a>, with command-line flags mapping to camel-cased options
in <code>neutrino.options.mocha</code>.</p>
<p><em>Example: Switch the test reporter from the default <code>spec</code> to <code>nyan</code>:</em></p>
<pre class="language-"><code class="lang-js"><span class="token punctuation">{</span>
<span class="token string">&quot;neutrino&quot;</span><span class="token punctuation">:</span> <span class="token punctuation">{</span>
<span class="token string">&quot;options&quot;</span><span class="token punctuation">:</span> <span class="token punctuation">{</span>
<span class="token string">&quot;mocha&quot;</span><span class="token punctuation">:</span> <span class="token punctuation">{</span>
<span class="token string">&quot;reporter&quot;</span><span class="token punctuation">:</span> <span class="token string">&quot;nyan&quot;</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
<pre class="language-"><code class="lang-bash">&#x276F; yarn <span class="token function">test</span>
1 -__,------,
0 -__<span class="token operator">|</span> /\_/\
0 -_~<span class="token operator">|</span>_<span class="token punctuation">(</span> ^ .^<span class="token punctuation">)</span>
-_ <span class="token string">&quot;&quot;</span> <span class="token string">&quot;&quot;</span>
1 passing <span class="token punctuation">(</span>362ms<span class="token punctuation">)</span>
&#x2728; Done <span class="token keyword">in</span> 3.28s.
</code></pre>
<p>By following the <a href="../../customization/simple.html">customization guide</a> and knowing the rule, loader, and plugin IDs above,
you can override and augment the build directly from package.json.</p>
<h3 id="advanced-configuration">Advanced configuration</h3>
<p>By following the <a href="../../customization/advanced.html">customization guide</a> and knowing the rule, and loader IDs above,
you can override and augment testing by creating a JS module which overrides the config.</p>
@ -660,7 +585,7 @@ you can override and augment testing by creating a JS module which overrides the
<code>neutrino.custom.mocha</code> object.</p>
<p><em>Example: Switch the test reporter from the default <code>spec</code> to <code>nyan</code>:</em></p>
<pre class="language-"><code class="lang-js">module<span class="token punctuation">.</span>exports <span class="token operator">=</span> neutrino <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
neutrino<span class="token punctuation">.</span>options<span class="token punctuation">.</span>mocha<span class="token punctuation">.</span>reporter <span class="token operator">=</span> <span class="token string">&apos;nyan&apos;</span><span class="token punctuation">;</span>
neutrino<span class="token punctuation">.</span>custom<span class="token punctuation">.</span>mocha<span class="token punctuation">.</span>reporter <span class="token operator">=</span> <span class="token string">&apos;nyan&apos;</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
<pre class="language-"><code class="lang-bash">&#x276F; yarn <span class="token function">test</span>
@ -721,7 +646,7 @@ containing all resources for developing Neutrino and its core presets. Follow th
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"Mocha","level":"1.7.6","depth":2,"next":{"title":"Jest","level":"1.7.7","depth":2,"path":"presets/neutrino-preset-jest/README.md","ref":"./presets/neutrino-preset-jest/README.md","articles":[]},"previous":{"title":"Karma","level":"1.7.5","depth":2,"path":"presets/neutrino-preset-karma/README.md","ref":"./presets/neutrino-preset-karma/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"presets/neutrino-preset-mocha/README.md","mtime":"2017-03-15T13:20:51.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-15T14:46:02.288Z"},"basePath":"../..","book":{"language":""}});
gitbook.page.hasChanged({"page":{"title":"Mocha","level":"1.6.6","depth":2,"next":{"title":"Jest","level":"1.6.7","depth":2,"path":"presets/neutrino-preset-jest/README.md","ref":"presets/neutrino-preset-jest/README.md","articles":[]},"previous":{"title":"Karma","level":"1.6.5","depth":2,"path":"presets/neutrino-preset-karma/README.md","ref":"presets/neutrino-preset-karma/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"presets/neutrino-preset-mocha/README.md","mtime":"2017-02-16T21:55:45.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-06T17:07:12.452Z"},"basePath":"../..","book":{"language":""}});
});
</script>
</div>

225
presets/neutrino-preset-node/index.html

@ -158,20 +158,7 @@
</li>
<li class="chapter " data-level="1.6" data-path="../../middleware/">
<a href="../../middleware/">
Middleware
</a>
</li>
<li class="chapter " data-level="1.7" data-path="../">
<li class="chapter " data-level="1.6" data-path="../">
<a href="../">
@ -185,7 +172,7 @@
<ul class="articles">
<li class="chapter " data-level="1.7.1" data-path="../neutrino-preset-web/">
<li class="chapter " data-level="1.6.1" data-path="../neutrino-preset-web/">
<a href="../neutrino-preset-web/">
@ -198,7 +185,7 @@
</li>
<li class="chapter " data-level="1.7.2" data-path="../neutrino-preset-react/">
<li class="chapter " data-level="1.6.2" data-path="../neutrino-preset-react/">
<a href="../neutrino-preset-react/">
@ -211,7 +198,7 @@
</li>
<li class="chapter active" data-level="1.7.3" data-path="./">
<li class="chapter active" data-level="1.6.3" data-path="./">
<a href="./">
@ -224,7 +211,7 @@
</li>
<li class="chapter " data-level="1.7.4" data-path="../neutrino-preset-airbnb-base/">
<li class="chapter " data-level="1.6.4" data-path="../neutrino-preset-airbnb-base/">
<a href="../neutrino-preset-airbnb-base/">
@ -237,7 +224,7 @@
</li>
<li class="chapter " data-level="1.7.5" data-path="../neutrino-preset-karma/">
<li class="chapter " data-level="1.6.5" data-path="../neutrino-preset-karma/">
<a href="../neutrino-preset-karma/">
@ -250,7 +237,7 @@
</li>
<li class="chapter " data-level="1.7.6" data-path="../neutrino-preset-mocha/">
<li class="chapter " data-level="1.6.6" data-path="../neutrino-preset-mocha/">
<a href="../neutrino-preset-mocha/">
@ -263,7 +250,7 @@
</li>
<li class="chapter " data-level="1.7.7" data-path="../neutrino-preset-jest/">
<li class="chapter " data-level="1.6.7" data-path="../neutrino-preset-jest/">
<a href="../neutrino-preset-jest/">
@ -276,7 +263,7 @@
</li>
<li class="chapter " data-level="1.7.8" data-path="../community-presets.html">
<li class="chapter " data-level="1.6.8" data-path="../community-presets.html">
<a href="../community-presets.html">
@ -294,7 +281,7 @@
</li>
<li class="chapter " data-level="1.8" data-path="../../customization/">
<li class="chapter " data-level="1.7" data-path="../../customization/">
<a href="../../customization/">
@ -308,7 +295,7 @@
<ul class="articles">
<li class="chapter " data-level="1.8.1" data-path="../../customization/simple.html">
<li class="chapter " data-level="1.7.1" data-path="../../customization/simple.html">
<a href="../../customization/simple.html">
@ -321,7 +308,7 @@
</li>
<li class="chapter " data-level="1.8.2" data-path="../../customization/advanced.html">
<li class="chapter " data-level="1.7.2" data-path="../../customization/advanced.html">
<a href="../../customization/advanced.html">
@ -339,7 +326,7 @@
</li>
<li class="chapter " data-level="1.9" data-path="../../creating-presets.html">
<li class="chapter " data-level="1.8" data-path="../../creating-presets.html">
<a href="../../creating-presets.html">
@ -353,9 +340,9 @@
<ul class="articles">
<li class="chapter " data-level="1.9.1" data-path="../neutrino-lint-base/README.md">
<li class="chapter " data-level="1.8.1" data-path="../neutrino-lint-base/">
<span>
<a href="../neutrino-lint-base/">
Creating linting presets
@ -371,7 +358,7 @@
</li>
<li class="chapter " data-level="1.10" data-path="../../learning-resources.html">
<li class="chapter " data-level="1.9" data-path="../../learning-resources.html">
<a href="../../learning-resources.html">
@ -384,7 +371,7 @@
</li>
<li class="chapter " data-level="1.11" data-path="../../api/">
<li class="chapter " data-level="1.10" data-path="../../api/">
<a href="../../api/">
@ -397,7 +384,7 @@
</li>
<li class="chapter " data-level="1.12" data-path="../../cli/">
<li class="chapter " data-level="1.11" data-path="../../cli/">
<a href="../../cli/">
@ -410,33 +397,7 @@
</li>
<li class="chapter " data-level="1.13" data-path="../../upgrading-neutrino.html">
<a href="../../upgrading-neutrino.html">
Upgrading from v4 to v5
</a>
</li>
<li class="chapter " data-level="1.14" >
<a target="_blank" href="https://github.com/mozilla-neutrino/neutrino-dev/tree/docs-v4/docs">
v4 Documentation
</a>
</li>
<li class="chapter " data-level="1.15" data-path="../../contributing/">
<li class="chapter " data-level="1.12" data-path="../../contributing/">
<a href="../../contributing/">
@ -450,7 +411,7 @@
<ul class="articles">
<li class="chapter " data-level="1.15.1" data-path="../../contributing/development.html">
<li class="chapter " data-level="1.12.1" data-path="../../contributing/development.html">
<a href="../../contributing/development.html">
@ -463,7 +424,7 @@
</li>
<li class="chapter " data-level="1.15.2" data-path="../../contributing/code-of-conduct.html">
<li class="chapter " data-level="1.12.2" data-path="../../contributing/code-of-conduct.html">
<a href="../../contributing/code-of-conduct.html">
@ -532,10 +493,9 @@
<h2 id="features">Features</h2>
<ul>
<li>Zero upfront configuration necessary to start developing and building a Node.js project</li>
<li>Modern Babel compilation supporting ES modules, Node.js 6.9+, async functions, and dynamic imports</li>
<li>Supports automatically-wired sourcemaps</li>
<li>Modern Babel compilation supporting ES modules, Node.js 6.9+, and async functions</li>
<li>Auto-wired sourcemaps</li>
<li>Tree-shaking to create smaller bundles</li>
<li>Hot Module Replacement with source-watching during development</li>
<li>Chunking of external dependencies apart from application code</li>
<li>Easily extensible to customize your project as needed</li>
</ul>
@ -543,7 +503,7 @@
<ul>
<li>Node.js v6.9+</li>
<li>Yarn or npm client</li>
<li>Neutrino v5</li>
<li>Neutrino v4</li>
</ul>
<h2 id="installation">Installation</h2>
<p><code>neutrino-preset-node</code> can be installed via the Yarn or npm clients. Inside your project, make sure
@ -584,9 +544,12 @@ a single JS file named <code>index.js</code> in it.</p>
<span class="token punctuation">.</span><span class="token function">listen</span><span class="token punctuation">(</span>port<span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=</span><span class="token operator">&gt;</span> console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token template-string"><span class="token string">`Server running on port </span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>port<span class="token interpolation-punctuation punctuation">}</span></span><span class="token string">`</span></span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
<p>Now edit your project&apos;s package.json to add commands for starting and building the application.</p>
<p><strong>Important Note:</strong> At the time of writing, Neutrino&apos;s Node preset does not support <code>watch</code>
compilation with <code>neutrino start</code>; it will instead fall back to running a build with the <code>NODE_ENV</code>
environment variable set to <code>development</code>.</p>
<pre class="language-"><code class="lang-json"><span class="token punctuation">{</span>
<span class="token property">&quot;scripts&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;start&quot;</span><span class="token operator">:</span> <span class="token string">&quot;neutrino start --presets neutrino-preset-node&quot;</span><span class="token punctuation">,</span>
<span class="token property">&quot;start&quot;</span><span class="token operator">:</span> <span class="token string">&quot;neutrino start --presets neutrino-preset-node &amp;&amp; node build/index.js&quot;</span><span class="token punctuation">,</span>
<span class="token property">&quot;build&quot;</span><span class="token operator">:</span> <span class="token string">&quot;neutrino build --presets neutrino-preset-node&quot;</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
@ -594,6 +557,13 @@ a single JS file named <code>index.js</code> in it.</p>
<p>Start the app, then either open a browser to <a href="http://localhost:3000" target="_blank">http://localhost:3000</a> or use curl from another terminal window:</p>
<h4 id="yarn">Yarn</h4>
<pre class="language-"><code class="lang-bash">&#x276F; yarn start
Warning: This preset does not support <span class="token function">watch</span> compilation. Falling back to a one-time build.
Hash: 89e4fb250fc535920ba4
Version: webpack 2.2.1
Time: 432ms
Asset Size Chunks Chunk Names
index.js 4.29 kB 0 <span class="token punctuation">[</span>emitted<span class="token punctuation">]</span> index
index.js.map 3.73 kB 0 <span class="token punctuation">[</span>emitted<span class="token punctuation">]</span> index
Server running on port 3000
</code></pre>
<pre class="language-"><code class="lang-bash">&#x276F; curl http://localhost:3000
@ -601,6 +571,13 @@ hi<span class="token operator">!</span>
</code></pre>
<h4 id="npm">npm</h4>
<pre class="language-"><code class="lang-bash">&#x276F; npm start
Warning: This preset does not support <span class="token function">watch</span> compilation. Falling back to a one-time build.
Hash: 89e4fb250fc535920ba4
Version: webpack 2.2.1
Time: 432ms
Asset Size Chunks Chunk Names
index.js 4.29 kB 0 <span class="token punctuation">[</span>emitted<span class="token punctuation">]</span> index
index.js.map 3.73 kB 0 <span class="token punctuation">[</span>emitted<span class="token punctuation">]</span> index
Server running on port 3000
</code></pre>
<pre class="language-"><code class="lang-bash">&#x276F; curl http://localhost:3000
@ -632,39 +609,6 @@ or via <code>.npmignore</code> to blacklist <code>src</code>.</p>
<span class="token punctuation">]</span>
<span class="token punctuation">}</span>
</code></pre>
<p><em>Note: While this preset works well for many types of Node.js applications, it&apos;s important to make the distinction
between applications and libraries. This preset will not work optimally out of the box for creating distributable
libraries, and will take a little extra customization to make them suitable for that purpose.</em></p>
<h2 id="hot-module-replacement">Hot Module Replacement</h2>
<p>While <code>neutrino-preset-node</code> supports Hot Module Replacement for your app, it does require some application-specific
changes in order to operate. Your application should define split points for which to accept modules to reload using
<code>module.hot</code>:</p>
<p>For example:</p>
<pre class="language-"><code class="lang-js"><span class="token keyword">import</span> <span class="token punctuation">{</span> createServer <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">&apos;http&apos;</span><span class="token punctuation">;</span>
<span class="token keyword">import</span> app <span class="token keyword">from</span> <span class="token string">&apos;./app&apos;</span><span class="token punctuation">;</span>
<span class="token keyword">if</span> <span class="token punctuation">(</span>module<span class="token punctuation">.</span>hot<span class="token punctuation">)</span> <span class="token punctuation">{</span>
module<span class="token punctuation">.</span>hot<span class="token punctuation">.</span><span class="token function">accept</span><span class="token punctuation">(</span><span class="token string">&apos;./app&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
<span class="token function">createServer</span><span class="token punctuation">(</span><span class="token punctuation">(</span>req<span class="token punctuation">,</span> res<span class="token punctuation">)</span> <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
res<span class="token punctuation">.</span><span class="token function">end</span><span class="token punctuation">(</span><span class="token function">app</span><span class="token punctuation">(</span><span class="token string">&apos;example&apos;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">listen</span><span class="token punctuation">(</span><span class="token comment" spellcheck="true">/* */</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
<p>Or for all paths:</p>
<pre class="language-"><code class="lang-js"><span class="token keyword">import</span> <span class="token punctuation">{</span> createServer <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">&apos;http&apos;</span><span class="token punctuation">;</span>
<span class="token keyword">import</span> app <span class="token keyword">from</span> <span class="token string">&apos;./app&apos;</span><span class="token punctuation">;</span>
<span class="token keyword">if</span> <span class="token punctuation">(</span>module<span class="token punctuation">.</span>hot<span class="token punctuation">)</span> <span class="token punctuation">{</span>
module<span class="token punctuation">.</span>hot<span class="token punctuation">.</span><span class="token function">accept</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
<span class="token function">createServer</span><span class="token punctuation">(</span><span class="token punctuation">(</span>req<span class="token punctuation">,</span> res<span class="token punctuation">)</span> <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
res<span class="token punctuation">.</span><span class="token function">end</span><span class="token punctuation">(</span><span class="token function">app</span><span class="token punctuation">(</span><span class="token string">&apos;example&apos;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">listen</span><span class="token punctuation">(</span><span class="token comment" spellcheck="true">/* */</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
<p>Using dynamic imports with <code>import()</code> will automatically create split points and hot replace those modules upon
modification during development.</p>
<h2 id="customizing">Customizing</h2>
<p>To override the build configuration, start with the documentation on <a href="../../customization/">customization</a>.
<code>neutrino-preset-node</code> creates some conventions to make overriding the configuration easier once you are ready to make
@ -693,41 +637,10 @@ package.json. No extra work is required to make this work.</p>
<h3 id="simple-customization">Simple customization</h3>
<p>By following the <a href="../../customization/simple.html">customization guide</a> and knowing the rule, loader, and plugin IDs above,
you can override and augment the build directly from package.json.</p>
<h4 id="compile-targets">Compile targets</h4>
<p>This preset uses babel-preset-env to compile code targeting the Node.js v6.9+. To change
the Node.js target from package.json, specify an object at <code>neutrino.options.compile.targets</code> which contains a
<a href="https://github.com/babel/babel-preset-env#targetsnode" target="_blank">babel-preset-env-compatible</a> Node.js target.</p>
<p><em>Example: Replace the preset Node.js target with support for Node.js 4.2:</em></p>
<pre class="language-"><code class="lang-json"><span class="token punctuation">{</span>
<span class="token property">&quot;neutrino&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;options&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;compile&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;targets&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;node&quot;</span><span class="token operator">:</span> <span class="token number">4.2</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
<p><em>Example: Change support to current Node.js version:</em></p>
<pre class="language-"><code class="lang-json"><span class="token punctuation">{</span>
<span class="token property">&quot;neutrino&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;options&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;compile&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;targets&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;node&quot;</span><span class="token operator">:</span> <span class="token string">&quot;current&quot;</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
<h4 id="other-customization-examples">Other customization examples</h4>
<p><em>Example: Allow importing modules with an <code>.mjs</code> extension.</em></p>
<pre class="language-"><code class="lang-json"><span class="token punctuation">{</span>
<span class="token property">&quot;neutrino&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;config&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;config&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;neutrino&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;resolve&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;extensions&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span>
<span class="token string">&quot;.mjs&quot;</span>
@ -740,54 +653,6 @@ the Node.js target from package.json, specify an object at <code>neutrino.option
<h3 id="advanced-configuration">Advanced configuration</h3>
<p>By following the <a href="../../customization/advanced.html">customization guide</a> and knowing the rule, loader, and plugin IDs above,
you can override and augment the build by creating a JS module which overrides the config.</p>
<h4 id="compile-targets">Compile targets</h4>
<p>This preset uses babel-preset-env to compile code targeting the Node.js v6.9+. To change
the Node.js target from package.json, specify an object at <code>neutrino.options.compile.targets</code> which contains a
<a href="https://github.com/babel/babel-preset-env#targetsnode" target="_blank">babel-preset-env-compatible</a> Node.js target.</p>
<p><strong>Note: Setting these options via <code>neutrino.options.compile</code> must be done prior to loading the Node.js preset or they
will not be picked up by the compile middleware. These examples show changing compile targets with options before
loading the preset and overriding them if loaded afterwards.</strong></p>
<p><em>Example: Replace the preset Node.js target with support for Node.js 4.2:</em></p>
<pre class="language-"><code class="lang-js">module<span class="token punctuation">.</span>exports <span class="token operator">=</span> neutrino <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
<span class="token comment" spellcheck="true">// Using neutrino.options prior to loading Node.js preset</span>
neutrino<span class="token punctuation">.</span>options<span class="token punctuation">.</span>compile <span class="token operator">=</span> <span class="token punctuation">{</span>
targets<span class="token punctuation">:</span> <span class="token punctuation">{</span>
node<span class="token punctuation">:</span> <span class="token number">4.2</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">// Using compile options override following loading Node.js preset</span>
neutrino<span class="token punctuation">.</span>config<span class="token punctuation">.</span>module
<span class="token punctuation">.</span><span class="token function">rule</span><span class="token punctuation">(</span><span class="token string">&apos;compile&apos;</span><span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">use</span><span class="token punctuation">(</span><span class="token string">&apos;babel&apos;</span><span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">tap</span><span class="token punctuation">(</span>options <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
options<span class="token punctuation">.</span>presets<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span><span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">]</span><span class="token punctuation">.</span>targets<span class="token punctuation">.</span>node <span class="token operator">=</span> <span class="token number">4.2</span><span class="token punctuation">;</span>
<span class="token keyword">return</span> options<span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
<p><em>Example: Change support to current Node.js version:</em></p>
<pre class="language-"><code class="lang-js">module<span class="token punctuation">.</span>exports <span class="token operator">=</span> neutrino <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
<span class="token comment" spellcheck="true">// Using neutrino.options prior to loading Node.js preset</span>
neutrino<span class="token punctuation">.</span>options<span class="token punctuation">.</span>compile <span class="token operator">=</span> <span class="token punctuation">{</span>
targets<span class="token punctuation">:</span> <span class="token punctuation">{</span>
node<span class="token punctuation">:</span> <span class="token number">4.2</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">// Using compile options override following loading Node.js preset</span>
neutrino<span class="token punctuation">.</span>config<span class="token punctuation">.</span>module
<span class="token punctuation">.</span><span class="token function">rule</span><span class="token punctuation">(</span><span class="token string">&apos;compile&apos;</span><span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">use</span><span class="token punctuation">(</span><span class="token string">&apos;babel&apos;</span><span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">tap</span><span class="token punctuation">(</span>options <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
options<span class="token punctuation">.</span>presets<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span><span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">]</span><span class="token punctuation">.</span>targets<span class="token punctuation">.</span>node <span class="token operator">=</span> <span class="token string">&apos;current&apos;</span><span class="token punctuation">;</span>
<span class="token keyword">return</span> options<span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
<h4 id="other-customization-examples">Other customization examples</h4>
<p><em>Example: Allow importing modules with an <code>.mjs</code> extension.</em></p>
<pre class="language-"><code class="lang-js">module<span class="token punctuation">.</span>exports <span class="token operator">=</span> neutrino <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
neutrino<span class="token punctuation">.</span>config<span class="token punctuation">.</span>resolve<span class="token punctuation">.</span>extensions<span class="token punctuation">.</span><span class="token function">add</span><span class="token punctuation">(</span><span class="token string">&apos;.mjs&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
@ -840,7 +705,7 @@ containing all resources for developing Neutrino and its core presets. Follow th
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"Node.js","level":"1.7.3","depth":2,"next":{"title":"Airbnb","level":"1.7.4","depth":2,"path":"presets/neutrino-preset-airbnb-base/README.md","ref":"./presets/neutrino-preset-airbnb-base/README.md","articles":[]},"previous":{"title":"React","level":"1.7.2","depth":2,"path":"presets/neutrino-preset-react/README.md","ref":"./presets/neutrino-preset-react/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"presets/neutrino-preset-node/README.md","mtime":"2017-03-15T13:20:51.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-15T14:46:02.288Z"},"basePath":"../..","book":{"language":""}});
gitbook.page.hasChanged({"page":{"title":"Node.js","level":"1.6.3","depth":2,"next":{"title":"Airbnb","level":"1.6.4","depth":2,"path":"presets/neutrino-preset-airbnb-base/README.md","ref":"presets/neutrino-preset-airbnb-base/README.md","articles":[]},"previous":{"title":"React","level":"1.6.2","depth":2,"path":"presets/neutrino-preset-react/README.md","ref":"presets/neutrino-preset-react/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"presets/neutrino-preset-node/README.md","mtime":"2017-03-01T16:01:35.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-06T17:07:12.452Z"},"basePath":"../..","book":{"language":""}});
});
</script>
</div>

106
presets/neutrino-preset-react/index.html

@ -158,20 +158,7 @@
</li>
<li class="chapter " data-level="1.6" data-path="../../middleware/">
<a href="../../middleware/">
Middleware
</a>
</li>
<li class="chapter " data-level="1.7" data-path="../">
<li class="chapter " data-level="1.6" data-path="../">
<a href="../">
@ -185,7 +172,7 @@
<ul class="articles">
<li class="chapter " data-level="1.7.1" data-path="../neutrino-preset-web/">
<li class="chapter " data-level="1.6.1" data-path="../neutrino-preset-web/">
<a href="../neutrino-preset-web/">
@ -198,7 +185,7 @@
</li>
<li class="chapter active" data-level="1.7.2" data-path="./">
<li class="chapter active" data-level="1.6.2" data-path="./">
<a href="./">
@ -211,7 +198,7 @@
</li>
<li class="chapter " data-level="1.7.3" data-path="../neutrino-preset-node/">
<li class="chapter " data-level="1.6.3" data-path="../neutrino-preset-node/">
<a href="../neutrino-preset-node/">
@ -224,7 +211,7 @@
</li>
<li class="chapter " data-level="1.7.4" data-path="../neutrino-preset-airbnb-base/">
<li class="chapter " data-level="1.6.4" data-path="../neutrino-preset-airbnb-base/">
<a href="../neutrino-preset-airbnb-base/">
@ -237,7 +224,7 @@
</li>
<li class="chapter " data-level="1.7.5" data-path="../neutrino-preset-karma/">
<li class="chapter " data-level="1.6.5" data-path="../neutrino-preset-karma/">
<a href="../neutrino-preset-karma/">
@ -250,7 +237,7 @@
</li>
<li class="chapter " data-level="1.7.6" data-path="../neutrino-preset-mocha/">
<li class="chapter " data-level="1.6.6" data-path="../neutrino-preset-mocha/">
<a href="../neutrino-preset-mocha/">
@ -263,7 +250,7 @@
</li>
<li class="chapter " data-level="1.7.7" data-path="../neutrino-preset-jest/">
<li class="chapter " data-level="1.6.7" data-path="../neutrino-preset-jest/">
<a href="../neutrino-preset-jest/">
@ -276,7 +263,7 @@
</li>
<li class="chapter " data-level="1.7.8" data-path="../community-presets.html">
<li class="chapter " data-level="1.6.8" data-path="../community-presets.html">
<a href="../community-presets.html">
@ -294,7 +281,7 @@
</li>
<li class="chapter " data-level="1.8" data-path="../../customization/">
<li class="chapter " data-level="1.7" data-path="../../customization/">
<a href="../../customization/">
@ -308,7 +295,7 @@
<ul class="articles">
<li class="chapter " data-level="1.8.1" data-path="../../customization/simple.html">
<li class="chapter " data-level="1.7.1" data-path="../../customization/simple.html">
<a href="../../customization/simple.html">
@ -321,7 +308,7 @@
</li>
<li class="chapter " data-level="1.8.2" data-path="../../customization/advanced.html">
<li class="chapter " data-level="1.7.2" data-path="../../customization/advanced.html">
<a href="../../customization/advanced.html">
@ -339,7 +326,7 @@
</li>
<li class="chapter " data-level="1.9" data-path="../../creating-presets.html">
<li class="chapter " data-level="1.8" data-path="../../creating-presets.html">
<a href="../../creating-presets.html">
@ -353,9 +340,9 @@
<ul class="articles">
<li class="chapter " data-level="1.9.1" data-path="../neutrino-lint-base/README.md">
<li class="chapter " data-level="1.8.1" data-path="../neutrino-lint-base/">
<span>
<a href="../neutrino-lint-base/">
Creating linting presets
@ -371,7 +358,7 @@
</li>
<li class="chapter " data-level="1.10" data-path="../../learning-resources.html">
<li class="chapter " data-level="1.9" data-path="../../learning-resources.html">
<a href="../../learning-resources.html">
@ -384,7 +371,7 @@
</li>
<li class="chapter " data-level="1.11" data-path="../../api/">
<li class="chapter " data-level="1.10" data-path="../../api/">
<a href="../../api/">
@ -397,7 +384,7 @@
</li>
<li class="chapter " data-level="1.12" data-path="../../cli/">
<li class="chapter " data-level="1.11" data-path="../../cli/">
<a href="../../cli/">
@ -410,33 +397,7 @@
</li>
<li class="chapter " data-level="1.13" data-path="../../upgrading-neutrino.html">
<a href="../../upgrading-neutrino.html">
Upgrading from v4 to v5
</a>
</li>
<li class="chapter " data-level="1.14" >
<a target="_blank" href="https://github.com/mozilla-neutrino/neutrino-dev/tree/docs-v4/docs">
v4 Documentation
</a>
</li>
<li class="chapter " data-level="1.15" data-path="../../contributing/">
<li class="chapter " data-level="1.12" data-path="../../contributing/">
<a href="../../contributing/">
@ -450,7 +411,7 @@
<ul class="articles">
<li class="chapter " data-level="1.15.1" data-path="../../contributing/development.html">
<li class="chapter " data-level="1.12.1" data-path="../../contributing/development.html">
<a href="../../contributing/development.html">
@ -463,7 +424,7 @@
</li>
<li class="chapter " data-level="1.15.2" data-path="../../contributing/code-of-conduct.html">
<li class="chapter " data-level="1.12.2" data-path="../../contributing/code-of-conduct.html">
<a href="../../contributing/code-of-conduct.html">
@ -536,7 +497,7 @@
<li>Support for React Hot Loader</li>
<li>Write JSX in .js or .jsx files</li>
<li>Extends from <a href="../neutrino-preset-web/">neutrino-preset-web</a><ul>
<li>Modern Babel compilation supporting ES modules, last 2 major browser versions, async functions, and dynamic imports</li>
<li>Modern Babel compilation supporting ES modules, last 2 major browser versions, and async functions</li>
<li>Webpack loaders for importing HTML, CSS, images, icons, and fonts</li>
<li>Webpack Dev Server during development</li>
<li>Automatic creation of HTML pages, no templating necessary</li>
@ -550,7 +511,7 @@
<ul>
<li>Node.js v6.9+</li>
<li>Yarn or npm client</li>
<li>Neutrino v5</li>
<li>Neutrino v4</li>
</ul>
<h2 id="installation">Installation</h2>
<p><code>neutrino-preset-react</code> can be installed via the Yarn or npm clients. Inside your project, make sure
@ -631,8 +592,8 @@ from your application code. When working with a React application, it is recomme
React and React DOM into the <code>vendor</code> chunk.</p>
<p><em>Example: Put React and React DOM into a separate &quot;vendor&quot; chunk:</em></p>
<pre class="language-"><code class="lang-json"><span class="token punctuation">{</span>
<span class="token property">&quot;neutrino&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;config&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;config&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;neutrino&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;entry&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;vendor&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span>
<span class="token string">&quot;react&quot;</span><span class="token punctuation">,</span>
@ -667,11 +628,9 @@ manifest.29ee4d0db8f2534cc643.bundle.js 1.44 kB 2 <span class="token p
neutrino-preset-web</a>.</p>
<p><em>Example: Change the application mount ID from &quot;root&quot; to &quot;app&quot;:</em></p>
<pre class="language-"><code class="lang-json"><span class="token punctuation">{</span>
<span class="token property">&quot;neutrino&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;options&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;html&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;appMountId&quot;</span><span class="token operator">:</span> <span class="token string">&quot;app&quot;</span>
<span class="token punctuation">}</span>
<span class="token property">&quot;config&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;html&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;appMountId&quot;</span><span class="token operator">:</span> <span class="token string">&quot;app&quot;</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
@ -690,8 +649,8 @@ from your application code.</p>
<span class="token punctuation">.</span><span class="token function">add</span><span class="token punctuation">(</span><span class="token string">&apos;react-dom&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
<h2 id="hot-module-replacement">Hot Module Replacement</h2>
<p>While <code>neutrino-preset-react</code> supports Hot Module Replacement your app using React Hot Loader, it does require some
<h2 id="hot-reloading">Hot Reloading</h2>
<p>While <code>neutrino-preset-react</code> supports hot reloading your app using React Hot Loader, it does require some
application-specific changes in order to operate.</p>
<p>First, install <code>react-hot-loader</code> as a dependency, this <strong>must</strong> be React Hot Loader v3+ (currently in beta):</p>
<h4 id="yarn">Yarn</h4>
@ -702,8 +661,7 @@ application-specific changes in order to operate.</p>
</code></pre>
<hr>
<ul>
<li>From your <code>index</code> entry point (defaults to <code>src/index.js</code> from <code>neutrino.options.entry</code>), import an <code>AppContainer</code>
from <code>react-hot-loader</code>.</li>
<li>From your <code>index</code> entry point (<code>src/index.js</code>), import an <code>AppContainer</code> from <code>react-hot-loader</code>.</li>
<li>Wrap your top-level React component in the <code>AppContainer</code>.</li>
<li>Perform the application render in a reusable function for initial load and subsequent reloads.</li>
<li>Add the <code>hot</code> acceptance to call this function.</li>
@ -773,7 +731,7 @@ containing all resources for developing Neutrino and its core presets. Follow th
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"React","level":"1.7.2","depth":2,"next":{"title":"Node.js","level":"1.7.3","depth":2,"path":"presets/neutrino-preset-node/README.md","ref":"./presets/neutrino-preset-node/README.md","articles":[]},"previous":{"title":"Web","level":"1.7.1","depth":2,"path":"presets/neutrino-preset-web/README.md","ref":"./presets/neutrino-preset-web/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"presets/neutrino-preset-react/README.md","mtime":"2017-03-15T13:20:51.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-15T14:46:02.288Z"},"basePath":"../..","book":{"language":""}});
gitbook.page.hasChanged({"page":{"title":"React","level":"1.6.2","depth":2,"next":{"title":"Node.js","level":"1.6.3","depth":2,"path":"presets/neutrino-preset-node/README.md","ref":"presets/neutrino-preset-node/README.md","articles":[]},"previous":{"title":"Web","level":"1.6.1","depth":2,"path":"presets/neutrino-preset-web/README.md","ref":"presets/neutrino-preset-web/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"presets/neutrino-preset-react/README.md","mtime":"2017-02-16T21:55:45.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-06T17:07:12.452Z"},"basePath":"../..","book":{"language":""}});
});
</script>
</div>

225
presets/neutrino-preset-web/index.html

@ -158,20 +158,7 @@
</li>
<li class="chapter " data-level="1.6" data-path="../../middleware/">
<a href="../../middleware/">
Middleware
</a>
</li>
<li class="chapter " data-level="1.7" data-path="../">
<li class="chapter " data-level="1.6" data-path="../">
<a href="../">
@ -185,7 +172,7 @@
<ul class="articles">
<li class="chapter active" data-level="1.7.1" data-path="./">
<li class="chapter active" data-level="1.6.1" data-path="./">
<a href="./">
@ -198,7 +185,7 @@
</li>
<li class="chapter " data-level="1.7.2" data-path="../neutrino-preset-react/">
<li class="chapter " data-level="1.6.2" data-path="../neutrino-preset-react/">
<a href="../neutrino-preset-react/">
@ -211,7 +198,7 @@
</li>
<li class="chapter " data-level="1.7.3" data-path="../neutrino-preset-node/">
<li class="chapter " data-level="1.6.3" data-path="../neutrino-preset-node/">
<a href="../neutrino-preset-node/">
@ -224,7 +211,7 @@
</li>
<li class="chapter " data-level="1.7.4" data-path="../neutrino-preset-airbnb-base/">
<li class="chapter " data-level="1.6.4" data-path="../neutrino-preset-airbnb-base/">
<a href="../neutrino-preset-airbnb-base/">
@ -237,7 +224,7 @@
</li>
<li class="chapter " data-level="1.7.5" data-path="../neutrino-preset-karma/">
<li class="chapter " data-level="1.6.5" data-path="../neutrino-preset-karma/">
<a href="../neutrino-preset-karma/">
@ -250,7 +237,7 @@
</li>
<li class="chapter " data-level="1.7.6" data-path="../neutrino-preset-mocha/">
<li class="chapter " data-level="1.6.6" data-path="../neutrino-preset-mocha/">
<a href="../neutrino-preset-mocha/">
@ -263,7 +250,7 @@
</li>
<li class="chapter " data-level="1.7.7" data-path="../neutrino-preset-jest/">
<li class="chapter " data-level="1.6.7" data-path="../neutrino-preset-jest/">
<a href="../neutrino-preset-jest/">
@ -276,7 +263,7 @@
</li>
<li class="chapter " data-level="1.7.8" data-path="../community-presets.html">
<li class="chapter " data-level="1.6.8" data-path="../community-presets.html">
<a href="../community-presets.html">
@ -294,7 +281,7 @@
</li>
<li class="chapter " data-level="1.8" data-path="../../customization/">
<li class="chapter " data-level="1.7" data-path="../../customization/">
<a href="../../customization/">
@ -308,7 +295,7 @@
<ul class="articles">
<li class="chapter " data-level="1.8.1" data-path="../../customization/simple.html">
<li class="chapter " data-level="1.7.1" data-path="../../customization/simple.html">
<a href="../../customization/simple.html">
@ -321,7 +308,7 @@
</li>
<li class="chapter " data-level="1.8.2" data-path="../../customization/advanced.html">
<li class="chapter " data-level="1.7.2" data-path="../../customization/advanced.html">
<a href="../../customization/advanced.html">
@ -339,7 +326,7 @@
</li>
<li class="chapter " data-level="1.9" data-path="../../creating-presets.html">
<li class="chapter " data-level="1.8" data-path="../../creating-presets.html">
<a href="../../creating-presets.html">
@ -353,9 +340,9 @@
<ul class="articles">
<li class="chapter " data-level="1.9.1" data-path="../neutrino-lint-base/README.md">
<li class="chapter " data-level="1.8.1" data-path="../neutrino-lint-base/">
<span>
<a href="../neutrino-lint-base/">
Creating linting presets
@ -371,7 +358,7 @@
</li>
<li class="chapter " data-level="1.10" data-path="../../learning-resources.html">
<li class="chapter " data-level="1.9" data-path="../../learning-resources.html">
<a href="../../learning-resources.html">
@ -384,7 +371,7 @@
</li>
<li class="chapter " data-level="1.11" data-path="../../api/">
<li class="chapter " data-level="1.10" data-path="../../api/">
<a href="../../api/">
@ -397,7 +384,7 @@
</li>
<li class="chapter " data-level="1.12" data-path="../../cli/">
<li class="chapter " data-level="1.11" data-path="../../cli/">
<a href="../../cli/">
@ -410,33 +397,7 @@
</li>
<li class="chapter " data-level="1.13" data-path="../../upgrading-neutrino.html">
<a href="../../upgrading-neutrino.html">
Upgrading from v4 to v5
</a>
</li>
<li class="chapter " data-level="1.14" >
<a target="_blank" href="https://github.com/mozilla-neutrino/neutrino-dev/tree/docs-v4/docs">
v4 Documentation
</a>
</li>
<li class="chapter " data-level="1.15" data-path="../../contributing/">
<li class="chapter " data-level="1.12" data-path="../../contributing/">
<a href="../../contributing/">
@ -450,7 +411,7 @@
<ul class="articles">
<li class="chapter " data-level="1.15.1" data-path="../../contributing/development.html">
<li class="chapter " data-level="1.12.1" data-path="../../contributing/development.html">
<a href="../../contributing/development.html">
@ -463,7 +424,7 @@
</li>
<li class="chapter " data-level="1.15.2" data-path="../../contributing/code-of-conduct.html">
<li class="chapter " data-level="1.12.2" data-path="../../contributing/code-of-conduct.html">
<a href="../../contributing/code-of-conduct.html">
@ -532,7 +493,7 @@
<h2 id="features">Features</h2>
<ul>
<li>Zero upfront configuration necessary to start developing and building a web app</li>
<li>Modern Babel compilation supporting ES modules, last 2 major browser versions, async functions, and dynamic imports</li>
<li>Modern Babel compilation supporting ES modules, last 2 major browser versions, and async functions</li>
<li>Webpack loaders for importing HTML, CSS, images, icons, and fonts</li>
<li>Webpack Dev Server during development</li>
<li>Automatic creation of HTML pages, no templating necessary</li>
@ -610,48 +571,19 @@ manifest.c10c6464802bf71a2c3f.bundle.js 1.41 kB 1 <span class="token p
&#x2728; Done <span class="token keyword">in</span> 2.10s.
</code></pre>
<p>You can either serve or deploy the contents of this <code>build</code> directory as a static site.</p>
<h2 id="hot-module-replacement">Hot Module Replacement</h2>
<p>While <code>neutrino-preset-web</code> supports Hot Module Replacement your app, it does require some application-specific changes
in order to operate. Your application should define split points for which to accept modules to reload using
<code>module.hot</code>:</p>
<p>For example:</p>
<pre class="language-"><code class="lang-js"><span class="token keyword">import</span> app <span class="token keyword">from</span> <span class="token string">&apos;./app&apos;</span><span class="token punctuation">;</span>
document
<span class="token punctuation">.</span><span class="token function">getElementById</span><span class="token punctuation">(</span><span class="token string">&apos;root&apos;</span><span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">appendChild</span><span class="token punctuation">(</span><span class="token function">app</span><span class="token punctuation">(</span><span class="token string">&apos;Hello world!&apos;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">if</span> <span class="token punctuation">(</span>module<span class="token punctuation">.</span>hot<span class="token punctuation">)</span> <span class="token punctuation">{</span>
module<span class="token punctuation">.</span>hot<span class="token punctuation">.</span><span class="token function">accept</span><span class="token punctuation">(</span><span class="token string">&apos;./app&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
<p>Or for all paths:</p>
<pre class="language-"><code class="lang-js"><span class="token keyword">import</span> app <span class="token keyword">from</span> <span class="token string">&apos;./app&apos;</span><span class="token punctuation">;</span>
document
<span class="token punctuation">.</span><span class="token function">getElementById</span><span class="token punctuation">(</span><span class="token string">&apos;root&apos;</span><span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">appendChild</span><span class="token punctuation">(</span><span class="token function">app</span><span class="token punctuation">(</span><span class="token string">&apos;Hello world!&apos;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">if</span> <span class="token punctuation">(</span>module<span class="token punctuation">.</span>hot<span class="token punctuation">)</span> <span class="token punctuation">{</span>
module<span class="token punctuation">.</span>hot<span class="token punctuation">.</span><span class="token function">accept</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
<p>Using dynamic imports with <code>import()</code> will automatically create split points and hot replace those modules upon
modification during development.</p>
<h2 id="customizing">Customizing</h2>
<p>To override the build configuration, start with the documentation on <a href="../../customization/">customization</a>.
<code>neutrino-preset-web</code> creates some conventions to make overriding the configuration easier once you are ready to make
changes.</p>
<p>By default the Web preset creates a single <strong>main</strong> <code>index</code> entry point to your application, and this maps to the
<code>index.js</code> file in the <code>src</code> directory. This value is provided by <code>neutrino.options.entry</code>.
This means that the Web preset is optimized toward the use case of single-page applications over multi-page
applications.</p>
<code>index.js</code> file in the <code>src</code> directory. This means that the Web preset is optimized toward the use case of single-page
applications over multi-page applications.</p>
<h3 id="rules">Rules</h3>
<p>The following is a list of rules and their identifiers which can be overridden:</p>
<ul>
<li><code>compile</code>: Compiles JS files from the <code>src</code> directory using Babel. Contains a single loader named <code>babel</code>.</li>
<li><code>html</code>: Allows importing HTML files from modules. Contains a single loader named <code>file</code>.</li>
<li><code>style</code>: Allows importing CSS stylesheets from modules. Contains two loaders named <code>style</code> and <code>css</code>.</li>
<li><code>css</code>: Allows importing CSS stylesheets from modules. Contains two loaders named <code>style</code> and <code>css</code>.</li>
<li><code>img</code>, <code>svg</code>, <code>ico</code>: Allows import image files from modules. Each contains a single loader named <code>url</code>.</li>
<li><code>woff</code>, <code>ttf</code>: Allows importing WOFF and TTF font files from modules. Each contains a single loader named <code>url</code>.</li>
<li><code>eot</code>: Allows importing EOT font files from modules. Contains a single loader named <code>file</code>.</li>
@ -670,47 +602,13 @@ applications.</p>
<h3 id="simple-customization">Simple customization</h3>
<p>By following the <a href="../../customization/simple.html">customization guide</a> and knowing the rule, loader, and plugin IDs above,
you can override and augment the build directly from package.json.</p>
<h4 id="compile-targets">Compile targets</h4>
<p>This preset uses babel-preset-env to compile code targeting the last 2 browser versions of major browsers. To change
the browser targets from package.json, specify an object at <code>neutrino.options.compile.targets</code> which contains a
<a href="https://github.com/ai/browserslist" target="_blank">browserlist-compatible</a> array of browser targets.</p>
<p><em>Example: Replace the Web preset browser targets with support for browsers with greater than 5% global usage:</em></p>
<pre class="language-"><code class="lang-json"><span class="token punctuation">{</span>
<span class="token property">&quot;neutrino&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;options&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;compile&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;targets&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;browsers&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span>
<span class="token string">&quot;&gt; 5%&quot;</span>
<span class="token punctuation">]</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
<p><em>Example: Change support to latest version instead of last 2 versions:</em></p>
<pre class="language-"><code class="lang-json"><span class="token punctuation">{</span>
<span class="token property">&quot;neutrino&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;options&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;compile&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;targets&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;browsers&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span>
<span class="token string">&quot;last 1 version&quot;</span>
<span class="token punctuation">]</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
<h4 id="vendoring">Vendoring</h4>
<p>By defining an entry point in package.json named <code>vendor</code> you can split out external dependencies into a chunk separate
from your application code.</p>
<p><em>Example: Put lodash into a separate &quot;vendor&quot; chunk:</em></p>
<pre class="language-"><code class="lang-json"><span class="token punctuation">{</span>
<span class="token property">&quot;neutrino&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;config&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;config&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;neutrino&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;entry&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;vendor&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span>
<span class="token string">&quot;lodash&quot;</span>
@ -725,15 +623,13 @@ from your application code.</p>
</code></pre>
<h4 id="html-files">HTML files</h4>
<p>Under the hood <code>neutrino-preset-web</code> uses <a href="https://www.npmjs.com/package/html-webpack-template" target="_blank">html-webpack-template</a>
for generating HTML files. If you wish to override how these files are created, define an object in your package.json
at <code>neutrino.options.html</code> with options matching the format expected by html-webpack-template.</p>
for generating HTML files. If you wish to override how these files are creating, define an object in your package.json
at <code>config.html</code> with options matching the format expected by html-webpack-template.</p>
<p><em>Example: Change the application mount ID from &quot;root&quot; to &quot;app&quot;:</em></p>
<pre class="language-"><code class="lang-json"><span class="token punctuation">{</span>
<span class="token property">&quot;neutrino&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;options&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;html&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;appMountId&quot;</span><span class="token operator">:</span> <span class="token string">&quot;app&quot;</span>
<span class="token punctuation">}</span>
<span class="token property">&quot;config&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;html&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;appMountId&quot;</span><span class="token operator">:</span> <span class="token string">&quot;app&quot;</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
@ -741,53 +637,6 @@ at <code>neutrino.options.html</code> with options matching the format expected
<h3 id="advanced-configuration">Advanced configuration</h3>
<p>By following the <a href="../../customization/advanced.html">customization guide</a> and knowing the rule, loader, and plugin IDs above,
you can override and augment the build by creating a JS module which overrides the config.</p>
<h4 id="compile-targets">Compile targets</h4>
<p>This preset uses babel-preset-env to compile code targeting the last 2 browser versions of major browsers. To change
the browser targets from an override file, specify an object at <code>neutrino.options.compile.targets</code> which contains a
<a href="https://github.com/ai/browserslist" target="_blank">browserlist-compatible</a> array of browser targets.</p>
<p><strong>Note: Setting these options via <code>neutrino.options.compile</code> must be done prior to loading the Web preset or they
will not be picked up by the compile middleware. These examples show changing compile targets with options before
loading the preset and overriding them if loaded afterwards.</strong></p>
<p><em>Example: Replace the Web preset browser targets with support for browsers with greater than 5% global usage:</em></p>
<pre class="language-"><code class="lang-js">module<span class="token punctuation">.</span>exports <span class="token operator">=</span> neutrino <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
<span class="token comment" spellcheck="true">// Using neutrino.options prior to loading Web preset</span>
neutrino<span class="token punctuation">.</span>options<span class="token punctuation">.</span>compile <span class="token operator">=</span> <span class="token punctuation">{</span>
targets<span class="token punctuation">:</span> <span class="token punctuation">{</span>
browsers<span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token string">&apos;&gt; 5%&apos;</span><span class="token punctuation">]</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">// Using compile options override following loading Web preset</span>
neutrino<span class="token punctuation">.</span>config<span class="token punctuation">.</span>module
<span class="token punctuation">.</span><span class="token function">rule</span><span class="token punctuation">(</span><span class="token string">&apos;compile&apos;</span><span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">use</span><span class="token punctuation">(</span><span class="token string">&apos;babel&apos;</span><span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">tap</span><span class="token punctuation">(</span>options <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
options<span class="token punctuation">.</span>presets<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span><span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">]</span><span class="token punctuation">.</span>targets<span class="token punctuation">.</span>browsers <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token string">&apos;&gt; 5%&apos;</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
<span class="token keyword">return</span> options<span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
<p><em>Example: Change support to latest version instead of last 2 versions:</em></p>
<pre class="language-"><code class="lang-js">module<span class="token punctuation">.</span>exports <span class="token operator">=</span> neutrino <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
<span class="token comment" spellcheck="true">// Using neutrino.options prior to loading Web preset</span>
neutrino<span class="token punctuation">.</span>options<span class="token punctuation">.</span>compile <span class="token operator">=</span> <span class="token punctuation">{</span>
targets<span class="token punctuation">:</span> <span class="token punctuation">{</span>
browsers<span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token string">&apos;last 1 version&apos;</span><span class="token punctuation">]</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">// Using compile options override following loading Web preset</span>
neutrino<span class="token punctuation">.</span>config<span class="token punctuation">.</span>module
<span class="token punctuation">.</span><span class="token function">rule</span><span class="token punctuation">(</span><span class="token string">&apos;compile&apos;</span><span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">use</span><span class="token punctuation">(</span><span class="token string">&apos;babel&apos;</span><span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">tap</span><span class="token punctuation">(</span>options <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
options<span class="token punctuation">.</span>presets<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span><span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">]</span><span class="token punctuation">.</span>targets<span class="token punctuation">.</span>browsers <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token string">&apos;last 1 version&apos;</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
<span class="token keyword">return</span> options<span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
<h4 id="vendoring">Vendoring</h4>
<p>By defining an entry point named <code>vendor</code> you can split out external dependencies into a chunk separate
from your application code.</p>
@ -798,14 +647,6 @@ from your application code.</p>
<span class="token punctuation">.</span><span class="token function">add</span><span class="token punctuation">(</span><span class="token string">&apos;lodash&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
<h4 id="html-files">HTML files</h4>
<p><em>Example: Change the application mount ID from &quot;root&quot; to &quot;app&quot;:</em></p>
<pre class="language-"><code class="lang-js"><span class="token keyword">const</span> merge <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&apos;deepmerge&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
module<span class="token punctuation">.</span>exports <span class="token operator">=</span> neutrino <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
neutrino<span class="token punctuation">.</span>options<span class="token punctuation">.</span>html<span class="token punctuation">.</span>appMountId <span class="token operator">=</span> <span class="token string">&apos;app&apos;</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
<h2 id="contributing">Contributing</h2>
<p>This preset is part of the <a href="https://github.com/mozilla-neutrino/neutrino-dev" target="_blank">neutrino-dev</a> repository, a monorepo
containing all resources for developing Neutrino and its core presets. Follow the
@ -853,7 +694,7 @@ containing all resources for developing Neutrino and its core presets. Follow th
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"Web","level":"1.7.1","depth":2,"next":{"title":"React","level":"1.7.2","depth":2,"path":"presets/neutrino-preset-react/README.md","ref":"./presets/neutrino-preset-react/README.md","articles":[]},"previous":{"title":"Presets","level":"1.7","depth":1,"path":"presets/README.md","ref":"./presets/README.md","articles":[{"title":"Web","level":"1.7.1","depth":2,"path":"presets/neutrino-preset-web/README.md","ref":"./presets/neutrino-preset-web/README.md","articles":[]},{"title":"React","level":"1.7.2","depth":2,"path":"presets/neutrino-preset-react/README.md","ref":"./presets/neutrino-preset-react/README.md","articles":[]},{"title":"Node.js","level":"1.7.3","depth":2,"path":"presets/neutrino-preset-node/README.md","ref":"./presets/neutrino-preset-node/README.md","articles":[]},{"title":"Airbnb","level":"1.7.4","depth":2,"path":"presets/neutrino-preset-airbnb-base/README.md","ref":"./presets/neutrino-preset-airbnb-base/README.md","articles":[]},{"title":"Karma","level":"1.7.5","depth":2,"path":"presets/neutrino-preset-karma/README.md","ref":"./presets/neutrino-preset-karma/README.md","articles":[]},{"title":"Mocha","level":"1.7.6","depth":2,"path":"presets/neutrino-preset-mocha/README.md","ref":"./presets/neutrino-preset-mocha/README.md","articles":[]},{"title":"Jest","level":"1.7.7","depth":2,"path":"presets/neutrino-preset-jest/README.md","ref":"./presets/neutrino-preset-jest/README.md","articles":[]},{"title":"Community presets","level":"1.7.8","depth":2,"path":"presets/community-presets.md","ref":"./presets/community-presets.md","articles":[]}]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"presets/neutrino-preset-web/README.md","mtime":"2017-03-15T13:20:51.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-15T14:46:02.288Z"},"basePath":"../..","book":{"language":""}});
gitbook.page.hasChanged({"page":{"title":"Web","level":"1.6.1","depth":2,"next":{"title":"React","level":"1.6.2","depth":2,"path":"presets/neutrino-preset-react/README.md","ref":"presets/neutrino-preset-react/README.md","articles":[]},"previous":{"title":"Presets","level":"1.6","depth":1,"path":"presets/README.md","ref":"presets/README.md","articles":[{"title":"Web","level":"1.6.1","depth":2,"path":"presets/neutrino-preset-web/README.md","ref":"presets/neutrino-preset-web/README.md","articles":[]},{"title":"React","level":"1.6.2","depth":2,"path":"presets/neutrino-preset-react/README.md","ref":"presets/neutrino-preset-react/README.md","articles":[]},{"title":"Node.js","level":"1.6.3","depth":2,"path":"presets/neutrino-preset-node/README.md","ref":"presets/neutrino-preset-node/README.md","articles":[]},{"title":"Airbnb","level":"1.6.4","depth":2,"path":"presets/neutrino-preset-airbnb-base/README.md","ref":"presets/neutrino-preset-airbnb-base/README.md","articles":[]},{"title":"Karma","level":"1.6.5","depth":2,"path":"presets/neutrino-preset-karma/README.md","ref":"presets/neutrino-preset-karma/README.md","articles":[]},{"title":"Mocha","level":"1.6.6","depth":2,"path":"presets/neutrino-preset-mocha/README.md","ref":"presets/neutrino-preset-mocha/README.md","articles":[]},{"title":"Jest","level":"1.6.7","depth":2,"path":"presets/neutrino-preset-jest/README.md","ref":"presets/neutrino-preset-jest/README.md","articles":[]},{"title":"Community presets","level":"1.6.8","depth":2,"path":"presets/community-presets.md","ref":"presets/community-presets.md","articles":[]}]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"presets/neutrino-preset-web/README.md","mtime":"2017-02-21T13:04:44.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-06T17:07:12.452Z"},"basePath":"../..","book":{"language":""}});
});
</script>
</div>

85
project-layout.html

@ -158,20 +158,7 @@
</li>
<li class="chapter " data-level="1.6" data-path="middleware/">
<a href="middleware/">
Middleware
</a>
</li>
<li class="chapter " data-level="1.7" data-path="presets/">
<li class="chapter " data-level="1.6" data-path="presets/">
<a href="presets/">
@ -185,7 +172,7 @@
<ul class="articles">
<li class="chapter " data-level="1.7.1" data-path="presets/neutrino-preset-web/">
<li class="chapter " data-level="1.6.1" data-path="presets/neutrino-preset-web/">
<a href="presets/neutrino-preset-web/">
@ -198,7 +185,7 @@
</li>
<li class="chapter " data-level="1.7.2" data-path="presets/neutrino-preset-react/">
<li class="chapter " data-level="1.6.2" data-path="presets/neutrino-preset-react/">
<a href="presets/neutrino-preset-react/">
@ -211,7 +198,7 @@
</li>
<li class="chapter " data-level="1.7.3" data-path="presets/neutrino-preset-node/">
<li class="chapter " data-level="1.6.3" data-path="presets/neutrino-preset-node/">
<a href="presets/neutrino-preset-node/">
@ -224,7 +211,7 @@
</li>
<li class="chapter " data-level="1.7.4" data-path="presets/neutrino-preset-airbnb-base/">
<li class="chapter " data-level="1.6.4" data-path="presets/neutrino-preset-airbnb-base/">
<a href="presets/neutrino-preset-airbnb-base/">
@ -237,7 +224,7 @@
</li>
<li class="chapter " data-level="1.7.5" data-path="presets/neutrino-preset-karma/">
<li class="chapter " data-level="1.6.5" data-path="presets/neutrino-preset-karma/">
<a href="presets/neutrino-preset-karma/">
@ -250,7 +237,7 @@
</li>
<li class="chapter " data-level="1.7.6" data-path="presets/neutrino-preset-mocha/">
<li class="chapter " data-level="1.6.6" data-path="presets/neutrino-preset-mocha/">
<a href="presets/neutrino-preset-mocha/">
@ -263,7 +250,7 @@
</li>
<li class="chapter " data-level="1.7.7" data-path="presets/neutrino-preset-jest/">
<li class="chapter " data-level="1.6.7" data-path="presets/neutrino-preset-jest/">
<a href="presets/neutrino-preset-jest/">
@ -276,7 +263,7 @@
</li>
<li class="chapter " data-level="1.7.8" data-path="presets/community-presets.html">
<li class="chapter " data-level="1.6.8" data-path="presets/community-presets.html">
<a href="presets/community-presets.html">
@ -294,7 +281,7 @@
</li>
<li class="chapter " data-level="1.8" data-path="customization/">
<li class="chapter " data-level="1.7" data-path="customization/">
<a href="customization/">
@ -308,7 +295,7 @@
<ul class="articles">
<li class="chapter " data-level="1.8.1" data-path="customization/simple.html">
<li class="chapter " data-level="1.7.1" data-path="customization/simple.html">
<a href="customization/simple.html">
@ -321,7 +308,7 @@
</li>
<li class="chapter " data-level="1.8.2" data-path="customization/advanced.html">
<li class="chapter " data-level="1.7.2" data-path="customization/advanced.html">
<a href="customization/advanced.html">
@ -339,7 +326,7 @@
</li>
<li class="chapter " data-level="1.9" data-path="creating-presets.html">
<li class="chapter " data-level="1.8" data-path="creating-presets.html">
<a href="creating-presets.html">
@ -353,9 +340,9 @@
<ul class="articles">
<li class="chapter " data-level="1.9.1" data-path="presets/neutrino-lint-base/README.md">
<li class="chapter " data-level="1.8.1" data-path="presets/neutrino-lint-base/">
<span>
<a href="presets/neutrino-lint-base/">
Creating linting presets
@ -371,7 +358,7 @@
</li>
<li class="chapter " data-level="1.10" data-path="learning-resources.html">
<li class="chapter " data-level="1.9" data-path="learning-resources.html">
<a href="learning-resources.html">
@ -384,7 +371,7 @@
</li>
<li class="chapter " data-level="1.11" data-path="api/">
<li class="chapter " data-level="1.10" data-path="api/">
<a href="api/">
@ -397,7 +384,7 @@
</li>
<li class="chapter " data-level="1.12" data-path="cli/">
<li class="chapter " data-level="1.11" data-path="cli/">
<a href="cli/">
@ -410,33 +397,7 @@
</li>
<li class="chapter " data-level="1.13" data-path="upgrading-neutrino.html">
<a href="upgrading-neutrino.html">
Upgrading from v4 to v5
</a>
</li>
<li class="chapter " data-level="1.14" >
<a target="_blank" href="https://github.com/mozilla-neutrino/neutrino-dev/tree/docs-v4/docs">
v4 Documentation
</a>
</li>
<li class="chapter " data-level="1.15" data-path="contributing/">
<li class="chapter " data-level="1.12" data-path="contributing/">
<a href="contributing/">
@ -450,7 +411,7 @@
<ul class="articles">
<li class="chapter " data-level="1.15.1" data-path="contributing/development.html">
<li class="chapter " data-level="1.12.1" data-path="contributing/development.html">
<a href="contributing/development.html">
@ -463,7 +424,7 @@
</li>
<li class="chapter " data-level="1.15.2" data-path="contributing/code-of-conduct.html">
<li class="chapter " data-level="1.12.2" data-path="contributing/code-of-conduct.html">
<a href="contributing/code-of-conduct.html">
@ -536,7 +497,7 @@ development process for new projects as quick as possible. This is broken up int
</ul>
<p>Each of these directories is set up via convention by a Neutrino preset, but each can be customized as
desired by overriding the preset&apos;s configuration or using a different preset. See
<a href="customization/">Custom Configuration</a> for detailed instructions.</p>
<a href="custom-configuration.md">Custom Configuration</a> for detailed instructions.</p>
<h2 id="source-code">Source Code</h2>
<p>By default, Neutrino presets expect all project source code to live in a directory named <code>src</code> in the
root of the project. This includes JavaScript files, CSS stylesheets, images, and any other assets
@ -599,7 +560,7 @@ detailed information about running tests and other conventions.</p>
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"Project Layout","level":"1.4","depth":1,"next":{"title":"FAQ","level":"1.5","depth":1,"path":"FAQ.md","ref":"./FAQ.md","articles":[]},"previous":{"title":"Usage","level":"1.3","depth":1,"path":"usage.md","ref":"./usage.md","articles":[]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"project-layout.md","mtime":"2017-03-15T13:20:51.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-15T14:46:02.288Z"},"basePath":".","book":{"language":""}});
gitbook.page.hasChanged({"page":{"title":"Project Layout","level":"1.4","depth":1,"next":{"title":"FAQ","level":"1.5","depth":1,"path":"FAQ.md","ref":"FAQ.md","articles":[]},"previous":{"title":"Usage","level":"1.3","depth":1,"path":"usage.md","ref":"usage.md","articles":[]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"project-layout.md","mtime":"2017-02-21T13:04:40.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-06T17:07:12.452Z"},"basePath":".","book":{"language":""}});
});
</script>
</div>

2
search_index.json

File diff suppressed because one or more lines are too long

822
upgrading-neutrino.html

@ -1,822 +0,0 @@
<!DOCTYPE HTML>
<html lang="" >
<head>
<meta charset="UTF-8">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>Upgrading from v4 to v5 · Neutrino</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="description" content="">
<meta name="generator" content="GitBook 3.2.2">
<link rel="stylesheet" href="gitbook/style.css">
<link rel="stylesheet" href="gitbook/gitbook-plugin-prism/prism.css">
<link rel="stylesheet" href="gitbook/gitbook-plugin-npmsearchlist/styles.css">
<link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
<link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
<meta name="HandheldFriendly" content="true"/>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
<link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">
<link rel="prev" href="cli/" />
</head>
<body>
<div class="book">
<div class="book-summary">
<div id="book-search-input" role="search">
<input type="text" placeholder="Type to search" />
</div>
<nav role="navigation">
<ul class="summary">
<li class="chapter " data-level="1.1" data-path="./">
<a href="./">
Introduction
</a>
</li>
<li class="chapter " data-level="1.2" data-path="installation.html">
<a href="installation.html">
Installation
</a>
</li>
<li class="chapter " data-level="1.3" data-path="usage.html">
<a href="usage.html">
Usage
</a>
</li>
<li class="chapter " data-level="1.4" data-path="project-layout.html">
<a href="project-layout.html">
Project Layout
</a>
</li>
<li class="chapter " data-level="1.5" data-path="FAQ.html">
<a href="FAQ.html">
FAQ
</a>
</li>
<li class="chapter " data-level="1.6" data-path="middleware/">
<a href="middleware/">
Middleware
</a>
</li>
<li class="chapter " data-level="1.7" data-path="presets/">
<a href="presets/">
Presets
</a>
<ul class="articles">
<li class="chapter " data-level="1.7.1" data-path="presets/neutrino-preset-web/">
<a href="presets/neutrino-preset-web/">
Web
</a>
</li>
<li class="chapter " data-level="1.7.2" data-path="presets/neutrino-preset-react/">
<a href="presets/neutrino-preset-react/">
React
</a>
</li>
<li class="chapter " data-level="1.7.3" data-path="presets/neutrino-preset-node/">
<a href="presets/neutrino-preset-node/">
Node.js
</a>
</li>
<li class="chapter " data-level="1.7.4" data-path="presets/neutrino-preset-airbnb-base/">
<a href="presets/neutrino-preset-airbnb-base/">
Airbnb
</a>
</li>
<li class="chapter " data-level="1.7.5" data-path="presets/neutrino-preset-karma/">
<a href="presets/neutrino-preset-karma/">
Karma
</a>
</li>
<li class="chapter " data-level="1.7.6" data-path="presets/neutrino-preset-mocha/">
<a href="presets/neutrino-preset-mocha/">
Mocha
</a>
</li>
<li class="chapter " data-level="1.7.7" data-path="presets/neutrino-preset-jest/">
<a href="presets/neutrino-preset-jest/">
Jest
</a>
</li>
<li class="chapter " data-level="1.7.8" data-path="presets/community-presets.html">
<a href="presets/community-presets.html">
Community presets
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.8" data-path="customization/">
<a href="customization/">
Customization
</a>
<ul class="articles">
<li class="chapter " data-level="1.8.1" data-path="customization/simple.html">
<a href="customization/simple.html">
Simple
</a>
</li>
<li class="chapter " data-level="1.8.2" data-path="customization/advanced.html">
<a href="customization/advanced.html">
Advanced
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.9" data-path="creating-presets.html">
<a href="creating-presets.html">
Creating presets
</a>
<ul class="articles">
<li class="chapter " data-level="1.9.1" data-path="presets/neutrino-lint-base/README.md">
<span>
Creating linting presets
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.10" data-path="learning-resources.html">
<a href="learning-resources.html">
Learning Resources
</a>
</li>
<li class="chapter " data-level="1.11" data-path="api/">
<a href="api/">
API
</a>
</li>
<li class="chapter " data-level="1.12" data-path="cli/">
<a href="cli/">
CLI
</a>
</li>
<li class="chapter active" data-level="1.13" data-path="upgrading-neutrino.html">
<a href="upgrading-neutrino.html">
Upgrading from v4 to v5
</a>
</li>
<li class="chapter " data-level="1.14" >
<a target="_blank" href="https://github.com/mozilla-neutrino/neutrino-dev/tree/docs-v4/docs">
v4 Documentation
</a>
</li>
<li class="chapter " data-level="1.15" data-path="contributing/">
<a href="contributing/">
Contributing
</a>
<ul class="articles">
<li class="chapter " data-level="1.15.1" data-path="contributing/development.html">
<a href="contributing/development.html">
Development Process
</a>
</li>
<li class="chapter " data-level="1.15.2" data-path="contributing/code-of-conduct.html">
<a href="contributing/code-of-conduct.html">
Code of Conduct
</a>
</li>
</ul>
</li>
<li class="divider"></li>
<li>
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
Published with GitBook
</a>
</li>
</ul>
</nav>
</div>
<div class="book-body">
<div class="body-inner">
<div class="book-header" role="navigation">
<!-- Title -->
<h1>
<i class="fa fa-circle-o-notch fa-spin"></i>
<a href="." >Upgrading from v4 to v5</a>
</h1>
</div>
<div class="page-wrapper" tabindex="-1" role="main">
<div class="page-inner">
<div id="book-search-results">
<div class="search-noresults">
<section class="normal markdown-section">
<h1 id="upgrading-from-neutrino-v4-to-v5">Upgrading from Neutrino v4 to v5</h1>
<p>Neutrino v5 introduces a number of changes, with some of them being breaking changes. To upgrade from Neutrino v4
to v5, be sure to check this list for tasks you may need to perform to use this latest version:</p>
<ul>
<li>Updates to config for creating plugins (from webpack-chain v3 upgrade):</li>
</ul>
<pre class="language-"><code class="lang-js"><span class="token comment" spellcheck="true">// Creating plugins in v4</span>
neutrino<span class="token punctuation">.</span>config
<span class="token punctuation">.</span><span class="token function">plugin</span><span class="token punctuation">(</span>name<span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">use</span><span class="token punctuation">(</span>WebpackPlugin<span class="token punctuation">,</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>args<span class="token punctuation">)</span>
<span class="token comment" spellcheck="true">// Creating plugins in v5</span>
neutrino<span class="token punctuation">.</span>config
<span class="token punctuation">.</span><span class="token function">plugin</span><span class="token punctuation">(</span>name<span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">use</span><span class="token punctuation">(</span>WebpackPlugin<span class="token punctuation">,</span> args<span class="token punctuation">)</span>
</code></pre>
<ul>
<li>Updates to config for modifying plugins (from webpack-chain v3 upgrade):</li>
</ul>
<pre class="language-"><code class="lang-js"><span class="token comment" spellcheck="true">// Modifying plugins in v4</span>
neutrino<span class="token punctuation">.</span>config
<span class="token punctuation">.</span><span class="token function">plugin</span><span class="token punctuation">(</span>name<span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">inject</span><span class="token punctuation">(</span><span class="token punctuation">(</span>Plugin<span class="token punctuation">,</span> args<span class="token punctuation">)</span> <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token keyword">new</span> <span class="token class-name">Plugin</span><span class="token punctuation">(</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>newArgs<span class="token punctuation">)</span><span class="token punctuation">)</span>
<span class="token comment" spellcheck="true">// Modifying plugins in v5</span>
neutrino<span class="token punctuation">.</span>config
<span class="token punctuation">.</span><span class="token function">plugin</span><span class="token punctuation">(</span>name<span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">tap</span><span class="token punctuation">(</span>args <span class="token operator">=</span><span class="token operator">&gt;</span> newArgs<span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
<ul>
<li>Updates to config for creating loaders (from webpack-chain v3 upgrade):</li>
</ul>
<pre class="language-"><code class="lang-js"><span class="token comment" spellcheck="true">// Creating loaders in v4</span>
neutrino<span class="token punctuation">.</span>config<span class="token punctuation">.</span>module
<span class="token punctuation">.</span><span class="token function">rule</span><span class="token punctuation">(</span><span class="token string">&apos;compile&apos;</span><span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">loader</span><span class="token punctuation">(</span><span class="token string">&apos;babel&apos;</span><span class="token punctuation">,</span> <span class="token string">&apos;babel-loader&apos;</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>
options<span class="token punctuation">:</span> <span class="token punctuation">{</span>
plugins<span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token string">&apos;object-rest-spread&apos;</span><span class="token punctuation">]</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">// Creating loaders in v5</span>
neutrino<span class="token punctuation">.</span>config
<span class="token punctuation">.</span><span class="token function">rule</span><span class="token punctuation">(</span><span class="token string">&apos;compile&apos;</span><span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">use</span><span class="token punctuation">(</span><span class="token string">&apos;babel&apos;</span><span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">loader</span><span class="token punctuation">(</span><span class="token string">&apos;babel-loader&apos;</span><span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">options</span><span class="token punctuation">(</span><span class="token punctuation">{</span> plugins<span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token string">&apos;object-rest-spread&apos;</span><span class="token punctuation">]</span> <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
<ul>
<li>Updates to config for modifying loaders (from webpack-chain v3 upgrade). The function now gets its options directly
instead of being nested in an object:</li>
</ul>
<pre class="language-"><code class="lang-js"><span class="token comment" spellcheck="true">// Modifying loaders in v4</span>
neutrino<span class="token punctuation">.</span>config<span class="token punctuation">.</span>module
<span class="token punctuation">.</span><span class="token function">rule</span><span class="token punctuation">(</span><span class="token string">&apos;compile&apos;</span><span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">loader</span><span class="token punctuation">(</span><span class="token string">&apos;babel&apos;</span><span class="token punctuation">,</span> props <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token function">merge</span><span class="token punctuation">(</span>props<span class="token punctuation">,</span> <span class="token punctuation">{</span>
options<span class="token punctuation">:</span> <span class="token punctuation">{</span>
plugins<span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token string">&apos;object-rest-spread&apos;</span><span class="token punctuation">]</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">// Modifying loaders in v5</span>
neutrino<span class="token punctuation">.</span>config<span class="token punctuation">.</span>module
<span class="token punctuation">.</span><span class="token function">rule</span><span class="token punctuation">(</span><span class="token string">&apos;compile&apos;</span><span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">use</span><span class="token punctuation">(</span><span class="token string">&apos;babel&apos;</span><span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">tap</span><span class="token punctuation">(</span>options <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token function">merge</span><span class="token punctuation">(</span>options<span class="token punctuation">,</span> <span class="token punctuation">{</span> plugins<span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token string">&apos;object-rest-spread&apos;</span><span class="token punctuation">]</span> <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
<ul>
<li>Updates to <code>include</code> and <code>exclude</code> for rules (from webpack-chain v3). In the previous webpack-chain
package, <code>include</code> and <code>exclude</code> were functions where you provided paths as arguments. These are now
<code>ChainedMap</code>s, making them much more extensible should you need to manipulate these values:</li>
</ul>
<pre class="language-"><code class="lang-js"><span class="token comment" spellcheck="true">// Adding rule includes and excludes in v4</span>
neutrino<span class="token punctuation">.</span>config<span class="token punctuation">.</span>module
<span class="token punctuation">.</span><span class="token function">rule</span><span class="token punctuation">(</span><span class="token string">&apos;compile&apos;</span><span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">include</span><span class="token punctuation">(</span>x<span class="token punctuation">,</span> y<span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">exclude</span><span class="token punctuation">(</span>x<span class="token punctuation">,</span> y<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">// Adding rule includes and excludes in v5</span>
neutrino<span class="token punctuation">.</span>config<span class="token punctuation">.</span>module
<span class="token punctuation">.</span><span class="token function">rule</span><span class="token punctuation">(</span><span class="token string">&apos;compile&apos;</span><span class="token punctuation">)</span>
<span class="token punctuation">.</span>include
<span class="token punctuation">.</span><span class="token function">add</span><span class="token punctuation">(</span>x<span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">add</span><span class="token punctuation">(</span>y<span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">end</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token punctuation">.</span>exclude
<span class="token punctuation">.</span><span class="token function">add</span><span class="token punctuation">(</span>x<span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">add</span><span class="token punctuation">(</span>y<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">// You can also use .merge() to add multiple paths at once:</span>
neutrino<span class="token punctuation">.</span>config<span class="token punctuation">.</span>module
<span class="token punctuation">.</span><span class="token function">rule</span><span class="token punctuation">(</span><span class="token string">&apos;compile&apos;</span><span class="token punctuation">)</span>
<span class="token punctuation">.</span>include<span class="token punctuation">.</span><span class="token function">merge</span><span class="token punctuation">(</span><span class="token punctuation">[</span>x<span class="token punctuation">,</span> y<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">end</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token punctuation">.</span>exclude<span class="token punctuation">.</span><span class="token function">merge</span><span class="token punctuation">(</span><span class="token punctuation">[</span>x<span class="token punctuation">,</span> y<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
<ul>
<li>Simple configuration via package.json now done from top-level <code>neutrino</code> object. Rename <code>config</code> to <code>neutrino</code>, and
rename <code>config.neutrino</code> to <code>neutrino.config</code>. Presets also fall under this <code>neutrino</code> object. The <code>custom</code> object has
been renamed to <code>options</code>.</li>
</ul>
<pre class="language-"><code class="lang-json"><span class="token punctuation">{</span>
<span class="token property">&quot;neutrino&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;config&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;entry&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;vendor&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span><span class="token string">&quot;react&quot;</span><span class="token punctuation">]</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span><span class="token punctuation">,</span>
<span class="token property">&quot;presets&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span>
<span class="token string">&quot;neutrino-preset-react&quot;</span>
<span class="token punctuation">]</span><span class="token punctuation">,</span>
<span class="token property">&quot;options&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;mocha&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;reporter&quot;</span><span class="token operator">:</span> <span class="token string">&quot;nyan&quot;</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
<ul>
<li>The Web preset has renamed its styling rule from <code>css</code> to <code>style</code>:</li>
</ul>
<pre class="language-"><code class="lang-js"><span class="token comment" spellcheck="true">// v4 API for Web preset</span>
neutrino<span class="token punctuation">.</span>config<span class="token punctuation">.</span>module<span class="token punctuation">.</span><span class="token function">rule</span><span class="token punctuation">(</span><span class="token string">&apos;css&apos;</span><span class="token punctuation">)</span>
<span class="token comment" spellcheck="true">// v5 API for Web preset</span>
neutrino<span class="token punctuation">.</span>config<span class="token punctuation">.</span>module<span class="token punctuation">.</span><span class="token function">rule</span><span class="token punctuation">(</span><span class="token string">&apos;style&apos;</span><span class="token punctuation">)</span>
</code></pre>
<pre class="language-"><code class="lang-json"><span class="token punctuation">{</span>
<span class="token property">&quot;neutrino&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;config&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;module&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;rule&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;style&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span><span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
<ul>
<li>Jest upgraded to v19, which changes the option <code>testPathDirs</code> to <code>roots</code>. Jest options set using
package.json can now only be done at <code>neutrino.options.jest</code> (no more package.json <code>jest</code>);</li>
<li>Linting base is deprecated in favor of <code>neutrino-middleware-eslint</code>:</li>
</ul>
<pre class="language-"><code class="lang-js"><span class="token comment" spellcheck="true">// v4 API</span>
<span class="token keyword">const</span> lint <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&apos;neutrino-lint-base&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token function">lint</span><span class="token punctuation">(</span>neutrino<span class="token punctuation">)</span><span class="token punctuation">;</span>
neutrino<span class="token punctuation">.</span>config<span class="token punctuation">.</span>module
<span class="token punctuation">.</span><span class="token function">rule</span><span class="token punctuation">(</span><span class="token string">&apos;lint&apos;</span><span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">loader</span><span class="token punctuation">(</span><span class="token string">&apos;eslint&apos;</span><span class="token punctuation">,</span> props <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token function">merge</span><span class="token punctuation">(</span>props<span class="token punctuation">,</span> <span class="token punctuation">{</span> rules<span class="token punctuation">:</span> <span class="token punctuation">{</span> <span class="token comment" spellcheck="true">/* */</span> <span class="token punctuation">}</span> <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">// v5 API</span>
<span class="token keyword">const</span> eslint <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&apos;neutrino-middleware-eslint&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
neutrino<span class="token punctuation">.</span><span class="token function">use</span><span class="token punctuation">(</span>eslint<span class="token punctuation">,</span> <span class="token punctuation">{</span>
rules<span class="token punctuation">:</span> <span class="token punctuation">{</span> <span class="token comment" spellcheck="true">/* */</span> <span class="token punctuation">}</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span>
</code></pre>
<ul>
<li>When using a linting preset or consuming anything with <code>neutrino-middleware-eslint</code>, the <code>eslintrc()</code> method has been
moved from <code>neutrino.custom.eslintrc</code> to <code>neutrino.eslintrc</code>:</li>
</ul>
<pre class="language-"><code class="lang-js"><span class="token comment" spellcheck="true">// v4 API</span>
neutrino<span class="token punctuation">.</span>custom<span class="token punctuation">.</span><span class="token function">eslintrc</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">// v5 API</span>
neutrino<span class="token punctuation">.</span><span class="token function">eslintrc</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
<ul>
<li>The Neutrino API no longer accepts preset strings in its constructor. The constructor now accepts an options object to
be set at <code>neutrino.options</code>:</li>
</ul>
<pre class="language-"><code class="lang-js"><span class="token keyword">const</span> Neutrino <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&apos;neutrino&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">const</span> api <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">Neutrino</span><span class="token punctuation">(</span><span class="token punctuation">{</span> mocha<span class="token punctuation">:</span> <span class="token punctuation">{</span> reporter<span class="token punctuation">:</span> <span class="token string">&apos;nyan&apos;</span> <span class="token punctuation">}</span> <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
api<span class="token punctuation">.</span>options<span class="token punctuation">.</span>mocha<span class="token punctuation">.</span>reporter <span class="token comment" spellcheck="true">// &quot;nyan&quot;</span>
</code></pre>
<ul>
<li>Since the Neutrino API no longer accepts preset strings in its constructor, you must now pass presets and middleware
as code/functions to the <code>.use()</code> method. This means the API no longer does preset module resolution. This has been
moved to the CLI.</li>
</ul>
<pre class="language-"><code class="lang-js"><span class="token comment" spellcheck="true">// v4 API</span>
<span class="token keyword">const</span> Neutrino <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&apos;neutrino&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">const</span> api <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">Neutrino</span><span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token string">&apos;neutrino-preset-node&apos;</span><span class="token punctuation">,</span> <span class="token string">&apos;neutrino-preset-mocha&apos;</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">// v5 API</span>
<span class="token keyword">const</span> Neutrino <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&apos;neutrino&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">const</span> api <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">Neutrino</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
api<span class="token punctuation">.</span><span class="token function">use</span><span class="token punctuation">(</span><span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&apos;neutrino-preset-node&apos;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
api<span class="token punctuation">.</span><span class="token function">use</span><span class="token punctuation">(</span><span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&apos;neutrino.preset-mocha&apos;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
<ul>
<li><code>neutrino.getWebpackOptions()</code> no longer caches the configuration after being called.</li>
<li>Using a <code>node</code> target no longer skips the watcher for a builder, it now uses the Webpack source watcher. This means
commands like <code>neutrino start &amp;&amp; node build</code> is obsolete. <code>neutrino build &amp;&amp; node build</code> would work to start a Node
instance for production-built bundles.</li>
</ul>
</section>
</div>
<div class="search-results">
<div class="has-results">
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
<ul class="search-results-list"></ul>
</div>
<div class="no-results">
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
</div>
</div>
</div>
</div>
</div>
</div>
<a href="cli/" class="navigation navigation-prev navigation-unique" aria-label="Previous page: CLI">
<i class="fa fa-angle-left"></i>
</a>
</div>
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"Upgrading from v4 to v5","level":"1.13","depth":1,"next":{"title":"v4 Documentation","level":"1.14","depth":1,"url":"https://github.com/mozilla-neutrino/neutrino-dev/tree/docs-v4/docs","ref":"https://github.com/mozilla-neutrino/neutrino-dev/tree/docs-v4/docs","articles":[]},"previous":{"title":"CLI","level":"1.12","depth":1,"path":"cli/README.md","ref":"./cli/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"upgrading-neutrino.md","mtime":"2017-03-15T13:20:51.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-15T14:46:02.288Z"},"basePath":".","book":{"language":""}});
});
</script>
</div>
<script src="gitbook/gitbook.js"></script>
<script src="gitbook/theme.js"></script>
<script src="gitbook/gitbook-plugin-edit-link/plugin.js"></script>
<script src="gitbook/gitbook-plugin-github/plugin.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/3.1.1/anchor.min.js"></script>
<script src="gitbook/gitbook-plugin-anchorjs/anchor-style.js"></script>
<script src="gitbook/gitbook-plugin-npmsearchlist/script.js"></script>
<script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
<script src="gitbook/gitbook-plugin-search/search.js"></script>
<script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
<script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
<script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
<script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
</body>
</html>

103
usage.html

@ -158,20 +158,7 @@
</li>
<li class="chapter " data-level="1.6" data-path="middleware/">
<a href="middleware/">
Middleware
</a>
</li>
<li class="chapter " data-level="1.7" data-path="presets/">
<li class="chapter " data-level="1.6" data-path="presets/">
<a href="presets/">
@ -185,7 +172,7 @@
<ul class="articles">
<li class="chapter " data-level="1.7.1" data-path="presets/neutrino-preset-web/">
<li class="chapter " data-level="1.6.1" data-path="presets/neutrino-preset-web/">
<a href="presets/neutrino-preset-web/">
@ -198,7 +185,7 @@
</li>
<li class="chapter " data-level="1.7.2" data-path="presets/neutrino-preset-react/">
<li class="chapter " data-level="1.6.2" data-path="presets/neutrino-preset-react/">
<a href="presets/neutrino-preset-react/">
@ -211,7 +198,7 @@
</li>
<li class="chapter " data-level="1.7.3" data-path="presets/neutrino-preset-node/">
<li class="chapter " data-level="1.6.3" data-path="presets/neutrino-preset-node/">
<a href="presets/neutrino-preset-node/">
@ -224,7 +211,7 @@
</li>
<li class="chapter " data-level="1.7.4" data-path="presets/neutrino-preset-airbnb-base/">
<li class="chapter " data-level="1.6.4" data-path="presets/neutrino-preset-airbnb-base/">
<a href="presets/neutrino-preset-airbnb-base/">
@ -237,7 +224,7 @@
</li>
<li class="chapter " data-level="1.7.5" data-path="presets/neutrino-preset-karma/">
<li class="chapter " data-level="1.6.5" data-path="presets/neutrino-preset-karma/">
<a href="presets/neutrino-preset-karma/">
@ -250,7 +237,7 @@
</li>
<li class="chapter " data-level="1.7.6" data-path="presets/neutrino-preset-mocha/">
<li class="chapter " data-level="1.6.6" data-path="presets/neutrino-preset-mocha/">
<a href="presets/neutrino-preset-mocha/">
@ -263,7 +250,7 @@
</li>
<li class="chapter " data-level="1.7.7" data-path="presets/neutrino-preset-jest/">
<li class="chapter " data-level="1.6.7" data-path="presets/neutrino-preset-jest/">
<a href="presets/neutrino-preset-jest/">
@ -276,7 +263,7 @@
</li>
<li class="chapter " data-level="1.7.8" data-path="presets/community-presets.html">
<li class="chapter " data-level="1.6.8" data-path="presets/community-presets.html">
<a href="presets/community-presets.html">
@ -294,7 +281,7 @@
</li>
<li class="chapter " data-level="1.8" data-path="customization/">
<li class="chapter " data-level="1.7" data-path="customization/">
<a href="customization/">
@ -308,7 +295,7 @@
<ul class="articles">
<li class="chapter " data-level="1.8.1" data-path="customization/simple.html">
<li class="chapter " data-level="1.7.1" data-path="customization/simple.html">
<a href="customization/simple.html">
@ -321,7 +308,7 @@
</li>
<li class="chapter " data-level="1.8.2" data-path="customization/advanced.html">
<li class="chapter " data-level="1.7.2" data-path="customization/advanced.html">
<a href="customization/advanced.html">
@ -339,7 +326,7 @@
</li>
<li class="chapter " data-level="1.9" data-path="creating-presets.html">
<li class="chapter " data-level="1.8" data-path="creating-presets.html">
<a href="creating-presets.html">
@ -353,9 +340,9 @@
<ul class="articles">
<li class="chapter " data-level="1.9.1" data-path="presets/neutrino-lint-base/README.md">
<li class="chapter " data-level="1.8.1" data-path="presets/neutrino-lint-base/">
<span>
<a href="presets/neutrino-lint-base/">
Creating linting presets
@ -371,7 +358,7 @@
</li>
<li class="chapter " data-level="1.10" data-path="learning-resources.html">
<li class="chapter " data-level="1.9" data-path="learning-resources.html">
<a href="learning-resources.html">
@ -384,7 +371,7 @@
</li>
<li class="chapter " data-level="1.11" data-path="api/">
<li class="chapter " data-level="1.10" data-path="api/">
<a href="api/">
@ -397,7 +384,7 @@
</li>
<li class="chapter " data-level="1.12" data-path="cli/">
<li class="chapter " data-level="1.11" data-path="cli/">
<a href="cli/">
@ -410,33 +397,7 @@
</li>
<li class="chapter " data-level="1.13" data-path="upgrading-neutrino.html">
<a href="upgrading-neutrino.html">
Upgrading from v4 to v5
</a>
</li>
<li class="chapter " data-level="1.14" >
<a target="_blank" href="https://github.com/mozilla-neutrino/neutrino-dev/tree/docs-v4/docs">
v4 Documentation
</a>
</li>
<li class="chapter " data-level="1.15" data-path="contributing/">
<li class="chapter " data-level="1.12" data-path="contributing/">
<a href="contributing/">
@ -450,7 +411,7 @@
<ul class="articles">
<li class="chapter " data-level="1.15.1" data-path="contributing/development.html">
<li class="chapter " data-level="1.12.1" data-path="contributing/development.html">
<a href="contributing/development.html">
@ -463,7 +424,7 @@
</li>
<li class="chapter " data-level="1.15.2" data-path="contributing/code-of-conduct.html">
<li class="chapter " data-level="1.12.2" data-path="contributing/code-of-conduct.html">
<a href="contributing/code-of-conduct.html">
@ -539,14 +500,14 @@ In a typical project:</p>
<li><code>scripts.build</code> would be the command you wish to run to create a production bundle</li>
<li><code>scripts.test</code> would be the command you wish to run to execute tests</li>
</ul>
<p>Using these script targets may not be suitable for every project. They are only the
typical recommendations for script target names. You may choose any different name if desired
<p>Using these script targets may not be suitable for every project; know that they are just
typical recommendations for script target names, you may choose a different name if desired
for your project.</p>
<h2 id="building-for-development">Building for development</h2>
<p>Neutrino provides the command <code>neutrino start</code> for creating a bundle during development. Using
<code>neutrino start</code> sets the Node.js environment to <code>development</code> using the <code>NODE_ENV</code> environment variable,
which is available in your project source code. Depending on the presets you are using, <code>neutrino start</code>
may also spin up a development server with Hot Module Replacement (HMR) capabilities.
may also spin up a development server with hot module reloading capabilities.
Check the documentation of your preset for details.</p>
<p>Usage:</p>
<pre class="language-"><code class="lang-bash"><span class="token comment" spellcheck="true"># PRESET_MODULE is the name of the preset to build with, e.g. neutrino-preset-react</span>
@ -580,8 +541,8 @@ neutrino build --presets PRESET_MODULE
<p>Neutrino provides the command <code>neutrino test</code> for invoking a set of tests included in your project.
Using <code>neutrino test</code> sets the Node.js environment variable to <code>test</code> using the <code>NODE_ENV</code> environment
variable, which is available in your project source code. How your source code is built and consumed from tests
is determined by the presets you are using. Running suites that are built the same as source files is encouraged by
using a Neutrino-compatible preset. Neutrino currently provides three core testing presets: Karma, Jest, and Mocha.</p>
is determined by the preset you are using. Running suites that are built the same as source files are encouraged
to use a Neutrino-compatible preset. Neutrino currently provides three core testing presets: Karma, Jest, and Mocha.</p>
<pre class="language-"><code class="lang-bash"><span class="token comment" spellcheck="true"># PRESET_MODULE is the name of the preset to build with, e.g. neutrino-preset-react</span>
<span class="token comment" spellcheck="true"># TESTING_MODULE is the name of another preset to build with, e.g. neutrino-preset-karma</span>
neutrino build --presets PRESET_MODULE TESTING_MODULE
@ -602,13 +563,11 @@ dashes after the last preset to denote the end of the presets and the beginning
</code></pre>
<h2 id="using-multiple-presets">Using multiple presets</h2>
<p>All Neutrino commands support the <code>--presets</code> command line parameter, but having to specify this for each script target
can be cumbersome and verbose, especially if you have many presets. Fortunately, Neutrino also supports specifying
presets using the <code>neutrino.presets</code> field in your project&apos;s package.json file. By omitting the <code>--presets</code> flag and
specifying a <code>neutrino.presets</code> array, every call to a Neutrino command will look up which presets are configured in
your package.json.</p>
<p>This is the recommended approach when using more than one preset.</p>
can be cumbersome, especially if you have many presets. Fortunately, Neutrino also supports specifying presets using the
<code>config.presets</code> field in your project&apos;s package.json file. By omitting the <code>--presets</code> flag and specifying a
<code>config.presets</code> array, every call to a Neutrino command will look up which presets are configured in your package.json.</p>
<pre class="language-"><code class="lang-json"><span class="token punctuation">{</span>
<span class="token property">&quot;neutrino&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;config&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">&quot;presets&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span>
<span class="token string">&quot;neutrino-preset-react&quot;</span><span class="token punctuation">,</span>
<span class="token string">&quot;neutrino-preset-karma&quot;</span>
@ -664,7 +623,7 @@ your package.json.</p>
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"Usage","level":"1.3","depth":1,"next":{"title":"Project Layout","level":"1.4","depth":1,"path":"project-layout.md","ref":"./project-layout.md","articles":[]},"previous":{"title":"Installation","level":"1.2","depth":1,"path":"installation.md","ref":"./installation.md","articles":[]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"usage.md","mtime":"2017-03-15T13:20:51.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-15T14:46:02.288Z"},"basePath":".","book":{"language":""}});
gitbook.page.hasChanged({"page":{"title":"Usage","level":"1.3","depth":1,"next":{"title":"Project Layout","level":"1.4","depth":1,"path":"project-layout.md","ref":"project-layout.md","articles":[]},"previous":{"title":"Installation","level":"1.2","depth":1,"path":"installation.md","ref":"installation.md","articles":[]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs","npmsearchlist"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/mozilla-neutrino/neutrino-dev/"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"npmsearchlist":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit page","base":"https://github.com/mozilla-neutrino/neutrino-dev/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchorjs":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Neutrino","gitbook":"*"},"file":{"path":"usage.md","mtime":"2017-03-01T15:25:58.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-06T17:07:12.452Z"},"basePath":".","book":{"language":""}});
});
</script>
</div>

Loading…
Cancel
Save