@bluealba/platform-cli 1.0.1 → 1.1.0
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 +278 -15
- package/docs/404.mdx +5 -0
- package/docs/architecture/api-explorer.mdx +478 -0
- package/docs/architecture/architecture-diagrams.mdx +12 -0
- package/docs/architecture/authentication-system.mdx +903 -0
- package/docs/architecture/authorization-system.mdx +886 -0
- package/docs/architecture/bootstrap.mdx +1442 -0
- package/docs/architecture/gateway-architecture.mdx +845 -0
- package/docs/architecture/multi-tenancy.mdx +1150 -0
- package/docs/architecture/overview.mdx +776 -0
- package/docs/architecture/scheduler.mdx +818 -0
- package/docs/architecture/shell.mdx +885 -0
- package/docs/architecture/ui-extension-points.mdx +781 -0
- package/docs/architecture/user-states.mdx +794 -0
- package/docs/development/overview.mdx +21 -0
- package/docs/development/workflow.mdx +914 -0
- package/docs/getting-started/core-concepts.mdx +892 -0
- package/docs/getting-started/installation.mdx +780 -0
- package/docs/getting-started/overview.mdx +83 -0
- package/docs/getting-started/quick-start.mdx +940 -0
- package/docs/guides/adding-documentation-sites.mdx +1367 -0
- package/docs/guides/creating-services.mdx +1736 -0
- package/docs/guides/creating-ui-modules.mdx +1860 -0
- package/docs/guides/identity-providers.mdx +1007 -0
- package/docs/guides/mermaid-diagrams.mdx +212 -0
- package/docs/guides/using-feature-flags.mdx +1059 -0
- package/docs/guides/working-with-rooms.mdx +566 -0
- package/docs/index.mdx +57 -0
- package/docs/platform-cli/commands.mdx +604 -0
- package/docs/platform-cli/overview.mdx +195 -0
- package/package.json +5 -2
- package/skills/ba-platform/platform-cli.skill.md +26 -0
- package/skills/ba-platform/platform.skill.md +35 -0
- package/templates/application-monorepo-template/gitignore +95 -0
- package/templates/bootstrap-service-template/Dockerfile.development +1 -1
- package/templates/bootstrap-service-template/gitignore +57 -0
- package/templates/bootstrap-service-template/package.json +1 -1
- package/templates/bootstrap-service-template/src/main.ts +6 -16
- package/templates/customization-ui-module-template/Dockerfile.development +1 -1
- package/templates/customization-ui-module-template/gitignore +73 -0
- package/templates/nestjs-service-module-template/Dockerfile.development +1 -1
- package/templates/nestjs-service-module-template/gitignore +56 -0
- package/templates/platform-init-template/{{platformName}}-core/gitignore +97 -0
- package/templates/platform-init-template/{{platformName}}-core/local/.env.example +1 -1
- package/templates/platform-init-template/{{platformName}}-core/local/platform-docker-compose.yml +1 -1
- package/templates/platform-init-template/{{platformName}}-core/local/{{platformName}}-core-docker-compose.yml +0 -1
- package/templates/react-ui-module-template/Dockerfile +1 -1
- package/templates/react-ui-module-template/Dockerfile.development +1 -3
- package/templates/react-ui-module-template/caddy/Caddyfile +1 -1
- package/templates/react-ui-module-template/gitignore +72 -0
- package/templates/react-ui-module-template/Dockerfile_nginx +0 -11
- package/templates/react-ui-module-template/nginx/default.conf +0 -23
|
@@ -0,0 +1,914 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Development Workflow
|
|
3
|
+
description: Day-to-day development workflow for the Blue Alba Platform including branching, changesets, testing, and pull requests
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
import { Steps, Aside, Card, CardGrid, Tabs, TabItem } from '@astrojs/starlight/components';
|
|
7
|
+
|
|
8
|
+
This guide covers the day-to-day workflow for developing with the Blue Alba Platform, from creating features to submitting pull requests.
|
|
9
|
+
|
|
10
|
+
## Development Process Overview
|
|
11
|
+
|
|
12
|
+
The Blue Alba Platform follows a **feature branching workflow** with automated version management using **changesets**.
|
|
13
|
+
|
|
14
|
+
```mermaid
|
|
15
|
+
graph LR
|
|
16
|
+
A[Create Branch] --> B[Make Changes]
|
|
17
|
+
B --> C[Run Tests]
|
|
18
|
+
C --> D[Create Changeset]
|
|
19
|
+
D --> E[Commit & Push]
|
|
20
|
+
E --> F[Create PR]
|
|
21
|
+
F --> G[Review & Merge]
|
|
22
|
+
G --> H[Automatic Release]
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Git Branching Strategy
|
|
28
|
+
|
|
29
|
+
### Branch Hierarchy
|
|
30
|
+
|
|
31
|
+
The repository uses the following branches:
|
|
32
|
+
|
|
33
|
+
<CardGrid>
|
|
34
|
+
<Card title="develop" icon="rocket">
|
|
35
|
+
**Primary development branch**
|
|
36
|
+
|
|
37
|
+
- All feature branches branch from `develop`
|
|
38
|
+
- All PRs merge into `develop`
|
|
39
|
+
- Automatically deployed to development environment
|
|
40
|
+
- Always in a deployable state
|
|
41
|
+
</Card>
|
|
42
|
+
|
|
43
|
+
<Card title="main" icon="star">
|
|
44
|
+
**Production branch**
|
|
45
|
+
|
|
46
|
+
- Reflects production-ready code
|
|
47
|
+
- Only release commits merge here
|
|
48
|
+
- Automatically deployed to production
|
|
49
|
+
- Protected - no direct commits
|
|
50
|
+
</Card>
|
|
51
|
+
|
|
52
|
+
<Card title="feature/*" icon="puzzle">
|
|
53
|
+
**Feature branches**
|
|
54
|
+
|
|
55
|
+
- Created from `develop`
|
|
56
|
+
- One feature or bug fix per branch
|
|
57
|
+
- Naming: `feature/description` or `fix/description`
|
|
58
|
+
- Deleted after merge
|
|
59
|
+
</Card>
|
|
60
|
+
|
|
61
|
+
<Card title="rc/*" icon="seti:config">
|
|
62
|
+
**Release candidate branches**
|
|
63
|
+
|
|
64
|
+
- Created automatically by CI
|
|
65
|
+
- Naming: `rc/x.y.z`
|
|
66
|
+
- For final testing before production
|
|
67
|
+
- Merged to `main` after approval
|
|
68
|
+
</Card>
|
|
69
|
+
</CardGrid>
|
|
70
|
+
|
|
71
|
+
### Creating a Feature Branch
|
|
72
|
+
|
|
73
|
+
<Steps>
|
|
74
|
+
|
|
75
|
+
1. **Ensure you're on develop and up to date**
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
git checkout develop
|
|
79
|
+
git pull origin develop
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
2. **Create a new feature branch**
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# For new features
|
|
86
|
+
git checkout -b feature/add-user-preferences
|
|
87
|
+
|
|
88
|
+
# For bug fixes
|
|
89
|
+
git checkout -b fix/login-redirect-issue
|
|
90
|
+
|
|
91
|
+
# For documentation
|
|
92
|
+
git checkout -b docs/update-api-guide
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
<Aside type="tip">
|
|
96
|
+
**Branch Naming Convention**:
|
|
97
|
+
- Use lowercase with hyphens
|
|
98
|
+
- Prefix with `feature/`, `fix/`, `docs/`, or `chore/`
|
|
99
|
+
- Be descriptive but concise
|
|
100
|
+
</Aside>
|
|
101
|
+
|
|
102
|
+
3. **Verify your branch**
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
git branch
|
|
106
|
+
# Should show your new branch with an asterisk
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
</Steps>
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Making Changes
|
|
114
|
+
|
|
115
|
+
### Working on Your Code
|
|
116
|
+
|
|
117
|
+
Once you're on your feature branch, make your changes following these practices:
|
|
118
|
+
|
|
119
|
+
#### 1. Make Focused Changes
|
|
120
|
+
|
|
121
|
+
Keep your changes focused on a single feature or fix:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
# Good - focused changes
|
|
125
|
+
feature/add-user-preferences
|
|
126
|
+
- Add preferences API endpoint
|
|
127
|
+
- Add preferences UI component
|
|
128
|
+
- Add preferences tests
|
|
129
|
+
|
|
130
|
+
# Bad - mixing unrelated changes
|
|
131
|
+
feature/various-updates
|
|
132
|
+
- Add preferences
|
|
133
|
+
- Fix login bug
|
|
134
|
+
- Update documentation
|
|
135
|
+
- Refactor database queries
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
#### 2. Commit Frequently
|
|
139
|
+
|
|
140
|
+
Make small, atomic commits with clear messages:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
# Stage specific files
|
|
144
|
+
git add src/services/preferences.service.ts
|
|
145
|
+
git add src/controllers/preferences.controller.ts
|
|
146
|
+
|
|
147
|
+
# Commit with descriptive message
|
|
148
|
+
git commit -m "Add preferences service with CRUD operations"
|
|
149
|
+
|
|
150
|
+
# Continue working
|
|
151
|
+
git add src/dto/preferences.dto.ts
|
|
152
|
+
git commit -m "Add preferences DTOs for validation"
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
<Aside>
|
|
156
|
+
**Commit Message Guidelines**:
|
|
157
|
+
- Use present tense ("Add feature" not "Added feature")
|
|
158
|
+
- Be specific and descriptive
|
|
159
|
+
- Keep first line under 72 characters
|
|
160
|
+
- Add body for complex changes
|
|
161
|
+
</Aside>
|
|
162
|
+
|
|
163
|
+
#### 3. Keep Your Branch Updated
|
|
164
|
+
|
|
165
|
+
Regularly sync with `develop` to avoid merge conflicts:
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
# Fetch latest changes
|
|
169
|
+
git fetch origin
|
|
170
|
+
|
|
171
|
+
# Merge develop into your branch
|
|
172
|
+
git merge origin/develop
|
|
173
|
+
|
|
174
|
+
# Or rebase (if you prefer linear history)
|
|
175
|
+
git rebase origin/develop
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## Testing Your Changes
|
|
181
|
+
|
|
182
|
+
Before creating a PR, thoroughly test your changes.
|
|
183
|
+
|
|
184
|
+
### Running Tests
|
|
185
|
+
|
|
186
|
+
<Tabs>
|
|
187
|
+
<TabItem label="All Tests">
|
|
188
|
+
Run all tests across the entire monorepo:
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
npx turbo test
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
This runs tests in all packages and apps in parallel.
|
|
195
|
+
</TabItem>
|
|
196
|
+
|
|
197
|
+
<TabItem label="Specific Package">
|
|
198
|
+
Test a specific package or app:
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
# Test a specific package
|
|
202
|
+
npx turbo test --filter=@bluealba/pae-core-lib
|
|
203
|
+
|
|
204
|
+
# Test a specific service
|
|
205
|
+
npx turbo test --filter=@bluealba/pae-nestjs-gateway-service
|
|
206
|
+
|
|
207
|
+
# Test a specific UI
|
|
208
|
+
npx turbo test --filter=@bluealba/pae-shell-ui
|
|
209
|
+
```
|
|
210
|
+
</TabItem>
|
|
211
|
+
|
|
212
|
+
<TabItem label="Watch Mode">
|
|
213
|
+
Run tests in watch mode for active development:
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
# In the package directory
|
|
217
|
+
cd packages/pae-core-lib
|
|
218
|
+
npm run test:watch
|
|
219
|
+
|
|
220
|
+
# Or for a service
|
|
221
|
+
cd apps/pae-habits-service
|
|
222
|
+
npm run test:watch
|
|
223
|
+
```
|
|
224
|
+
</TabItem>
|
|
225
|
+
|
|
226
|
+
<TabItem label="Coverage">
|
|
227
|
+
Generate test coverage reports:
|
|
228
|
+
|
|
229
|
+
```bash
|
|
230
|
+
# All packages
|
|
231
|
+
npx turbo test:coverage
|
|
232
|
+
|
|
233
|
+
# Specific package
|
|
234
|
+
cd packages/pae-core-lib
|
|
235
|
+
npm run test:coverage
|
|
236
|
+
|
|
237
|
+
# View coverage report
|
|
238
|
+
open coverage/lcov-report/index.html
|
|
239
|
+
```
|
|
240
|
+
</TabItem>
|
|
241
|
+
</Tabs>
|
|
242
|
+
|
|
243
|
+
### Running Services Locally
|
|
244
|
+
|
|
245
|
+
Test your changes with services running locally:
|
|
246
|
+
|
|
247
|
+
<Steps>
|
|
248
|
+
|
|
249
|
+
1. **Stop the Docker container** (if running)
|
|
250
|
+
|
|
251
|
+
```bash
|
|
252
|
+
cd sandbox-product/pae-sandbox-local
|
|
253
|
+
docker-compose -f docker-compose-pae.yml stop pae-habits-service
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
<Aside type="tip">
|
|
257
|
+
As an alternative to stopping the Docker container, you can keep the full Docker stack running and instead add a `serviceLocal` block to the module's definition in `modules.json`. When the bootstrap service is started with `LOCAL_MODE=true`, it will point the gateway at your locally running process (for example `localhost:4002`) without affecting the Docker-based configuration used by the rest of the team. See [Local Development Overrides](/_/docs/architecture/bootstrap/#local-development-overrides-servicelocal) for details.
|
|
258
|
+
</Aside>
|
|
259
|
+
|
|
260
|
+
2. **Build your changes**
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
cd bluealba-platform/apps/pae-habits-service
|
|
264
|
+
npm run build
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
3. **Run in development mode**
|
|
268
|
+
|
|
269
|
+
```bash
|
|
270
|
+
npm run dev
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
The service starts with hot reload enabled.
|
|
274
|
+
|
|
275
|
+
4. **Test via the gateway**
|
|
276
|
+
|
|
277
|
+
```bash
|
|
278
|
+
# Test API endpoint
|
|
279
|
+
curl -k https://localhost:9443/habits \
|
|
280
|
+
-H "Authorization: Bearer YOUR_JWT_TOKEN"
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
5. **View logs**
|
|
284
|
+
|
|
285
|
+
Watch the console output for errors and debug information.
|
|
286
|
+
|
|
287
|
+
</Steps>
|
|
288
|
+
|
|
289
|
+
### Running UIs Locally
|
|
290
|
+
|
|
291
|
+
Test UI changes with hot reload:
|
|
292
|
+
|
|
293
|
+
<Steps>
|
|
294
|
+
|
|
295
|
+
1. **Start the UI in dev mode**
|
|
296
|
+
|
|
297
|
+
```bash
|
|
298
|
+
cd bluealba-platform/apps/pae-shell-ui
|
|
299
|
+
npm run dev
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
The UI typically runs on `http://localhost:8080`.
|
|
303
|
+
|
|
304
|
+
2. **Access via browser**
|
|
305
|
+
|
|
306
|
+
Open `http://localhost:8080` and log in.
|
|
307
|
+
|
|
308
|
+
3. **Make changes**
|
|
309
|
+
|
|
310
|
+
Edit source files - the UI automatically reloads.
|
|
311
|
+
|
|
312
|
+
4. **Test with backend**
|
|
313
|
+
|
|
314
|
+
The dev server proxies API requests to the gateway.
|
|
315
|
+
|
|
316
|
+
</Steps>
|
|
317
|
+
|
|
318
|
+
<Aside type="note">
|
|
319
|
+
**Hot Reload**: Both services and UIs support hot reload. Change source files and see results immediately without manual restarts.
|
|
320
|
+
</Aside>
|
|
321
|
+
|
|
322
|
+
---
|
|
323
|
+
|
|
324
|
+
## Building the Project
|
|
325
|
+
|
|
326
|
+
Always build before creating a PR to catch compilation errors:
|
|
327
|
+
|
|
328
|
+
### Full Build
|
|
329
|
+
|
|
330
|
+
Build everything in the monorepo:
|
|
331
|
+
|
|
332
|
+
```bash
|
|
333
|
+
npx turbo build
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
Turborepo builds packages in dependency order and caches results.
|
|
337
|
+
|
|
338
|
+
### Incremental Build
|
|
339
|
+
|
|
340
|
+
Build only changed packages:
|
|
341
|
+
|
|
342
|
+
```bash
|
|
343
|
+
npx turbo build --filter=...[origin/develop]
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
This builds packages that changed since your branch diverged from `develop`.
|
|
347
|
+
|
|
348
|
+
### Force Build
|
|
349
|
+
|
|
350
|
+
Bypass cache and rebuild everything:
|
|
351
|
+
|
|
352
|
+
```bash
|
|
353
|
+
npx turbo build --force
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
### Build Verification
|
|
357
|
+
|
|
358
|
+
Verify the build succeeded:
|
|
359
|
+
|
|
360
|
+
```bash
|
|
361
|
+
# Check for dist directories
|
|
362
|
+
ls apps/pae-habits-service/dist
|
|
363
|
+
ls packages/pae-core-lib/dist
|
|
364
|
+
|
|
365
|
+
# Check for errors in output
|
|
366
|
+
npx turbo build 2>&1 | grep -i error
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
---
|
|
370
|
+
|
|
371
|
+
## Using Changesets
|
|
372
|
+
|
|
373
|
+
**Changesets** are the most important part of the workflow. They track what changed and how to version packages.
|
|
374
|
+
|
|
375
|
+
### What is a Changeset?
|
|
376
|
+
|
|
377
|
+
A changeset is:
|
|
378
|
+
- A **description** of what changed
|
|
379
|
+
- A **list** of affected packages
|
|
380
|
+
- A **version bump type** (major, minor, or patch) for each package
|
|
381
|
+
|
|
382
|
+
### When to Create a Changeset
|
|
383
|
+
|
|
384
|
+
Create a changeset when you make changes that affect:
|
|
385
|
+
- Package functionality (new features, bug fixes, breaking changes)
|
|
386
|
+
- Public APIs
|
|
387
|
+
- Dependencies
|
|
388
|
+
- Build outputs
|
|
389
|
+
|
|
390
|
+
<Aside type="caution" title="Required">
|
|
391
|
+
**You MUST create a changeset before merging any PR** that changes packages or apps. PRs without changesets will fail CI checks.
|
|
392
|
+
</Aside>
|
|
393
|
+
|
|
394
|
+
### Creating a Changeset
|
|
395
|
+
|
|
396
|
+
<Steps>
|
|
397
|
+
|
|
398
|
+
1. **Run the changeset command**
|
|
399
|
+
|
|
400
|
+
```bash
|
|
401
|
+
npm run changeset
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
2. **Select affected packages**
|
|
405
|
+
|
|
406
|
+
The CLI will either:
|
|
407
|
+
- Auto-detect changed packages by comparing with git
|
|
408
|
+
- Prompt you to manually select packages
|
|
409
|
+
|
|
410
|
+
```
|
|
411
|
+
🦋 Which packages would you like to include?
|
|
412
|
+
◯ @bluealba/pae-core-lib
|
|
413
|
+
◉ @bluealba/pae-habits-service
|
|
414
|
+
◯ @bluealba/pae-shell-ui
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
Use arrow keys and space to select.
|
|
418
|
+
|
|
419
|
+
3. **Choose version bump type**
|
|
420
|
+
|
|
421
|
+
For each selected package, choose:
|
|
422
|
+
|
|
423
|
+
- **Patch** (0.0.X): Bug fixes, minor changes, no breaking changes
|
|
424
|
+
- **Minor** (0.X.0): New features, backwards compatible
|
|
425
|
+
- **Major** (X.0.0): Breaking changes, incompatible API changes
|
|
426
|
+
|
|
427
|
+
```
|
|
428
|
+
🦋 What kind of change is this for @bluealba/pae-habits-service?
|
|
429
|
+
❯ patch
|
|
430
|
+
minor
|
|
431
|
+
major
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
<Aside type="tip">
|
|
435
|
+
**Semantic Versioning**:
|
|
436
|
+
- **Patch**: Bug fixes, typos, performance improvements
|
|
437
|
+
- **Minor**: New features, new API methods, optional parameters
|
|
438
|
+
- **Major**: Removing APIs, changing signatures, breaking changes
|
|
439
|
+
</Aside>
|
|
440
|
+
|
|
441
|
+
4. **Write a summary**
|
|
442
|
+
|
|
443
|
+
Describe your changes:
|
|
444
|
+
|
|
445
|
+
```
|
|
446
|
+
🦋 Please enter a summary for this change:
|
|
447
|
+
Add user preferences API endpoints with CRUD operations
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
This appears in the changelog.
|
|
451
|
+
|
|
452
|
+
5. **Review and confirm**
|
|
453
|
+
|
|
454
|
+
The CLI shows a summary and creates files in `.changeset/`:
|
|
455
|
+
|
|
456
|
+
```
|
|
457
|
+
🦋 Changeset created:
|
|
458
|
+
✔ .changeset/brave-bears-jump.md
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
6. **Commit the changeset**
|
|
462
|
+
|
|
463
|
+
```bash
|
|
464
|
+
git add .changeset/brave-bears-jump.md
|
|
465
|
+
git commit -m "Add changeset for user preferences feature"
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
</Steps>
|
|
469
|
+
|
|
470
|
+
### Changeset File Format
|
|
471
|
+
|
|
472
|
+
Changesets are markdown files:
|
|
473
|
+
|
|
474
|
+
```markdown
|
|
475
|
+
---
|
|
476
|
+
"@bluealba/pae-habits-service": minor
|
|
477
|
+
"@bluealba/pae-core-lib": patch
|
|
478
|
+
---
|
|
479
|
+
|
|
480
|
+
Add user preferences API endpoints with CRUD operations
|
|
481
|
+
|
|
482
|
+
- Add GET /preferences endpoint
|
|
483
|
+
- Add POST /preferences endpoint
|
|
484
|
+
- Add PUT /preferences/:id endpoint
|
|
485
|
+
- Add DELETE /preferences/:id endpoint
|
|
486
|
+
- Update core-lib with preferences types
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
### Multiple Changesets
|
|
490
|
+
|
|
491
|
+
You can create multiple changesets in one branch:
|
|
492
|
+
|
|
493
|
+
```bash
|
|
494
|
+
# Make some changes
|
|
495
|
+
npm run changeset
|
|
496
|
+
git add .changeset/
|
|
497
|
+
git commit -m "Add changeset for feature A"
|
|
498
|
+
|
|
499
|
+
# Make more changes
|
|
500
|
+
npm run changeset
|
|
501
|
+
git add .changeset/
|
|
502
|
+
git commit -m "Add changeset for feature B"
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
The release process will merge them.
|
|
506
|
+
|
|
507
|
+
---
|
|
508
|
+
|
|
509
|
+
## Linting and Formatting
|
|
510
|
+
|
|
511
|
+
Ensure code quality before committing:
|
|
512
|
+
|
|
513
|
+
### Running Linters
|
|
514
|
+
|
|
515
|
+
```bash
|
|
516
|
+
# Lint everything
|
|
517
|
+
npx turbo lint
|
|
518
|
+
|
|
519
|
+
# Lint specific package
|
|
520
|
+
npx turbo lint --filter=@bluealba/pae-habits-service
|
|
521
|
+
|
|
522
|
+
# Auto-fix linting issues
|
|
523
|
+
npx turbo lint:fix
|
|
524
|
+
```
|
|
525
|
+
|
|
526
|
+
### Format Code
|
|
527
|
+
|
|
528
|
+
Most IDEs auto-format on save, but you can manually format:
|
|
529
|
+
|
|
530
|
+
```bash
|
|
531
|
+
# Using Prettier (if configured)
|
|
532
|
+
npx prettier --write "src/**/*.ts"
|
|
533
|
+
|
|
534
|
+
# Using ESLint
|
|
535
|
+
npx eslint --fix "src/**/*.ts"
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
<Aside type="tip">
|
|
539
|
+
**IDE Setup**: Configure VS Code to auto-format on save:
|
|
540
|
+
|
|
541
|
+
```json
|
|
542
|
+
{
|
|
543
|
+
"editor.formatOnSave": true,
|
|
544
|
+
"editor.codeActionsOnSave": {
|
|
545
|
+
"source.fixAll.eslint": true
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
```
|
|
549
|
+
</Aside>
|
|
550
|
+
|
|
551
|
+
---
|
|
552
|
+
|
|
553
|
+
## Creating a Pull Request
|
|
554
|
+
|
|
555
|
+
Once your feature is complete, tested, and you've created a changeset, create a PR.
|
|
556
|
+
|
|
557
|
+
<Steps>
|
|
558
|
+
|
|
559
|
+
1. **Push your branch**
|
|
560
|
+
|
|
561
|
+
```bash
|
|
562
|
+
git push origin feature/add-user-preferences
|
|
563
|
+
```
|
|
564
|
+
|
|
565
|
+
If this is the first push:
|
|
566
|
+
|
|
567
|
+
```bash
|
|
568
|
+
git push -u origin feature/add-user-preferences
|
|
569
|
+
```
|
|
570
|
+
|
|
571
|
+
2. **Open GitHub**
|
|
572
|
+
|
|
573
|
+
Navigate to the repository on GitHub. You'll see a prompt to create a PR.
|
|
574
|
+
|
|
575
|
+
3. **Fill out the PR template**
|
|
576
|
+
|
|
577
|
+
Provide a clear description:
|
|
578
|
+
|
|
579
|
+
```markdown
|
|
580
|
+
## Description
|
|
581
|
+
Add user preferences API endpoints to allow users to save and retrieve preferences.
|
|
582
|
+
|
|
583
|
+
## Changes
|
|
584
|
+
- Add PreferencesService with CRUD operations
|
|
585
|
+
- Add PreferencesController with REST endpoints
|
|
586
|
+
- Add PreferencesDto for validation
|
|
587
|
+
- Add integration tests
|
|
588
|
+
- Update core-lib with Preferences entity
|
|
589
|
+
|
|
590
|
+
## Testing
|
|
591
|
+
- Added unit tests for PreferencesService
|
|
592
|
+
- Added integration tests for API endpoints
|
|
593
|
+
- Tested manually via Postman
|
|
594
|
+
- All existing tests pass
|
|
595
|
+
|
|
596
|
+
## Checklist
|
|
597
|
+
- [x] Tests added/updated
|
|
598
|
+
- [x] Documentation updated
|
|
599
|
+
- [x] Changeset created
|
|
600
|
+
- [x] Code builds successfully
|
|
601
|
+
- [x] Linter passes
|
|
602
|
+
```
|
|
603
|
+
|
|
604
|
+
4. **Set base branch to `develop`**
|
|
605
|
+
|
|
606
|
+
Ensure your PR targets `develop`, not `main`.
|
|
607
|
+
|
|
608
|
+
5. **Request reviews**
|
|
609
|
+
|
|
610
|
+
Tag team members for review.
|
|
611
|
+
|
|
612
|
+
6. **Address feedback**
|
|
613
|
+
|
|
614
|
+
Make changes based on review comments:
|
|
615
|
+
|
|
616
|
+
```bash
|
|
617
|
+
# Make changes
|
|
618
|
+
git add .
|
|
619
|
+
git commit -m "Address PR feedback: add error handling"
|
|
620
|
+
git push
|
|
621
|
+
```
|
|
622
|
+
|
|
623
|
+
The PR updates automatically.
|
|
624
|
+
|
|
625
|
+
7. **Ensure CI passes**
|
|
626
|
+
|
|
627
|
+
Wait for CI checks to complete:
|
|
628
|
+
- Build check
|
|
629
|
+
- Test check
|
|
630
|
+
- Lint check
|
|
631
|
+
- Changeset check
|
|
632
|
+
|
|
633
|
+
Fix any failures before merging.
|
|
634
|
+
|
|
635
|
+
</Steps>
|
|
636
|
+
|
|
637
|
+
<Aside type="note">
|
|
638
|
+
**CI Checks**: All PRs must pass automated checks before merging. This includes builds, tests, lints, and changeset validation.
|
|
639
|
+
</Aside>
|
|
640
|
+
|
|
641
|
+
---
|
|
642
|
+
|
|
643
|
+
## Working with Turborepo
|
|
644
|
+
|
|
645
|
+
Turborepo is the build system that powers the monorepo.
|
|
646
|
+
|
|
647
|
+
### Key Commands
|
|
648
|
+
|
|
649
|
+
<Tabs>
|
|
650
|
+
<TabItem label="Build">
|
|
651
|
+
```bash
|
|
652
|
+
# Build everything
|
|
653
|
+
npx turbo build
|
|
654
|
+
|
|
655
|
+
# Build specific package
|
|
656
|
+
npx turbo build --filter=@bluealba/pae-core-lib
|
|
657
|
+
|
|
658
|
+
# Build with dependencies
|
|
659
|
+
npx turbo build --filter=@bluealba/pae-habits-service...
|
|
660
|
+
|
|
661
|
+
# Force rebuild (bypass cache)
|
|
662
|
+
npx turbo build --force
|
|
663
|
+
```
|
|
664
|
+
</TabItem>
|
|
665
|
+
|
|
666
|
+
<TabItem label="Test">
|
|
667
|
+
```bash
|
|
668
|
+
# Test everything
|
|
669
|
+
npx turbo test
|
|
670
|
+
|
|
671
|
+
# Test specific package
|
|
672
|
+
npx turbo test --filter=@bluealba/pae-core-lib
|
|
673
|
+
|
|
674
|
+
# Test changed packages
|
|
675
|
+
npx turbo test --filter=...[origin/develop]
|
|
676
|
+
```
|
|
677
|
+
</TabItem>
|
|
678
|
+
|
|
679
|
+
<TabItem label="Dev">
|
|
680
|
+
```bash
|
|
681
|
+
# Run all apps in dev mode
|
|
682
|
+
npx turbo dev
|
|
683
|
+
|
|
684
|
+
# Run specific app
|
|
685
|
+
npx turbo dev --filter=@bluealba/pae-shell-ui
|
|
686
|
+
|
|
687
|
+
# Run multiple apps
|
|
688
|
+
npx turbo dev --filter=@bluealba/pae-shell-ui --filter=@bluealba/pae-admin-ui
|
|
689
|
+
```
|
|
690
|
+
</TabItem>
|
|
691
|
+
|
|
692
|
+
<TabItem label="Clean">
|
|
693
|
+
```bash
|
|
694
|
+
# Clean all build artifacts
|
|
695
|
+
npx turbo clean
|
|
696
|
+
|
|
697
|
+
# Clean specific package
|
|
698
|
+
npx turbo clean --filter=@bluealba/pae-core-lib
|
|
699
|
+
```
|
|
700
|
+
</TabItem>
|
|
701
|
+
</Tabs>
|
|
702
|
+
|
|
703
|
+
### Understanding Filters
|
|
704
|
+
|
|
705
|
+
Filters control which packages Turborepo operates on:
|
|
706
|
+
|
|
707
|
+
```bash
|
|
708
|
+
# Single package
|
|
709
|
+
--filter=@bluealba/pae-core-lib
|
|
710
|
+
|
|
711
|
+
# Package and its dependencies
|
|
712
|
+
--filter=...@bluealba/pae-habits-service
|
|
713
|
+
|
|
714
|
+
# Package and its dependents
|
|
715
|
+
--filter=@bluealba/pae-core-lib...
|
|
716
|
+
|
|
717
|
+
# Multiple packages
|
|
718
|
+
--filter=@bluealba/pae-core-lib --filter=@bluealba/pae-habits-service
|
|
719
|
+
|
|
720
|
+
# Changed packages since a branch
|
|
721
|
+
--filter=...[origin/develop]
|
|
722
|
+
|
|
723
|
+
# Glob patterns
|
|
724
|
+
--filter="@bluealba/pae-*-service"
|
|
725
|
+
```
|
|
726
|
+
|
|
727
|
+
### Turborepo Caching
|
|
728
|
+
|
|
729
|
+
Turborepo caches build outputs for speed:
|
|
730
|
+
|
|
731
|
+
- **Cache hit**: Task skipped, output restored from cache
|
|
732
|
+
- **Cache miss**: Task runs, output cached
|
|
733
|
+
|
|
734
|
+
View cache information:
|
|
735
|
+
|
|
736
|
+
```bash
|
|
737
|
+
npx turbo build --summarize
|
|
738
|
+
```
|
|
739
|
+
|
|
740
|
+
Clear cache:
|
|
741
|
+
|
|
742
|
+
```bash
|
|
743
|
+
rm -rf node_modules/.cache/turbo
|
|
744
|
+
```
|
|
745
|
+
|
|
746
|
+
---
|
|
747
|
+
|
|
748
|
+
## Common Workflows
|
|
749
|
+
|
|
750
|
+
### Workflow 1: Adding a New Feature to a Service
|
|
751
|
+
|
|
752
|
+
<Steps>
|
|
753
|
+
|
|
754
|
+
1. Create feature branch from `develop`
|
|
755
|
+
2. Make changes to the service code
|
|
756
|
+
3. Add tests for new functionality
|
|
757
|
+
4. Run tests locally: `npx turbo test --filter=@bluealba/pae-habits-service`
|
|
758
|
+
5. Build: `npx turbo build --filter=@bluealba/pae-habits-service`
|
|
759
|
+
6. Test manually by running service: `npm run dev`
|
|
760
|
+
7. Create changeset: `npm run changeset`
|
|
761
|
+
8. Commit changes including changeset
|
|
762
|
+
9. Push and create PR
|
|
763
|
+
|
|
764
|
+
</Steps>
|
|
765
|
+
|
|
766
|
+
### Workflow 2: Updating a Shared Library
|
|
767
|
+
|
|
768
|
+
<Steps>
|
|
769
|
+
|
|
770
|
+
1. Create feature branch from `develop`
|
|
771
|
+
2. Make changes to the library (e.g., `pae-core-lib`)
|
|
772
|
+
3. Add tests for new functionality
|
|
773
|
+
4. Build library: `npx turbo build --filter=@bluealba/pae-core-lib`
|
|
774
|
+
5. Test dependent packages: `npx turbo test --filter=@bluealba/pae-core-lib...`
|
|
775
|
+
6. Create changeset for library: `npm run changeset`
|
|
776
|
+
7. Commit and push
|
|
777
|
+
8. Create PR
|
|
778
|
+
|
|
779
|
+
</Steps>
|
|
780
|
+
|
|
781
|
+
<Aside>
|
|
782
|
+
**Dependency Impact**: When updating shared libraries, test all dependent packages. Turborepo makes this easy with the `...` filter syntax.
|
|
783
|
+
</Aside>
|
|
784
|
+
|
|
785
|
+
### Workflow 3: Fixing a Bug
|
|
786
|
+
|
|
787
|
+
<Steps>
|
|
788
|
+
|
|
789
|
+
1. Create fix branch from `develop`
|
|
790
|
+
2. Write a failing test that reproduces the bug
|
|
791
|
+
3. Fix the bug
|
|
792
|
+
4. Verify test now passes
|
|
793
|
+
5. Run full test suite: `npx turbo test`
|
|
794
|
+
6. Create changeset (usually a patch): `npm run changeset`
|
|
795
|
+
7. Commit and push
|
|
796
|
+
8. Create PR with "fix:" prefix
|
|
797
|
+
|
|
798
|
+
</Steps>
|
|
799
|
+
|
|
800
|
+
### Workflow 4: Adding a New UI Component
|
|
801
|
+
|
|
802
|
+
<Steps>
|
|
803
|
+
|
|
804
|
+
1. Create feature branch from `develop`
|
|
805
|
+
2. Add component to `pae-ui-react-core`
|
|
806
|
+
3. Write component tests
|
|
807
|
+
4. Add Storybook story (if applicable)
|
|
808
|
+
5. Build: `npx turbo build --filter=@bluealba/pae-ui-react-core`
|
|
809
|
+
6. Test in a UI app that uses the component
|
|
810
|
+
7. Create changeset: `npm run changeset`
|
|
811
|
+
8. Commit and push
|
|
812
|
+
9. Create PR
|
|
813
|
+
|
|
814
|
+
</Steps>
|
|
815
|
+
|
|
816
|
+
---
|
|
817
|
+
|
|
818
|
+
## Best Practices
|
|
819
|
+
|
|
820
|
+
<CardGrid>
|
|
821
|
+
<Card title="Small, Focused PRs" icon="approve-check">
|
|
822
|
+
Keep PRs focused on one feature or fix. Easier to review and less likely to have conflicts.
|
|
823
|
+
</Card>
|
|
824
|
+
|
|
825
|
+
<Card title="Test Everything" icon="seti:test">
|
|
826
|
+
Write tests for new functionality and bug fixes. Maintain high test coverage.
|
|
827
|
+
</Card>
|
|
828
|
+
|
|
829
|
+
<Card title="Always Create Changesets" icon="document">
|
|
830
|
+
Never forget changesets. They're required for proper versioning and releases.
|
|
831
|
+
</Card>
|
|
832
|
+
|
|
833
|
+
<Card title="Keep Branches Updated" icon="rocket">
|
|
834
|
+
Regularly merge `develop` into your branch to avoid large merge conflicts.
|
|
835
|
+
</Card>
|
|
836
|
+
|
|
837
|
+
<Card title="Clear Commit Messages" icon="pencil">
|
|
838
|
+
Write descriptive commit messages. They become part of the project history.
|
|
839
|
+
</Card>
|
|
840
|
+
|
|
841
|
+
<Card title="Leverage Turborepo" icon="setting">
|
|
842
|
+
Use Turborepo filters to work efficiently with the monorepo.
|
|
843
|
+
</Card>
|
|
844
|
+
</CardGrid>
|
|
845
|
+
|
|
846
|
+
---
|
|
847
|
+
|
|
848
|
+
## Release Process
|
|
849
|
+
|
|
850
|
+
Releases are automated, but here's how they work:
|
|
851
|
+
|
|
852
|
+
### Automatic Releases
|
|
853
|
+
|
|
854
|
+
1. **Accumulation Phase**: Developers create changesets in PRs
|
|
855
|
+
2. **Merge to Develop**: PRs are merged, changesets accumulate
|
|
856
|
+
3. **Release Decision**: Team decides to cut a release
|
|
857
|
+
4. **CI Creates RC**: Automated workflow creates release candidate branch
|
|
858
|
+
5. **Version Bump**: CI uses changesets to bump versions
|
|
859
|
+
6. **Changelog Generation**: CI generates changelog from changesets
|
|
860
|
+
7. **Testing**: RC is deployed to staging for final testing
|
|
861
|
+
8. **Merge to Main**: RC is merged to `main`
|
|
862
|
+
9. **Publish**: Packages are published to npm (if public)
|
|
863
|
+
10. **Deploy**: Production deployment is triggered
|
|
864
|
+
|
|
865
|
+
### Manual Release (if needed)
|
|
866
|
+
|
|
867
|
+
If you need to manually create a release:
|
|
868
|
+
|
|
869
|
+
```bash
|
|
870
|
+
# Generate version bumps from changesets
|
|
871
|
+
npx changeset version
|
|
872
|
+
|
|
873
|
+
# Review changes
|
|
874
|
+
git diff
|
|
875
|
+
|
|
876
|
+
# Commit version bumps
|
|
877
|
+
git add .
|
|
878
|
+
git commit -m "Version bump for release"
|
|
879
|
+
|
|
880
|
+
# Tag release
|
|
881
|
+
git tag v1.2.3
|
|
882
|
+
|
|
883
|
+
# Push
|
|
884
|
+
git push origin develop --tags
|
|
885
|
+
```
|
|
886
|
+
|
|
887
|
+
<Aside type="caution">
|
|
888
|
+
**Caution**: Manual releases are rarely needed. The automated process is preferred for consistency and reliability.
|
|
889
|
+
</Aside>
|
|
890
|
+
|
|
891
|
+
---
|
|
892
|
+
|
|
893
|
+
## Next Steps
|
|
894
|
+
|
|
895
|
+
You now understand the complete development workflow!
|
|
896
|
+
|
|
897
|
+
Explore these topics next:
|
|
898
|
+
|
|
899
|
+
1. **[Core Concepts](/_/docs/getting-started/core-concepts/)** - Deeper understanding of platform concepts
|
|
900
|
+
2. **[Architecture](/_/docs/architecture/overview/)** - Learn the technical architecture
|
|
901
|
+
3. **[Building Services](/_/docs/guides/building-services/)** - Create your first service
|
|
902
|
+
4. **[Building UIs](/_/docs/guides/building-uis/)** - Create your first micro-frontend
|
|
903
|
+
|
|
904
|
+
## Getting Help
|
|
905
|
+
|
|
906
|
+
If you encounter workflow issues:
|
|
907
|
+
|
|
908
|
+
1. **Check CI logs**: Review failed checks on GitHub
|
|
909
|
+
2. **Ask the team**: Slack or GitHub Discussions
|
|
910
|
+
3. **Review this guide**: The answer might be here
|
|
911
|
+
4. **Check Turborepo docs**: [turbo.build](https://turbo.build/)
|
|
912
|
+
5. **Check Changesets docs**: [changesets](https://github.com/changesets/changesets)
|
|
913
|
+
|
|
914
|
+
Happy coding!
|