Skip to content

Commit ac97ba5

Browse files
committed
feat: improve contributing guide
1 parent d24fe82 commit ac97ba5

File tree

1 file changed

+92
-54
lines changed

1 file changed

+92
-54
lines changed

src/Web/Documentation/content/main/5-extra-topics/01-contributing.md

Lines changed: 92 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,11 @@ Welcome aboard! We're excited that you are interested in contributing to the Tem
66

77
## How do I...
88

9-
* Ask about...
10-
[🐞 An Error or Bug](#report-an-issue)
11-
[💡 A Feature](#request-a-feature)
12-
* Make...
13-
[📖 A Contribution to Documentation](#contribute-to-the-documentation)
14-
[🔨 A Contribution to the Code](#contribute-code)
15-
16-
<!--
17-
TODO: Add these sections.
18-
* Manage...
19-
* [❓ Issues and Pull Requests]()
20-
* [📦 Sub-split packages]()
21-
* [✅ Releases]()
22-
-->
23-
24-
## Report an issue
9+
* Ask about... &nbsp; [🐞 An error or bug](#report-an-error-or-bug) &nbsp; or &nbsp; [💡 A feature](#request-a-feature)
10+
* Make... &nbsp; [📖 A contribution to documentation](#contribute-documentation) &nbsp; or &nbsp; [🔨 A contribution to the code](#contribute-code)
11+
12+
## Report an error or bug
13+
2514
To report an error or a bug, please:
2615

2716
* Head over to the [issue page](https://github.com/tempestphp/tempest-framework/issues) to open an issue.
@@ -39,7 +28,8 @@ Once the issue has been opened, the Tempest team will:
3928
In the event that an issue is opened, but we get no response within 30 days, the issue will be closed.
4029

4130
## Request a feature
42-
Tempest is a work in progress! We recognize that some features you might benefit from or expect may be missing. If you do have a feature request, please:
31+
32+
Tempest is a work in progress. We recognize that some features you might benefit from or expect may be missing. If you do have a feature request, please:
4333

4434
* Head over to the [issue page](https://github.com/tempestphp/tempest-framework/issues) to open an issue.
4535
* Provide as much detail about the feature you are looking for and how it might benefit you and others.
@@ -49,14 +39,19 @@ Once the feature request has been opened, the Tempest team will:
4939
<!-- TODO: Update this section with some links -->
5040
* Label the issue appropriately.
5141
* Ask any clarifying question to help better understand the use case.
52-
* If the feature requested is accepted, the Tempest team will assign the "Uncharted Waters" label. A Tempest team member or a member of the community can contribute the code for this.
42+
* If the feature requested is accepted, the Tempest team will assign the `{txt}Uncharted waters` label. A Tempest team member or a member of the community can contribute the code for this.
5343

54-
**We welcome all contributions and greatly value your time and effort. To ensure your work aligns with Tempest's vision and avoids unnecessary effort, we aim to provide clear guidance and feedback throughout the process.**
44+
:::tip
45+
We welcome all contributions and greatly value your time and effort. To ensure your work aligns with Tempest's vision and avoids unnecessary effort, we aim to provide clear guidance and feedback throughout the process.
46+
:::
47+
48+
## Contribute documentation
5549

56-
## Contribute to the documentation
5750
Documentation is how users learn about the framework, and developers begin to understand how Tempest works under the hood. It's critical to everything we do! Thank you in advance for your assistance in ensuring Tempest documentation is extensive, user-friendly, and up-to-date.
5851

59-
**We welcome contributions of any size! Feel free to submit a pull request, even if it's just fixing a typo or adding a sentence.**
52+
:::tip
53+
We welcome contributions of any size! Feel free to submit a pull request, even if it's just fixing a typo or adding a sentence. We especially value additions coming from new users' perspectives, which help make Tempest more accessible.
54+
:::
6055

6156
To contribute to Tempest's documentation, please:
6257
* Head over to the [Tempest docs repository](https://github.com/tempestphp/tempest-docs) to fork the project.
@@ -71,16 +66,19 @@ Once a pull request has been opened, the Tempest team will:
7166
* If your pull request is accepted, we will mark it as such and merge it into the project. It will be released in the next tagged version! 🎉
7267

7368
## Contribute code
74-
So you want to dive into the code! We cannot wait to get your pull request! To make the most of your time, please ensure that any contributions pertain to an approved feature request or a confirmed bug. This helps us focus on the vision for Tempest and ensuring the best developer experience.
7569

76-
To contribute to Tempest's code, please:
77-
* [Setup Tempest Locally](#setting-up-tempest-locally)
70+
So, you want to dive into the code. To make the most of your time, please ensure that any contributions pertain to an approved feature request or a confirmed bug. This helps us focus on the vision for Tempest and ensuring the best developer experience.
71+
72+
To contribute to Tempest's code, you will need to first [setup Tempest locally](#setting-up-tempest-locally). Then,
7873
* Make the relevant code changes.
7974
* Write tests that verify that your contribution works as expected.
8075
* Run `composer qa` to ensure you are adhering to our style guidelines.
81-
* Document your changes in the CHANGELOG following the [Keep a Changelog](https://keepachangelog.com) format.
82-
* Go to https://github.com/tempestphp/tempest-framework/pulls and create a pull request with your changes.
83-
* If your pull request is connected to an open issue, add a line in your description that says `Fixes: #xxx`, where `#xxx` is the number of the issue you're fixing.
76+
* Create a [pull request](https://github.com/tempestphp/tempest-framework/pulls) with your changes.
77+
* If your pull request is connected to an open issue, add a line in your description that says `{txt}Fixes #xxx`, where `{txt}#xxx` is the number of the issue you're fixing.
78+
79+
:::tip Pull request titles
80+
We use [conventional commits](#commit-and-merge-conventions) to automatically generate readable changelogs. You may help with this by providing a clear pull request title, which will appear in the changelog and needs to be understandable without the pull request's content as a context. Read more about this in the [pull requests](#pull-requests) section.
81+
:::
8482

8583
Once a pull request has been opened, the Tempest team will:
8684
* Use GitHub reviews to review your pull request.
@@ -89,33 +87,74 @@ Once a pull request has been opened, the Tempest team will:
8987
* If we decide to pass on your pull request, we will thank you for your contribution and explain our decision. We appreciate all the time contributors put into Tempest!
9088
* If your pull request is accepted, we will mark it as such and merge it into the project. It will be released in the next tagged version! 🎉
9189

92-
### Setting up Tempest Locally
93-
* Install PHP
94-
* Install Composer
95-
* [Fork the Tempest repository.](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo)
90+
### Setting up Tempest locally
91+
92+
* Install PHP.
93+
* Install Composer.
94+
* Install [Bun](https://bun.sh) or Node.
95+
* [Fork and clone](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo) the Tempest repository.
9696

97-
Then in your terminal run:
98-
```shell
97+
In your terminal, run:
98+
```sh
9999
cd /path/to/your/clone
100100
composer update
101+
bun install
102+
bun dev
101103
```
102104

103105
You're ready to get started!
104106

107+
#### Linking your local Tempest to another local Tempest application
108+
109+
If you have another Tempest application with which you want to use your local version of the framework, you may do so with [composer symlinking](https://getcomposer.org/doc/05-repositories.md#path).
110+
111+
Add the following in your `composer.json`, replacing `{txt}/path/to/your/clone` with the absolute path to your local version of the framework:
112+
113+
```json
114+
{
115+
// ...
116+
"repositories": [
117+
{
118+
"type": "path",
119+
"url": "/path/to/your/clone"
120+
}
121+
],
122+
"minimum-stability": "dev",
123+
"prefer-stable": true
124+
// ...
125+
}
126+
```
127+
128+
You may then run `{sh}composer require "tempest/framework:*"`.
129+
130+
If you are also working on one of the JavaScript packages, you may also symlink them to your local Tempest application by running `{sh}bun install /path/to/your/clone/package`. Note that the path must be to the actual JavaScript package, and not the root of the framework.
131+
132+
For instance, assuming you cloned the framework in `/Users/you/Code/forks/tempest`, the command to symlink `vite-plugin-tempest` should look like that:
133+
134+
```sh
135+
bun install /Users/you/Code/forks/tempest/packages/vite-plugin-tempest
136+
```
137+
138+
Do not forget to run `bun dev` in the root of your local version of the framework, so your changes can be reflected on your local application without needing to run `bun build` each time.
139+
105140
### Styling decisions
141+
106142
Tempest uses a modified version of PSR-12. We automate the entire styling process because we know everyone is used to different standards and workflows. To see some of the rules we enforce, check out our [Mago](https://github.com/tempestphp/tempest-framework/blob/main/mago.toml) and [Rector](https://github.com/tempestphp/tempest-framework/blob/main/rector.php) configurations.
107143

108144
The following outlines some other guidelines we have established for Tempest.
109145

110146
#### `final` and `readonly` as a default
147+
111148
Whenever possible, classes should be `final` and `readonly`. This practice promotes immutability and prevents inadvertent changes to logic.
112149

113-
_Resources_
114-
* [Why I use final](https://www.youtube.com/watch?v=HiD6CwWq5Ds&ab_channel=PHPAnnotated)
150+
:::tip
151+
You may watch this [video](https://www.youtube.com/watch?v=HiD6CwWq5Ds&ab_channel=PHPAnnotated) to understand my thoughts about using `final`.
152+
:::
115153

116154
---
117155

118156
#### Acronym casing
157+
119158
Tempest uses a modified version of the [.NET best practices](https://learn.microsoft.com/en-us/previous-versions/dotnet/netframework-4.0/ms229043(v=vs.100)?redirectedfrom=MSDN) for acronym casing. Please see below for our guidelines:
120159

121160
__Do capitalize all characters of two to three character acronyms, except the first word of a camel-cased identifier.__
@@ -130,26 +169,25 @@ A class named `Uuid` is an example of a long acronym (Uuid) used as the first wo
130169
---
131170

132171
#### Validation class formatting
133-
[final and readonly](#final-and-readonly-as-a-default)
134-
2. __Error Message Formatting__:
135-
- __Avoid Ending Punctuation__: When crafting error messages for validation rules, refrain from including ending punctuation such as periods, exclamation marks, or question marks. This helps in maintaining a uniform style and prevents inconsistency in error message presentation.
136172

137-
__&nbsp;Good Example__
138-
> Value should be a valid email address
173+
1. __Error message formatting__:
174+
- __Avoid ending punctuation__. When writing error messages for validation rules, refrain from including ending punctuation such as periods, exclamation marks, or question marks. This helps in maintaining a uniform style and prevents inconsistency in error message presentation.
139175

140-
__&nbsp;Bad Example__
141-
> Value should be a valid email address!
176+
```diff
177+
- Value should be a valid email address!
178+
+ Value should be a valid email address
179+
```
142180

143181
## Release workflow
144182

145-
**Tempest uses sub-splits to allow components to be installed as individual packages. The following outlines how this process works.**
183+
Tempest uses sub-splits to allow components to be installed as individual packages. The following outlines how this process works.
146184

147185
### Workflow steps
148186

149-
1. **Trigger Event**
187+
1. **Trigger event**
150188
- When a pull request is merged, or a new tag is created, the `.github/workflows/subsplit-packages.yml` action is run.
151189

152-
2. **Package Information Retrieval**
190+
2. **Package information retrieval**
153191
- When the `subsplit-packages.yml` is run, it calls `bin/get-packages`.
154192
- This PHP script uses a combination of Composer and the filesystem to return (in JSON) some information about every package. It returns the:
155193
- **Directory**
@@ -158,11 +196,11 @@ __❌&nbsp;Bad Example__
158196
- **Organization**
159197
- **Repository**
160198

161-
3. **Action Matrix Creation**
199+
3. **Action matrix creation**
162200
- The result of the `get-packages` command is then used to create an action matrix.
163201
- This ensures that the next steps are performed for _every_ package discovered.
164202

165-
4. **Monorepo Split Action**
203+
4. **Monorepo split action**
166204
- The `symplify/[email protected]` GitHub action is called for every package and provided the necessary information (destination repo, directory, etc.).
167205
- This action takes any changes and pushes them to the sub-split repository determined by combining the "Organization" and "Repository" values returned in step 2.
168206
- Depending on whether a tag is found or not, a tag is also supplied so the repository is tagged appropriately.
@@ -197,13 +235,13 @@ Scopes are not mandatory, but are highly recommended for consistency and easy of
197235
Here are some commit examples:
198236

199237
```
200-
feat(support): add `StringHelper` class
201-
feat(support/string): add `uuid` method
202-
perf(discovery): improve cache efficiency
203-
refactor(highlight): improve code readability
204-
docs: mention new `highlight` package
205-
chore: update dependencies
206-
style: apply php-cs-fixer
238+
{:hl-property:feat:}({:hl-keyword:support:}): add `StringHelper` class
239+
{:hl-property:feat:}({:hl-keyword:support/string:}): add `uuid` method
240+
{:hl-property:perf:}({:hl-keyword:discovery:}): improve cache efficiency
241+
{:hl-property:refactor:}({:hl-keyword:highlight:}): improve code readability
242+
{:hl-property:docs:}: mention new `highlight` package
243+
{:hl-property:chore:}: update dependencies
244+
{:hl-property:style:}: apply php-cs-fixer
207245
```
208246

209247
### Pull requests

0 commit comments

Comments
 (0)