Dependencies

Using env.jsonc, you control the dependencies of components in a central configuration file. This is commonly used for setting peer dependencies such as your framework, styled-components, or dev dependencies like typescript or jest.

Peers

For example, configuring react as a peer dependency requires setting up the version you want your component to use for it's build and other operations. You can also set an optional compatiblity version range.

{
  "policy": {
    "peers": [
      {
        "name": "react", // name of the dependency
        "version": "^18.0.0", // version to use for development purposes
        "supportedRange": "^17.0.0 || ^18.0.0" // supported range to expects consumers to have
      }
    ]
  }
}
CopiedCopy
When to use peers?

To better understand when to set dependencies as peerDependencies, see here

Dev

Use the devDependencies property in env.jsonc to manage version compatiblity of your tooling.

{
  "policy": {
    "dev": {
      {
        "name": "@testing-library/react",
        "version": "^13.4.0"
      }
    }
  }
}
CopiedCopy
Why this is needed?

Configuring these devDependencies via the env.jsonc file is needed because often plugins, tools and some libs are not explicitly depended on by components, so we manage them manually.

Learn more