dependency-grouper 0.1.0 → 0.1.1
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 +51 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -86,6 +86,33 @@ Run `dependency-grouper generate` and it merges the groups with automatic sortin
|
|
|
86
86
|
|
|
87
87
|
## Usage
|
|
88
88
|
|
|
89
|
+
### Quick Start (Existing Monorepo)
|
|
90
|
+
|
|
91
|
+
If you already have a monorepo with dependencies, bootstrap from existing packages:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
# 1. Install
|
|
95
|
+
pnpm add -D dependency-grouper
|
|
96
|
+
|
|
97
|
+
# 2. Add depGroups to your packages
|
|
98
|
+
# Edit packages/your-app/package.json:
|
|
99
|
+
{
|
|
100
|
+
"depGroups": ["yourProjectNames(more than 1 will add to all, later you can decide their fate)"] // ← Add this
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
# 3. Generate .dep-groups.yaml from existing dependencies
|
|
104
|
+
npx dependency-grouper sync
|
|
105
|
+
# This creates .dep-groups.yaml with all dependencies from packages with depGroups
|
|
106
|
+
|
|
107
|
+
# 4. Review and organize .dep-groups.yaml
|
|
108
|
+
nano .dep-groups.yaml
|
|
109
|
+
|
|
110
|
+
# 5. Generate to sync across all packages
|
|
111
|
+
npx dependency-grouper generate
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Fresh Setup
|
|
115
|
+
|
|
89
116
|
### 1. Install
|
|
90
117
|
|
|
91
118
|
```bash
|
|
@@ -212,6 +239,8 @@ To automatically sync new dependencies after install without regenerating all fi
|
|
|
212
239
|
- ✅ **Smart merging** - Preserves project-specific dependencies
|
|
213
240
|
- ✅ **Version control** - Update versions in one place
|
|
214
241
|
- ✅ **CI/CD ready** - Optional preinstall hook for automation
|
|
242
|
+
- ✅ **Nested projects** - Recursively finds all package.json files in monorepo
|
|
243
|
+
- ✅ **Bootstrap from existing** - Generate .dep-groups.yaml from current dependencies
|
|
215
244
|
|
|
216
245
|
## Configuration
|
|
217
246
|
|
|
@@ -235,13 +264,28 @@ groups:
|
|
|
235
264
|
```
|
|
236
265
|
|
|
237
266
|
## How It Works
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
267
|
+
Recursively finds all package.json files (including nested sub-projects)
|
|
268
|
+
3. Syncs new dependencies from package.json files to .dep-groups.yaml (bidirectional)
|
|
269
|
+
4. Finds all package.json files with `depGroups` field
|
|
270
|
+
5. Merges specified groups with existing dependencies
|
|
271
|
+
6. Sorts dependencies alphabetically within each section
|
|
272
|
+
7. Formats entire package.json with proper key ordering
|
|
273
|
+
8. Writes updated package.json files
|
|
274
|
+
9. Preserves project-specific dependencies
|
|
275
|
+
|
|
276
|
+
**Supports nested structures:**
|
|
277
|
+
```
|
|
278
|
+
monorepo/
|
|
279
|
+
├── .dep-groups.yaml
|
|
280
|
+
├── packages/
|
|
281
|
+
│ ├── app1/package.json
|
|
282
|
+
│ └── nested/
|
|
283
|
+
│ └── deep/
|
|
284
|
+
│ └── app2/package.json ← Found!
|
|
285
|
+
└── apps/
|
|
286
|
+
└── frontend/
|
|
287
|
+
└── utils/package.json ← Found!
|
|
288
|
+
``` key ordering
|
|
245
289
|
7. Writes updated package.json files
|
|
246
290
|
8. Preserves project-specific dependencies
|
|
247
291
|
|