Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(v2): CLI docs #1476

Merged
merged 4 commits into from
May 17, 2019
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 78 additions & 3 deletions website/docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,83 @@ id: cli
title: CLI
---

TODO: Add CLI reference here.
Docusaurus provides a set of scripts to help you generate, serve, and deploy your website.

#### References
Once your website is generated, your website package will contain the Docusaurus scripts that you may invoke with your package manager:

- TODO
```json
// package.json
{
// ...
"scripts": {
"start": "docusaurus start",
"build": "docusaurus build",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy"
}
}
```

## Docusaurus CLI commands

Below is a list of Docusaurus CLI commands and their usages:

### `docusaurus init`
endiliey marked this conversation as resolved.
Show resolved Hide resolved

The `docusaurus init` command is intended to be used with `docusaurus` installed globally:

```shell
$ yarn global add docusaurus
# or
$ npm install --global docusaurus
```

<!-- TODO: init docs after the init command is implemented -->

### `docusaurus start`

Builds and serves the static site with [Webpack Dev Server](https://webpack.js.org/configuration/dev-server).

**options**

|Options|Default|Description|
|-|-|-|
|`--port`|`3000`|Specifies the port of the dev server|
|`--host`|`localhost`|Specifie a host to use. E.g., if you want your server to be accessible externally, you can use `--host 0.0.0.0`|
|`--no-watch`|`false`|<!-- TODO verify how this works --> Disables watching files for hot reload|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The no-watch is still buggy. Need to investigate

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, let's still leave this line of doc here, will revisit once that is fixed.

|`--hot-only`|`false`|Enables Hot Module Replacement without page refresh as fallback in case of build failures. More information [here](https://webpack.js.org/configuration/dev-server/#devserverhotonly).|

### `docusaurus build`

Compiles your site for production.

**options**

|Options|Default|Description|
|-|-|-|
|`--bundle-analyzer`||Starts [bundle analyzer](https://github.com/webpack-contrib/webpack-bundle-analyzer)|


### `docusaurus swizzle`

endiliey marked this conversation as resolved.
Show resolved Hide resolved
Swizzle any Docusaurus Theme components with your own component with `docusaurus swizzle`.

```shell
$ docusaurus swizzle <swizzleComponent> <pathToNewComponent>
endiliey marked this conversation as resolved.
Show resolved Hide resolved
```

**params**

- `$swizzleComponent`: name of the component to be shadowed
- `$pathToNewComponent`: relative path to the desired location to the new component

Running the above command will copy the swizzle component to the path you indicated. You may then make any changes to the copied component and Docusaurus will use that component from then on.

<!-- TODO a separate section for swizzle tutorial -->
To learn more about swizzling, check [here](#).

<!-- TODO is there a way to "unswizzle" a component? -->
endiliey marked this conversation as resolved.
Show resolved Hide resolved

### `docusaurus deploy`

Deploys your site with [GitHub Pages](https://pages.github.com/).