# DrEdition CLI

## Installation

`npm install @aptoma/dredition-cli`

Can also be installed globally:

`npm install -g @aptoma/dredition-cli`

## Usage

### DrEdition layoutpreview

#### Live reload

`dredition layoutpreview live-reload`

Should be called at the root of your assets directory. An example of an expected structure looks like this:

```
.
├── stylesheets
    ├── **/*.scss
│   └── styles.scss
└── templates
    └── components
        ├── headline
        │   ├── headline.html
        │   └── headline.scss
        ├── intro
        │   ├── intro.html
        │   └── intro.scss
        └── componentName
            ├── componentName.html
            └── componentName.scss
```

The first time the script is run, you will be asked to configure everything. The config file will be default be stored in `~/.aptoma/dredition/config.json`.

If you are a developer and want to run live-reload with a dev environment, you'll have to edit `config.json` manually. The automated setup will only work for production use.

#### Example custom setups of `config.json`

**Override urls for all configs:**

```json
{
    "default": {
        "frontendUrl": "https://{account}.dredition-dev.aptoma.no",
        "apiUrl": "https://dredition-api-dev.aptoma.no",
        "assetBuilderUrl": "https://asset-builder.dev.ecs.aws.aptoma.no"
    },
    "broadcast": {
        "account": "broadcast",
        "apikey": "secret"
    },
    "aptoma": {
        "account": "aptoma",
        "apikey": "secret"
    }
}
```

**Override urls for only a specific config:**

```json
{
    "broadcast": {
        "account": "broadcast",
        "apikey": "secret",
    },
    "broadcast-dev": {
        "account": "broadcast",
        "apikey": "secret",
        "frontendUrl": "https://{account}.dredition-dev.aptoma.no",
        "apiUrl": "https://dredition-api-dev.aptoma.no",
        "assetBuilderUrl": "https://asset-builder.dev.ecs.aws.aptoma.no"
    }
}
```
