workspace-utils 1.0.0 → 1.0.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/dist/index.js +15460 -0
- package/dist/package.json +57 -0
- package/package.json +4 -1
- package/.github/workflows/mdbook.yml +0 -64
- package/.prettierignore +0 -22
- package/.prettierrc +0 -13
- package/docs/book.toml +0 -10
- package/docs/src/SUMMARY.md +0 -24
- package/docs/src/commands/build.md +0 -110
- package/docs/src/commands/dev.md +0 -118
- package/docs/src/commands/overview.md +0 -239
- package/docs/src/commands/run.md +0 -153
- package/docs/src/configuration.md +0 -249
- package/docs/src/examples.md +0 -567
- package/docs/src/installation.md +0 -148
- package/docs/src/introduction.md +0 -117
- package/docs/src/quick-start.md +0 -278
- package/docs/src/troubleshooting.md +0 -533
- package/index.ts +0 -84
- package/src/commands/build.ts +0 -158
- package/src/commands/dev.ts +0 -192
- package/src/commands/run.test.ts +0 -329
- package/src/commands/run.ts +0 -118
- package/src/core/dependency-graph.ts +0 -262
- package/src/core/process-runner.ts +0 -355
- package/src/core/workspace.test.ts +0 -404
- package/src/core/workspace.ts +0 -228
- package/src/package-managers/bun.test.ts +0 -209
- package/src/package-managers/bun.ts +0 -79
- package/src/package-managers/detector.test.ts +0 -199
- package/src/package-managers/detector.ts +0 -111
- package/src/package-managers/index.ts +0 -10
- package/src/package-managers/npm.ts +0 -79
- package/src/package-managers/pnpm.ts +0 -101
- package/src/package-managers/types.ts +0 -42
- package/src/utils/output.ts +0 -301
- package/src/utils/package-utils.ts +0 -243
- package/tests/bun-workspace/apps/web-app/package.json +0 -18
- package/tests/bun-workspace/bun.lockb +0 -0
- package/tests/bun-workspace/package.json +0 -18
- package/tests/bun-workspace/packages/shared-utils/package.json +0 -15
- package/tests/bun-workspace/packages/ui-components/package.json +0 -17
- package/tests/npm-workspace/package-lock.json +0 -0
- package/tests/npm-workspace/package.json +0 -18
- package/tests/npm-workspace/packages/core/package.json +0 -15
- package/tests/pnpm-workspace/package.json +0 -14
- package/tests/pnpm-workspace/packages/utils/package.json +0 -15
- package/tests/pnpm-workspace/pnpm-workspace.yaml +0 -3
- package/tsconfig.json +0 -29
package/docs/src/examples.md
DELETED
|
@@ -1,567 +0,0 @@
|
|
|
1
|
-
# Examples
|
|
2
|
-
|
|
3
|
-
This page provides comprehensive examples of using workspace-utils in real-world scenarios. Each example includes the monorepo structure, commands, and expected output.
|
|
4
|
-
|
|
5
|
-
## Example 1: Full-Stack JavaScript Application
|
|
6
|
-
|
|
7
|
-
### Project Structure
|
|
8
|
-
|
|
9
|
-
```
|
|
10
|
-
my-fullstack-app/
|
|
11
|
-
├── package.json (workspaces)
|
|
12
|
-
├── packages/
|
|
13
|
-
│ ├── shared-types/ # TypeScript definitions
|
|
14
|
-
│ ├── ui-components/ # React component library
|
|
15
|
-
│ ├── api-client/ # REST API client
|
|
16
|
-
│ └── utils/ # Shared utilities
|
|
17
|
-
└── apps/
|
|
18
|
-
├── web-app/ # Next.js frontend
|
|
19
|
-
├── mobile-app/ # React Native
|
|
20
|
-
└── api-server/ # Express.js backend
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
### Common Workflows
|
|
24
|
-
|
|
25
|
-
#### Run All Tests
|
|
26
|
-
|
|
27
|
-
Add to your `package.json`:
|
|
28
|
-
|
|
29
|
-
```json
|
|
30
|
-
{
|
|
31
|
-
"scripts": {
|
|
32
|
-
"test": "wsu run test"
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
Then run:
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
npm run test
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
**Output:**
|
|
44
|
-
|
|
45
|
-
```
|
|
46
|
-
🚀 Running script "test" across packages...
|
|
47
|
-
|
|
48
|
-
📦 Found 7 packages
|
|
49
|
-
✅ Running "test" in 6 packages:
|
|
50
|
-
• packages/shared-types
|
|
51
|
-
• packages/ui-components
|
|
52
|
-
• packages/api-client
|
|
53
|
-
• packages/utils
|
|
54
|
-
• apps/web-app
|
|
55
|
-
• apps/api-server
|
|
56
|
-
|
|
57
|
-
🔧 Package manager: pnpm
|
|
58
|
-
⚡ Execution mode: parallel (concurrency: 4)
|
|
59
|
-
|
|
60
|
-
[packages/utils] ✅ Completed in 1,200ms
|
|
61
|
-
[packages/shared-types] ✅ Completed in 800ms
|
|
62
|
-
[packages/api-client] ✅ Completed in 2,100ms
|
|
63
|
-
[packages/ui-components] ✅ Completed in 3,400ms
|
|
64
|
-
[apps/api-server] ✅ Completed in 2,800ms
|
|
65
|
-
[apps/web-app] ✅ Completed in 4,200ms
|
|
66
|
-
|
|
67
|
-
📊 Execution Summary:
|
|
68
|
-
✅ Successful: 6
|
|
69
|
-
⏱️ Total duration: 4,200ms
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
#### Build Everything in Dependency Order
|
|
73
|
-
|
|
74
|
-
Add to your `package.json`:
|
|
75
|
-
|
|
76
|
-
```json
|
|
77
|
-
{
|
|
78
|
-
"scripts": {
|
|
79
|
-
"build": "wsu build"
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
Then run:
|
|
85
|
-
|
|
86
|
-
```bash
|
|
87
|
-
npm run build
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
**Output:**
|
|
91
|
-
|
|
92
|
-
```
|
|
93
|
-
🏗️ Building packages in dependency order...
|
|
94
|
-
|
|
95
|
-
📊 Building dependency graph...
|
|
96
|
-
✅ Build order determined: 4 batches
|
|
97
|
-
|
|
98
|
-
📋 Build Plan:
|
|
99
|
-
Batch 1: packages/shared-types, packages/utils
|
|
100
|
-
Batch 2: packages/ui-components, packages/api-client
|
|
101
|
-
Batch 3: apps/api-server
|
|
102
|
-
Batch 4: apps/web-app, apps/mobile-app
|
|
103
|
-
|
|
104
|
-
🔧 Package manager: pnpm
|
|
105
|
-
⚡ Batch concurrency: 4
|
|
106
|
-
|
|
107
|
-
🔄 Running batch 1/4 (2 packages)
|
|
108
|
-
[packages/shared-types] ✅ Completed in 1,500ms
|
|
109
|
-
[packages/utils] ✅ Completed in 1,200ms
|
|
110
|
-
|
|
111
|
-
🔄 Running batch 2/4 (2 packages)
|
|
112
|
-
[packages/ui-components] ✅ Completed in 8,900ms
|
|
113
|
-
[packages/api-client] ✅ Completed in 3,200ms
|
|
114
|
-
|
|
115
|
-
🔄 Running batch 3/4 (1 packages)
|
|
116
|
-
[apps/api-server] ✅ Completed in 4,100ms
|
|
117
|
-
|
|
118
|
-
🔄 Running batch 4/4 (2 packages)
|
|
119
|
-
[apps/web-app] ✅ Completed in 12,300ms
|
|
120
|
-
[apps/mobile-app] ✅ Completed in 8,700ms
|
|
121
|
-
|
|
122
|
-
🎉 All packages built successfully!
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
#### Start Development Environment
|
|
126
|
-
|
|
127
|
-
Add to your `package.json`:
|
|
128
|
-
|
|
129
|
-
```json
|
|
130
|
-
{
|
|
131
|
-
"scripts": {
|
|
132
|
-
"dev": "wsu dev"
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
Then run:
|
|
138
|
-
|
|
139
|
-
```bash
|
|
140
|
-
npm run dev
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
**Output:**
|
|
144
|
-
|
|
145
|
-
```
|
|
146
|
-
🚀 Starting development servers with live log streaming...
|
|
147
|
-
|
|
148
|
-
✅ Starting dev servers for 4 packages:
|
|
149
|
-
• packages/ui-components
|
|
150
|
-
• apps/web-app
|
|
151
|
-
• apps/mobile-app
|
|
152
|
-
• apps/api-server
|
|
153
|
-
|
|
154
|
-
🔧 Package manager: pnpm
|
|
155
|
-
⚡ Running 4 dev servers simultaneously
|
|
156
|
-
💡 Tip: Use Ctrl+C to stop all development servers
|
|
157
|
-
|
|
158
|
-
[packages/ui-components] Storybook running on http://localhost:6006
|
|
159
|
-
[apps/api-server] Server running on http://localhost:4000
|
|
160
|
-
[apps/web-app] Next.js running on http://localhost:3000
|
|
161
|
-
[apps/mobile-app] Expo running on http://localhost:19000
|
|
162
|
-
[apps/web-app] Hot reload enabled
|
|
163
|
-
[packages/ui-components] Hot reload enabled
|
|
164
|
-
[apps/api-server] Watching for changes...
|
|
165
|
-
[apps/mobile-app] Metro bundler started
|
|
166
|
-
...
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
## Example 2: Design System Monorepo
|
|
170
|
-
|
|
171
|
-
### Project Structure
|
|
172
|
-
|
|
173
|
-
```
|
|
174
|
-
design-system/
|
|
175
|
-
├── packages/
|
|
176
|
-
│ ├── tokens/ # Design tokens
|
|
177
|
-
│ ├── icons/ # Icon library
|
|
178
|
-
│ ├── components/ # React components
|
|
179
|
-
│ ├── themes/ # Theme definitions
|
|
180
|
-
│ └── utils/ # Design utilities
|
|
181
|
-
├── apps/
|
|
182
|
-
│ ├── storybook/ # Component documentation
|
|
183
|
-
│ └── playground/ # Component testing
|
|
184
|
-
└── tools/
|
|
185
|
-
└── build-tools/ # Custom build scripts
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
### Workflows
|
|
189
|
-
|
|
190
|
-
#### Build Design System
|
|
191
|
-
|
|
192
|
-
Add to your `package.json`:
|
|
193
|
-
|
|
194
|
-
```json
|
|
195
|
-
{
|
|
196
|
-
"scripts": {
|
|
197
|
-
"build": "wsu build",
|
|
198
|
-
"build:tokens": "wsu build --filter 'packages/tokens'",
|
|
199
|
-
"build:icons": "wsu build --filter 'packages/icons'",
|
|
200
|
-
"test:visual": "wsu run test:visual --concurrency 2",
|
|
201
|
-
"lint": "wsu run lint --concurrency 8"
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
Then run:
|
|
207
|
-
|
|
208
|
-
```bash
|
|
209
|
-
npm run build:tokens # Build tokens first
|
|
210
|
-
npm run build:icons # Then icons
|
|
211
|
-
npm run build # Then everything else
|
|
212
|
-
npm run test:visual # Visual regression tests
|
|
213
|
-
npm run lint # Lint all code
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
## Example 3: Microservices Architecture
|
|
217
|
-
|
|
218
|
-
### Project Structure
|
|
219
|
-
|
|
220
|
-
```
|
|
221
|
-
microservices/
|
|
222
|
-
├── shared/
|
|
223
|
-
│ ├── types/ # Shared TypeScript types
|
|
224
|
-
│ ├── configs/ # Shared configurations
|
|
225
|
-
│ └── middleware/ # Common middleware
|
|
226
|
-
├── services/
|
|
227
|
-
│ ├── auth-service/ # Authentication
|
|
228
|
-
│ ├── user-service/ # User management
|
|
229
|
-
│ ├── payment-service/ # Payment processing
|
|
230
|
-
│ ├── notification-service/ # Notifications
|
|
231
|
-
│ └── gateway-service/ # API Gateway
|
|
232
|
-
└── tools/
|
|
233
|
-
├── docker-compose/ # Container orchestration
|
|
234
|
-
└── deployment/ # Deployment scripts
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
### Workflows
|
|
238
|
-
|
|
239
|
-
#### Service Workflows
|
|
240
|
-
|
|
241
|
-
Add to your `package.json`:
|
|
242
|
-
|
|
243
|
-
```json
|
|
244
|
-
{
|
|
245
|
-
"scripts": {
|
|
246
|
-
"test:services": "wsu run test --filter 'services/*'",
|
|
247
|
-
"build:shared": "wsu build --filter 'shared/*'",
|
|
248
|
-
"build:services": "wsu build --filter 'services/*' --sequential",
|
|
249
|
-
"dev:services": "wsu dev --filter 'services/*' --concurrency 6"
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
```
|
|
253
|
-
|
|
254
|
-
Then run:
|
|
255
|
-
|
|
256
|
-
```bash
|
|
257
|
-
npm run test:services # Run tests for all services
|
|
258
|
-
npm run build:shared # Build shared libraries first
|
|
259
|
-
npm run build:services # Then build all services
|
|
260
|
-
npm run dev:services # Start local development
|
|
261
|
-
```
|
|
262
|
-
|
|
263
|
-
## Example 4: Multi-Platform Mobile App
|
|
264
|
-
|
|
265
|
-
### Project Structure
|
|
266
|
-
|
|
267
|
-
```
|
|
268
|
-
mobile-app/
|
|
269
|
-
├── packages/
|
|
270
|
-
│ ├── core/ # Business logic
|
|
271
|
-
│ ├── ui/ # Shared UI components
|
|
272
|
-
│ ├── api/ # API layer
|
|
273
|
-
│ └── utils/ # Utilities
|
|
274
|
-
├── apps/
|
|
275
|
-
│ ├── ios/ # iOS app
|
|
276
|
-
│ ├── android/ # Android app
|
|
277
|
-
│ └── web/ # Web version
|
|
278
|
-
└── tools/
|
|
279
|
-
├── build-scripts/ # Platform build tools
|
|
280
|
-
└── testing/ # Testing utilities
|
|
281
|
-
```
|
|
282
|
-
|
|
283
|
-
### Platform-Specific Workflows
|
|
284
|
-
|
|
285
|
-
#### Platform-Specific Workflows
|
|
286
|
-
|
|
287
|
-
Add to your `package.json`:
|
|
288
|
-
|
|
289
|
-
```json
|
|
290
|
-
{
|
|
291
|
-
"scripts": {
|
|
292
|
-
"dev:ios": "wsu dev --filter 'apps/ios' --filter 'packages/*'",
|
|
293
|
-
"dev:android": "wsu dev --filter 'apps/android' --filter 'packages/*'",
|
|
294
|
-
"test:core": "wsu run test --filter 'packages/*'",
|
|
295
|
-
"test:ios": "wsu run test:ios --filter 'apps/ios'",
|
|
296
|
-
"test:android": "wsu run test:android --filter 'apps/android'"
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
```
|
|
300
|
-
|
|
301
|
-
Then run:
|
|
302
|
-
|
|
303
|
-
```bash
|
|
304
|
-
npm run dev:ios # iOS development
|
|
305
|
-
npm run dev:android # Android development
|
|
306
|
-
npm run test:core # Test core logic
|
|
307
|
-
npm run test:ios # Test iOS specifically
|
|
308
|
-
npm run test:android # Test Android specifically
|
|
309
|
-
```
|
|
310
|
-
|
|
311
|
-
## Example 5: Enterprise Library Collection
|
|
312
|
-
|
|
313
|
-
### Project Structure
|
|
314
|
-
|
|
315
|
-
```
|
|
316
|
-
enterprise-libs/
|
|
317
|
-
├── core/
|
|
318
|
-
│ ├── auth/ # Authentication library
|
|
319
|
-
│ ├── logging/ # Logging utilities
|
|
320
|
-
│ ├── validation/ # Data validation
|
|
321
|
-
│ └── storage/ # Storage abstractions
|
|
322
|
-
├── ui/
|
|
323
|
-
│ ├── react-components/ # React component library
|
|
324
|
-
│ ├── vue-components/ # Vue component library
|
|
325
|
-
│ └── angular-components/ # Angular component library
|
|
326
|
-
└── integrations/
|
|
327
|
-
├── aws-integration/ # AWS utilities
|
|
328
|
-
├── gcp-integration/ # Google Cloud utilities
|
|
329
|
-
└── azure-integration/ # Azure utilities
|
|
330
|
-
```
|
|
331
|
-
|
|
332
|
-
### Library Publishing Workflow
|
|
333
|
-
|
|
334
|
-
#### Library Publishing Workflow
|
|
335
|
-
|
|
336
|
-
Add to your `package.json`:
|
|
337
|
-
|
|
338
|
-
```json
|
|
339
|
-
{
|
|
340
|
-
"scripts": {
|
|
341
|
-
"test": "wsu run test",
|
|
342
|
-
"build": "wsu build",
|
|
343
|
-
"publish": "wsu run publish --sequential",
|
|
344
|
-
"test:react": "wsu run test --filter '*react*'",
|
|
345
|
-
"test:vue": "wsu run test --filter '*vue*'",
|
|
346
|
-
"test:angular": "wsu run test --filter '*angular*'"
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
```
|
|
350
|
-
|
|
351
|
-
Then run:
|
|
352
|
-
|
|
353
|
-
```bash
|
|
354
|
-
npm run test # Run all tests first
|
|
355
|
-
npm run build # Build everything
|
|
356
|
-
npm run publish # Publish packages
|
|
357
|
-
npm run test:react # Test React components
|
|
358
|
-
npm run test:vue # Test Vue components
|
|
359
|
-
npm run test:angular # Test Angular components
|
|
360
|
-
```
|
|
361
|
-
|
|
362
|
-
## Example 6: Documentation Site
|
|
363
|
-
|
|
364
|
-
### Project Structure
|
|
365
|
-
|
|
366
|
-
```
|
|
367
|
-
docs-site/
|
|
368
|
-
├── content/
|
|
369
|
-
│ ├── guides/ # User guides
|
|
370
|
-
│ ├── api-docs/ # API documentation
|
|
371
|
-
│ └── examples/ # Code examples
|
|
372
|
-
├── tools/
|
|
373
|
-
│ ├── markdown-processor/ # Custom markdown tools
|
|
374
|
-
│ ├── code-generator/ # Generate code samples
|
|
375
|
-
│ └── link-checker/ # Validate links
|
|
376
|
-
└── sites/
|
|
377
|
-
├── main-site/ # Main documentation
|
|
378
|
-
├── blog/ # Blog site
|
|
379
|
-
└── api-reference/ # API reference site
|
|
380
|
-
```
|
|
381
|
-
|
|
382
|
-
### Documentation Workflows
|
|
383
|
-
|
|
384
|
-
#### Documentation Workflows
|
|
385
|
-
|
|
386
|
-
Add to your `package.json`:
|
|
387
|
-
|
|
388
|
-
```json
|
|
389
|
-
{
|
|
390
|
-
"scripts": {
|
|
391
|
-
"docs:generate": "wsu run generate --filter 'tools/*'",
|
|
392
|
-
"docs:build": "wsu build --filter 'sites/*'",
|
|
393
|
-
"docs:dev": "wsu dev --filter 'sites/*'",
|
|
394
|
-
"docs:validate": "wsu run validate --filter 'tools/link-checker'",
|
|
395
|
-
"docs:spellcheck": "wsu run spellcheck --sequential"
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
```
|
|
399
|
-
|
|
400
|
-
Then run:
|
|
401
|
-
|
|
402
|
-
```bash
|
|
403
|
-
npm run docs:generate # Generate content first
|
|
404
|
-
npm run docs:build # Then build sites
|
|
405
|
-
npm run docs:dev # Development with live reload
|
|
406
|
-
npm run docs:validate # Check links and content
|
|
407
|
-
npm run docs:spellcheck # Spell check
|
|
408
|
-
```
|
|
409
|
-
|
|
410
|
-
## Filtering Patterns Reference
|
|
411
|
-
|
|
412
|
-
### Scope-Based Filtering
|
|
413
|
-
|
|
414
|
-
Add to your `package.json`:
|
|
415
|
-
|
|
416
|
-
```json
|
|
417
|
-
{
|
|
418
|
-
"scripts": {
|
|
419
|
-
"test:company": "wsu run test --filter '@company/*'",
|
|
420
|
-
"build:internal": "wsu build --filter '@internal/*'"
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
```
|
|
424
|
-
|
|
425
|
-
### Directory-Based Filtering
|
|
426
|
-
|
|
427
|
-
```json
|
|
428
|
-
{
|
|
429
|
-
"scripts": {
|
|
430
|
-
"dev:apps": "wsu dev --filter 'apps/*'",
|
|
431
|
-
"lint:packages": "wsu run lint --filter 'packages/*'",
|
|
432
|
-
"build:tools": "wsu run build --filter 'tools/*'"
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
```
|
|
436
|
-
|
|
437
|
-
### Name Pattern Filtering
|
|
438
|
-
|
|
439
|
-
```json
|
|
440
|
-
{
|
|
441
|
-
"scripts": {
|
|
442
|
-
"test:backend": "wsu run test --filter '*backend*'",
|
|
443
|
-
"dev:frontend": "wsu dev --filter '*frontend*'",
|
|
444
|
-
"build:utils": "wsu build --filter '*utils*'",
|
|
445
|
-
"lint:test": "wsu run lint --filter '*test*'"
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
```
|
|
449
|
-
|
|
450
|
-
### Combined Filtering Examples
|
|
451
|
-
|
|
452
|
-
```json
|
|
453
|
-
{
|
|
454
|
-
"scripts": {
|
|
455
|
-
"test:backend-services": "wsu run test --filter 'services/*backend*'",
|
|
456
|
-
"build:react": "wsu run build --filter '*react*'"
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
```
|
|
460
|
-
|
|
461
|
-
## Package.json Script Patterns
|
|
462
|
-
|
|
463
|
-
### Basic Setup
|
|
464
|
-
|
|
465
|
-
```json
|
|
466
|
-
{
|
|
467
|
-
"scripts": {
|
|
468
|
-
"test": "wsu run test",
|
|
469
|
-
"build": "wsu build",
|
|
470
|
-
"dev": "wsu dev",
|
|
471
|
-
"lint": "wsu run lint"
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
```
|
|
475
|
-
|
|
476
|
-
### Advanced Patterns
|
|
477
|
-
|
|
478
|
-
```json
|
|
479
|
-
{
|
|
480
|
-
"scripts": {
|
|
481
|
-
"test": "wsu run test",
|
|
482
|
-
"test:watch": "wsu run test:watch",
|
|
483
|
-
"test:coverage": "wsu run test:coverage",
|
|
484
|
-
"build": "wsu build",
|
|
485
|
-
"build:prod": "wsu build --concurrency 2",
|
|
486
|
-
"dev": "wsu dev",
|
|
487
|
-
"dev:apps": "wsu dev --filter 'apps/*'",
|
|
488
|
-
"lint": "wsu run lint --concurrency 8",
|
|
489
|
-
"lint:fix": "wsu run lint:fix",
|
|
490
|
-
"typecheck": "wsu run typecheck",
|
|
491
|
-
"clean": "wsu run clean --sequential"
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
```
|
|
495
|
-
|
|
496
|
-
## Performance Optimization Examples
|
|
497
|
-
|
|
498
|
-
### Resource-Constrained Environments
|
|
499
|
-
|
|
500
|
-
Add to your `package.json`:
|
|
501
|
-
|
|
502
|
-
```json
|
|
503
|
-
{
|
|
504
|
-
"scripts": {
|
|
505
|
-
"test:ci": "wsu run test --concurrency 1",
|
|
506
|
-
"build:low-mem": "wsu build --concurrency 2",
|
|
507
|
-
"lint:fast": "wsu run lint --concurrency 12"
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
```
|
|
511
|
-
|
|
512
|
-
### High-Performance Development
|
|
513
|
-
|
|
514
|
-
```json
|
|
515
|
-
{
|
|
516
|
-
"scripts": {
|
|
517
|
-
"test:fast": "wsu run test --concurrency 8",
|
|
518
|
-
"build:fast": "wsu build --concurrency 6",
|
|
519
|
-
"typecheck:fast": "wsu run typecheck --concurrency 16"
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
```
|
|
523
|
-
|
|
524
|
-
## Troubleshooting Common Scenarios
|
|
525
|
-
|
|
526
|
-
### Mixed Package Managers
|
|
527
|
-
|
|
528
|
-
If your monorepo accidentally has mixed lock files:
|
|
529
|
-
|
|
530
|
-
```bash
|
|
531
|
-
# This will fail with clear error message
|
|
532
|
-
npm run test
|
|
533
|
-
|
|
534
|
-
# Clean up mixed lock files first
|
|
535
|
-
rm -f package-lock.json yarn.lock # Keep only pnpm-lock.yaml
|
|
536
|
-
npm run test # Now works
|
|
537
|
-
```
|
|
538
|
-
|
|
539
|
-
### Missing Scripts
|
|
540
|
-
|
|
541
|
-
If some packages don't have the script you're trying to run:
|
|
542
|
-
|
|
543
|
-
```bash
|
|
544
|
-
# This automatically skips packages without 'storybook' script
|
|
545
|
-
npm run storybook
|
|
546
|
-
|
|
547
|
-
# Output shows which packages were skipped
|
|
548
|
-
# ⚠️ Skipped 3 packages without 'storybook' script
|
|
549
|
-
```
|
|
550
|
-
|
|
551
|
-
### Build Dependencies
|
|
552
|
-
|
|
553
|
-
If builds fail due to missing dependencies:
|
|
554
|
-
|
|
555
|
-
```bash
|
|
556
|
-
# Use build command instead of run for dependency-aware building
|
|
557
|
-
npm run build # ✅ Builds in correct order
|
|
558
|
-
|
|
559
|
-
# Instead of this which might fail
|
|
560
|
-
npm run build:parallel # ❌ Might fail due to missing dependencies
|
|
561
|
-
```
|
|
562
|
-
|
|
563
|
-
## Next Steps
|
|
564
|
-
|
|
565
|
-
- Explore [Command Reference](./commands/overview.md) for detailed options
|
|
566
|
-
- Learn about [Troubleshooting](./troubleshooting.md) common issues
|
|
567
|
-
- See [Advanced Usage](./advanced/patterns.md) for complex scenarios
|
package/docs/src/installation.md
DELETED
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
# Installation
|
|
2
|
-
|
|
3
|
-
workspace-utils is designed to be installed as a development dependency in your project and used through package.json scripts.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
Install workspace-utils as a development dependency in your monorepo root:
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
# npm
|
|
11
|
-
npm install --save-dev workspace-utils
|
|
12
|
-
|
|
13
|
-
# pnpm
|
|
14
|
-
pnpm add -D workspace-utils
|
|
15
|
-
|
|
16
|
-
# bun
|
|
17
|
-
bun add -d workspace-utils
|
|
18
|
-
|
|
19
|
-
# yarn
|
|
20
|
-
yarn add --dev workspace-utils
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Setup Package Scripts
|
|
24
|
-
|
|
25
|
-
Add scripts to your root `package.json` using the `wsu` short command:
|
|
26
|
-
|
|
27
|
-
```json
|
|
28
|
-
{
|
|
29
|
-
"scripts": {
|
|
30
|
-
"test": "wsu run test",
|
|
31
|
-
"build": "wsu build",
|
|
32
|
-
"dev": "wsu dev",
|
|
33
|
-
"lint": "wsu run lint",
|
|
34
|
-
"typecheck": "wsu run typecheck",
|
|
35
|
-
"clean": "wsu run clean --sequential"
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
Now you can run commands like:
|
|
41
|
-
|
|
42
|
-
```bash
|
|
43
|
-
npm run test # Run tests across all packages
|
|
44
|
-
npm run build # Build packages in dependency order
|
|
45
|
-
npm run dev # Start all dev servers
|
|
46
|
-
npm run lint # Run linting across packages
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
## System Requirements
|
|
50
|
-
|
|
51
|
-
- **Node.js**: Version 18 or higher
|
|
52
|
-
- **Package Manager**: Any of the following:
|
|
53
|
-
- npm (comes with Node.js)
|
|
54
|
-
- pnpm (install with `npm install -g pnpm`)
|
|
55
|
-
- Bun (install from [bun.sh](https://bun.sh))
|
|
56
|
-
- Yarn (install with `npm install -g yarn`)
|
|
57
|
-
|
|
58
|
-
## Verification
|
|
59
|
-
|
|
60
|
-
After installation, verify that workspace-utils is working by running a script:
|
|
61
|
-
|
|
62
|
-
```bash
|
|
63
|
-
npm run build
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
You should see workspace-utils detect your workspace and execute the build process.
|
|
67
|
-
|
|
68
|
-
## Workspace Requirements
|
|
69
|
-
|
|
70
|
-
workspace-utils works with any monorepo that has one of the following configurations:
|
|
71
|
-
|
|
72
|
-
### Bun Workspaces
|
|
73
|
-
|
|
74
|
-
- Root `package.json` with `workspaces` field
|
|
75
|
-
- `bun.lockb` file (or `bunfig.toml`)
|
|
76
|
-
|
|
77
|
-
```json
|
|
78
|
-
{
|
|
79
|
-
"name": "my-monorepo",
|
|
80
|
-
"workspaces": ["packages/*", "apps/*"]
|
|
81
|
-
}
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
### pnpm Workspaces
|
|
85
|
-
|
|
86
|
-
- `pnpm-workspace.yaml` file
|
|
87
|
-
- `pnpm-lock.yaml` file
|
|
88
|
-
|
|
89
|
-
```yaml
|
|
90
|
-
# pnpm-workspace.yaml
|
|
91
|
-
packages:
|
|
92
|
-
- 'packages/*'
|
|
93
|
-
- 'apps/*'
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
### npm Workspaces
|
|
97
|
-
|
|
98
|
-
- Root `package.json` with `workspaces` field
|
|
99
|
-
- `package-lock.json` file
|
|
100
|
-
|
|
101
|
-
```json
|
|
102
|
-
{
|
|
103
|
-
"name": "my-monorepo",
|
|
104
|
-
"workspaces": ["packages/*", "apps/*"]
|
|
105
|
-
}
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
## Next Steps
|
|
109
|
-
|
|
110
|
-
Once installed, check out the [Quick Start](./quick-start.md) guide to begin using workspace-utils in your monorepo.
|
|
111
|
-
|
|
112
|
-
## Troubleshooting Installation
|
|
113
|
-
|
|
114
|
-
### Installation Issues
|
|
115
|
-
|
|
116
|
-
If you encounter issues during installation:
|
|
117
|
-
|
|
118
|
-
**Clear package manager cache:**
|
|
119
|
-
|
|
120
|
-
```bash
|
|
121
|
-
# npm
|
|
122
|
-
npm cache clean --force
|
|
123
|
-
|
|
124
|
-
# pnpm
|
|
125
|
-
pnpm store prune
|
|
126
|
-
|
|
127
|
-
# bun
|
|
128
|
-
bun pm cache rm
|
|
129
|
-
|
|
130
|
-
# yarn
|
|
131
|
-
yarn cache clean
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
**Reinstall dependencies:**
|
|
135
|
-
|
|
136
|
-
```bash
|
|
137
|
-
rm -rf node_modules package-lock.json
|
|
138
|
-
npm install
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
### Script Not Working
|
|
142
|
-
|
|
143
|
-
If scripts in package.json don't work:
|
|
144
|
-
|
|
145
|
-
1. Ensure workspace-utils is installed as a dev dependency
|
|
146
|
-
2. Check that your package.json scripts use `wsu` correctly
|
|
147
|
-
3. Run `npm ls workspace-utils` to verify installation
|
|
148
|
-
4. Try running the command directly: `npx wsu --version`
|