You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
621 lines
21 KiB
621 lines
21 KiB
|
|
<!DOCTYPE HTML>
|
|
<html lang="" >
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
|
<title>CLI · 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-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="../contributing/" />
|
|
|
|
|
|
<link rel="prev" href="../api/" />
|
|
|
|
|
|
</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="../presets/">
|
|
|
|
<a href="../presets/">
|
|
|
|
|
|
Presets
|
|
|
|
</a>
|
|
|
|
|
|
|
|
<ul class="articles">
|
|
|
|
|
|
<li class="chapter " data-level="1.5.1" data-path="../presets/neutrino-preset-web/">
|
|
|
|
<a href="../presets/neutrino-preset-web/">
|
|
|
|
|
|
Web
|
|
|
|
</a>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
<li class="chapter " data-level="1.5.2" data-path="../presets/neutrino-preset-react/">
|
|
|
|
<a href="../presets/neutrino-preset-react/">
|
|
|
|
|
|
React
|
|
|
|
</a>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
<li class="chapter " data-level="1.5.3" data-path="../presets/neutrino-preset-node/">
|
|
|
|
<a href="../presets/neutrino-preset-node/">
|
|
|
|
|
|
Node.js
|
|
|
|
</a>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
<li class="chapter " data-level="1.5.4" data-path="../presets/neutrino-preset-airbnb-base/">
|
|
|
|
<a href="../presets/neutrino-preset-airbnb-base/">
|
|
|
|
|
|
Airbnb
|
|
|
|
</a>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
<li class="chapter " data-level="1.5.5" data-path="../presets/neutrino-preset-karma/">
|
|
|
|
<a href="../presets/neutrino-preset-karma/">
|
|
|
|
|
|
Karma
|
|
|
|
</a>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
<li class="chapter " data-level="1.5.6" data-path="../presets/neutrino-preset-mocha/">
|
|
|
|
<a href="../presets/neutrino-preset-mocha/">
|
|
|
|
|
|
Mocha
|
|
|
|
</a>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
<li class="chapter " data-level="1.5.7" data-path="../presets/neutrino-preset-jest/">
|
|
|
|
<a href="../presets/neutrino-preset-jest/">
|
|
|
|
|
|
Jest
|
|
|
|
</a>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
</li>
|
|
|
|
<li class="chapter " data-level="1.6" data-path="../customization/">
|
|
|
|
<a href="../customization/">
|
|
|
|
|
|
Customization
|
|
|
|
</a>
|
|
|
|
|
|
|
|
<ul class="articles">
|
|
|
|
|
|
<li class="chapter " data-level="1.6.1" data-path="../customization/simple.html">
|
|
|
|
<a href="../customization/simple.html">
|
|
|
|
|
|
Simple
|
|
|
|
</a>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
<li class="chapter " data-level="1.6.2" data-path="../customization/advanced.html">
|
|
|
|
<a href="../customization/advanced.html">
|
|
|
|
|
|
Advanced
|
|
|
|
</a>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
</li>
|
|
|
|
<li class="chapter " data-level="1.7" data-path="../creating-presets.html">
|
|
|
|
<a href="../creating-presets.html">
|
|
|
|
|
|
Creating presets
|
|
|
|
</a>
|
|
|
|
|
|
|
|
<ul class="articles">
|
|
|
|
|
|
<li class="chapter " data-level="1.7.1" data-path="../presets/neutrino-lint-base/">
|
|
|
|
<a href="../presets/neutrino-lint-base/">
|
|
|
|
|
|
Creating linting presets
|
|
|
|
</a>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
</li>
|
|
|
|
<li class="chapter " data-level="1.8" data-path="../learning-resources.html">
|
|
|
|
<a href="../learning-resources.html">
|
|
|
|
|
|
Learning Resources
|
|
|
|
</a>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
<li class="chapter " data-level="1.9" data-path="../api/">
|
|
|
|
<a href="../api/">
|
|
|
|
|
|
API
|
|
|
|
</a>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
<li class="chapter active" data-level="1.10" data-path="./">
|
|
|
|
<a href="./">
|
|
|
|
|
|
CLI
|
|
|
|
</a>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
<li class="chapter " data-level="1.11" data-path="../contributing/">
|
|
|
|
<a href="../contributing/">
|
|
|
|
|
|
Contributing
|
|
|
|
</a>
|
|
|
|
|
|
|
|
<ul class="articles">
|
|
|
|
|
|
<li class="chapter " data-level="1.11.1" data-path="../contributing/development.html">
|
|
|
|
<a href="../contributing/development.html">
|
|
|
|
|
|
Development Process
|
|
|
|
</a>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
<li class="chapter " data-level="1.11.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=".." >CLI</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-cli">Neutrino CLI</h1>
|
|
<p>Using the command-line interface is the preferred way of interacting with Neutrino. Let'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">❯ neutrino --help
|
|
Commands:
|
|
start Build a project <span class="token keyword">in</span> development mode
|
|
build Compile the <span class="token function">source</span> directory to a bundled build
|
|
<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:
|
|
--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>
|
|
<pre class="language-"><code class="lang-bash">❯ neutrino --version
|
|
4.0.0
|
|
</code></pre>
|
|
<h2 id="-presets"><code>--presets</code></h2>
|
|
<p>The <code>--presets</code> flag can be used in conjunction with any of the top-level commands to specify a collection of
|
|
presets to load. These can be an npm package or a relative path to a module to load as a preset.</p>
|
|
<pre class="language-"><code class="lang-bash">❯ neutrino start --presets neutrino-preset-react neutrino-preset-karma
|
|
</code></pre>
|
|
<p>The Neutrino CLI will still attempt to load any presets defined in the project's package.json located at
|
|
<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="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">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">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>
|
|
<p>Looking at the <code>--help</code> for <code>neutrino test</code>:</p>
|
|
<pre class="language-"><code class="lang-bash">❯ neutrino <span class="token function">test</span> --help
|
|
neutrino <span class="token function">test</span> <span class="token punctuation">[</span>files<span class="token punctuation">..</span><span class="token punctuation">]</span>
|
|
|
|
Options:
|
|
--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>
|
|
--watch Watch <span class="token function">source</span> files <span class="token keyword">for</span> changes and re-run tests <span class="token punctuation">[</span>boolean<span class="token punctuation">]</span> <span class="token punctuation">[</span>default: false<span class="token punctuation">]</span>
|
|
</code></pre>
|
|
<p>Using the command <code>neutrino test</code> will execute every test file located in your
|
|
<a href="../project-layout#Testing">testing directory</a>. You may also provide to this command the specific test files you wish
|
|
to run individually. It is important to note that when combined with the <code>--presets</code> parameter, you should use two
|
|
dashes after the last preset to denote the end of the presets and the beginning of the test files.</p>
|
|
<pre class="language-"><code class="lang-bash">❯ neutrino <span class="token function">test</span> a_test.js b_test.js
|
|
</code></pre>
|
|
<pre class="language-"><code class="lang-bash">❯ neutrino <span class="token function">test</span> --presets neutrino-preset-react neutrino-preset-karma -- a_test.js b_test.js
|
|
</code></pre>
|
|
<p>You can also pass a flag <code>--watch</code> to watch source files for changes and re-run tests, if your preset supports it.</p>
|
|
<pre class="language-"><code class="lang-bash">❯ neutrino <span class="token function">test</span> --watch
|
|
</code></pre>
|
|
<h2 id="exit-codes">Exit codes</h2>
|
|
<p>When the CLI creates an instance of Neutrino, it waits for all commands to either resolve or reject their Promise.
|
|
If the command succeeded, the CLI will exit with code <code>0</code>. If there was an error, the CLI will log the error
|
|
to the console and exit with code <code>1</code>. This makes it easier to use Neutrino commands for status reasons, such
|
|
as failing a pull request on continuous integration if any tests fail or if there are linter errors.</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="../api/" class="navigation navigation-prev " aria-label="Previous page: API">
|
|
<i class="fa fa-angle-left"></i>
|
|
</a>
|
|
|
|
|
|
<a href="../contributing/" class="navigation navigation-next " aria-label="Next page: Contributing">
|
|
<i class="fa fa-angle-right"></i>
|
|
</a>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<script>
|
|
var gitbook = gitbook || [];
|
|
gitbook.push(function() {
|
|
gitbook.page.hasChanged({"page":{"title":"CLI","level":"1.10","depth":1,"next":{"title":"Contributing","level":"1.11","depth":1,"path":"contributing/README.md","ref":"contributing/README.md","articles":[{"title":"Development Process","level":"1.11.1","depth":2,"path":"contributing/development.md","ref":"contributing/development.md","articles":[]},{"title":"Code of Conduct","level":"1.11.2","depth":2,"path":"contributing/code-of-conduct.md","ref":"contributing/code-of-conduct.md","articles":[]}]},"previous":{"title":"API","level":"1.9","depth":1,"path":"api/README.md","ref":"api/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["edit-link","prism","-highlight","github","anchorjs"],"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},"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-02-17T16:19:42.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-02-24T16:49:00.681Z"},"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-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>
|
|
|
|
|