Skip to content

Commit 7429711

Browse files
committed
Add CONTRIBUTING.md
1 parent 3ea19c1 commit 7429711

File tree

2 files changed

+103
-12
lines changed

2 files changed

+103
-12
lines changed

CONTRIBUTING.md

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# Contributing
2+
3+
Thank you for considering contributing to Symfony UX!
4+
5+
Symfony UX is an open source, community-driven project, and we are happy to receive contributions from the community!
6+
7+
> [!TIP]
8+
> It's a good idea to read the [Symfony's Contribution Guide](https://symfony.com/doc/current/contributing/index.html) first, even if not all of it applies to Symfony UX and should be adapted to this project (e.g.: Symfony UX has only one base branch, `2.x`).
9+
10+
## Reporting an issue
11+
12+
If you either find a bug, have a feature request, or need help/have a question, please [open an issue](https://github.com/symfony/ux/issues/new/choose).
13+
14+
Please follow the issue template and provide as much information as possible,
15+
and remember to follow our [Code of Conduct](https://symfony.com/doc/current/contributing/code_of_conduct/index.html)
16+
as well, to ensure a friendly environment for all contributors.
17+
18+
## Contributing to the code and documentation
19+
20+
Thanks for your interest in contributing to Symfony UX! Here are some guidelines to help you get started.
21+
22+
### Forking the repository
23+
24+
To contribute to Symfony UX, you need to fork the repository on GitHub. This will give you a copy of the code under your GitHub user account.
25+
26+
After forking the repository, you can clone it to your local machine:
27+
28+
```shell
29+
$ git clone [email protected]:<USERNAME>/symfony-ux.git symfony-ux
30+
$ cd symfony-ux
31+
# Add the upstream repository, to keep your fork up-to-date
32+
$ git remote add upstream [email protected]:symfony/ux.git
33+
```
34+
35+
### Setting up the development environment
36+
37+
To set up the development environment, you need the following tools:
38+
39+
- [PHP](https://www.php.net/downloads.php) 8.1 or higher
40+
- [Composer](https://getcomposer.org/download/)
41+
- [Node.js](https://nodejs.org/en/download/package-manager) 22 or higher
42+
- [Yarn](https://yarnpkg.com/) 4 or higher
43+
44+
With these tools installed, you can install the project dependencies:
45+
46+
```shell
47+
$ composer install
48+
$ yarn install
49+
```
50+
51+
### Linking Symfony UX packages to your project
52+
53+
If you want to test your code in an existing project that uses Symfony UX packages,
54+
you can use the `link` utility provided in this Git repository (that you have to clone).
55+
56+
This tool scans the `vendor/` directory of your project, finds Symfony UX packages it uses,
57+
and replaces them by symbolic links to the ones in the Git repository.
58+
59+
```shell
60+
$ php link /path/to/your/project
61+
```
62+
63+
### Working with PHP code
64+
65+
Symfony UX is first and foremost a PHP project, and we follow the [Symfony coding standards](https://symfony.com/doc/current/contributing/code/standards.html)
66+
and [the Backward Compatibility Promise](https://symfony.com/doc/current/contributing/code/bc.html).
67+
68+
When contributing, please make sure to follow these standards and to write tests for your code,
69+
runnable with `php vendor/bin/simple-phpunit`.
70+
71+
### Working with assets
72+
73+
Assets are specific to each Symfony UX package:
74+
- They are located in the `assets/` directory of each package, and can be either TypeScript or CSS files, respectively compiled through Rollup and PostCSS,
75+
- Assets are mentioned in the `package.json` file of each package,
76+
- Assets **must be** compiled before committing changes,
77+
- Assets **must be** compatible with the [Symfony AssetMapper](https://symfony.com/doc/current/frontend/asset_mapper.html) and [Symfony Webpack Encore](https://symfony.com/doc/current/frontend/encore/index.html).
78+
79+
To help you with assets, we provide the following commands that can be run at the root of the repository or in each package directory:
80+
- `yarn run build`: build (compile) assets,
81+
- `yarn run test`: run the tests (through Vitest),
82+
- `yarn run lint`: lint assets (through Biome.js),
83+
- `yarn run format`: format assets (through Biome.js),
84+
- `yarn run check-lint`: check assets linting (through Biome.js),
85+
- `yarn run check-format`: check assets formatting (through Biome.js)
86+
87+
## Useful Git commands
88+
89+
1. To keep your fork up-to-date with the upstream repository and `2.x` branch, you can run the following commands:
90+
```shell
91+
$ git checkout 2.x && \
92+
git fetch upstream && \
93+
git rebase upstream/2.x && \
94+
git push origin 2.x
95+
```
96+
97+
2. To rebase your branch on top of the `2.x` branch, you can run the following commands:
98+
```shell
99+
$ git checkout my-feature-branch && \
100+
git rebase upstream/2.x && \
101+
git push -u origin my-feature-branch
102+
```

README.md

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,7 @@ Help Symfony by [sponsoring][3] its development!
5050

5151
## Contributing
5252

53-
If you want to test your code in an existing project that uses Symfony UX packages,
54-
you can use the `link` utility provided in this Git repository (that you have to clone).
55-
This tool scans the `vendor/` directory of your project, finds Symfony UX packages it uses,
56-
and replaces them by symbolic links to the ones in the Git repository.
57-
58-
```shell
59-
# Install required dependencies
60-
$ composer install
61-
62-
# And link Symfony UX packages to your project
63-
$ php link /path/to/your/project
64-
```
53+
Thank you for considering contributing to Symfony UX! You can find the [contribution guide here](CONTRIBUTING.md).
6554

6655
[1]: https://symfony.com/backers
6756
[2]: https://mercure.rocks

0 commit comments

Comments
 (0)