pnpm-plugin-alex-857 1.0.22 → 1.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -27
- package/package.json +1 -1
- package/pnpm-catalog.json +2 -1
package/README.md
CHANGED
|
@@ -8,62 +8,79 @@ A pnpm config plugin that provides a shared **catalog** of dependency versions a
|
|
|
8
8
|
- **Config**: Sets `strictPeerDependencies: true`, `hoist: false`, and `hoistWorkspacePackages: true`.
|
|
9
9
|
- **install-catalog**: A script to add all catalog packages to your project in one go.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
---
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
## Setup (step by step)
|
|
14
|
+
|
|
15
|
+
### Step 1: Add the plugin as a config dependency
|
|
16
|
+
|
|
17
|
+
From your monorepo root:
|
|
14
18
|
|
|
15
19
|
```bash
|
|
16
20
|
pnpm add --config pnpm-plugin-alex-857@latest
|
|
17
21
|
```
|
|
18
22
|
|
|
19
|
-
This updates your `pnpm-workspace.yaml` with
|
|
23
|
+
This updates your `pnpm-workspace.yaml` with a `configDependencies` entry and installs the plugin so its pnpmfile and catalog are used on every `pnpm install`.
|
|
24
|
+
|
|
25
|
+
### Step 2: Add scripts to your root `package.json`
|
|
20
26
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
27
|
+
Add the following scripts so the plugin’s install-catalog script runs correctly (config dependencies don’t expose bins to the workspace):
|
|
28
|
+
|
|
29
|
+
```json
|
|
30
|
+
{
|
|
31
|
+
"name": "monorepo-a",
|
|
32
|
+
"version": "1.0.0",
|
|
33
|
+
"private": true,
|
|
34
|
+
"scripts": {
|
|
35
|
+
"preinstall": "pnpm add --config pnpm-plugin-alex-857@latest",
|
|
36
|
+
"postinstall": "pnpm run install:catalog",
|
|
37
|
+
"install:catalog": "node node_modules/.pnpm-config/pnpm-plugin-alex-857/install-catalog.js"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
24
40
|
```
|
|
25
41
|
|
|
26
|
-
|
|
42
|
+
- **preinstall**: Ensures the latest plugin version is used before each install.
|
|
43
|
+
- **postinstall**: Runs after `pnpm install` and adds all catalog packages to the root (if not already present).
|
|
44
|
+
- **install:catalog**: Manual script to add all catalog packages at once.
|
|
27
45
|
|
|
28
|
-
###
|
|
46
|
+
### Step 3: Use the catalog in your dependencies
|
|
29
47
|
|
|
30
|
-
|
|
48
|
+
In your root or workspace `package.json`, reference catalog versions with `catalog:`:
|
|
31
49
|
|
|
32
50
|
```json
|
|
33
51
|
{
|
|
34
52
|
"dependencies": {
|
|
35
53
|
"react": "catalog:",
|
|
36
54
|
"react-dom": "catalog:",
|
|
37
|
-
"react-router
|
|
55
|
+
"react-router": "catalog:",
|
|
56
|
+
"react-router-config": "catalog:",
|
|
57
|
+
"react-router-dom": "catalog:",
|
|
58
|
+
"recharts": "catalog:"
|
|
38
59
|
}
|
|
39
60
|
}
|
|
40
61
|
```
|
|
41
62
|
|
|
42
|
-
Or add a single package:
|
|
63
|
+
Or add a single package from the catalog:
|
|
43
64
|
|
|
44
65
|
```bash
|
|
45
66
|
pnpm add react@catalog:
|
|
46
67
|
```
|
|
47
68
|
|
|
48
|
-
|
|
69
|
+
---
|
|
49
70
|
|
|
50
|
-
|
|
71
|
+
## Updating the plugin
|
|
72
|
+
|
|
73
|
+
**If there is a new update in pnpm-plugin-alex-857, developers only need to run:**
|
|
51
74
|
|
|
52
75
|
```bash
|
|
53
|
-
pnpm
|
|
76
|
+
pnpm install
|
|
54
77
|
```
|
|
55
78
|
|
|
56
|
-
|
|
79
|
+
The **preinstall** script runs `pnpm add --config pnpm-plugin-alex-857@latest`, so the latest plugin version is installed automatically. No extra steps are required.
|
|
57
80
|
|
|
58
|
-
|
|
59
|
-
{
|
|
60
|
-
"scripts": {
|
|
61
|
-
"install:catalog": "node node_modules/.pnpm-config/pnpm-plugin-alex-857/install-catalog.js"
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
```
|
|
81
|
+
---
|
|
65
82
|
|
|
66
|
-
|
|
83
|
+
## Config applied by the plugin
|
|
67
84
|
|
|
68
85
|
When the plugin is installed, it sets:
|
|
69
86
|
|
|
@@ -73,14 +90,15 @@ When the plugin is installed, it sets:
|
|
|
73
90
|
| `hoist` | `false` |
|
|
74
91
|
| `hoistWorkspacePackages` | `true` |
|
|
75
92
|
|
|
93
|
+
---
|
|
94
|
+
|
|
76
95
|
## Catalog
|
|
77
96
|
|
|
78
|
-
The default catalog is defined in the plugin’s `pnpm-catalog.json
|
|
97
|
+
The default catalog is defined in the plugin’s `pnpm-catalog.json` (e.g. react, react-dom, react-router, react-router-dom, react-router-config, recharts).
|
|
79
98
|
|
|
80
|
-
|
|
81
|
-
- react-router, react-router-dom, react-router-config
|
|
99
|
+
To use a custom catalog in your repo, place a `pnpm-catalog.json` in the project root; the `install-catalog` script will use it if found there.
|
|
82
100
|
|
|
83
|
-
|
|
101
|
+
---
|
|
84
102
|
|
|
85
103
|
## License
|
|
86
104
|
|
package/package.json
CHANGED