Skip to content

Commit 9e4b5f6

Browse files
docs: create CONTRIBUTING.md (#193)
1 parent 01172da commit 9e4b5f6

File tree

1 file changed

+142
-0
lines changed

1 file changed

+142
-0
lines changed

CONTRIBUTING.md

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
# 🔄 ngrx-toolkit – Branching, Versioning & Contribution Strategy
2+
3+
This document describes how we manage Angular version compatibility, branching, npm publishing, and contributor workflow for `ngrx-toolkit`.
4+
5+
---
6+
7+
## ✅ Overview
8+
9+
We support multiple Angular versions in parallel using **versioned branches** and **matching npm major versions**:
10+
11+
| Git Branch | Angular Version Support | npm Version | npm Tag | Purpose |
12+
|------------|--------------------------|--------------|--------------|----------------------------------|
13+
| `main` | Angular 20+ | `20.x` | `latest` | Active development |
14+
| `v19` | Angular 15–19 | `19.x` | `angular19` | Maintenance only |
15+
| `v20` | Angular 20 | `20.x` | (optional) | Frozen once `main` moves to v21 |
16+
| `v21` | Angular 21 (future) | `21.x` | `latest` | Active once Angular 21 is current |
17+
18+
---
19+
20+
## 🧱 Codebase Structure
21+
22+
```
23+
src/
24+
core/ ← shared logic for all versions
25+
angular/
26+
v20/ ← Angular 20+ only features
27+
v21/ ← Angular 21+ only features (future)
28+
```
29+
30+
- `core/` holds reusable code shared across all versions
31+
- `angular/vXX/` contains version-specific logic, only exported in compatible branches
32+
33+
---
34+
35+
## 📦 `public-api.ts` per Branch
36+
37+
Control what is exported in each branch:
38+
39+
### In `main` (Angular 20):
40+
```ts
41+
export * from './src/core';
42+
export * from './src/angular/v20/http-resource-feature';
43+
```
44+
45+
### In `v19`:
46+
```ts
47+
export * from './src/core';
48+
// Do not export v20 or v21 features
49+
```
50+
51+
---
52+
53+
## 🔁 npm Publishing Commands
54+
55+
### From `v19`:
56+
```bash
57+
git checkout v19
58+
npm version 19.x.y
59+
npm publish --tag angular19
60+
git push origin v19 --tags
61+
```
62+
63+
### From `main` (Angular 20):
64+
```bash
65+
git checkout main
66+
npm version 20.x.y
67+
npm publish
68+
git push origin main --tags
69+
```
70+
71+
### When Angular 21 is released:
72+
```bash
73+
git checkout main
74+
git checkout -b v20 # Freeze Angular 20
75+
git push origin v20
76+
77+
# Upgrade Angular in main, then:
78+
npm version 21.0.0
79+
npm publish # This becomes new `latest`
80+
```
81+
82+
---
83+
84+
## ❌ Deprecated or Obsolete Features
85+
86+
- If a feature becomes redundant (e.g. `signalFromObservable` now built into Angular):
87+
- **Keep** it in `v19`
88+
- In `main`:
89+
- **Option 1:** Re-export from Angular
90+
- **Option 2:** Mark as `@deprecated`
91+
- **Option 3:** Remove entirely
92+
- No need to move old features to a `legacy/` folder - just delete them per branch. Git history preserves them.
93+
94+
---
95+
96+
## 🧪 CI Recommendations
97+
98+
Use a GitHub Actions matrix to test:
99+
100+
- `v19` with Angular 19
101+
- `main` with Angular 20
102+
- (future) `main` with Angular 21
103+
104+
Each job should:
105+
- Verify `peerDependencies`
106+
- Run build, lint, test
107+
108+
---
109+
110+
## 📥 Contributor Workflow
111+
112+
- All **new development** goes into `main`
113+
- If a feature is **backportable** to Angular 19:
114+
- Cherry-pick into `v19`
115+
- Avoid Angular 20+ APIs in `v19` (like `httpResource`, `linkedSignal`)
116+
- Clearly document breaking changes in changelog
117+
- Update `public-api.ts` carefully in each branch
118+
119+
---
120+
121+
## 📦 Installation Matrix
122+
123+
```bash
124+
# Angular 20+ projects
125+
npm install ngrx-toolkit
126+
127+
# Angular 15–19 projects
128+
npm install ngrx-toolkit@angular19
129+
```
130+
131+
---
132+
133+
## 📌 Best Practices
134+
135+
- Each Angular version gets its own major npm version and branch
136+
- `main` always tracks the latest Angular
137+
- Features are removed from branches where they're no longer needed
138+
- Avoid unnecessary abstraction: Git + clean exports are all you need
139+
140+
---
141+
142+
For questions or proposals, please open a discussion or issue. Happy contributing! 🚀

0 commit comments

Comments
 (0)