pnpm-plugin-alex-857 1.0.23 → 1.0.25
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 +53 -27
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,62 +8,87 @@ 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
|
+
## Developer checklist
|
|
14
|
+
|
|
15
|
+
Use this checklist when setting up a monorepo with this plugin:
|
|
16
|
+
|
|
17
|
+
- [ ] **Add the plugin** – From the monorepo root, run: `pnpm add --config pnpm-plugin-alex-857@latest`
|
|
18
|
+
- [ ] **Add scripts** – Copy the `scripts` block from Step 2 below into your root `package.json`
|
|
19
|
+
- [ ] **Use the catalog** – Add dependencies with `catalog:` in root or workspace `package.json`, or run `pnpm run install:catalog` to add all catalog packages at once
|
|
20
|
+
- [ ] **Verify** – Run `pnpm install` and confirm install and postinstall complete without errors
|
|
21
|
+
|
|
22
|
+
For updates: when a new version of the plugin is released, running **`pnpm install`** is enough (preinstall will pull the latest).
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Setup (step by step)
|
|
27
|
+
|
|
28
|
+
### Step 1: Add the plugin as a config dependency
|
|
29
|
+
|
|
30
|
+
From your monorepo root:
|
|
14
31
|
|
|
15
32
|
```bash
|
|
16
33
|
pnpm add --config pnpm-plugin-alex-857@latest
|
|
17
34
|
```
|
|
18
35
|
|
|
19
|
-
This updates your `pnpm-workspace.yaml` with
|
|
36
|
+
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`.
|
|
37
|
+
|
|
38
|
+
### Step 2: Add scripts to your root `package.json`
|
|
20
39
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
40
|
+
**Copy and paste** this `scripts` block into your root `package.json`:
|
|
41
|
+
|
|
42
|
+
```json
|
|
43
|
+
"scripts": {
|
|
44
|
+
"preinstall": "pnpm add --config pnpm-plugin-alex-857@latest && node node_modules/.pnpm-config/pnpm-plugin-alex-857/install-workspace.js",
|
|
45
|
+
"postinstall": "pnpm run install:catalog",
|
|
46
|
+
"install:catalog": "node node_modules/.pnpm-config/pnpm-plugin-alex-857/install-catalog.js"
|
|
47
|
+
}
|
|
24
48
|
```
|
|
25
49
|
|
|
26
|
-
|
|
50
|
+
- **preinstall**: Ensures the latest plugin version is used and runs the workspace setup script.
|
|
51
|
+
- **postinstall**: Runs after `pnpm install` and adds all catalog packages to the root (if not already present).
|
|
52
|
+
- **install:catalog**: Manual script to add all catalog packages at once.
|
|
27
53
|
|
|
28
|
-
###
|
|
54
|
+
### Step 3: Use the catalog in your dependencies
|
|
29
55
|
|
|
30
|
-
|
|
56
|
+
In your root or workspace `package.json`, reference catalog versions with `catalog:`:
|
|
31
57
|
|
|
32
58
|
```json
|
|
33
59
|
{
|
|
34
60
|
"dependencies": {
|
|
35
61
|
"react": "catalog:",
|
|
36
62
|
"react-dom": "catalog:",
|
|
37
|
-
"react-router
|
|
63
|
+
"react-router": "catalog:",
|
|
64
|
+
"react-router-config": "catalog:",
|
|
65
|
+
"react-router-dom": "catalog:",
|
|
66
|
+
"recharts": "catalog:"
|
|
38
67
|
}
|
|
39
68
|
}
|
|
40
69
|
```
|
|
41
70
|
|
|
42
|
-
Or add a single package:
|
|
71
|
+
Or add a single package from the catalog:
|
|
43
72
|
|
|
44
73
|
```bash
|
|
45
74
|
pnpm add react@catalog:
|
|
46
75
|
```
|
|
47
76
|
|
|
48
|
-
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Updating the plugin
|
|
49
80
|
|
|
50
|
-
|
|
81
|
+
**If there is a new update in pnpm-plugin-alex-857, developers only need to run:**
|
|
51
82
|
|
|
52
83
|
```bash
|
|
53
|
-
pnpm
|
|
84
|
+
pnpm install
|
|
54
85
|
```
|
|
55
86
|
|
|
56
|
-
|
|
87
|
+
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
88
|
|
|
58
|
-
|
|
59
|
-
{
|
|
60
|
-
"scripts": {
|
|
61
|
-
"install:catalog": "node node_modules/.pnpm-config/pnpm-plugin-alex-857/install-catalog.js"
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
```
|
|
89
|
+
---
|
|
65
90
|
|
|
66
|
-
|
|
91
|
+
## Config applied by the plugin
|
|
67
92
|
|
|
68
93
|
When the plugin is installed, it sets:
|
|
69
94
|
|
|
@@ -73,14 +98,15 @@ When the plugin is installed, it sets:
|
|
|
73
98
|
| `hoist` | `false` |
|
|
74
99
|
| `hoistWorkspacePackages` | `true` |
|
|
75
100
|
|
|
101
|
+
---
|
|
102
|
+
|
|
76
103
|
## Catalog
|
|
77
104
|
|
|
78
|
-
The default catalog is defined in the plugin’s `pnpm-catalog.json
|
|
105
|
+
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
106
|
|
|
80
|
-
|
|
81
|
-
- react-router, react-router-dom, react-router-config
|
|
107
|
+
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
108
|
|
|
83
|
-
|
|
109
|
+
---
|
|
84
110
|
|
|
85
111
|
## License
|
|
86
112
|
|