import { Meta } from '@storybook/addon-docs/blocks';

<Meta title="Guides/Installation/Libraries" />

# Installation: Libraries

This guide applies to libraries consumed in Preply applications, and assumes these applications are already integrated according to the steps outlined in the [Installation: Applications](/story/guides-installation-applications--page) guide.

## Install Packages

Since the `@preply/ds-web-lib` is already available in these applications, you need to install them as **peer dependencies** in your library.

```
yarn add --peer @preply/ds-web-lib
```

Depending on what features of the Design System you want to use, you will need to install different libraries:

- `@preply/ds-web-lib` - for components
- `@preply/ds-core` - for tokens
- `@preply/ds-web-core` - for hooks
- `@preply/ds-web-root` - for using RootProvider in "dev mode" isolated from host applications

Make sure to install these packages as peer dependencies as addding them as direct dependencies will lead to duplicate instances of Design System singletons in the application builds which will cause incidents.

Also make sure that your library build system is properly configured to effectively exclude peer dependencies from your bundle.

### Jest

If you are using Jest for unit tests, you will need to add an ignore pattern to your library's `jest.config.js` to force transpilation of our modules before the tests are executed.

```
transformIgnorePatterns: ['/node_modules/(?!(@preply)/)'],`
```

### Storybook

If your library has a local instance of Storybook you will also have to follow the steps in [Installation: Storybook](/story/guides-installation-storybook--page).
