# Local development

## Install [yalc](https://github.com/wclr/yalc) globally

```shell
npm i -g yalc
```

## Publish Sonik to the yalc store

```shell
[Sonik] npm run publish:local
```

## Add the yalc-stored dependency to your host app

```shell
[Host app] yalc add @loophq/sonik
```

- Make sure that [HOST_APP_LOCAL.md](./HOST_APP_LOCAL.md) work is done.
- Make sure that `'@loophq/sonik'` is added to `YALC_LIBS` array.

## Start host app's dev environment as usual

```shell
[Host app] make start/restart
...
```

## Re-publish Sonik

When you make changes to Sonik, run

```shell
[Sonik] npm run publish:local
```

to re-publish the changes to the host app(s). The host app(s) will auto-reload the changes locally.

## Remove from yalc store

Once done with the development, remove the dependency from the host app

```shell
[Sonik] yalc remove @loophq/sonik
[Host apps] yalc remove @loophq/sonik
```
