# frontend-feature-fm

## Workstation SPA
`frontend-feature-fm` is part of the workstation single page application.
Read up on the framework and tooling by visiting the [frontend-workstation](https://github.com/theorchard/frontend-workstation) repo.

## Setup / Installing
Use the node and package manager versions declared in [`package.json`](./package.json) (`engines` and `packageManager`). Anything else is unsupported.

Make sure you have configured the private npm registry used by `workstation-cli`.
Read the documentation on how to configure it here:
https://github.com/theorchard/frontend-workstation/blob/master/docs/cli.md


Initialize environment configuration:

```shell
cp .env.shadow .env
```

Install dependencies

```shell
yarn
```

## Running

_**Note**: You will need to be on the VPN (or in the NYC office) to be able to access Orchard services._

Run the local development server:

```shell
yarn start
```

## Features control and flags
For controlling user features during development, add the `USER_FEATURES` or/and `USER_RESTRICTIONS` variables to your .env file.

```bash
#.env file
USER_FEATURES={"reactified_audience_page":"enabled",, "second_feature":"control"}
USER_RESTRICTIONS=["Vendor Restricted Feature"]
```

## Localization
For loading the module in different locales, add the `POEDITOR_PROJECT_ID` and `POEDITOR_API_TOKEN` variables to your .env file.

```bash
#.env file
POEDITOR_PROJECT_ID=226899
POEDITOR_API_TOKEN=xxxxxx
```

Then you can start development in e.g. german.
```bash
yarn start -l de
```

## Testing

Run the linter and the tests:

```shell
yarn test
```

Run the linter independently:

```shell
yarn lint
```

Run the unit tests independently:

```shell
yarn test:unit
```

Run the unit tests in watch mode:

```shell
yarn test:unit --watch [pattern]
```
