@@ -4,10 +4,11 @@ This document contains all available commands in the IFLA standards-dev monorepo
44
55## Quick Usage
66The most common commands you'll use:
7- - ` pnpm build:{site} ` - Build a specific site
7+ - ` nx build {site} ` - Build a specific site (e.g., ` nx build portal ` )
8+ - ` nx run {site}:start:robust ` - Start dev server with port cleanup
89- ` pnpm lint:fix ` - Fix linting issues
9- - ` pnpm start:{site} ` - Start dev server for a site
10- - ` pnpm test ` - Run tests
10+ - ` pnpm test ` - Run affected tests with Nx optimization
11+ - ` pnpm start:robust ` - Start all sites with port cleanup
1112
1213## Developer Information
1314
@@ -22,6 +23,104 @@ Commands are organized by their primary function. All commands are run from the
2223- ISBD: 3004
2324- MulDiCat: 3005
2425- UNIMARC: 3006
26+ - NewTest: 3008
27+
28+ ### Nx Integration
29+ This project uses Nx for monorepo management with:
30+ - ** Dependency tracking** : Theme changes automatically rebuild dependent sites
31+ - ** Parallel execution** : Up to 6 concurrent processes
32+ - ** Smart caching** : 70% faster builds in CI with cache optimization
33+ - ** Affected commands** : Only build/test projects impacted by changes
34+
35+ ---
36+
37+ ## 🚀 Nx-Optimized Commands
38+
39+ ### Nx Build Commands (Recommended)
40+ ``` bash
41+ # Single site builds
42+ nx build portal # Build portal site
43+ nx build isbdm # Build ISBDM site
44+ nx build lrm # Build LRM site
45+ nx build frbr # Build FRBR site
46+ nx build isbd # Build ISBD site
47+ nx build muldicat # Build MulDiCat site
48+ nx build unimarc # Build UNIMARC site
49+
50+ # Workspace builds
51+ nx run-many --target=build --all # Build all sites in parallel
52+ nx affected --target=build # Build only affected sites
53+ nx run standards-dev:build-all # Build all via workspace target
54+ nx run standards-dev:build-affected # Build affected via workspace target
55+ ```
56+
57+ ### Nx Start Commands (Development)
58+ ``` bash
59+ # Standard start (no port cleanup)
60+ nx start portal # Start portal dev server
61+ nx start isbdm # Start ISBDM dev server
62+
63+ # Robust start (with automatic port cleanup)
64+ nx run portal:start:robust # Start portal with port cleanup
65+ nx run isbdm:start:robust # Start ISBDM with port cleanup
66+ nx run standards-dev:start-all:robust # Start all sites with port cleanup
67+
68+ # Package.json shortcuts
69+ pnpm start:robust # Start all with port cleanup
70+ pnpm start:robust:nx # Via Nx workspace target
71+ ```
72+
73+ ### Nx Serve Commands (Production)
74+ ``` bash
75+ # Standard serve
76+ nx serve portal # Serve built portal
77+ nx serve isbdm # Serve built ISBDM
78+
79+ # Robust serve (with automatic port cleanup)
80+ nx run portal:serve:robust # Serve portal with port cleanup
81+ nx run isbdm:serve:robust # Serve ISBDM with port cleanup
82+ nx run standards-dev:serve-all:robust # Serve all sites with port cleanup
83+
84+ # Package.json shortcuts
85+ pnpm serve:robust # Serve all with port cleanup
86+ pnpm serve:robust:nx # Via Nx workspace target
87+ ```
88+
89+ ### Nx Test Commands
90+ ``` bash
91+ # Run tests
92+ nx test # Run all tests
93+ nx test @ifla/theme # Run theme tests only
94+ nx test portal # Run portal tests only
95+ nx affected --target=test # Run tests for affected projects
96+ nx run-many --target=test --all # Run all project tests
97+
98+ # Test types
99+ nx affected --target=test:unit # Run unit tests only (fast feedback)
100+ nx affected --target=test:integration # Run integration tests only
101+ nx run-many --target=test:unit --all # All unit tests
102+ nx run-many --target=test:integration --all # All integration tests
103+ ```
104+
105+ ### Port Management Commands
106+ ``` bash
107+ # Kill ports manually
108+ pnpm ports:kill # Kill all project ports silently
109+ pnpm ports:kill:verbose # Kill all ports with detailed output
110+ pnpm ports:kill:site portal # Kill specific site port
111+ node scripts/utils/port-manager.js all --verbose # Direct port manager usage
112+ node scripts/utils/port-manager.js site isbdm # Kill specific site port
113+ node scripts/utils/port-manager.js port 3001 # Kill specific port number
114+ ```
115+
116+ ### Nx Utility Commands
117+ ``` bash
118+ nx graph # View project dependency graph
119+ nx show projects # List all projects
120+ nx show projects --with-target=test # Show projects with test targets
121+ nx affected --target=build --dry-run # See what would be affected
122+ nx reset # Clear Nx cache
123+ ```
25124
26125---
27126
@@ -225,33 +324,59 @@ pnpm prepare # Setup Husky git hooks
225324
226325## 🎯 Common Workflows
227326
228- ### Before Committing
327+ ### Before Committing (Nx-Optimized)
229328``` bash
230- pnpm lint:fix # Fix linting issues
231- pnpm typecheck # Check TypeScript
232- pnpm test # Run tests
329+ pnpm lint:fix # Fix linting issues
330+ pnpm typecheck # Check TypeScript (affected only)
331+ pnpm test # Run affected tests
332+ nx affected --target=build --dry-run # See what would be affected
233333```
234334
235- ### Building After Theme Changes
335+ ### Building After Theme Changes (Nx-Optimized)
236336``` bash
237- pnpm build:theme # Build the theme package
238- pnpm build:lrm # Test with one site first
337+ nx build @ifla/theme # Build the theme package
338+ nx affected --target=build # Build all affected sites automatically
339+ # OR test with one site first
340+ nx build lrm # Test with one site first
239341```
240342
241- ### Full Site Validation
343+ ### Full Site Validation (Nx-Optimized)
242344``` bash
243- pnpm build: all:safe # Clean build everything
244- pnpm validate:navigation # Check navigation
245- pnpm validate:built-site # Check built sites
246- pnpm validate:env-urls # Check environment URLs
345+ nx run standards-dev:build- all # Build all sites via workspace target
346+ pnpm validate:navigation # Check navigation
347+ pnpm validate:built-site # Check built sites
348+ pnpm validate:env-urls # Check environment URLs
247349```
248350
249- ### Testing a Single Site
351+ ### Testing a Single Site (Nx-Optimized)
250352``` bash
251- pnpm build: lrm # Build specific site
252- pnpm serve:lrm # Serve to test
353+ nx build lrm # Build specific site (with theme deps)
354+ nx run lrm: serve:robust # Serve with port cleanup
253355# OR for development
254- pnpm start:lrm # Start dev server
356+ nx run lrm:start:robust # Start dev server with port cleanup
357+ ```
358+
359+ ### Working with Multiple Sites
360+ ``` bash
361+ # Start all sites for development
362+ pnpm start:robust # All sites with port cleanup
363+ # OR
364+ nx run standards-dev:start-all:robust # Via Nx workspace target
365+
366+ # Build only affected sites (faster CI)
367+ nx affected --target=build --parallel=3
368+
369+ # Run tests for affected projects only
370+ nx affected --target=test:unit --parallel=3
371+ ```
372+
373+ ### Port Conflict Resolution
374+ ``` bash
375+ # If getting port conflicts
376+ pnpm ports:kill:verbose # Kill all ports with details
377+ nx run portal:start:robust # Start with automatic cleanup
378+ # OR use direct port manager
379+ node scripts/utils/port-manager.js site portal --verbose
255380```
256381
257382### Cleaning Up Problems
0 commit comments