# wp-partner-integrations

The JustWatch WordPress plugin lets you effortlessly embed streaming sources for movies and TV shows into your blog posts. Real-time Video-On-Demand availability for up to 250,000 movies and 60,000 TV shows in over 140 countries.

## Development

### WordPress

Download and install [Docker CE](https://www.docker.com/get-docker) for your OS.

Point your terminal to your project root and start up the container:

```shell
docker-compose up -d
```

Open your browser at [http://localhost:8008](http://localhost:8008).

Go through the WordPress installation steps and activate the plugin.


### Composer

Update Composer dependencies

```shell
docker compose run composer update
```

### Code Sniffer

Lint codebase

```shell
vendor/bin/phpcs --standard=.phpcs.xml .
```

Fix linting issues

```shell
php -d memory_limit=512M vendor/bin/phpcbf --standard=.phpcs.xml .
```


### Psalm

Run Psalm

```shell
./vendor/bin/psalm -c ./psalm.xml --show-info
```

Clear Psalm cache

```shell
./vendor/bin/psalm --clear-cache
```

### Frontend

Download and install [Node.js](https://nodejs.org) for your OS.

Install `pnpm` globally:

```shell
npm install -g pnpm
```

Install npm dependencies:

```shell
pnpm install
```

Run the build:

```
pnpm build
```

Watch for changes

```shell
pnpm watch
```

### Unit Tests

Run unit tests

```shell
pnpm test
```

Run unit-tests in the browser

```shell
pnpm test:browser
```

Run headless tests

```shell
pnpm test:headless
```

### Storybook

Run Storybook:

```shell
pnpm storybook
```

Build Storybook

```shell
pnpm storybook:build
```

Clear the Storybook cache:

```shell
pnpm storybook:clear
```

### Mock Service Worker

Regenerate the mock data.
For that to happen, a valid API key must be present in .env.

```shell
pnpm mock:gen
```

Run the mock server (optionally)

```shell
pnpm mock:run
```



#### ESLint

Lint the code

```shell
pnpm lint
```

Fix linting issues

```shell
pnpm lint:fix
```

### Vite

Clear Vite cache

```shell
rm -rf node_modules/.vite
```