# Using the cli

## Installation
The package is located in a private npm registry hosted by packagecloud.io. 
To be able to install it you need to add the registry to your npm configuration.

Please follow the guide on how to set up your environment.  
[Javascript Package Management Setup](https://www.notion.so/Javascript-Package-Management-Setup-9553d5d491c94835aa787fdf0fc4838d)

## Usage
When using the command line interface, you should always prefix it with `yarn`. This ensures that the CLI is executed in the right working directory.

`yarn frontend <cmd>`

### `> frontend start`
Starts the development server.

#### Arguments

| Argument      | Example                           | Description                               |
| ------------- | --------------------------------- | ----------------------------------------- |
| -l, --locale  | yarn frontend start -l de      | Sets the locale to load your module in.   |
| -h, --hot     | yarn frontend start -h         | Enable Hot Module Reload (HMR).           |
| -a, --analyze | yarn frontend start -a         | Open webpack bundle analyzer.             |
| -p, --port    | yarn frontend start -p 8080    | Specify server port number.               |
| -e, --entry   | yarn frontend start -e index2  | Specify an alternative entry file.        |

### `> frontend build`
Builds the production bundles.

### Arguments

| Argument              | Example                       | Description                                   |
| --------------------- | ------------------------------| --------------------------------------------- |
| -l, --locale          | yarn frontend build -l de  | Sets a single locale to include in bundle.    |
| -u, --uncompressed    | yarn frontend build -u     | Do not minify output bundles.                 |
| -a, --analyze         | yarn frontend build -a     | Open webpack bundle analyzer.                 |
| --disable-locales     |                               | Do not include locales in output bundles.     |

### `> frontend i18n`
Syncs POEditor terms and translations.

**NOTE** Local terms/translations are only pushed to POEditor when running in production mode.

#### Arguments

| Argument      | Example                       | Description                                   |
| ------------- | ----------------------------- | --------------------------------------------- |
| -l, --locale  | yarn frontend i18n -l de   | Download translations for a single language.  |
| --force-sync  |                               | Force upload of local terms/translations.     |
