Skip to content

Commit fc0ee52

Browse files
committed
Merge branch '2.x' into 3.x
# By Hugo Alliaume (8) and others * 2.x: [CI] Tests over Symfony 7.4.0-beta1 and 8.0.0-beta1 fix: add missing closing quote to attribute [Toolkit][Shadcn] Add missing as props, update CONTRIBUTING.md [Toolkit][Shadcn] Add missing as props, update CONTRIBUTING.md [TwigComponent] Merge `profiler` and `profiler_collect_components` config options Add clarification about difference between component re-rendering and initial loading [Toolkit] Add CONTRIBUTING.md [TwigComponent][Perf] Add option to disable the dump of components [Toolkit][Shadcn][Button] Re-introduce `as` prop, adjust some examples [Toolkit][Shadcn] Update Button CSS class, remove as props [Toolkit][Shadcn][Item] Minor fixes (html_cva, missing dependencies, more examples) [Toolkit][Shadcn] docs for Item component [Toolkit][Shadcn] Add Item component [Site] Document Toolkit recipes props and blocks [CI] Fix sudo issues when installing npm before installing node Update versions to 2.31.0 fix(render): [autocomplete] missing common config properties during merge (such as `no_results`) for `options_as_html` inputs [Turbo] Fix mercure auth the wrong hub with turbo_steam_listen [LiveComponent] Add dispatch browser event test # Conflicts: # .github/workflows/unit-tests.yaml # CONTRIBUTING.md # src/Autocomplete/composer.json # src/Autocomplete/tests/Fixtures/Kernel.php # src/Icons/composer.json # src/LazyImage/assets/package.json # src/LiveComponent/CHANGELOG.md # src/LiveComponent/composer.json # src/LiveComponent/tests/Fixtures/Kernel.php # src/Swup/assets/package.json # src/TogglePassword/assets/package.json # src/Turbo/composer.json # src/TwigComponent/CHANGELOG.md # src/TwigComponent/src/DependencyInjection/TwigComponentExtension.php # src/TwigComponent/tests/Unit/DependencyInjection/TwigComponentExtensionTest.php # src/Typed/assets/package.json # ux.symfony.com/composer.lock
2 parents ad4d098 + f2c7d77 commit fc0ee52

File tree

173 files changed

+1788
-9414
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

173 files changed

+1788
-9414
lines changed

.github/workflows/release-on-npm.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ jobs:
2525
- name: Extract version from tag
2626
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
2727

28-
# npm 11.5.1 or later is required for OIDC
29-
- run: npm install -g npm@latest
30-
3128
- run: npm i -g corepack && corepack enable
3229
- uses: actions/setup-node@v4
3330
with:
@@ -39,6 +36,9 @@ jobs:
3936
package.json
4037
src/**/package.json
4138
39+
# npm 11.5.1 or later is required for OIDC
40+
- run: npm install -g npm@latest
41+
4242
- name: Install root JS dependencies
4343
run: pnpm install --frozen-lockfile
4444

.github/workflows/unit-tests.yaml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ jobs:
3434
minimum-stability: ['stable']
3535
os: ['']
3636
include:
37-
# dev packages (probably not needed to have multiple such jobs)
3837
- minimum-stability: 'dev'
3938
php-version: '8.5'
4039
# lowest deps
@@ -50,12 +49,15 @@ jobs:
5049
symfony-version: '6.4.*'
5150
os: 'windows-latest'
5251

52+
# Explicit Symfony versions
5353
- php-version: '8.2'
54-
symfony-version: '7.4.x-dev' # TODO: change to '7.4' when Symfony 7.4 is released
54+
symfony-version: '^7.4.0-RC1' # TODO: change to '7.4.*' when Symfony 7.4 is released
55+
56+
- php-version: '8.4'
57+
symfony-version: '^8.0.0-RC1' # TODO: change to '8.0.*' when Symfony 8.0 is released
5558

5659
- php-version: '8.5'
57-
symfony-version: '8.0.x-dev' # TODO: change to '8.0' when Symfony 8.0 is released
58-
minimum-stability: 'dev' # TODO: remove when Symfony 8.0 is released
60+
symfony-version: '^8.0.0-RC1' # TODO: change to '8.0.*' when Symfony 8.0 is released
5961

6062
env:
6163
SYMFONY_REQUIRE: ${{ matrix.symfony-version || '>=6.4' }}
@@ -69,7 +71,7 @@ jobs:
6971
echo COLUMNS=120 >> $GITHUB_ENV
7072
echo COMPOSER_MIN_STAB='composer config minimum-stability ${{ matrix.minimum-stability || 'stable' }} --ansi' >> $GITHUB_ENV
7173
echo COMPOSER_UP='composer update ${{ matrix.dependency-version == 'lowest' && '--prefer-lowest' || '' }} --no-progress --no-interaction --ansi' >> $GITHUB_ENV
72-
echo PHPUNIT='vendor/bin/simple-phpunit ${{ matrix.os == 'windows-latest' && '--exclude-group transient-on-windows' || '' }}' >> $GITHUB_ENV
74+
echo PHPUNIT='vendor/bin/simple-phpunit ${{ matrix.dependency-version == 'lowest' && '--exclude-group skip-on-lowest' || '' }} ${{ matrix.os == 'windows-latest' && '--exclude-group transient-on-windows' || '' }}' >> $GITHUB_ENV
7375
[ 'lowest' = '${{ matrix.dependency-version }}' ] && export SYMFONY_DEPRECATIONS_HELPER=weak
7476
7577
# Turbo has its own workflow file

CONTRIBUTING.md

Lines changed: 73 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ Thank you for considering contributing to Symfony UX!
55
Symfony UX is an open source, community-driven project, and we are happy to receive contributions from the community!
66

77
> [!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`).
8+
> It's a good idea to read the [Symfony's Contribution Guide](https://symfony.com/doc/current/contributing/index.html) first
99
1010
## Reporting an issue
1111

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).
12+
If you 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).
1313

1414
Please provide as much information as possible,
1515
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.
16+
to ensure a friendly environment for all contributors.
1717

1818
## Contributing to the code and documentation
1919

@@ -22,11 +22,15 @@ Thanks for your interest in contributing to Symfony UX! Here are some guidelines
2222
### Forking the repository
2323

2424
To contribute to Symfony UX, you need to [fork the **symfony/ux** repository](https://github.com/symfony/ux/fork) on GitHub.
25-
This will give you a copy of the code under your GitHub user account, read [the documentation "How to fork a repository"](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo).
25+
This will give you a copy of the code under your GitHub user account. Read [the documentation "How to fork a repository"](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo).
2626

2727
After forking the repository, you can clone it to your local machine:
2828

2929
```shell
30+
# With GitHub CLI https://cli.github.com/
31+
$ gh repo clone <USERNAME>/symfony-ux symfony-ux
32+
33+
# Using SSH
3034
$ git clone [email protected]:<USERNAME>/symfony-ux.git symfony-ux
3135
$ cd symfony-ux
3236
# Add the upstream repository, to keep your fork up-to-date
@@ -37,16 +41,19 @@ $ git remote add upstream [email protected]:symfony/ux.git
3741

3842
To set up the development environment, you need the following tools:
3943

40-
- [PHP](https://www.php.net/downloads.php) 8.2 or higher
41-
- [Composer](https://getcomposer.org/download/)
42-
- [Node.js](https://nodejs.org/en/download/package-manager) 22.18 or higher
43-
- [Corepack](https://github.com/nodejs/corepack)
44-
- [PNPM](https://pnpm.io/) 10.13 or higher
44+
- **[PHP](https://www.php.net/downloads.php) 8.2 or higher** - Required for running Symfony components
45+
- **[Composer](https://getcomposer.org/download/)** - PHP dependency manager
46+
- **[Node.js](https://nodejs.org/en/download/package-manager) 22.18 or higher** - Required for asset compilation
47+
- **[Corepack](https://github.com/nodejs/corepack)** - Package manager manager (comes with Node.js 16+)
48+
- **[PNPM](https://pnpm.io/) 10.16.1 or higher** - JavaScript package manager (installed via Corepack)
4549

4650
With these tools installed, you can install the project dependencies:
4751

4852
```shell
53+
# Install root PHP dependencies
4954
$ composer install
55+
56+
# Enable PNPM through Corepack, and install JavaScript dependencies
5057
$ corepack enable && pnpm install
5158
```
5259

@@ -70,36 +77,51 @@ and [the Backward Compatibility Promise](https://symfony.com/doc/current/contrib
7077
When contributing, please make sure to follow these standards and to write tests for your code,
7178
runnable with `php vendor/bin/simple-phpunit`.
7279

80+
#### Generate snapshots for UX Toolkit
81+
82+
If you make changes to a component template or add a new one, create or update the EXAMPLES.md of the component.
83+
Then, you can (re)generate new snapshots by running:
84+
85+
```shell
86+
php vendor/bin/simple-phpunit -d --update-snapshots
87+
```
88+
89+
> [!IMPORTANT]
90+
> Snapshots will not reflect changes if you forget to update the EXAMPLES.md.
91+
7392
### Working with assets
7493

7594
Assets are specific to each Symfony UX package:
76-
- They are located in the `assets/` directory of each package, and can be either TypeScript or CSS files, respectively compiled through Rollup and PostCSS,
77-
- Assets are mentioned in the `package.json` file of each package,
78-
- Assets **must be** compiled before committing changes,
79-
- 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).
95+
- They are located in the `assets/` directory of each package and can be either TypeScript or CSS files, all compiled through [tsup](https://github.com/egoist/tsup)
96+
- Assets are mentioned in the `package.json` file of each package
97+
- Assets **must be** compiled before committing changes
98+
- 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)
8099

81100
To help you with assets, you can run the following commands in a specific package directory (e.g., `src/Map/assets/`):
82-
- `pnpm run build`: build (compile) assets from the package,
83-
- `pnpm run watch`: watch for modifications and rebuild assets from the package,
84-
- `pnpm run test`: run the tests from the package,
85-
- `pnpm run test:unit`: run the Unit tests from the package,
86-
- `pnpm run test:browser`: run the Browser tests from the package, in a headless browser
87-
- `pnpm run test:browser:ui`: run the Browser tests from the package in interactive mode, allowing you to see the tests running in a browser window and debug them if needed
88-
- `pnpm run check`: run the formatter, linter, and sort imports, and fails if any modifications
89-
- `pnpm run check --write`: run the formatter, linter, imports sorting, and write modifications
101+
- `pnpm run build`: build (compile) assets from the package
102+
- `pnpm run watch`: watch for modifications and rebuild assets from the package
103+
- `pnpm run test`: run the tests from the package
104+
- `pnpm run test:unit`: run the unit tests from the package
105+
- `pnpm run test:browser`: run the browser tests from the package in a headless browser
106+
- `pnpm run test:browser:ui`: run the browser tests from the package in interactive mode, allowing you to see the tests running in a browser window and debug them if needed
107+
- `pnpm run check`: run the formatter, linter, and sort imports, and fail if any modifications are needed
108+
- `pnpm run check --write`: run the formatter, linter, and import sorting, and write modifications
90109

91110
Thanks to [PNPM Workspaces](https://pnpm.io/workspaces), you can also run these commands from the root directory of the project:
92-
- `pnpm run build`: build (compile) assets from **all** packages,
93-
- `pnpm run test`: run the tests from **all** packages,
94-
- `pnpm run test:unit`: run the Unit tests from **all** packages,
95-
- `pnpm run test:browser`: run the Browser tests from **all** packages, in a headless browser
96-
- `pnpm run check`: run the formatter, linter, and sort imports for **all** packages, and fails if any modifications
97-
- `pnpm run check --write`: run the formatter, linter, imports sorting for **all** packages, and write modifications
111+
- `pnpm run build`: build (compile) assets from **all** packages
112+
- `pnpm run test`: run the tests from **all** packages
113+
- `pnpm run test:unit`: run the unit tests from **all** packages
114+
- `pnpm run test:browser`: run the browser tests from **all** packages in a headless browser
115+
- `pnpm run check`: run the formatter, linter, and sort imports for **all** packages, and fail if any modifications are needed
116+
- `pnpm run check --write`: run the formatter, linter, and import sorting for **all** packages, and write modifications
117+
118+
> [!IMPORTANT]
119+
> Always run `pnpm run build` before committing your changes to ensure assets are properly compiled.
98120
99121
#### Working with Unit tests
100122

101123
We use [Vitest](https://vitest.dev/) for unit testing of the assets,
102-
and tests files are located in the `assets/test/unit/` directory of each UX package,
124+
and test files are located in the `assets/test/unit/` directory of each UX package,
103125
for example: `src/Vue/assets/test/unit/render_controller.test.ts`.
104126

105127
**Running tests:**
@@ -109,37 +131,43 @@ for example: `src/Vue/assets/test/unit/render_controller.test.ts`.
109131
- `pnpm run test:unit`: runs the unit tests for the package
110132

111133
> [!IMPORTANT]
112-
> The command `pnpm run test:unit` ensure that each possible combination of dependencies is tested
134+
> The command `pnpm run test:unit` ensures that each possible combination of dependencies is tested
113135
> (e.g., `"chart.js": "^3.4.1 || ^4.0"` for UX Chartjs).
114-
> Thus it may take some time to run, and it may be not recommended to use watch mode.
136+
> Thus it may take some time to run, and **we don't recommend using watch mode**.
115137
116138
#### Working with End-to-End (E2E) tests
117139

118140
> [!NOTE]
119141
> E2E tests simulate real user interactions in a browser, to ensure that the
120142
> UX packages work as expected in a real-world scenario.
121143
122-
Symfony UX use [Playwright](https://playwright.dev/) for browser automation and testing,
144+
Symfony UX uses [Playwright](https://playwright.dev/) for browser automation and testing,
123145
and a dedicated Symfony application located in the [`apps/e2e/`](./apps/e2e/) directory,
124-
which contains many examples of Symfony UX packages usage.
146+
which contains many examples of Symfony UX package usages.
125147

126-
Tests files are located in the `assets/test/browser/` directory of each UX package,
148+
Test files are located in the `assets/test/browser/` directory of each UX package,
127149
for example: `src/Vue/assets/test/browser/vue.test.ts`.
128150

129151
**Setup:**
130-
1. Ensure to have followed the steps in the [Setting up the development environment](#setting-up-the-development-environment) section
131-
2. Read and follow the instructions in the [`apps/e2e/README.md`](./apps/e2e/README.md) file,
152+
1. Ensure you have followed the steps in the [Setting up the development environment](#setting-up-the-development-environment) section
153+
2. Read and follow the instructions in the [`apps/e2e/README.md`](./apps/e2e/README.md) file
132154

133155
**Running tests:**
134156
- At the project's root, you can run the following commands:
135-
- `pnpm run test:browser`: runs the browser tests for **all** UX packages, using a headless browser
157+
- `pnpm run test:browser`: runs the browser tests for **all** UX packages using a headless browser
136158
- Inside the `assets/` directory of each UX package, you can run the following commands:
137-
- `pnpm run test:browser`: runs browser tests for the package, using a headless browser
159+
- `pnpm run test:browser`: runs browser tests for the package using a headless browser
138160
- `pnpm run test:browser:ui`: runs the browser tests in interactive mode, allowing you to see the tests running in a browser window and debug them if needed
139161

140162
> [!IMPORTANT]
141163
> Due to their nature, E2E tests may be slower to run than unit tests.
142-
> During the development, we recommend to run `pnpm run test:browser` or `pnpm run test:browser:ui` for a specific UX package.
164+
> During development, we recommend running `pnpm run test:browser` or `pnpm run test:browser:ui` for a specific UX package.
165+
166+
> [!TIP]
167+
> If tests are failing locally, try running them in headed mode to see what's happening:
168+
> ```shell
169+
> $ pnpm run test:browser:ui
170+
> ```
143171
144172
### Working on documentation
145173
@@ -156,19 +184,19 @@ command from the root directory of the project:
156184
docker run --rm -it -e DOCS_DIR='/docs' -v ${PWD}:/docs oskarstark/doctor-rst -vvv
157185
```
158186
159-
## Useful Git commands
187+
## Useful commands
160188

161-
1. To keep your fork up-to-date with the upstream repository and `2.x` branch, you can run the following commands:
189+
To keep your fork up-to-date with the upstream repository and `2.x` branch:
162190
```shell
163-
$ git checkout 2.x && \
191+
$ git checkout 3.x && \
164192
git fetch upstream && \
165-
git reset --hard upstream/2.x && \
166-
git push origin 2.x
193+
git reset --hard upstream/3.x && \
194+
git push origin 3.x
167195
```
168196

169-
2. To rebase your branch on top of the `2.x` branch, you can run the following commands:
197+
To rebase your branch on top of the `3.x` branch:
170198
```shell
171199
$ git checkout my-feature-branch && \
172-
git rebase upstream/2.x && \
200+
git rebase upstream/3.x && \
173201
git push -u origin my-feature-branch
174202
```

apps/e2e/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
composer.lock
2+
13
###> symfony/framework-bundle ###
24
/.env.local
35
/.env.local.php

apps/e2e/composer.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@
7979
"symfony/flex": true,
8080
"symfony/runtime": true
8181
},
82+
"audit": {
83+
"ignore": {
84+
"PKSA-365x-2zjk-pt47": "false positive for symfony/http-foundation"
85+
}
86+
},
8287
"bump-after-update": true,
8388
"sort-packages": true
8489
},

0 commit comments

Comments
 (0)