Skip to content

Commit 18741bd

Browse files
committed
Merge branch '2.x' into fix-expanded-choices
# Conflicts: # src/LiveComponent/assets/dist/live_controller.js # src/LiveComponent/assets/src/live_controller.ts # src/LiveComponent/composer.json # src/LiveComponent/src/ComponentWithFormTrait.php # src/LiveComponent/tests/Fixtures/Component/FormComponent1.php # src/LiveComponent/tests/Fixtures/Kernel.php # src/LiveComponent/tests/Fixtures/templates/components/form_component1.html.twig # src/LiveComponent/tests/Functional/Form/ComponentWithFormTest.php
2 parents a5f56f2 + 9f50cbb commit 18741bd

File tree

91 files changed

+2273
-826
lines changed

Some content is hidden

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

91 files changed

+2273
-826
lines changed

.github/workflows/test-turbo.yml

Lines changed: 7 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,9 @@ jobs:
1717
php-version: '8.0'
1818
extensions: zip
1919

20-
- name: Get composer cache directory
21-
id: composercache
22-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
23-
24-
- name: Cache dependencies
25-
uses: actions/cache@v2
20+
- uses: ramsey/composer-install@v2
2621
with:
27-
path: ${{ steps.composercache.outputs.dir }}
28-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
29-
restore-keys: ${{ runner.os }}-composer-
30-
31-
- name: Install dependencies
32-
working-directory: src/Turbo
33-
run: composer install --prefer-dist
22+
working-directory: src/Turbo
3423

3524
- name: Install PHPUnit dependencies
3625
working-directory: src/Turbo
@@ -71,20 +60,9 @@ jobs:
7160
php-version: ${{ matrix.php-versions }}
7261
extensions: zip, pdo_sqlite
7362

74-
- name: Get composer cache directory
75-
id: composercache
76-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
77-
78-
- name: Cache PHP dependencies
79-
uses: actions/cache@v2
63+
- uses: ramsey/composer-install@v2
8064
with:
81-
path: ${{ steps.composercache.outputs.dir }}
82-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
83-
restore-keys: ${{ runner.os }}-composer-
84-
85-
- name: Install PHP dependencies
86-
working-directory: src/Turbo
87-
run: composer install --prefer-dist
65+
working-directory: src/Turbo
8866

8967
- name: Get yarn cache directory path
9068
id: yarn-cache-dir-path
@@ -143,20 +121,10 @@ jobs:
143121
php-version: '8.0'
144122
extensions: zip, pdo_sqlite
145123

146-
- name: Get composer cache directory
147-
id: composercache
148-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
149-
150-
- name: Cache PHP dependencies
151-
uses: actions/cache@v2
124+
- uses: ramsey/composer-install@v2
152125
with:
153-
path: ${{ steps.composercache.outputs.dir }}
154-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
155-
restore-keys: ${{ runner.os }}-composer-
156-
157-
- name: Install PHP dependencies
158-
working-directory: src/Turbo
159-
run: composer update --prefer-dist --prefer-lowest --prefer-stable
126+
working-directory: src/Turbo
127+
dependency-versions: lowest
160128

161129
- name: Get yarn cache directory path
162130
id: yarn-cache-dir-path

.github/workflows/test.yaml

Lines changed: 149 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -18,37 +18,88 @@ jobs:
1818
runs-on: ubuntu-latest
1919
steps:
2020
- uses: actions/checkout@master
21+
- name: Get yarn cache directory path
22+
id: yarn-cache-dir-path
23+
run: echo "::set-output name=dir::$(yarn cache dir)"
24+
- uses: actions/cache@v2
25+
id: yarn-cache
26+
with:
27+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
28+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}
29+
restore-keys: |
30+
${{ runner.os }}-yarn-
2131
- run: yarn
2232
- run: yarn check-lint
2333
- run: yarn check-format
2434

35+
js-dist-current:
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@master
39+
- name: Get yarn cache directory path
40+
id: yarn-cache-dir-path
41+
run: echo "::set-output name=dir::$(yarn cache dir)"
42+
- uses: actions/cache@v2
43+
id: yarn-cache
44+
with:
45+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
46+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}
47+
restore-keys: |
48+
${{ runner.os }}-yarn-
49+
- run: yarn && yarn build
50+
- name: Check if js dist files are current
51+
id: changes
52+
uses: UnicornGlobal/[email protected]
53+
54+
- name: Ensure no changes
55+
if: steps.changes.outputs.changed == 1
56+
run: |
57+
echo "JS dist files need to be rebuilt"
58+
exit 1
59+
2560
tests-php-low-deps:
2661
runs-on: ubuntu-latest
2762
steps:
2863
- uses: actions/checkout@master
2964
- uses: shivammathur/setup-php@v2
3065
with:
3166
php-version: '7.2'
32-
- name: Chartjs
33-
run: |
34-
cd src/Chartjs
35-
composer update --prefer-lowest --prefer-dist --no-interaction --no-ansi --no-progress
36-
php vendor/bin/simple-phpunit
37-
- name: Cropperjs
38-
run: |
39-
cd src/Cropperjs
40-
composer update --prefer-lowest --prefer-dist --no-interaction --no-ansi --no-progress
41-
php vendor/bin/simple-phpunit
42-
- name: Dropzone
43-
run: |
44-
cd src/Dropzone
45-
composer update --prefer-lowest --prefer-dist --no-interaction --no-ansi --no-progress
46-
php vendor/bin/simple-phpunit
47-
- name: LazyImage
48-
run: |
49-
cd src/LazyImage
50-
composer update --prefer-lowest --prefer-dist --no-interaction --no-ansi --no-progress
51-
php vendor/bin/simple-phpunit
67+
68+
- name: Chartjs Dependencies
69+
uses: ramsey/composer-install@v2
70+
with:
71+
working-directory: src/Chartjs
72+
dependency-versions: lowest
73+
- name: Chartjs Tests
74+
run: php vendor/bin/simple-phpunit
75+
working-directory: src/Chartjs
76+
77+
- name: Cropperjs Dependencies
78+
uses: ramsey/composer-install@v2
79+
with:
80+
working-directory: src/Cropperjs
81+
dependency-versions: lowest
82+
- name: Cropperjs Tests
83+
run: php vendor/bin/simple-phpunit
84+
working-directory: src/Cropperjs
85+
86+
- name: Dropzone Dependencies
87+
uses: ramsey/composer-install@v2
88+
with:
89+
working-directory: src/Dropzone
90+
dependency-versions: lowest
91+
- name: Dropzone Tests
92+
run: php vendor/bin/simple-phpunit
93+
working-directory: src/Dropzone
94+
95+
- name: LazyImage Dependencies
96+
uses: ramsey/composer-install@v2
97+
with:
98+
working-directory: src/LazyImage
99+
dependency-versions: lowest
100+
- name: LazyImage Tests
101+
run: php vendor/bin/simple-phpunit
102+
working-directory: src/LazyImage
52103

53104
tests-php8-low-deps:
54105
runs-on: ubuntu-latest
@@ -57,17 +108,25 @@ jobs:
57108
- uses: shivammathur/setup-php@v2
58109
with:
59110
php-version: '8.0'
60-
- name: TwigComponent
61-
run: |
62-
cd src/TwigComponent
63-
composer update --prefer-lowest --prefer-dist --no-interaction --no-ansi --no-progress
64-
php vendor/bin/simple-phpunit
65-
- name: LiveComponent
66-
run: |
67-
cd src/LiveComponent
68-
php ../../.github/build-packages.php
69-
composer update --prefer-lowest --prefer-dist --no-interaction --no-ansi --no-progress
70-
php vendor/bin/simple-phpunit
111+
- run: php .github/build-packages.php
112+
113+
- name: TwigComponent Dependencies
114+
uses: ramsey/composer-install@v2
115+
with:
116+
working-directory: src/TwigComponent
117+
dependency-versions: lowest
118+
- name: TwigComponent Tests
119+
run: php vendor/bin/simple-phpunit
120+
working-directory: src/TwigComponent
121+
122+
- name: LiveComponent Dependencies
123+
uses: ramsey/composer-install@v2
124+
with:
125+
working-directory: src/LiveComponent
126+
dependency-versions: lowest
127+
- name: LiveComponent Tests
128+
working-directory: src/LiveComponent
129+
run: php vendor/bin/simple-phpunit
71130

72131
tests-php-high-deps:
73132
runs-on: ubuntu-latest
@@ -76,41 +135,69 @@ jobs:
76135
- uses: shivammathur/setup-php@v2
77136
with:
78137
php-version: '8.0'
79-
- name: Chartjs
80-
run: |
81-
cd src/Chartjs
82-
composer update --prefer-dist --no-interaction --no-ansi --no-progress
83-
php vendor/bin/simple-phpunit
84-
- name: Cropperjs
85-
run: |
86-
cd src/Cropperjs
87-
composer update --prefer-dist --no-interaction --no-ansi --no-progress
88-
php vendor/bin/simple-phpunit
89-
- name: Dropzone
90-
run: |
91-
cd src/Dropzone
92-
composer update --prefer-dist --no-interaction --no-ansi --no-progress
93-
php vendor/bin/simple-phpunit
94-
- name: LazyImage
95-
run: |
96-
cd src/LazyImage
97-
composer update --prefer-dist --no-interaction --no-ansi --no-progress
98-
php vendor/bin/simple-phpunit
99-
- name: TwigComponent
100-
run: |
101-
cd src/TwigComponent
102-
composer update --prefer-dist --no-interaction --no-ansi --no-progress
103-
php vendor/bin/simple-phpunit
104-
- name: LiveComponent
105-
run: |
106-
cd src/LiveComponent
107-
php ../../.github/build-packages.php
108-
composer update --prefer-dist --no-interaction --no-ansi --no-progress
109-
php vendor/bin/simple-phpunit
138+
- run: php .github/build-packages.php
139+
140+
- name: Chartjs Dependencies
141+
uses: ramsey/composer-install@v2
142+
with:
143+
working-directory: src/Chartjs
144+
- name: Chartjs Tests
145+
run: php vendor/bin/simple-phpunit
146+
working-directory: src/Chartjs
147+
148+
- name: Cropperjs Dependencies
149+
uses: ramsey/composer-install@v2
150+
with:
151+
working-directory: src/Cropperjs
152+
- name: Cropperjs Tests
153+
run: php vendor/bin/simple-phpunit
154+
working-directory: src/Cropperjs
155+
156+
- name: Dropzone Dependencies
157+
uses: ramsey/composer-install@v2
158+
with:
159+
working-directory: src/Dropzone
160+
- name: Dropzone Tests
161+
run: php vendor/bin/simple-phpunit
162+
working-directory: src/Dropzone
163+
164+
- name: LazyImage Dependencies
165+
uses: ramsey/composer-install@v2
166+
with:
167+
working-directory: src/LazyImage
168+
- name: LazyImage Tests
169+
run: php vendor/bin/simple-phpunit
170+
working-directory: src/LazyImage
171+
172+
- name: TwigComponent Dependencies
173+
uses: ramsey/composer-install@v2
174+
with:
175+
working-directory: src/TwigComponent
176+
- name: TwigComponent Tests
177+
run: php vendor/bin/simple-phpunit
178+
working-directory: src/TwigComponent
179+
180+
- name: LiveComponent Dependencies
181+
uses: ramsey/composer-install@v2
182+
with:
183+
working-directory: src/LiveComponent
184+
- name: LiveComponent Tests
185+
working-directory: src/LiveComponent
186+
run: php vendor/bin/simple-phpunit
110187

111188
tests-js:
112189
runs-on: ubuntu-latest
113190
steps:
114191
- uses: actions/checkout@master
192+
- name: Get yarn cache directory path
193+
id: yarn-cache-dir-path
194+
run: echo "::set-output name=dir::$(yarn cache dir)"
195+
- uses: actions/cache@v2
196+
id: yarn-cache
197+
with:
198+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
199+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}
200+
restore-keys: |
201+
${{ runner.os }}-yarn-
115202
- run: yarn
116203
- run: yarn test

.php-cs-fixer.dist.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
->append([__FILE__])
2525
->notPath('#/Fixtures/#')
2626
->notPath('#/app/var/#')
27+
->notPath('#/var/cache/#')
2728
->notPath('Turbo/Attribute/Broadcast.php') // Need https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues/4702
2829
)
2930
;

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@
4545
"plugin:@typescript-eslint/recommended"
4646
],
4747
"rules": {
48-
"@typescript-eslint/no-explicit-any": "off"
48+
"@typescript-eslint/no-explicit-any": "off",
49+
"@typescript-eslint/no-empty-function": "off"
4950
},
5051
"env": {
5152
"browser": true

src/LiveComponent/CHANGELOG.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,29 @@
22

33
## 2.1.0
44

5+
- Your component's live "data" is now send over Ajax as a JSON string.
6+
Previously data was sent as pure query parameters or as pure POST data.
7+
However, this made it impossible to keep certain data types, like
8+
distinguishing between `null` and `''`. This has no impact on end-users.
9+
10+
- Added `data-live-ignore` attribute. If included in an element, that element
11+
will not be updated on re-render.
12+
13+
- `ComponentWithFormTrait` no longer has a `setForm()` method. But there
14+
is also no need to call it anymore. To pass an already-built form to
15+
your component, pass it as a `form` var to `component()`. If you have
16+
a custom `mount()`, you no longer need to call `setForm()` or anything else.
17+
518
- The Live Component AJAX endpoints now return HTML in all situations
619
instead of JSON.
720

8-
- Send live action arguments to backend
21+
- Ability to send live action arguments to backend
22+
23+
- [BC BREAK] Remove `init_live_component()` twig function, use `{{ attributes }}` instead:
24+
```diff
25+
- <div {{ init_live_component() }}>
26+
+ <div {{ attributes }}>
27+
```
928

1029
## 2.0.0
1130

0 commit comments

Comments
 (0)