Skip to content

Commit 84f7203

Browse files
authored
Merge pull request #2 from CenterForOpenScience/docs/arch-convetion
Documentation for Architecture, Project Structure and GIT
2 parents eb6a15a + a74f95b commit 84f7203

File tree

3 files changed

+187
-16
lines changed

3 files changed

+187
-16
lines changed

README.md

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,22 +36,6 @@ ng build
3636

3737
This will compile your project and store the build artifacts in the `dist/` directory. By default, the production build optimizes your application for performance and speed.
3838

39-
## Running unit tests
40-
41-
To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
42-
43-
```bash
44-
ng test
45-
```
46-
47-
## Running end-to-end tests
48-
49-
For end-to-end (e2e) testing, run:
50-
51-
```bash
52-
ng e2e
53-
```
54-
5539
Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
5640

5741
## Additional Resources

docs/arch.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# 📂 Folder Structure
2+
3+
Project based on principle **Feature-based Architecture**, this approach provides reusable and consistant
4+
features across the application.
5+
6+
```bash
7+
📦 src/
8+
├── 📂 features/ # Каталог із функціональними модулями
9+
│ ├── 📂 feature-name/
10+
│ │ ├── 📂 feature.component.ts/html/scss # Component with template and styles, and base logic file
11+
│ │ ├── 📂 feature-service.ts # Service or Facade to provide data for NGXS
12+
│ │ ├── 📂 feature.store.ts # NGXS Store for feature
13+
│ │ ├── 📂 feature.entitity.ts # Feature Interface for data, Types, Enums
14+
│ │ ├── 📂 feature.guards.ts # Guard's for feature routing and permissions
15+
│ │ ├── 📂 feature.resolvers.ts # Resolvers for data fetching and preloading
16+
│ │ ├── 📂 feature.utils.ts # Additinal utils for feature (formBuilders, converters, mappers)
17+
│ │ ├── feature.module.ts # Optional, if standalone
18+
│ │ ├── feature.routing.ts # Export of standalone components by path
19+
20+
├── 📂 core/ # Base module for global services, components, and state
21+
│ ├── 📂 services/ # Global services (API, Auth, LocalStorage)
22+
│ ├── 📂 components/ # Global components (Header, Footer, Sidebar)
23+
│ ├── 📂 store/ # Core state management (Auth, Settings, Router)
24+
│ ├── core.module.ts # Optional, but must have a provider for core.
25+
26+
├── 📂 shared/ # Shared module for common components, directives, pipes, and services
27+
│ ├── 📂 ui/ # Shared UI components (Button, Input, Modal), or wrappers for 3rd party
28+
│ ├── 📂 directives/ # Shared Directives (ClickOutside, Draggable)
29+
│ ├── 📂 pipes/ # Shared Pipes (Filter, Sort, Format)
30+
│ ├── 📂 services/ # Services, Facades for shared logic (Http, LocalStorage)
31+
│ ├── 📂 store/ # Shared State management (Settings, Theme, Language)
32+
33+
├── app.routes.ts # General Entry point for routing
34+
├── main.ts # Providers Setup and Bootstrap
35+
├── package.json # Dependencies and Scripts
36+
37+
38+
---
39+
```
40+
41+
## 🚀 Dynamic File Generation (Schematics)
42+
43+
Use Angular CLI to generate new feature components, services, and modules.
44+
45+
```sh
46+
ng generate component feature-name/components/new-component
47+
48+
### 📌 Other Schematics:
49+
50+
| **Entity** | **Command** |
51+
|--------------|----------------------------------------------|
52+
| 📌 **Service** | `ng g s feature-name/services/new-service` |
53+
| 📦 **Module** | `ng g m feature-name` |
54+
| 🔐 **Guard** | `ng g g feature-name/guards/auth-guard` |
55+
| 🔄 **Pipe** | `ng g p shared/pipes/currency-format` |
56+
|**Directive** | `ng g d shared/directives/highlight` |
57+
58+

docs/git-convention.md

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
# 📌 Git Branch Naming Convention (Aligned with Angular Guideline)
2+
3+
# 📖 Introduction
4+
5+
### To maintain a clean commit history and improve team collaboration, we follow Angular Conventional Commits in our Git branch naming. This approach makes it easy to identify change types and automate release processes.
6+
7+
# 🚀 Branch Naming Format
8+
9+
### The branch name should follow the format:
10+
11+
```bash
12+
<type>/<issue-id>-<short-description>
13+
14+
typetype of change (inspired by Angular Commit Message Convention).
15+
16+
issue-id – task or issue ID (optional but recommended).
17+
18+
short-description – a brief description of the change.
19+
20+
```
21+
22+
# 📌 Available Types (type)
23+
24+
### We use the following types to categorize changes:
25+
```bash
26+
| Type --- Purpose
27+
| feat --- Adding a new feature
28+
| fix --- Fixing a bug or issue
29+
| refactor --- Code refactoring without changing functionality
30+
| perf --- Performance improvements
31+
| test --- Adding or updating tests
32+
| chore --- Updating configurations, tools, or dependencies
33+
| docs --- Updating or adding documentation
34+
| style --- Code style changes (formatting, indentation, comments)
35+
| ci --- Changes in CI/CD pipeline
36+
| build --- Updates in build process or dependencies
37+
| revert --- Reverting previous changes
38+
```
39+
40+
# 📝 Branch Naming Examples
41+
42+
### Here are some examples of branch names:
43+
```bash
44+
* feat/1234-add-user-authentication
45+
* fix/5678-fix-login-bug
46+
* refactor/4321-optimize-api-calls
47+
* docs/7890-update-readme
48+
* test/8765-add-e2e-tests-for-dashboard
49+
50+
```
51+
# 🛠 Example of Creating a Branch:
52+
53+
### To create a new branch, use the following command:
54+
```bash
55+
git checkout -b feat/1234-add-user-authentication
56+
57+
```
58+
59+
# 🏆 Best Practices
60+
61+
* ✅ Use short and clear descriptions in branch names.
62+
* ✅ Follow a consistent style across all branches for better project structure.
63+
* ✅ Avoid redundant words, e.g., fix/1234-fix-bug (the word "fix" is redundant).
64+
* ✅ Use kebab-case (- instead of _ or CamelCase).
65+
* ✅ If there is no issue ID, omit it, e.g., docs/update-contributing-guide.
66+
67+
# 🔗 Additional Resources
68+
69+
**Conventional Commits**: https://www.conventionalcommits.org
70+
71+
**Angular Commit Guidelines**: https://github.com/angular/angular/blob/main/CONTRIBUTING.md
72+
73+
**Git Flow**: https://nvie.com/posts/a-successful-git-branching-model/
74+
75+
# This branch naming strategy ensures better traceability and improves commit history readability. 🚀
76+
77+
# 📝 Commit Message Formatting
78+
79+
To ensure clear and structured commit messages, we follow the Conventional Commit format:
80+
81+
🔹 **Commit Message Structure**
82+
83+
```bash
84+
<type>(<scope>): <short description>
85+
86+
[optional body]
87+
88+
[optional footer]
89+
90+
type – The type of change (e.g., feat, fix, docs, style, etc.).
91+
92+
scope – A short context describing the part of the project affected (optional but recommended).
93+
94+
short description – A concise summary of the change (in imperative form, e.g., "fix login bug").
95+
96+
body – A more detailed explanation of the change (if necessary).
97+
98+
footer – Additional metadata, e.g., references to issues (Closes #123).
99+
```
100+
101+
# 📌 Example Commit Messages
102+
103+
```bash
104+
105+
feat(auth): add user authentication flow
106+
107+
Implemented login, registration, and session handling.
108+
Closes #1234.
109+
110+
fix(ui): resolve button alignment issue
111+
112+
Fixed misalignment of buttons in the settings panel.
113+
114+
docs(readme): update installation instructions
115+
116+
Clarified step-by-step setup instructions for the project.
117+
118+
```
119+
120+
# 🔗 Additional Resources
121+
122+
Conventional Commits: https://www.conventionalcommits.org
123+
124+
Angular Commit Guidelines: https://github.com/angular/angular/blob/main/CONTRIBUTING.md
125+
126+
Git Flow: https://nvie.com/posts/a-successful-git-branching-model/
127+
128+
This branch naming and commit message strategy ensures better traceability and improves commit history readability. 🚀
129+

0 commit comments

Comments
 (0)