Skip to content

Commit b09a82b

Browse files
committed
docs: update
1 parent 9819799 commit b09a82b

File tree

2 files changed

+52
-2
lines changed

2 files changed

+52
-2
lines changed

cspell.config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ words:
1313
- pkgroll
1414
- sonarjs
1515
- vitepress
16+
- xsai
1617
ignoreWords: []
1718
import: []

docs/node/pnpm.md

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,59 @@
22

33
## [Workspace](https://pnpm.io/workspaces)
44

5+
```yaml
6+
# pnpm-workspace.yaml
7+
packages:
8+
- packages/*
9+
```
10+
511
## [Catalogs](https://pnpm.io/catalogs)
612
7-
## [publishConfig](https://pnpm.io/package_json#publishconfig)
13+
When you have multiple packages in your workspace that depend on the same library, you can use catalogs to better standardize versions.
14+
15+
```yaml
16+
# pnpm-workspace.yaml
17+
packages:
18+
- packages/*
19+
20+
catalog:
21+
react: ^19.1.0
22+
23+
catalogs:
24+
xsai:
25+
xsai: ^0.2.0
26+
```
27+
28+
```jsonc
29+
// packages/foo/package.json
30+
{
31+
"name": "@example/foo",
32+
"dependencies": {
33+
"react": "catalog:",
34+
"xsai": "catalog:xsai"
35+
}
36+
}
37+
```
38+
39+
### YAML Anchors
40+
41+
Do you remember that `pnpm-workspace.yaml` is YAML?
42+
43+
This means we can use YAML Anchors to manage the same version, like this:
44+
45+
```yaml
46+
# pnpm-workspace.yaml
47+
packages:
48+
- packages/*
49+
50+
catalog:
51+
'@xsai/embed': &xsai ^0.2.0
52+
'@xsai/generate-text': *xsai
53+
'@xsai/shared': *xsai
54+
'@xsai/shared-chat': *xsai
55+
```
56+
57+
## [package.json#publishConfig](https://pnpm.io/package_json#publishconfig)
858
959
pnpm supports overriding something at publish time via publishConfig.
1060
@@ -23,7 +73,6 @@ So we can do that:
2373
}
2474
},
2575
"main": "./dist/index.js",
26-
"module": "./dist/index.js",
2776
"types": "./dist/index.d.ts"
2877
}
2978
}

0 commit comments

Comments
 (0)