<html><head><metacharset="utf-8"/><metahttp-equiv="X-UA-Compatible"content="IE=edge, chrome=1"/><title>CLI Commands · Docusaurus</title><metaname="viewport"content="width=device-width"/><metaproperty="og:title"content="CLI Commands · Docusaurus"/><metaproperty="og:type"content="website"/><metaproperty="og:url"content="https://docusaurus.io/index.html"/><metaproperty="og:description"content="Docusaurus provides a set of scripts to help you generate, serve, and deploy your website. These scripts can be invoked with the `run` command when using Yarn or npm. Some common commands are:"/><metaname="robots"content="noindex"/><linkrel="shortcut icon"href="/img/docusaurus.ico"/><linkrel="stylesheet"href="/css/main.css"/><scriptasync=""defer=""src="https://buttons.github.io/buttons.js"></script></head><bodyclass="sideNavVisible"><divclass="fixedHeaderContainer"><divclass="headerWrapper wrapper"><header><ahref="/"><imgsrc="/img/docusaurus.svg"/><h2>Docusaurus</h2></a><divclass="navigationWrapper navigationSlider"><navclass="slidingNav"><ulclass="nav-site nav-site-internal"><li><ahref="/docs/installation.html"target="_self">Docs</a></li><li><ahref="/en/help.html"target="_self">Help</a></li><li><ahref="https://github.com/facebookexperimental/docusaurus"target="_self">GitHub</a></li></ul></nav></div></header></div></div><divclass="navPusher"><divclass="docMainWrapper wrapper"><divclass="container docsNavContainer"id="docsNav"><navclass="toc"><divclass="toggleNav"><sectionclass="navWrapper wrapper"><divclass="navBreadcrumb wrapper"><divclass="navToggle"id="navToggler"><i></i></div><h2><i>›</i><span>API</span></h2></div><divclass="navGroups"><divclass="navGroup navGroupActive"><h3>Getting Started</h3><ul><liclass="navListItem"><aclass="navItem"href="/docs/installation.html#content">Installation</a></li><liclass="navListItem"><aclass="navItem"href="/docs/site-preparation.html#content">Site Preparation</a></li><liclass="navListItem"><aclass="navItem"href="/docs/site-creation.html#content">Creating your site</a></li></ul></div><divclass="navGroup navGroupActive"><h3>Guides</h3><ul><liclass="navListItem"><aclass="navItem"href="/docs/custom-pages.html#content">Custom Pages</a></li><liclass="navListItem"><aclass="navItem"href="/docs/navigation.html#content">Navigation and Sidebars</a></li><liclass="navListItem"><aclass="navItem"href="/docs/blog.html#content">Adding a Blog</a></li><liclass="navListItem"><aclass="navItem"href="/docs/translation.html#content">Translations</a></li><liclass="navListItem"><aclass="navItem"href="/docs/search.html#content">Enabling Search</a></li><liclass="navListItem"><aclass="navItem"href="/docs/versioning.html#content">Versioning</a></li></ul></div><divclass="navGroup navGroupActive"><h3>API</h3><ul><liclass="navListItem navListItemActive"><aclass="navItem navItemActive"href="/docs/commands.html#content">CLI Commands</a></li><liclass="navListItem"><aclass="navItem"href="/docs/api-pages.html#content">Pages and Styles</a></li><liclass="navListItem"><aclass="navItem"href="/docs/site-config.html#content">siteConfig.js</a></li><liclass="navListItem"><aclass="navItem"href="/docs/doc-markdown.html#content">Markdown Features</a></li></ul></div></div></section></div><script>
var toggler = document.getElementById('navToggler');
var nav = document.getElementById('docsNav');
toggler.onclick = function() {
nav.classList.toggle('docsSliderActive');
};
</script></nav></div><divclass="container mainContainer"><divclass="wrapper"><divclass="post"><headerclass="postHeader"><aclass="edit-page-link button"href="https://github.com/facebookexperimental/docusaurus/edit/master/docs/api-commands.md"target="_blank">Edit this Doc</a><h1>CLI Commands</h1></header><article><div><p>Docusaurus provides a set of scripts to help you generate, serve, and deploy your website. These scripts can be invoked with the <code>run</code> command when using Yarn or npm. Some common commands are:</p><ul><li><ahref="/docs/commands.html#docusaurus-start-port-number"target=""><code>yarn run start</code></a>: build and serve the website from a local server</li><li><ahref="/docs/commands.html#docusaurus-examples"target=""><code>yarn run examples</code></a>: create example configuration files</li></ul><h2><aclass="anchor"name="running-from-the-command-line"></a>Running from the command line <aclass="hash-link"href="#running-from-the-command-line">#</a></h2><p>The scripts can be run using either Yarn or npm. If you've already gone through our Getting Started guide, you may already be familiar with the <code>start</code> command. It's the command that tells Docusaurus to run the <code>docusaurus-start</code> script which generates the site and starts up a server, and it's usually invoked like so:</p><preclass="prism language-javascript">yarn run start</pre><p>The same script can be invoked using npm:</p><preclass="prism language-javascript">npm run start</pre><p>To run a particular script, just replace the <code>start</code> command in the examples above with the command associated with your script.</p><h2><aclass="anchor"name="using-arguments"></a>Using arguments <aclass="hash-link"href="#using-arguments">#</a></h2><p>Some commands support optional arguments. For example, to start a server on port 8080, you can specify the <code>--port</code> argument when running <code>start</code>:</p><preclass="prism language-javascript">yarn run start <spanclass="token operator">--</span>port <spanclass="token number">8080</span></pre><p>If you run Docusaurus using npm, you can still use the command line arguments by inserting a <code>--</code> between <code>npm run <command></code> and the command arguments:</p><preclass="prism language-javascript">npm run start <spanclass="token operator">--</span><spanclass="token operator">--</span>port <spanclass="token number">8080</span></pre><h2><aclass="anchor"name="configuration"></a>Configuration <aclass="hash-link"href="#configuration">#</a></h2><p>These scripts are set up under the <code>"scripts"</code> key in your <code>website/package.json</code> file as part of the installation process. If you need help setting them up again, please refer to the <ahref="/docs/installation.html"target="">Installation guide</a>.</p><p>Docusaurus provides some default mappings to allow you to run commands following Node conventions. Instead of typing <code>docusaurus-start</code> every time, you can type <code>yarn run start</code> or <code>npm start</code> to achieve the same.</p><h2><aclass="anchor"name="commands"></a>Commands <aclass="hash-link"href="#commands">#</a></h2><ul><li><ahref="#docusaurus-build"target=""><code>docusaurus-build</code></a></li><li><ahref="#docusaurus-examples-feature"target=""><code>docusaurus-examples [feature]</code></a></li><li><ahref="#docusaurus-publish"target=""><code>docusaurus-publish</code></a></li><li><ahref="#docusaurus-rename-version-currentversion-newversion"target=""><code>docusaurus-rename-version <currentVersion><newVersion></code></a></li><li><ahref="#docusaurus-start-port-number"target=""><code>docusaurus-start [--port <number>]</code></a></li><li><ahref="#docusaurus-version-version"target=""><code>docusaurus-version <version></code></a></li><li><ahref="#docusaurus-write-translations"target=""><code>docusaurus-write-translations</code></a></li></ul><hr/><h2><aclass="anchor"name="reference"></a>Reference <aclass="hash-link"