synopkg
Version:
Consistent dependency versions in large JavaScript Monorepos
43 lines (35 loc) • 1.19 kB
text/mdx
title: Pin local versions to pnpm workspace:*
Add a [Pinned Version Group](VERSION_GROUP_PINNED) so that local packages are always installed using `workspace:*` when they are used in `devDependencies`.
- An optional **label** can be added to document the rule.
- The **dependencies** array defines the names of the dependencies we want to target.
- **dependencyTypes** results in these dependencies only being targeted by this group when they are located in `devDependencies`.
- **pinVersion** states that these dependencies must always use `workspace:*`.
```json title=".synopkgrc.json"
{
"versionGroups": [
{
"label": "Use workspace protocol when developing local packages",
"dependencies": [
"@your-repo/node-client-plugin-retry",
"@your-repo/node-client",
"dashboard-ui"
],
"dependencyTypes": ["dev"],
"pinVersion": "workspace:*"
}
]
}
```
:::tip
The above example can be shortened: The `$LOCAL` keyword is a helper to avoid writing out the names of every local package.
```diff
"dependencies": [
+ "$LOCAL"
- "@your-repo/node-client-plugin-retry",
- "@your-repo/node-client",
- "dashboard-ui"
],
```
:::