# frontend-homepage

## Workstation SPA
`frontend-homepage` 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 access to our private NPM packages.  
https://www.notion.so/Javascript-Package-Management-Setup-9553d5d491c94835aa787fdf0fc4838d


Initialize environment configuration:

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

Install dependencies

```shell
pnpm install
```

## 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
pnpm start
```

## Local development, auth and feature flags
`frontend-homepage` runs inside the workstation shell, which owns local-dev setup, Auth0 sign-in, label impersonation, and how to test under a specific set of feature flags, restrictions or permissions. Follow the single source of truth in the shell repo rather than duplicating it here: [frontend-workstation / Local development](https://github.com/theorchard/frontend-workstation/blob/master/docs/local-development.md).

The old `GRASS_TOKEN`, `USER_FEATURES` and `USER_RESTRICTIONS` `.env` knobs are gone. To exercise a given vendor state, impersonate a vendor that already has it (see the doc above).

## 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=252555
POEDITOR_API_TOKEN=xxxxxx
```

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

## Testing

Run the linter and the tests:

```shell
pnpm test
```

Run the linter independently:

```shell
pnpm lint
```

Run the unit tests independently:

```shell
pnpm test:unit
```

Run the unit tests in watch mode:

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