|
| 1 | +# Contributing |
| 2 | + |
| 3 | +Thank you for considering contributing to Symfony Reprise! |
| 4 | + |
| 5 | +Symfony Reprise 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 [Symfony's Contribution Guide](https://symfony.com/doc/current/contributing/index.html) first. |
| 9 | +
|
| 10 | +## Reporting an issue |
| 11 | + |
| 12 | +If you find a bug, have a feature request, or need help, please [open an issue](https://github.com/symfony/reprise/issues). |
| 13 | + |
| 14 | +Please provide as much information as possible, and remember to follow our [Code of Conduct](https://symfony.com/doc/current/contributing/code_of_conduct/index.html) to keep the project welcoming for everyone. |
| 15 | + |
| 16 | +## Contributing to the code |
| 17 | + |
| 18 | +### Forking the repository |
| 19 | + |
| 20 | +To contribute to Symfony Reprise, you need to [fork the **symfony/reprise** repository](https://github.com/symfony/reprise/fork) on GitHub. |
| 21 | + |
| 22 | +```shell |
| 23 | +# With GitHub CLI https://cli.github.com/ |
| 24 | +$ gh repo clone <USERNAME>/reprise reprise |
| 25 | + |
| 26 | +# Using SSH |
| 27 | +$ git clone git@github.com:<USERNAME>/reprise.git reprise |
| 28 | +$ cd reprise |
| 29 | +$ git remote add upstream git@github.com:symfony/reprise.git |
| 30 | +``` |
| 31 | + |
| 32 | +### Setting up the development environment |
| 33 | + |
| 34 | +- **PHP 8.4 or higher** |
| 35 | +- **Composer** |
| 36 | +- **Node.js 22 or higher** |
| 37 | +- **Corepack** |
| 38 | +- **pnpm 11.10 or higher** |
| 39 | + |
| 40 | +```shell |
| 41 | +$ composer install |
| 42 | +$ corepack enable && pnpm install |
| 43 | +``` |
| 44 | + |
| 45 | +> [!IMPORTANT] |
| 46 | +> This repository has a dual structure: a PHP Symfony bundle (`symfony/reprise`) at the root, and an npm package (`@symfony/reprise`) in `assets/`, managed together as a pnpm workspace. Most changes touch only one side, but some (like adding a new option) touch both. |
| 47 | +
|
| 48 | +### Working with the PHP bundle |
| 49 | + |
| 50 | +The PHP source lives in `src/`, tests in `tests/`. The bundle follows Symfony's PHP coding standards and the Backward Compatibility promise. |
| 51 | + |
| 52 | +```shell |
| 53 | +# Run the test suite |
| 54 | +$ vendor/bin/phpunit |
| 55 | + |
| 56 | +# Run static analysis |
| 57 | +$ vendor/bin/phpstan analyse |
| 58 | + |
| 59 | +# Fix coding standards |
| 60 | +$ vendor/bin/php-cs-fixer fix |
| 61 | +``` |
| 62 | + |
| 63 | +### Working with the assets |
| 64 | + |
| 65 | +The actual bundler plugin (the unplugin for Vite and Rsbuild) lives in `assets/`, written in TypeScript and built with [tsdown](https://tsdown.dev/). These commands run from the repository root: |
| 66 | + |
| 67 | +```shell |
| 68 | +# Build the plugin |
| 69 | +$ pnpm build |
| 70 | + |
| 71 | +# Watch and rebuild on change |
| 72 | +$ pnpm dev |
| 73 | + |
| 74 | +# Run the test suite |
| 75 | +$ pnpm test |
| 76 | + |
| 77 | +# Lint |
| 78 | +$ pnpm lint |
| 79 | +``` |
| 80 | + |
| 81 | +For manual end-to-end verification against a real Symfony backend, use the `playground/` app (a full Symfony 7 project that imports the plugin directly from `assets/`): |
| 82 | + |
| 83 | +```shell |
| 84 | +$ npm -C playground run vite:dev |
| 85 | +$ npm -C playground run vite:build |
| 86 | + |
| 87 | +$ npm -C playground run rsbuild:dev |
| 88 | +$ npm -C playground run rsbuild:build |
| 89 | +``` |
| 90 | + |
| 91 | +### Commit messages |
| 92 | + |
| 93 | +Commit messages follow the same `[<Scope>] <Short description>` convention used across Symfony UX and WebpackEncoreBundle, not Conventional Commits. The scope is PascalCase, the description is imperative mood with a capitalized first word and no trailing period. Combine scopes as `[A][B]` when a change spans several areas. |
| 94 | + |
| 95 | +``` |
| 96 | +[Stimulus] Emit forward-slash local controller paths |
| 97 | +[Docs] Frame Stimulus usage as the Encore experience |
| 98 | +[CI] Cancel superseded runs with a concurrency group |
| 99 | +``` |
| 100 | + |
| 101 | +## Keeping your fork up to date |
| 102 | + |
| 103 | +To reset your local `main` to match upstream: |
| 104 | + |
| 105 | +```shell |
| 106 | +$ git checkout main && \ |
| 107 | + git fetch upstream && \ |
| 108 | + git reset --hard upstream/main && \ |
| 109 | + git push origin main |
| 110 | +``` |
| 111 | + |
| 112 | +To rebase a feature branch on top of `upstream/main`: |
| 113 | + |
| 114 | +```shell |
| 115 | +$ git checkout my-feature-branch && \ |
| 116 | + git rebase upstream/main && \ |
| 117 | + git push -u origin my-feature-branch |
| 118 | +``` |
0 commit comments