mirror of
https://github.com/home-assistant/frontend.git
synced 2025-08-13 19:29:27 +00:00
Compare commits
634 Commits
20250509.0
...
gulp-ts
Author | SHA1 | Date | |
---|---|---|---|
![]() |
efece17f50 | ||
![]() |
3e2f5b0dd3 | ||
![]() |
aae1a3604c | ||
![]() |
e31b9c4264 | ||
![]() |
90a9dbafbf | ||
![]() |
7041557ee2 | ||
![]() |
3d6e5ef1f0 | ||
![]() |
d9bf605c3f | ||
![]() |
20dab92ad8 | ||
![]() |
98ed3bdd4d | ||
![]() |
f5bc6309ae | ||
![]() |
620ebd8a61 | ||
![]() |
ca30af5c8a | ||
![]() |
9d30ce348f | ||
![]() |
07c7b07362 | ||
![]() |
c13a80ce5e | ||
![]() |
13868478f7 | ||
![]() |
77aca59dda | ||
![]() |
b86605949b | ||
![]() |
cd19022e2e | ||
![]() |
03368c1859 | ||
![]() |
8e0ed288e1 | ||
![]() |
879e0ed3d5 | ||
![]() |
657275fd17 | ||
![]() |
3d1c908a01 | ||
![]() |
713e8e7b71 | ||
![]() |
9e597d22a5 | ||
![]() |
259e8a14da | ||
![]() |
4de4243b55 | ||
![]() |
a667cb627b | ||
![]() |
9461634670 | ||
![]() |
51b79b33fb | ||
![]() |
539884295b | ||
![]() |
e1192403d9 | ||
![]() |
f5c49c83a0 | ||
![]() |
faae7a2322 | ||
![]() |
f6aa55ef74 | ||
![]() |
1a0afc5079 | ||
![]() |
4a50ca4ea5 | ||
![]() |
6cb27ede09 | ||
![]() |
1b68c51a05 | ||
![]() |
5f2b11ca9f | ||
![]() |
ec6666a4ea | ||
![]() |
a10dbb64f0 | ||
![]() |
aa17be0e33 | ||
![]() |
a8919703ee | ||
![]() |
1c66a5e437 | ||
![]() |
767d785d04 | ||
![]() |
0839528e22 | ||
![]() |
1012245ef7 | ||
![]() |
0d6db8b834 | ||
![]() |
adea2efb01 | ||
![]() |
818914b837 | ||
![]() |
b207528ecf | ||
![]() |
039ef18d8c | ||
![]() |
db387834f2 | ||
![]() |
1b7d9f9e3b | ||
![]() |
ed8c9f5ce5 | ||
![]() |
c3bf1d8770 | ||
![]() |
7db4693082 | ||
![]() |
72a12a4ba4 | ||
![]() |
aee9e4b0a5 | ||
![]() |
55f6affc9e | ||
![]() |
1e5f2f7215 | ||
![]() |
da864d5bb7 | ||
![]() |
8d60f39cf4 | ||
![]() |
2045519814 | ||
![]() |
3f70e88a4f | ||
![]() |
6ed5fbe102 | ||
![]() |
4e72d5083d | ||
![]() |
f9e102e537 | ||
![]() |
e54363875b | ||
![]() |
1ce4e2a799 | ||
![]() |
80b86a89f0 | ||
![]() |
1a316d251e | ||
![]() |
a74f90b768 | ||
![]() |
fc6e457581 | ||
![]() |
ad7b8b66f2 | ||
![]() |
0714677a8a | ||
![]() |
0a946a5c43 | ||
![]() |
4930a8d88e | ||
![]() |
8b781cec8e | ||
![]() |
065c98c5d7 | ||
![]() |
69d8eeb7db | ||
![]() |
3b7d2869e5 | ||
![]() |
bcda5cd0cf | ||
![]() |
eeb64a25ff | ||
![]() |
9134132ba9 | ||
![]() |
1ded254e5a | ||
![]() |
fc104a7992 | ||
![]() |
e7e062a222 | ||
![]() |
5233086efb | ||
![]() |
8d95f0d95d | ||
![]() |
5cf8b39703 | ||
![]() |
15dabe372c | ||
![]() |
aab52a8bb2 | ||
![]() |
aa52825b40 | ||
![]() |
2809a306e6 | ||
![]() |
a6304d6284 | ||
![]() |
8e866e86d6 | ||
![]() |
2e8203f666 | ||
![]() |
b60f2e3201 | ||
![]() |
c5f57f436c | ||
![]() |
3bb930b906 | ||
![]() |
e75331e159 | ||
![]() |
d6b66a7145 | ||
![]() |
5c346798c8 | ||
![]() |
5ffe37407a | ||
![]() |
2b056c0434 | ||
![]() |
27b36707e5 | ||
![]() |
5760614b65 | ||
![]() |
3835912b01 | ||
![]() |
a385655c85 | ||
![]() |
e177012108 | ||
![]() |
cc3234ad8f | ||
![]() |
4d932f0b4a | ||
![]() |
257769cdc7 | ||
![]() |
6619f064eb | ||
![]() |
382a47a082 | ||
![]() |
ad4be75fe1 | ||
![]() |
d605b67b41 | ||
![]() |
dba6a3c756 | ||
![]() |
002e9ad071 | ||
![]() |
6e7874c2c9 | ||
![]() |
978f9b0f83 | ||
![]() |
2b88669a72 | ||
![]() |
252fd2bb6c | ||
![]() |
cc68a087a2 | ||
![]() |
3e1341a731 | ||
![]() |
6be25270fd | ||
![]() |
ce929aea46 | ||
![]() |
8853bf6ea2 | ||
![]() |
2241807745 | ||
![]() |
50d705c943 | ||
![]() |
eb111d3c32 | ||
![]() |
1e59f9f4be | ||
![]() |
523eb9522f | ||
![]() |
f6cb322819 | ||
![]() |
4f97756f4e | ||
![]() |
8644dd5271 | ||
![]() |
26d842f432 | ||
![]() |
ad4f14ffaf | ||
![]() |
948c858e78 | ||
![]() |
49099223d3 | ||
![]() |
0fbd430594 | ||
![]() |
8cc762d839 | ||
![]() |
89d9dd2893 | ||
![]() |
b7d1ce1c37 | ||
![]() |
869d10ca3f | ||
![]() |
f338089148 | ||
![]() |
06b0f9fcaf | ||
![]() |
7ad07e4c55 | ||
![]() |
ad65600d11 | ||
![]() |
e91d907e56 | ||
![]() |
b35a1fc9e0 | ||
![]() |
dd18ad96f3 | ||
![]() |
62eec56e5f | ||
![]() |
7187e25cad | ||
![]() |
6d9e6a616d | ||
![]() |
44d87e3c66 | ||
![]() |
085e2460bc | ||
![]() |
1f8a9e4caf | ||
![]() |
f08877437e | ||
![]() |
6690d1ef22 | ||
![]() |
9d8a5b366e | ||
![]() |
22c798c9d6 | ||
![]() |
8aabb1f32f | ||
![]() |
33d5cecc85 | ||
![]() |
7693a4dc24 | ||
![]() |
9ec38c7dd9 | ||
![]() |
e8cb85f7ff | ||
![]() |
ef964a2717 | ||
![]() |
369881f8a6 | ||
![]() |
68e22d23f1 | ||
![]() |
696ba69a9e | ||
![]() |
e2ab52e10e | ||
![]() |
b154bc1502 | ||
![]() |
a952b880d8 | ||
![]() |
018aceb542 | ||
![]() |
2fb86f118e | ||
![]() |
6c8caccfec | ||
![]() |
3dd3a80054 | ||
![]() |
675310afdf | ||
![]() |
f5df91d4c7 | ||
![]() |
d8ab9b73ba | ||
![]() |
89ab0b4a3d | ||
![]() |
dd4cb1df72 | ||
![]() |
b81cd37776 | ||
![]() |
34112e7446 | ||
![]() |
2dee45b465 | ||
![]() |
10eb0a8b87 | ||
![]() |
551035238f | ||
![]() |
eb9359e9e1 | ||
![]() |
df2523a6a2 | ||
![]() |
edb1e1bba7 | ||
![]() |
e5bc234ab3 | ||
![]() |
6006e926a7 | ||
![]() |
93df473ad2 | ||
![]() |
af149dcfab | ||
![]() |
3ab6a02994 | ||
![]() |
e7a04eb3d2 | ||
![]() |
2dfe5f50a6 | ||
![]() |
174d54396f | ||
![]() |
5c1a8029bf | ||
![]() |
884341656f | ||
![]() |
fcbc8de95a | ||
![]() |
f90eb4fee0 | ||
![]() |
9afc4260c9 | ||
![]() |
3aafa47f6d | ||
![]() |
35ba2fffda | ||
![]() |
31bc708725 | ||
![]() |
caa60e4e8c | ||
![]() |
edcca81acc | ||
![]() |
508e451f94 | ||
![]() |
bfcc36bb40 | ||
![]() |
976bf7c512 | ||
![]() |
fb28c8971b | ||
![]() |
641a2eb77c | ||
![]() |
47b90feffa | ||
![]() |
45e66d8b6e | ||
![]() |
73cd1e8e9d | ||
![]() |
1a8ff83e2d | ||
![]() |
e6fbe0d538 | ||
![]() |
5ac6781f7d | ||
![]() |
7f7e693547 | ||
![]() |
51246f119c | ||
![]() |
d764187e8c | ||
![]() |
6738b7d708 | ||
![]() |
77c458a0e5 | ||
![]() |
876e36b4e0 | ||
![]() |
dd64fa228c | ||
![]() |
b3f5eb256f | ||
![]() |
a5005c0840 | ||
![]() |
c73122d7ee | ||
![]() |
82da36825e | ||
![]() |
3e2a5bff4d | ||
![]() |
1349d9d8e3 | ||
![]() |
f6f2cb0fce | ||
![]() |
589fa75b17 | ||
![]() |
fdd6ccf379 | ||
![]() |
f50d5d79a4 | ||
![]() |
ad589b32c9 | ||
![]() |
1990472970 | ||
![]() |
299713fd5e | ||
![]() |
a13dae4745 | ||
![]() |
8324c23618 | ||
![]() |
9c8d6a939b | ||
![]() |
1059b519af | ||
![]() |
52a02093e3 | ||
![]() |
b608bd949b | ||
![]() |
f87e20cae9 | ||
![]() |
d58186fec9 | ||
![]() |
f47336392c | ||
![]() |
e9272b9a27 | ||
![]() |
b20d489bdd | ||
![]() |
f7634c45c2 | ||
![]() |
8ee80586a8 | ||
![]() |
6aa8a24aad | ||
![]() |
65e78de41c | ||
![]() |
573c1db081 | ||
![]() |
cf03e041a8 | ||
![]() |
b4dbfa6f70 | ||
![]() |
723bb4dfeb | ||
![]() |
98dcce6af1 | ||
![]() |
e3cdd69835 | ||
![]() |
0ddf3aa675 | ||
![]() |
9c9ce78ff9 | ||
![]() |
4f8c50aaa9 | ||
![]() |
3cfc6297b5 | ||
![]() |
cc0586bf36 | ||
![]() |
bdf48140e4 | ||
![]() |
d7f4a7acb0 | ||
![]() |
154e85eb45 | ||
![]() |
ea15e5a44e | ||
![]() |
d581c4b0aa | ||
![]() |
5b7655cf72 | ||
![]() |
634e1dbde8 | ||
![]() |
a255463a76 | ||
![]() |
3c40b3112e | ||
![]() |
9f33ec55f5 | ||
![]() |
c35c4d16f0 | ||
![]() |
159c4d100a | ||
![]() |
05035a281b | ||
![]() |
67c7a3931f | ||
![]() |
cf41a43070 | ||
![]() |
5c385d5368 | ||
![]() |
0ae78300c9 | ||
![]() |
de42714505 | ||
![]() |
359460b570 | ||
![]() |
38545a01dd | ||
![]() |
8cead75087 | ||
![]() |
7f68447a4f | ||
![]() |
01d2ef13c6 | ||
![]() |
af6911e848 | ||
![]() |
21af10fd28 | ||
![]() |
380f760f79 | ||
![]() |
bffe38c827 | ||
![]() |
89d0746c7c | ||
![]() |
6d30d15638 | ||
![]() |
7e2059e836 | ||
![]() |
0d97962578 | ||
![]() |
4c5015e178 | ||
![]() |
28214aebc5 | ||
![]() |
a26ca7d065 | ||
![]() |
2ab20aef69 | ||
![]() |
8149ee60cb | ||
![]() |
89ce6870f6 | ||
![]() |
4307e2350f | ||
![]() |
7dc4d555ae | ||
![]() |
1483e8e38f | ||
![]() |
5daec6bbc5 | ||
![]() |
d542b52ebd | ||
![]() |
43cc49bb32 | ||
![]() |
b3f0a6328e | ||
![]() |
9d6a7e7e6f | ||
![]() |
78d7da21aa | ||
![]() |
0474a24df6 | ||
![]() |
6e7ac6fdf7 | ||
![]() |
7b9683df89 | ||
![]() |
8523ddfd29 | ||
![]() |
2589e1a49f | ||
![]() |
5ce5f9a189 | ||
![]() |
6dd7217a20 | ||
![]() |
0d02d0d334 | ||
![]() |
fed0dfa091 | ||
![]() |
39de40dec9 | ||
![]() |
e1c42d9985 | ||
![]() |
ad375c9b01 | ||
![]() |
07230e5ef5 | ||
![]() |
52f5af6090 | ||
![]() |
3c07289077 | ||
![]() |
8eb7fe8b0a | ||
![]() |
c8c2966d34 | ||
![]() |
a8768a5d9d | ||
![]() |
02bb7086e7 | ||
![]() |
42d8b2ae19 | ||
![]() |
e08f4a6bba | ||
![]() |
2e6c35d977 | ||
![]() |
17305a818b | ||
![]() |
08389dad04 | ||
![]() |
ab6ace46b5 | ||
![]() |
535dedbbc4 | ||
![]() |
412eb0c647 | ||
![]() |
87c8ebd493 | ||
![]() |
6e49f89126 | ||
![]() |
77eae6044d | ||
![]() |
84ac0cd41e | ||
![]() |
74f9c1551e | ||
![]() |
aebd6350c0 | ||
![]() |
4c78eb4797 | ||
![]() |
560e3890b9 | ||
![]() |
e448268feb | ||
![]() |
7ceba218fa | ||
![]() |
cd61725cf5 | ||
![]() |
228860a1ee | ||
![]() |
9f69347e1d | ||
![]() |
a099e65a9d | ||
![]() |
11e4a9f056 | ||
![]() |
b617299eee | ||
![]() |
768f27b1b9 | ||
![]() |
5ed816df6d | ||
![]() |
6692ac7517 | ||
![]() |
65499db0cb | ||
![]() |
11a1eabf61 | ||
![]() |
b30fa122ba | ||
![]() |
6730d08b85 | ||
![]() |
67003d6fd1 | ||
![]() |
414d46be65 | ||
![]() |
1485d1a1de | ||
![]() |
fd13e41524 | ||
![]() |
77f7ca0368 | ||
![]() |
7471250a07 | ||
![]() |
8b0a63d791 | ||
![]() |
57ffa814ed | ||
![]() |
46e05f10d1 | ||
![]() |
a1819d6189 | ||
![]() |
48a3e1fd63 | ||
![]() |
139c8b3702 | ||
![]() |
9458946dcc | ||
![]() |
b907dbefad | ||
![]() |
5371fd649c | ||
![]() |
61d9b0d2a3 | ||
![]() |
16e20456e2 | ||
![]() |
9c0ce41ebb | ||
![]() |
79e5c59fdf | ||
![]() |
0aa34a14dd | ||
![]() |
b458a1d7c6 | ||
![]() |
1ced9959fa | ||
![]() |
1b67a6f358 | ||
![]() |
0eaeeb1141 | ||
![]() |
b7e63e697f | ||
![]() |
06db0f4b98 | ||
![]() |
d33636c6fb | ||
![]() |
bbb546159c | ||
![]() |
e8fc36026a | ||
![]() |
06270c771f | ||
![]() |
ae49de8e71 | ||
![]() |
6abdeeae20 | ||
![]() |
116716c51d | ||
![]() |
77ee69b64d | ||
![]() |
1a57eeddde | ||
![]() |
9131bf6dfd | ||
![]() |
1611423ca5 | ||
![]() |
38f8c804af | ||
![]() |
7c5bf26240 | ||
![]() |
189067d14b | ||
![]() |
e79e0f77b8 | ||
![]() |
b226e5c697 | ||
![]() |
52ad31601c | ||
![]() |
cba3e4df7f | ||
![]() |
3532cfa974 | ||
![]() |
de56c3376e | ||
![]() |
629eb29d42 | ||
![]() |
61019447cf | ||
![]() |
cde2b436d1 | ||
![]() |
6c7d750734 | ||
![]() |
fcf5ed7731 | ||
![]() |
3ce639946c | ||
![]() |
bb5f01ac81 | ||
![]() |
208e863327 | ||
![]() |
9f5f100e98 | ||
![]() |
114c1fb98b | ||
![]() |
3e5bd64b83 | ||
![]() |
02b4b8e334 | ||
![]() |
da8d43f5d1 | ||
![]() |
18aaa44d2d | ||
![]() |
7fa697a768 | ||
![]() |
28fe60f02b | ||
![]() |
549451eccb | ||
![]() |
113cc118cf | ||
![]() |
7ffb0f1e3b | ||
![]() |
60ef43044b | ||
![]() |
4e4a82e023 | ||
![]() |
f563146165 | ||
![]() |
81ba2db93a | ||
![]() |
4d8176ad6e | ||
![]() |
9b8be9f1af | ||
![]() |
c11d2c10df | ||
![]() |
412a0e9f6a | ||
![]() |
67dc830bbf | ||
![]() |
5581c10139 | ||
![]() |
ec26818c53 | ||
![]() |
399458f811 | ||
![]() |
3355986585 | ||
![]() |
9b7db191a6 | ||
![]() |
2d549ba22f | ||
![]() |
c3e155a95c | ||
![]() |
754829a836 | ||
![]() |
87bd039239 | ||
![]() |
32b3c83337 | ||
![]() |
f0beef22d2 | ||
![]() |
07e5f53469 | ||
![]() |
97e0217906 | ||
![]() |
006c7e1ea8 | ||
![]() |
9736d0cb55 | ||
![]() |
9ec689382b | ||
![]() |
4de95f6710 | ||
![]() |
a55ef8ad47 | ||
![]() |
01b398c2a3 | ||
![]() |
83df10ef29 | ||
![]() |
a026c72230 | ||
![]() |
c4e391c264 | ||
![]() |
4b72a6029c | ||
![]() |
8b87188075 | ||
![]() |
2a4c6c9af5 | ||
![]() |
5cbadaa5f9 | ||
![]() |
15fd4134d0 | ||
![]() |
eda9abc3c5 | ||
![]() |
7e56d5f351 | ||
![]() |
5d4805cde6 | ||
![]() |
c94326bc08 | ||
![]() |
b61180baa6 | ||
![]() |
bc15d1474e | ||
![]() |
95c3013497 | ||
![]() |
69a156f352 | ||
![]() |
67f3d31a4b | ||
![]() |
98a2966432 | ||
![]() |
75a2c061c2 | ||
![]() |
724df18175 | ||
![]() |
c00b4120ab | ||
![]() |
d392bb4c83 | ||
![]() |
30d46f2f8a | ||
![]() |
7c879cc291 | ||
![]() |
9a731880f3 | ||
![]() |
77efaaf7de | ||
![]() |
da96266454 | ||
![]() |
036d739d6e | ||
![]() |
c274a94ee5 | ||
![]() |
da7d359696 | ||
![]() |
20a7b3870c | ||
![]() |
9749a64ae1 | ||
![]() |
68741f6ba4 | ||
![]() |
e052ee04b4 | ||
![]() |
d2cc4a624e | ||
![]() |
5bcbe98f8e | ||
![]() |
beee76580d | ||
![]() |
28e5a30772 | ||
![]() |
785929b370 | ||
![]() |
55cf7e635d | ||
![]() |
4b270eb444 | ||
![]() |
d0e55719d1 | ||
![]() |
87f9397643 | ||
![]() |
910e7e10a7 | ||
![]() |
e1b9b47ac7 | ||
![]() |
89e04fcc45 | ||
![]() |
93f2e75fc9 | ||
![]() |
6c671d398f | ||
![]() |
2e5c6a4d3f | ||
![]() |
04e736a51e | ||
![]() |
ec3fdc0ea7 | ||
![]() |
a7a8c25d24 | ||
![]() |
60d457c3d9 | ||
![]() |
a58b1e636d | ||
![]() |
f67e7ae081 | ||
![]() |
0032c5508e | ||
![]() |
036df78de8 | ||
![]() |
617a6ba938 | ||
![]() |
76b9063aec | ||
![]() |
60c1d0a556 | ||
![]() |
193caec2df | ||
![]() |
42c8d132bf | ||
![]() |
0311a7c976 | ||
![]() |
40ffd50b8a | ||
![]() |
334991902a | ||
![]() |
c968266065 | ||
![]() |
d4fc0318f7 | ||
![]() |
8a0d3baf67 | ||
![]() |
8fc55cb6e2 | ||
![]() |
d6ebd9bfc4 | ||
![]() |
15ae37d077 | ||
![]() |
461d5eb687 | ||
![]() |
3058fcad46 | ||
![]() |
06bd1ae4cd | ||
![]() |
00733357a1 | ||
![]() |
62f2b286ae | ||
![]() |
8f7760f88f | ||
![]() |
665c971822 | ||
![]() |
eff5471dd1 | ||
![]() |
4fba9c3c0a | ||
![]() |
0b32b51e2f | ||
![]() |
6370b0b8e5 | ||
![]() |
ff3b65605e | ||
![]() |
681518f443 | ||
![]() |
9f5b89978d | ||
![]() |
130839ee7b | ||
![]() |
ba4ec960c8 | ||
![]() |
6692d9c6aa | ||
![]() |
4d2d94c54f | ||
![]() |
d59c6612c6 | ||
![]() |
498f158253 | ||
![]() |
b8026ccf46 | ||
![]() |
84def48222 | ||
![]() |
cea0ac02fe | ||
![]() |
e1b099e88b | ||
![]() |
d571ef3f18 | ||
![]() |
c8cffef647 | ||
![]() |
6b568307a4 | ||
![]() |
1b501907f1 | ||
![]() |
c7e79998a4 | ||
![]() |
03ccf014d9 | ||
![]() |
ab41bdb87d | ||
![]() |
821a0bc418 | ||
![]() |
6d931b9e37 | ||
![]() |
b823a3b139 | ||
![]() |
47c9a407e6 | ||
![]() |
c0ba48beb6 | ||
![]() |
075e1df204 | ||
![]() |
22c57853b4 | ||
![]() |
fe824062a5 | ||
![]() |
92bf9b4979 | ||
![]() |
ac616a4d3d | ||
![]() |
1aa1bfda2c | ||
![]() |
38a5035d68 | ||
![]() |
042cd0d3a3 | ||
![]() |
00d708fbd4 | ||
![]() |
852278e8aa | ||
![]() |
15dcdffe55 | ||
![]() |
0729aaacb8 | ||
![]() |
92b8cd8f45 | ||
![]() |
ad8d3dd598 | ||
![]() |
d618c25095 | ||
![]() |
83289bdd41 | ||
![]() |
c7882f3926 | ||
![]() |
7434b12d9f | ||
![]() |
9081441d95 | ||
![]() |
d63f610023 | ||
![]() |
e069875432 | ||
![]() |
91026b0986 | ||
![]() |
4ec5fbc9a4 | ||
![]() |
fb3a59272d | ||
![]() |
9155c85509 | ||
![]() |
9d74cd7561 | ||
![]() |
22ddcca954 | ||
![]() |
8f422357f1 | ||
![]() |
44f5f7bdb5 | ||
![]() |
83819a9be0 | ||
![]() |
3c9dce20e2 | ||
![]() |
a19e7002ea | ||
![]() |
75608db9b8 | ||
![]() |
08f30b714b | ||
![]() |
9983129e26 | ||
![]() |
40fe62c2ec | ||
![]() |
d7660370ab | ||
![]() |
bdad76937e | ||
![]() |
d2822308ec | ||
![]() |
99b94e799d | ||
![]() |
1fb28df1a6 | ||
![]() |
b4e8c56f58 | ||
![]() |
17cc63deba | ||
![]() |
b4f1c8755d | ||
![]() |
b0d4c699db | ||
![]() |
c07bf68161 | ||
![]() |
d1a0eaece5 | ||
![]() |
f608783551 | ||
![]() |
dddba58d38 | ||
![]() |
ebc16d6520 | ||
![]() |
4ed8ecad01 | ||
![]() |
c26fb1713d | ||
![]() |
2b7b17625e | ||
![]() |
cd3e4f55e2 | ||
![]() |
1c12aea8f6 | ||
![]() |
3722f971ca | ||
![]() |
409f665641 | ||
![]() |
5b3b17ef6d | ||
![]() |
05b49e8c80 | ||
![]() |
2dbdbb4b64 | ||
![]() |
a825b632bf | ||
![]() |
f8d706277d | ||
![]() |
221bc732fb | ||
![]() |
055c18463c | ||
![]() |
ddd51ff097 | ||
![]() |
55c75096d0 | ||
![]() |
fd3502f3bc | ||
![]() |
7d6bec01ae |
6
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
6
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
@@ -11,7 +11,7 @@ body:
|
||||
|
||||
**Please do not report issues for custom cards.**
|
||||
|
||||
[fr]: https://github.com/home-assistant/frontend/discussions
|
||||
[fr]: https://github.com/orgs/home-assistant/discussions
|
||||
[releases]: https://github.com/home-assistant/home-assistant/releases
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
@@ -108,9 +108,9 @@ body:
|
||||
render: yaml
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Javascript errors shown in your browser console/inspector
|
||||
label: JavaScript errors shown in your browser console/inspector
|
||||
description: >
|
||||
If you come across any Javascript or other error logs, e.g., in your
|
||||
If you come across any JavaScript or other error logs, e.g., in your
|
||||
browser console/inspector please provide them.
|
||||
render: txt
|
||||
- type: textarea
|
||||
|
2
.github/ISSUE_TEMPLATE/config.yml
vendored
2
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -1,7 +1,7 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: Request a feature for the UI / Dashboards
|
||||
url: https://github.com/home-assistant/frontend/discussions/category_choices
|
||||
url: https://github.com/orgs/home-assistant/discussions
|
||||
about: Request a new feature for the Home Assistant frontend.
|
||||
- name: Report a bug that is NOT related to the UI / Dashboards
|
||||
url: https://github.com/home-assistant/core/issues
|
||||
|
53
.github/ISSUE_TEMPLATE/task.yml
vendored
Normal file
53
.github/ISSUE_TEMPLATE/task.yml
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
name: Task
|
||||
description: For staff only - Create a task
|
||||
type: Task
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
## ⚠️ RESTRICTED ACCESS
|
||||
|
||||
**This form is restricted to Open Home Foundation staff and authorized contributors only.**
|
||||
|
||||
If you are a community member wanting to contribute, please:
|
||||
- For bug reports: Use the [bug report form](https://github.com/home-assistant/frontend/issues/new?template=bug_report.yml)
|
||||
- For feature requests: Submit to [Feature Requests](https://github.com/orgs/home-assistant/discussions)
|
||||
|
||||
---
|
||||
|
||||
### For authorized contributors
|
||||
|
||||
Use this form to create tasks for development work, improvements, or other actionable items that need to be tracked.
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
label: Description
|
||||
description: |
|
||||
Provide a clear and detailed description of the task that needs to be accomplished.
|
||||
|
||||
Be specific about what needs to be done, why it's important, and any constraints or requirements.
|
||||
placeholder: |
|
||||
Describe the task, including:
|
||||
- What needs to be done
|
||||
- Why this task is needed
|
||||
- Expected outcome
|
||||
- Any constraints or requirements
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: additional_context
|
||||
attributes:
|
||||
label: Additional context
|
||||
description: |
|
||||
Any additional information, links, research, or context that would be helpful.
|
||||
|
||||
Include links to related issues, research, prototypes, roadmap opportunities etc.
|
||||
placeholder: |
|
||||
- Roadmap opportunity: [link]
|
||||
- Epic: [link]
|
||||
- Feature request: [link]
|
||||
- Technical design documents: [link]
|
||||
- Prototype/mockup: [link]
|
||||
- Dependencies: [links]
|
||||
validations:
|
||||
required: false
|
592
.github/copilot-instructions.md
vendored
Normal file
592
.github/copilot-instructions.md
vendored
Normal file
@@ -0,0 +1,592 @@
|
||||
# GitHub Copilot & Claude Code Instructions
|
||||
|
||||
You are an assistant helping with development of the Home Assistant frontend. The frontend is built using Lit-based Web Components and TypeScript, providing a responsive and performant interface for home automation control.
|
||||
|
||||
## Table of Contents
|
||||
|
||||
- [Quick Reference](#quick-reference)
|
||||
- [Core Architecture](#core-architecture)
|
||||
- [Development Standards](#development-standards)
|
||||
- [Component Library](#component-library)
|
||||
- [Common Patterns](#common-patterns)
|
||||
- [Text and Copy Guidelines](#text-and-copy-guidelines)
|
||||
- [Development Workflow](#development-workflow)
|
||||
- [Review Guidelines](#review-guidelines)
|
||||
|
||||
## Quick Reference
|
||||
|
||||
### Essential Commands
|
||||
|
||||
```bash
|
||||
yarn lint # ESLint + Prettier + TypeScript + Lit
|
||||
yarn format # Auto-fix ESLint + Prettier
|
||||
yarn lint:types # TypeScript compiler
|
||||
yarn test # Vitest
|
||||
script/develop # Development server
|
||||
```
|
||||
|
||||
### Component Prefixes
|
||||
|
||||
- `ha-` - Home Assistant components
|
||||
- `hui-` - Lovelace UI components
|
||||
- `dialog-` - Dialog components
|
||||
|
||||
### Import Patterns
|
||||
|
||||
```typescript
|
||||
import type { HomeAssistant } from "../types";
|
||||
import { fireEvent } from "../common/dom/fire_event";
|
||||
import { showAlertDialog } from "../dialogs/generic/show-alert-dialog";
|
||||
```
|
||||
|
||||
## Core Architecture
|
||||
|
||||
The Home Assistant frontend is a modern web application that:
|
||||
|
||||
- Uses Web Components (custom elements) built with Lit framework
|
||||
- Is written entirely in TypeScript with strict type checking
|
||||
- Communicates with the backend via WebSocket API
|
||||
- Provides comprehensive theming and internationalization
|
||||
|
||||
## Development Standards
|
||||
|
||||
### Code Quality Requirements
|
||||
|
||||
**Linting and Formatting (Enforced by Tools)**
|
||||
|
||||
- ESLint config extends Airbnb, TypeScript strict, Lit, Web Components, Accessibility
|
||||
- Prettier with ES5 trailing commas enforced
|
||||
- No console statements (`no-console: "error"`) - use proper logging
|
||||
- Import organization: No unused imports, consistent type imports
|
||||
|
||||
**Naming Conventions**
|
||||
|
||||
- PascalCase for types and classes
|
||||
- camelCase for variables, methods
|
||||
- Private methods require leading underscore
|
||||
- Public methods forbid leading underscore
|
||||
|
||||
### TypeScript Usage
|
||||
|
||||
- **Always use strict TypeScript**: Enable all strict flags, avoid `any` types
|
||||
- **Proper type imports**: Use `import type` for type-only imports
|
||||
- **Define interfaces**: Create proper interfaces for data structures
|
||||
- **Type component properties**: All Lit properties must be properly typed
|
||||
- **No unused variables**: Prefix with `_` if intentionally unused
|
||||
- **Consistent imports**: Use `@typescript-eslint/consistent-type-imports`
|
||||
|
||||
```typescript
|
||||
// Good
|
||||
import type { HomeAssistant } from "../types";
|
||||
|
||||
interface EntityConfig {
|
||||
entity: string;
|
||||
name?: string;
|
||||
}
|
||||
|
||||
@property({ type: Object })
|
||||
hass!: HomeAssistant;
|
||||
|
||||
// Bad
|
||||
@property()
|
||||
hass: any;
|
||||
```
|
||||
|
||||
### Web Components with Lit
|
||||
|
||||
- **Use Lit 3.x patterns**: Follow modern Lit practices
|
||||
- **Extend appropriate base classes**: Use `LitElement`, `SubscribeMixin`, or other mixins as needed
|
||||
- **Define custom element names**: Use `ha-` prefix for components
|
||||
|
||||
```typescript
|
||||
@customElement("ha-my-component")
|
||||
export class HaMyComponent extends LitElement {
|
||||
@property({ attribute: false })
|
||||
hass!: HomeAssistant;
|
||||
|
||||
@state()
|
||||
private _config?: MyComponentConfig;
|
||||
|
||||
static get styles() {
|
||||
return css`
|
||||
:host {
|
||||
display: block;
|
||||
}
|
||||
`;
|
||||
}
|
||||
|
||||
render() {
|
||||
return html`<div>Content</div>`;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Component Guidelines
|
||||
|
||||
- **Use composition**: Prefer composition over inheritance
|
||||
- **Lazy load panels**: Heavy panels should be dynamically imported
|
||||
- **Optimize renders**: Use `@state()` for internal state, `@property()` for public API
|
||||
- **Handle loading states**: Always show appropriate loading indicators
|
||||
- **Support themes**: Use CSS custom properties from theme
|
||||
|
||||
### Data Management
|
||||
|
||||
- **Use WebSocket API**: All backend communication via home-assistant-js-websocket
|
||||
- **Cache appropriately**: Use collections and caching for frequently accessed data
|
||||
- **Handle errors gracefully**: All API calls should have error handling
|
||||
- **Update real-time**: Subscribe to state changes for live updates
|
||||
|
||||
```typescript
|
||||
// Good
|
||||
try {
|
||||
const result = await fetchEntityRegistry(this.hass.connection);
|
||||
this._processResult(result);
|
||||
} catch (err) {
|
||||
showAlertDialog(this, {
|
||||
text: `Failed to load: ${err.message}`,
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
### Styling Guidelines
|
||||
|
||||
- **Use CSS custom properties**: Leverage the theme system
|
||||
- **Mobile-first responsive**: Design for mobile, enhance for desktop
|
||||
- **Follow Material Design**: Use Material Web Components where appropriate
|
||||
- **Support RTL**: Ensure all layouts work in RTL languages
|
||||
|
||||
```typescript
|
||||
static get styles() {
|
||||
return css`
|
||||
:host {
|
||||
--spacing: 16px;
|
||||
padding: var(--spacing);
|
||||
color: var(--primary-text-color);
|
||||
background-color: var(--card-background-color);
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
:host {
|
||||
--spacing: 8px;
|
||||
}
|
||||
}
|
||||
`;
|
||||
}
|
||||
```
|
||||
|
||||
### Performance Best Practices
|
||||
|
||||
- **Code split**: Split code at the panel/dialog level
|
||||
- **Lazy load**: Use dynamic imports for heavy components
|
||||
- **Optimize bundle**: Keep initial bundle size minimal
|
||||
- **Use virtual scrolling**: For long lists, implement virtual scrolling
|
||||
- **Memoize computations**: Cache expensive calculations
|
||||
|
||||
### Testing Requirements
|
||||
|
||||
- **Write tests**: Add tests for data processing and utilities
|
||||
- **Test with Vitest**: Use the established test framework
|
||||
- **Mock appropriately**: Mock WebSocket connections and API calls
|
||||
- **Test accessibility**: Ensure components are accessible
|
||||
|
||||
## Component Library
|
||||
|
||||
### Dialog Components
|
||||
|
||||
**Available Dialog Types:**
|
||||
|
||||
- `ha-md-dialog` - Preferred for new code (Material Design 3)
|
||||
- `ha-dialog` - Legacy component still widely used
|
||||
|
||||
**Opening Dialogs (Fire Event Pattern - Recommended):**
|
||||
|
||||
```typescript
|
||||
fireEvent(this, "show-dialog", {
|
||||
dialogTag: "dialog-example",
|
||||
dialogImport: () => import("./dialog-example"),
|
||||
dialogParams: { title: "Example", data: someData },
|
||||
});
|
||||
```
|
||||
|
||||
**Dialog Implementation Requirements:**
|
||||
|
||||
- Implement `HassDialog<T>` interface
|
||||
- Use `createCloseHeading()` for standard headers
|
||||
- Import `haStyleDialog` for consistent styling
|
||||
- Return `nothing` when no params (loading state)
|
||||
- Fire `dialog-closed` event when closing
|
||||
- Add `dialogInitialFocus` for accessibility
|
||||
|
||||
````
|
||||
|
||||
### Form Component (ha-form)
|
||||
- Schema-driven using `HaFormSchema[]`
|
||||
- Supports entity, device, area, target, number, boolean, time, action, text, object, select, icon, media, location selectors
|
||||
- Built-in validation with error display
|
||||
- Use `dialogInitialFocus` in dialogs
|
||||
- Use `computeLabel`, `computeError`, `computeHelper` for translations
|
||||
|
||||
```typescript
|
||||
<ha-form
|
||||
.hass=${this.hass}
|
||||
.data=${this._data}
|
||||
.schema=${this._schema}
|
||||
.error=${this._errors}
|
||||
.computeLabel=${(schema) => this.hass.localize(`ui.panel.${schema.name}`)}
|
||||
@value-changed=${this._valueChanged}
|
||||
></ha-form>
|
||||
````
|
||||
|
||||
### Alert Component (ha-alert)
|
||||
|
||||
- Types: `error`, `warning`, `info`, `success`
|
||||
- Properties: `title`, `alert-type`, `dismissable`, `icon`, `action`, `rtl`
|
||||
- Content announced by screen readers when dynamically displayed
|
||||
|
||||
```html
|
||||
<ha-alert alert-type="error">Error message</ha-alert>
|
||||
<ha-alert alert-type="warning" title="Warning">Description</ha-alert>
|
||||
<ha-alert alert-type="success" dismissable>Success message</ha-alert>
|
||||
```
|
||||
|
||||
## Common Patterns
|
||||
|
||||
### Creating a Panel
|
||||
|
||||
```typescript
|
||||
@customElement("ha-panel-myfeature")
|
||||
export class HaPanelMyFeature extends SubscribeMixin(LitElement) {
|
||||
@property({ attribute: false })
|
||||
hass!: HomeAssistant;
|
||||
|
||||
@property({ type: Boolean, reflect: true })
|
||||
narrow!: boolean;
|
||||
|
||||
@property()
|
||||
route!: Route;
|
||||
|
||||
hassSubscribe() {
|
||||
return [
|
||||
subscribeEntityRegistry(this.hass.connection, (entities) => {
|
||||
this._entities = entities;
|
||||
}),
|
||||
];
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Creating a Dialog
|
||||
|
||||
```typescript
|
||||
@customElement("dialog-my-feature")
|
||||
export class DialogMyFeature
|
||||
extends LitElement
|
||||
implements HassDialog<MyDialogParams>
|
||||
{
|
||||
@property({ attribute: false })
|
||||
hass!: HomeAssistant;
|
||||
|
||||
@state()
|
||||
private _params?: MyDialogParams;
|
||||
|
||||
public async showDialog(params: MyDialogParams): Promise<void> {
|
||||
this._params = params;
|
||||
}
|
||||
|
||||
public closeDialog(): void {
|
||||
this._params = undefined;
|
||||
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
||||
}
|
||||
|
||||
protected render() {
|
||||
if (!this._params) {
|
||||
return nothing;
|
||||
}
|
||||
|
||||
return html`
|
||||
<ha-dialog
|
||||
open
|
||||
@closed=${this.closeDialog}
|
||||
.heading=${createCloseHeading(this.hass, this._params.title)}
|
||||
>
|
||||
<!-- Dialog content -->
|
||||
<ha-button @click=${this.closeDialog} slot="secondaryAction">
|
||||
${this.hass.localize("ui.common.cancel")}
|
||||
</ha-button>
|
||||
<ha-button @click=${this._submit} slot="primaryAction">
|
||||
${this.hass.localize("ui.common.save")}
|
||||
</ha-button>
|
||||
</ha-dialog>
|
||||
`;
|
||||
}
|
||||
|
||||
static styles = [haStyleDialog, css``];
|
||||
}
|
||||
```
|
||||
|
||||
### Dialog Design Guidelines
|
||||
|
||||
- Max width: 560px (Alert/confirmation: 320px fixed width)
|
||||
- Close X-icon on top left (all screen sizes)
|
||||
- Submit button grouped with cancel at bottom right
|
||||
- Keep button labels short: "Save", "Delete", "Enable"
|
||||
- Destructive actions use red warning button
|
||||
- Always use a title (best practice)
|
||||
- Strive for minimalism
|
||||
|
||||
#### Creating a Lovelace Card
|
||||
|
||||
**Purpose**: Cards allow users to tell different stories about their house (based on gallery)
|
||||
|
||||
```typescript
|
||||
@customElement("hui-my-card")
|
||||
export class HuiMyCard extends LitElement implements LovelaceCard {
|
||||
@property({ attribute: false })
|
||||
hass!: HomeAssistant;
|
||||
|
||||
@state()
|
||||
private _config?: MyCardConfig;
|
||||
|
||||
public setConfig(config: MyCardConfig): void {
|
||||
if (!config.entity) {
|
||||
throw new Error("Entity required");
|
||||
}
|
||||
this._config = config;
|
||||
}
|
||||
|
||||
public getCardSize(): number {
|
||||
return 3; // Height in grid units
|
||||
}
|
||||
|
||||
// Optional: Editor for card configuration
|
||||
public static getConfigElement(): LovelaceCardEditor {
|
||||
return document.createElement("hui-my-card-editor");
|
||||
}
|
||||
|
||||
// Optional: Stub config for card picker
|
||||
public static getStubConfig(): object {
|
||||
return { entity: "" };
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Card Guidelines:**
|
||||
|
||||
- Cards are highly customizable for different households
|
||||
- Implement `LovelaceCard` interface with `setConfig()` and `getCardSize()`
|
||||
- Use proper error handling in `setConfig()`
|
||||
- Consider all possible states (loading, error, unavailable)
|
||||
- Support different entity types and states
|
||||
- Follow responsive design principles
|
||||
- Add configuration editor when needed
|
||||
|
||||
### Internationalization
|
||||
|
||||
- **Use localize**: Always use the localization system
|
||||
- **Add translation keys**: Add keys to src/translations/en.json
|
||||
- **Support placeholders**: Use proper placeholder syntax
|
||||
|
||||
```typescript
|
||||
this.hass.localize("ui.panel.config.updates.update_available", {
|
||||
count: 5,
|
||||
});
|
||||
```
|
||||
|
||||
### Accessibility
|
||||
|
||||
- **ARIA labels**: Add appropriate ARIA labels
|
||||
- **Keyboard navigation**: Ensure all interactions work with keyboard
|
||||
- **Screen reader support**: Test with screen readers
|
||||
- **Color contrast**: Meet WCAG AA standards
|
||||
|
||||
## Development Workflow
|
||||
|
||||
### Setup and Commands
|
||||
|
||||
1. **Setup**: `script/setup` - Install dependencies
|
||||
2. **Develop**: `script/develop` - Development server
|
||||
3. **Lint**: `yarn lint` - Run all linting before committing
|
||||
4. **Test**: `yarn test` - Add and run tests
|
||||
5. **Build**: `script/build_frontend` - Test production build
|
||||
|
||||
### Common Pitfalls to Avoid
|
||||
|
||||
- Don't use `querySelector` - Use refs or component properties
|
||||
- Don't manipulate DOM directly - Let Lit handle rendering
|
||||
- Don't use global styles - Scope styles to components
|
||||
- Don't block the main thread - Use web workers for heavy computation
|
||||
- Don't ignore TypeScript errors - Fix all type issues
|
||||
|
||||
### Security Best Practices
|
||||
|
||||
- Sanitize HTML - Never use `unsafeHTML` with user content
|
||||
- Validate inputs - Always validate user inputs
|
||||
- Use HTTPS - All external resources must use HTTPS
|
||||
- CSP compliance - Ensure code works with Content Security Policy
|
||||
|
||||
### Text and Copy Guidelines
|
||||
|
||||
#### Terminology Standards
|
||||
|
||||
**Delete vs Remove** (Based on gallery/src/pages/Text/remove-delete-add-create.markdown)
|
||||
|
||||
- **Use "Remove"** for actions that can be restored or reapplied:
|
||||
- Removing a user's permission
|
||||
- Removing a user from a group
|
||||
- Removing links between items
|
||||
- Removing a widget from dashboard
|
||||
- Removing an item from a cart
|
||||
- **Use "Delete"** for permanent, non-recoverable actions:
|
||||
- Deleting a field
|
||||
- Deleting a value in a field
|
||||
- Deleting a task
|
||||
- Deleting a group
|
||||
- Deleting a permission
|
||||
- Deleting a calendar event
|
||||
|
||||
**Create vs Add** (Create pairs with Delete, Add pairs with Remove)
|
||||
|
||||
- **Use "Add"** for already-existing items:
|
||||
- Adding a permission to a user
|
||||
- Adding a user to a group
|
||||
- Adding links between items
|
||||
- Adding a widget to dashboard
|
||||
- Adding an item to a cart
|
||||
- **Use "Create"** for something made from scratch:
|
||||
- Creating a new field
|
||||
- Creating a new task
|
||||
- Creating a new group
|
||||
- Creating a new permission
|
||||
- Creating a new calendar event
|
||||
|
||||
#### Writing Style (Consistent with Home Assistant Documentation)
|
||||
|
||||
- **Use American English**: Standard spelling and terminology
|
||||
- **Friendly, informational tone**: Be inspiring, personal, comforting, engaging
|
||||
- **Address users directly**: Use "you" and "your"
|
||||
- **Be inclusive**: Objective, non-discriminatory language
|
||||
- **Be concise**: Use clear, direct language
|
||||
- **Be consistent**: Follow established terminology patterns
|
||||
- **Use active voice**: "Delete the automation" not "The automation should be deleted"
|
||||
- **Avoid jargon**: Use terms familiar to home automation users
|
||||
|
||||
#### Language Standards
|
||||
|
||||
- **Always use "Home Assistant"** in full, never "HA" or "HASS"
|
||||
- **Avoid abbreviations**: Spell out terms when possible
|
||||
- **Use sentence case everywhere**: Titles, headings, buttons, labels, UI elements
|
||||
- ✅ "Create new automation"
|
||||
- ❌ "Create New Automation"
|
||||
- ✅ "Device settings"
|
||||
- ❌ "Device Settings"
|
||||
- **Oxford comma**: Use in lists (item 1, item 2, and item 3)
|
||||
- **Replace Latin terms**: Use "like" instead of "e.g.", "for example" instead of "i.e."
|
||||
- **Avoid CAPS for emphasis**: Use bold or italics instead
|
||||
- **Write for all skill levels**: Both technical and non-technical users
|
||||
|
||||
#### Key Terminology
|
||||
|
||||
- **"add-on"** (hyphenated, not "addon")
|
||||
- **"integration"** (preferred over "component")
|
||||
- **Technical terms**: Use lowercase (automation, entity, device, service)
|
||||
|
||||
#### Translation Considerations
|
||||
|
||||
- **Add translation keys**: All user-facing text must be translatable
|
||||
- **Use placeholders**: Support dynamic content in translations
|
||||
- **Keep context**: Provide enough context for translators
|
||||
|
||||
```typescript
|
||||
// Good
|
||||
this.hass.localize("ui.panel.config.automation.delete_confirm", {
|
||||
name: automation.alias,
|
||||
});
|
||||
|
||||
// Bad - hardcoded text
|
||||
("Are you sure you want to delete this automation?");
|
||||
```
|
||||
|
||||
### Common Review Issues (From PR Analysis)
|
||||
|
||||
#### User Experience and Accessibility
|
||||
|
||||
- **Form validation**: Always provide proper field labels and validation feedback
|
||||
- **Form accessibility**: Prevent password managers from incorrectly identifying fields
|
||||
- **Loading states**: Show clear progress indicators during async operations
|
||||
- **Error handling**: Display meaningful error messages when operations fail
|
||||
- **Mobile responsiveness**: Ensure components work well on small screens
|
||||
- **Hit targets**: Make clickable areas large enough for touch interaction
|
||||
- **Visual feedback**: Provide clear indication of interactive states
|
||||
|
||||
#### Dialog and Modal Patterns
|
||||
|
||||
- **Dialog width constraints**: Respect minimum and maximum width requirements
|
||||
- **Interview progress**: Show clear progress for multi-step operations
|
||||
- **State persistence**: Handle dialog state properly during background operations
|
||||
- **Cancel behavior**: Ensure cancel/close buttons work consistently
|
||||
- **Form prefilling**: Use smart defaults but allow user override
|
||||
|
||||
#### Component Design Patterns
|
||||
|
||||
- **Terminology consistency**: Use "Join"/"Apply" instead of "Group" when appropriate
|
||||
- **Visual hierarchy**: Ensure proper font sizes and spacing ratios
|
||||
- **Grid alignment**: Components should align to the design grid system
|
||||
- **Badge placement**: Position badges and indicators consistently
|
||||
- **Color theming**: Respect theme variables and design system colors
|
||||
|
||||
#### Code Quality Issues
|
||||
|
||||
- **Null checking**: Always check if entities exist before accessing properties
|
||||
- **TypeScript safety**: Handle potentially undefined array/object access
|
||||
- **Import organization**: Remove unused imports and use proper type imports
|
||||
- **Event handling**: Properly subscribe and unsubscribe from events
|
||||
- **Memory leaks**: Clean up subscriptions and event listeners
|
||||
|
||||
#### Configuration and Props
|
||||
|
||||
- **Optional parameters**: Make configuration fields optional when sensible
|
||||
- **Smart defaults**: Provide reasonable default values
|
||||
- **Future extensibility**: Design APIs that can be extended later
|
||||
- **Validation**: Validate configuration before applying changes
|
||||
|
||||
## Review Guidelines
|
||||
|
||||
### Core Requirements Checklist
|
||||
|
||||
- [ ] TypeScript strict mode passes (`yarn lint:types`)
|
||||
- [ ] No ESLint errors or warnings (`yarn lint:eslint`)
|
||||
- [ ] Prettier formatting applied (`yarn lint:prettier`)
|
||||
- [ ] Lit analyzer passes (`yarn lint:lit`)
|
||||
- [ ] Component follows Lit best practices
|
||||
- [ ] Proper error handling implemented
|
||||
- [ ] Loading states handled
|
||||
- [ ] Mobile responsive
|
||||
- [ ] Theme variables used
|
||||
- [ ] Translations added
|
||||
- [ ] Accessible to screen readers
|
||||
- [ ] Tests added (where applicable)
|
||||
- [ ] No console statements (use proper logging)
|
||||
- [ ] Unused imports removed
|
||||
- [ ] Proper naming conventions
|
||||
|
||||
### Text and Copy Checklist
|
||||
|
||||
- [ ] Follows terminology guidelines (Delete vs Remove, Create vs Add)
|
||||
- [ ] Localization keys added for all user-facing text
|
||||
- [ ] Uses "Home Assistant" (never "HA" or "HASS")
|
||||
- [ ] Sentence case for ALL text (titles, headings, buttons, labels)
|
||||
- [ ] American English spelling
|
||||
- [ ] Friendly, informational tone
|
||||
- [ ] Avoids abbreviations and jargon
|
||||
- [ ] Correct terminology (add-on not addon, integration not component)
|
||||
|
||||
### Component-Specific Checks
|
||||
|
||||
- [ ] Dialogs implement HassDialog interface
|
||||
- [ ] Dialog styling uses haStyleDialog
|
||||
- [ ] Dialog accessibility includes dialogInitialFocus
|
||||
- [ ] ha-alert used correctly for messages
|
||||
- [ ] ha-form uses proper schema structure
|
||||
- [ ] Components handle all states (loading, error, unavailable)
|
||||
- [ ] Entity existence checked before property access
|
||||
- [ ] Event subscriptions properly cleaned up
|
4
.github/workflows/cast_deployment.yaml
vendored
4
.github/workflows/cast_deployment.yaml
vendored
@@ -35,7 +35,7 @@ jobs:
|
||||
run: yarn install --immutable
|
||||
|
||||
- name: Build Cast
|
||||
run: ./node_modules/.bin/gulp build-cast
|
||||
run: yarn run-task build-cast
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
@@ -70,7 +70,7 @@ jobs:
|
||||
run: yarn install --immutable
|
||||
|
||||
- name: Build Cast
|
||||
run: ./node_modules/.bin/gulp build-cast
|
||||
run: yarn run-task build-cast
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
|
8
.github/workflows/ci.yaml
vendored
8
.github/workflows/ci.yaml
vendored
@@ -35,7 +35,7 @@ jobs:
|
||||
- name: Check for duplicate dependencies
|
||||
run: yarn dedupe --check
|
||||
- name: Build resources
|
||||
run: ./node_modules/.bin/gulp gen-icons-json build-translations build-locale-data gather-gallery-pages
|
||||
run: yarn run-task gen-icons-json build-translations build-locale-data gather-gallery-pages
|
||||
- name: Setup lint cache
|
||||
uses: actions/cache@v4.2.3
|
||||
with:
|
||||
@@ -67,7 +67,7 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: yarn install --immutable
|
||||
- name: Build resources
|
||||
run: ./node_modules/.bin/gulp gen-icons-json build-translations build-locale-data
|
||||
run: yarn run-task gen-icons-json build-translations build-locale-data
|
||||
- name: Run Tests
|
||||
run: yarn run test
|
||||
build:
|
||||
@@ -85,7 +85,7 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: yarn install --immutable
|
||||
- name: Build Application
|
||||
run: ./node_modules/.bin/gulp build-app
|
||||
run: yarn run-task build-app
|
||||
env:
|
||||
IS_TEST: "true"
|
||||
- name: Upload bundle stats
|
||||
@@ -109,7 +109,7 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: yarn install --immutable
|
||||
- name: Build Application
|
||||
run: ./node_modules/.bin/gulp build-hassio
|
||||
run: yarn run-task build-hassio
|
||||
env:
|
||||
IS_TEST: "true"
|
||||
- name: Upload bundle stats
|
||||
|
4
.github/workflows/demo_deployment.yaml
vendored
4
.github/workflows/demo_deployment.yaml
vendored
@@ -36,7 +36,7 @@ jobs:
|
||||
run: yarn install --immutable
|
||||
|
||||
- name: Build Demo
|
||||
run: ./node_modules/.bin/gulp build-demo
|
||||
run: yarn run-task build-demo
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
@@ -71,7 +71,7 @@ jobs:
|
||||
run: yarn install --immutable
|
||||
|
||||
- name: Build Demo
|
||||
run: ./node_modules/.bin/gulp build-demo
|
||||
run: yarn run-task build-demo
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
|
2
.github/workflows/design_deployment.yaml
vendored
2
.github/workflows/design_deployment.yaml
vendored
@@ -28,7 +28,7 @@ jobs:
|
||||
run: yarn install --immutable
|
||||
|
||||
- name: Build Gallery
|
||||
run: ./node_modules/.bin/gulp build-gallery
|
||||
run: yarn run-task build-gallery
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
|
2
.github/workflows/design_preview.yaml
vendored
2
.github/workflows/design_preview.yaml
vendored
@@ -33,7 +33,7 @@ jobs:
|
||||
run: yarn install --immutable
|
||||
|
||||
- name: Build Gallery
|
||||
run: ./node_modules/.bin/gulp build-gallery
|
||||
run: yarn run-task build-gallery
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
|
2
.github/workflows/relative-ci.yaml
vendored
2
.github/workflows/relative-ci.yaml
vendored
@@ -17,7 +17,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Send bundle stats and build information to RelativeCI
|
||||
uses: relative-ci/agent-action@v2.2.0
|
||||
uses: relative-ci/agent-action@v3.0.0
|
||||
with:
|
||||
key: ${{ secrets[format('RELATIVE_CI_KEY_{0}_{1}', matrix.bundle, matrix.build)] }}
|
||||
token: ${{ github.token }}
|
||||
|
6
.github/workflows/release.yaml
vendored
6
.github/workflows/release.yaml
vendored
@@ -55,7 +55,7 @@ jobs:
|
||||
script/release
|
||||
|
||||
- name: Upload release assets
|
||||
uses: softprops/action-gh-release@v2.2.2
|
||||
uses: softprops/action-gh-release@v2.3.2
|
||||
with:
|
||||
files: |
|
||||
dist/*.whl
|
||||
@@ -107,7 +107,7 @@ jobs:
|
||||
- name: Tar folder
|
||||
run: tar -czf landing-page/home_assistant_frontend_landingpage-${{ github.event.release.tag_name }}.tar.gz -C landing-page/dist .
|
||||
- name: Upload release asset
|
||||
uses: softprops/action-gh-release@v2.2.2
|
||||
uses: softprops/action-gh-release@v2.3.2
|
||||
with:
|
||||
files: landing-page/home_assistant_frontend_landingpage-${{ github.event.release.tag_name }}.tar.gz
|
||||
|
||||
@@ -136,6 +136,6 @@ jobs:
|
||||
- name: Tar folder
|
||||
run: tar -czf hassio/home_assistant_frontend_supervisor-${{ github.event.release.tag_name }}.tar.gz -C hassio/build .
|
||||
- name: Upload release asset
|
||||
uses: softprops/action-gh-release@v2.2.2
|
||||
uses: softprops/action-gh-release@v2.3.2
|
||||
with:
|
||||
files: hassio/home_assistant_frontend_supervisor-${{ github.event.release.tag_name }}.tar.gz
|
||||
|
58
.github/workflows/restrict-task-creation.yml
vendored
Normal file
58
.github/workflows/restrict-task-creation.yml
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
name: Restrict task creation
|
||||
|
||||
# yamllint disable-line rule:truthy
|
||||
on:
|
||||
issues:
|
||||
types: [opened]
|
||||
|
||||
jobs:
|
||||
check-authorization:
|
||||
runs-on: ubuntu-latest
|
||||
# Only run if this is a Task issue type (from the issue form)
|
||||
if: github.event.issue.issue_type == 'Task'
|
||||
steps:
|
||||
- name: Check if user is authorized
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const issueAuthor = context.payload.issue.user.login;
|
||||
|
||||
// Check if user is an organization member
|
||||
try {
|
||||
await github.rest.orgs.checkMembershipForUser({
|
||||
org: 'home-assistant',
|
||||
username: issueAuthor
|
||||
});
|
||||
console.log(`✅ ${issueAuthor} is an organization member`);
|
||||
return; // Authorized
|
||||
} catch (error) {
|
||||
console.log(`❌ ${issueAuthor} is not authorized to create Task issues`);
|
||||
}
|
||||
|
||||
// Close the issue with a comment
|
||||
await github.rest.issues.createComment({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: context.issue.number,
|
||||
body: `Hi @${issueAuthor}, thank you for your contribution!\n\n` +
|
||||
`Task issues are restricted to Open Home Foundation staff and authorized contributors.\n\n` +
|
||||
`If you would like to:\n` +
|
||||
`- Report a bug: Please use the [bug report form](https://github.com/home-assistant/frontend/issues/new?template=bug_report.yml)\n` +
|
||||
`- Request a feature: Please submit to [Feature Requests](https://github.com/orgs/home-assistant/discussions)\n\n` +
|
||||
`If you believe you should have access to create Task issues, please contact the maintainers.`
|
||||
});
|
||||
|
||||
await github.rest.issues.update({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: context.issue.number,
|
||||
state: 'closed'
|
||||
});
|
||||
|
||||
// Add a label to indicate this was auto-closed
|
||||
await github.rest.issues.addLabels({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: context.issue.number,
|
||||
labels: ['auto-closed']
|
||||
});
|
1
.github/workflows/translations.yaml
vendored
1
.github/workflows/translations.yaml
vendored
@@ -1,6 +1,7 @@
|
||||
name: Translations
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- dev
|
||||
|
4
.gitignore
vendored
4
.gitignore
vendored
@@ -53,3 +53,7 @@ src/cast/dev_const.ts
|
||||
|
||||
# test coverage
|
||||
test/coverage/
|
||||
|
||||
# AI tooling
|
||||
.claude
|
||||
|
||||
|
@@ -1 +1 @@
|
||||
yarn run lint-staged --relative --shell "/bin/bash"
|
||||
yarn run lint-staged --relative
|
||||
|
@@ -1,18 +0,0 @@
|
||||
diff --git a/dist/hls.light.mjs b/dist/hls.light.mjs
|
||||
index eed9d788fafdb159975e1a2eb08ac88ba9c9ac33..ace881935e6665946f1c8110ebd2f739cde4427e 100644
|
||||
--- a/dist/hls.light.mjs
|
||||
+++ b/dist/hls.light.mjs
|
||||
@@ -20523,9 +20523,9 @@ class Hls {
|
||||
}
|
||||
Hls.defaultConfig = void 0;
|
||||
|
||||
-var KeySystemFormats = empty.KeySystemFormats;
|
||||
-var KeySystems = empty.KeySystems;
|
||||
-var SubtitleStreamController = empty.SubtitleStreamController;
|
||||
-var TimelineController = empty.TimelineController;
|
||||
+var KeySystemFormats = empty;
|
||||
+var KeySystems = empty;
|
||||
+var SubtitleStreamController = empty;
|
||||
+var TimelineController = empty;
|
||||
export { AbrController, AttrList, Cues as AudioStreamController, Cues as AudioTrackController, BasePlaylistController, BaseSegment, BaseStreamController, BufferController, Cues as CMCDController, CapLevelController, ChunkMetadata, ContentSteeringController, DateRange, Cues as EMEController, ErrorActionFlags, ErrorController, ErrorDetails, ErrorTypes, Events, FPSController, Fragment, Hls, HlsSkip, HlsUrlParameters, KeySystemFormats, KeySystems, Level, LevelDetails, LevelKey, LoadStats, MetadataSchema, NetworkErrorAction, Part, PlaylistLevelType, SubtitleStreamController, Cues as SubtitleTrackController, TimelineController, Hls as default, getMediaSource, isMSESupported, isSupported };
|
||||
//# sourceMappingURL=hls.light.mjs.map
|
File diff suppressed because one or more lines are too long
@@ -6,4 +6,4 @@ enableGlobalCache: false
|
||||
|
||||
nodeLinker: node-modules
|
||||
|
||||
yarnPath: .yarn/releases/yarn-4.9.1.cjs
|
||||
yarnPath: .yarn/releases/yarn-4.9.2.cjs
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import defineProvider from "@babel/helper-define-polyfill-provider";
|
||||
import { join } from "node:path";
|
||||
import paths from "../paths.cjs";
|
||||
import paths from "../paths";
|
||||
|
||||
const POLYFILL_DIR = join(paths.root_dir, "src/resources/polyfills");
|
||||
|
@@ -1,42 +1,41 @@
|
||||
const path = require("path");
|
||||
const env = require("./env.cjs");
|
||||
const paths = require("./paths.cjs");
|
||||
const { dependencies } = require("../package.json");
|
||||
import path from "node:path";
|
||||
import packageJson from "../package.json" assert { type: "json" };
|
||||
import { version } from "./env.ts";
|
||||
import paths, { dirname } from "./paths.ts";
|
||||
|
||||
const BABEL_PLUGINS = path.join(__dirname, "babel-plugins");
|
||||
const dependencies = packageJson.dependencies;
|
||||
|
||||
const BABEL_PLUGINS = path.join(dirname, "babel-plugins");
|
||||
|
||||
// GitHub base URL to use for production source maps
|
||||
// Nightly builds use the commit SHA, otherwise assumes there is a tag that matches the version
|
||||
module.exports.sourceMapURL = () => {
|
||||
const ref = env.version().endsWith("dev")
|
||||
export const sourceMapURL = () => {
|
||||
const ref = version().endsWith("dev")
|
||||
? process.env.GITHUB_SHA || "dev"
|
||||
: env.version();
|
||||
: version();
|
||||
return `https://raw.githubusercontent.com/home-assistant/frontend/${ref}/`;
|
||||
};
|
||||
|
||||
// Files from NPM Packages that should not be imported
|
||||
module.exports.ignorePackages = () => [];
|
||||
|
||||
// Files from NPM packages that we should replace with empty file
|
||||
module.exports.emptyPackages = ({ isHassioBuild }) =>
|
||||
export const emptyPackages = ({ isHassioBuild }) =>
|
||||
[
|
||||
require.resolve("@vaadin/vaadin-material-styles/typography.js"),
|
||||
require.resolve("@vaadin/vaadin-material-styles/font-icons.js"),
|
||||
import.meta.resolve("@vaadin/vaadin-material-styles/typography.js"),
|
||||
import.meta.resolve("@vaadin/vaadin-material-styles/font-icons.js"),
|
||||
// Icons in supervisor conflict with icons in HA so we don't load.
|
||||
isHassioBuild &&
|
||||
require.resolve(
|
||||
import.meta.resolve(
|
||||
path.resolve(paths.root_dir, "src/components/ha-icon.ts")
|
||||
),
|
||||
isHassioBuild &&
|
||||
require.resolve(
|
||||
import.meta.resolve(
|
||||
path.resolve(paths.root_dir, "src/components/ha-icon-picker.ts")
|
||||
),
|
||||
].filter(Boolean);
|
||||
|
||||
module.exports.definedVars = ({ isProdBuild, latestBuild, defineOverlay }) => ({
|
||||
export const definedVars = ({ isProdBuild, latestBuild, defineOverlay }) => ({
|
||||
__DEV__: !isProdBuild,
|
||||
__BUILD__: JSON.stringify(latestBuild ? "modern" : "legacy"),
|
||||
__VERSION__: JSON.stringify(env.version()),
|
||||
__VERSION__: JSON.stringify(version()),
|
||||
__DEMO__: false,
|
||||
__SUPERVISOR__: false,
|
||||
__BACKWARDS_COMPAT__: false,
|
||||
@@ -53,7 +52,7 @@ module.exports.definedVars = ({ isProdBuild, latestBuild, defineOverlay }) => ({
|
||||
...defineOverlay,
|
||||
});
|
||||
|
||||
module.exports.htmlMinifierOptions = {
|
||||
export const htmlMinifierOptions = {
|
||||
caseSensitive: true,
|
||||
collapseWhitespace: true,
|
||||
conservativeCollapse: true,
|
||||
@@ -65,16 +64,16 @@ module.exports.htmlMinifierOptions = {
|
||||
},
|
||||
};
|
||||
|
||||
module.exports.terserOptions = ({ latestBuild, isTestBuild }) => ({
|
||||
export const terserOptions = ({ latestBuild, isTestBuild }) => ({
|
||||
safari10: !latestBuild,
|
||||
ecma: latestBuild ? 2015 : 5,
|
||||
ecma: latestBuild ? (2015 as const) : (5 as const),
|
||||
module: latestBuild,
|
||||
format: { comments: false },
|
||||
sourceMap: !isTestBuild,
|
||||
});
|
||||
|
||||
/** @type {import('@rspack/core').SwcLoaderOptions} */
|
||||
module.exports.swcOptions = () => ({
|
||||
export const swcOptions = () => ({
|
||||
jsc: {
|
||||
loose: true,
|
||||
externalHelpers: true,
|
||||
@@ -86,11 +85,16 @@ module.exports.swcOptions = () => ({
|
||||
},
|
||||
});
|
||||
|
||||
module.exports.babelOptions = ({
|
||||
export const babelOptions = ({
|
||||
latestBuild,
|
||||
isProdBuild,
|
||||
isTestBuild,
|
||||
sw,
|
||||
}: {
|
||||
latestBuild?: boolean;
|
||||
isProdBuild?: boolean;
|
||||
isTestBuild?: boolean;
|
||||
sw?: boolean;
|
||||
}) => ({
|
||||
babelrc: false,
|
||||
compact: false,
|
||||
@@ -137,7 +141,7 @@ module.exports.babelOptions = ({
|
||||
"@polymer/polymer/lib/utils/html-tag.js": ["html"],
|
||||
},
|
||||
strictCSS: true,
|
||||
htmlMinifier: module.exports.htmlMinifierOptions,
|
||||
htmlMinifier: htmlMinifierOptions,
|
||||
failOnError: false, // we can turn this off in case of false positives
|
||||
},
|
||||
],
|
||||
@@ -160,7 +164,7 @@ module.exports.babelOptions = ({
|
||||
// themselves to prevent self-injection.
|
||||
plugins: [
|
||||
[
|
||||
path.join(BABEL_PLUGINS, "custom-polyfill-plugin.js"),
|
||||
path.join(BABEL_PLUGINS, "custom-polyfill-plugin.ts"),
|
||||
{ method: "usage-global" },
|
||||
],
|
||||
],
|
||||
@@ -221,8 +225,20 @@ const publicPath = (latestBuild, root = "") =>
|
||||
}
|
||||
*/
|
||||
|
||||
module.exports.config = {
|
||||
app({ isProdBuild, latestBuild, isStatsBuild, isTestBuild, isWDS }) {
|
||||
export const config = {
|
||||
app({
|
||||
isProdBuild,
|
||||
latestBuild,
|
||||
isStatsBuild,
|
||||
isTestBuild,
|
||||
isWDS,
|
||||
}: {
|
||||
isProdBuild?: boolean;
|
||||
latestBuild?: boolean;
|
||||
isStatsBuild?: boolean;
|
||||
isTestBuild?: boolean;
|
||||
isWDS?: boolean;
|
||||
}) {
|
||||
return {
|
||||
name: "frontend" + nameSuffix(latestBuild),
|
||||
entry: {
|
||||
@@ -257,7 +273,7 @@ module.exports.config = {
|
||||
outputPath: outputPath(paths.demo_output_root, latestBuild),
|
||||
publicPath: publicPath(latestBuild),
|
||||
defineOverlay: {
|
||||
__VERSION__: JSON.stringify(`DEMO-${env.version()}`),
|
||||
__VERSION__: JSON.stringify(`DEMO-${version()}`),
|
||||
__DEMO__: true,
|
||||
},
|
||||
isProdBuild,
|
||||
@@ -267,7 +283,7 @@ module.exports.config = {
|
||||
},
|
||||
|
||||
cast({ isProdBuild, latestBuild }) {
|
||||
const entry = {
|
||||
const entry: Record<string, string> = {
|
||||
launcher: path.resolve(paths.cast_dir, "src/launcher/entrypoint.ts"),
|
||||
media: path.resolve(paths.cast_dir, "src/media/entrypoint.ts"),
|
||||
};
|
@@ -1,34 +0,0 @@
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const paths = require("./paths.cjs");
|
||||
|
||||
const isTrue = (value) => value === "1" || value?.toLowerCase() === "true";
|
||||
|
||||
module.exports = {
|
||||
isProdBuild() {
|
||||
return (
|
||||
process.env.NODE_ENV === "production" || module.exports.isStatsBuild()
|
||||
);
|
||||
},
|
||||
isStatsBuild() {
|
||||
return isTrue(process.env.STATS);
|
||||
},
|
||||
isTestBuild() {
|
||||
return isTrue(process.env.IS_TEST);
|
||||
},
|
||||
isNetlify() {
|
||||
return isTrue(process.env.NETLIFY);
|
||||
},
|
||||
version() {
|
||||
const version = fs
|
||||
.readFileSync(path.resolve(paths.root_dir, "pyproject.toml"), "utf8")
|
||||
.match(/version\W+=\W"(\d{8}\.\d(?:\.dev)?)"/);
|
||||
if (!version) {
|
||||
throw Error("Version not found");
|
||||
}
|
||||
return version[1];
|
||||
},
|
||||
isDevContainer() {
|
||||
return isTrue(process.env.DEV_CONTAINER);
|
||||
},
|
||||
};
|
21
build-scripts/env.ts
Normal file
21
build-scripts/env.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import paths from "./paths.ts";
|
||||
|
||||
const isTrue = (value) => value === "1" || value?.toLowerCase() === "true";
|
||||
|
||||
export const isProdBuild = () =>
|
||||
process.env.NODE_ENV === "production" || isStatsBuild();
|
||||
export const isStatsBuild = () => isTrue(process.env.STATS);
|
||||
export const isTestBuild = () => isTrue(process.env.IS_TEST);
|
||||
export const isNetlify = () => isTrue(process.env.NETLIFY);
|
||||
export const version = () => {
|
||||
const pyProjectVersion = fs
|
||||
.readFileSync(path.resolve(paths.root_dir, "pyproject.toml"), "utf8")
|
||||
.match(/version\W+=\W"(\d{8}\.\d(?:\.dev)?)"/);
|
||||
if (!pyProjectVersion) {
|
||||
throw Error("Version not found");
|
||||
}
|
||||
return pyProjectVersion[1];
|
||||
};
|
||||
export const isDevContainer = () => isTrue(process.env.DEV_CONTAINER);
|
@@ -1,57 +0,0 @@
|
||||
import gulp from "gulp";
|
||||
import env from "../env.cjs";
|
||||
import "./clean.js";
|
||||
import "./compress.js";
|
||||
import "./entry-html.js";
|
||||
import "./gather-static.js";
|
||||
import "./gen-icons-json.js";
|
||||
import "./locale-data.js";
|
||||
import "./service-worker.js";
|
||||
import "./translations.js";
|
||||
import "./rspack.js";
|
||||
|
||||
gulp.task(
|
||||
"develop-app",
|
||||
gulp.series(
|
||||
async function setEnv() {
|
||||
process.env.NODE_ENV = "development";
|
||||
},
|
||||
"clean",
|
||||
gulp.parallel(
|
||||
"gen-service-worker-app-dev",
|
||||
"gen-icons-json",
|
||||
"gen-pages-app-dev",
|
||||
"build-translations",
|
||||
"build-locale-data"
|
||||
),
|
||||
"copy-static-app",
|
||||
"rspack-watch-app"
|
||||
)
|
||||
);
|
||||
|
||||
gulp.task(
|
||||
"build-app",
|
||||
gulp.series(
|
||||
async function setEnv() {
|
||||
process.env.NODE_ENV = "production";
|
||||
},
|
||||
"clean",
|
||||
gulp.parallel("gen-icons-json", "build-translations", "build-locale-data"),
|
||||
"copy-static-app",
|
||||
"rspack-prod-app",
|
||||
gulp.parallel("gen-pages-app-prod", "gen-service-worker-app-prod"),
|
||||
// Don't compress running tests
|
||||
...(env.isTestBuild() || env.isStatsBuild() ? [] : ["compress-app"])
|
||||
)
|
||||
);
|
||||
|
||||
gulp.task(
|
||||
"analyze-app",
|
||||
gulp.series(
|
||||
async function setEnv() {
|
||||
process.env.STATS = "1";
|
||||
},
|
||||
"clean",
|
||||
"rspack-prod-app"
|
||||
)
|
||||
);
|
54
build-scripts/gulp/app.ts
Normal file
54
build-scripts/gulp/app.ts
Normal file
@@ -0,0 +1,54 @@
|
||||
import { parallel, series } from "gulp";
|
||||
import { isStatsBuild, isTestBuild } from "../env.ts";
|
||||
import { clean } from "./clean.ts";
|
||||
import { compressApp } from "./compress.ts";
|
||||
import { genPagesAppDev, genPagesAppProd } from "./entry-html.ts";
|
||||
import { copyStaticApp } from "./gather-static.ts";
|
||||
import { genIconsJson } from "./gen-icons-json.ts";
|
||||
import { buildLocaleData } from "./locale-data.ts";
|
||||
import { rspackProdApp, rspackWatchApp } from "./rspack.ts";
|
||||
import {
|
||||
genServiceWorkerAppDev,
|
||||
genServiceWorkerAppProd,
|
||||
} from "./service-worker.ts";
|
||||
import { buildTranslations } from "./translations.ts";
|
||||
|
||||
// develop-app
|
||||
export const developApp = series(
|
||||
async () => {
|
||||
process.env.NODE_ENV = "development";
|
||||
},
|
||||
clean,
|
||||
parallel(
|
||||
genServiceWorkerAppDev,
|
||||
genIconsJson,
|
||||
genPagesAppDev,
|
||||
buildTranslations,
|
||||
buildLocaleData
|
||||
),
|
||||
copyStaticApp,
|
||||
rspackWatchApp
|
||||
);
|
||||
|
||||
// build-app
|
||||
export const buildApp = series(
|
||||
async () => {
|
||||
process.env.NODE_ENV = "production";
|
||||
},
|
||||
clean,
|
||||
parallel(genIconsJson, buildTranslations, buildLocaleData),
|
||||
copyStaticApp,
|
||||
rspackProdApp,
|
||||
parallel(genPagesAppProd, genServiceWorkerAppProd),
|
||||
// Don't compress running tests
|
||||
...(isTestBuild() || isStatsBuild() ? [] : [compressApp])
|
||||
);
|
||||
|
||||
// analyze-app
|
||||
export const analyzeApp = series(
|
||||
async () => {
|
||||
process.env.STATS = "1";
|
||||
},
|
||||
clean,
|
||||
rspackProdApp
|
||||
);
|
@@ -1,37 +0,0 @@
|
||||
import gulp from "gulp";
|
||||
import "./clean.js";
|
||||
import "./entry-html.js";
|
||||
import "./gather-static.js";
|
||||
import "./service-worker.js";
|
||||
import "./translations.js";
|
||||
import "./rspack.js";
|
||||
|
||||
gulp.task(
|
||||
"develop-cast",
|
||||
gulp.series(
|
||||
async function setEnv() {
|
||||
process.env.NODE_ENV = "development";
|
||||
},
|
||||
"clean-cast",
|
||||
"translations-enable-merge-backend",
|
||||
gulp.parallel("gen-icons-json", "build-translations", "build-locale-data"),
|
||||
"copy-static-cast",
|
||||
"gen-pages-cast-dev",
|
||||
"rspack-dev-server-cast"
|
||||
)
|
||||
);
|
||||
|
||||
gulp.task(
|
||||
"build-cast",
|
||||
gulp.series(
|
||||
async function setEnv() {
|
||||
process.env.NODE_ENV = "production";
|
||||
},
|
||||
"clean-cast",
|
||||
"translations-enable-merge-backend",
|
||||
gulp.parallel("gen-icons-json", "build-translations", "build-locale-data"),
|
||||
"copy-static-cast",
|
||||
"rspack-prod-cast",
|
||||
"gen-pages-cast-prod"
|
||||
)
|
||||
);
|
38
build-scripts/gulp/cast.ts
Normal file
38
build-scripts/gulp/cast.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { parallel, series } from "gulp";
|
||||
import { cleanCast } from "./clean.ts";
|
||||
import { genPagesCastDev, genPagesCastProd } from "./entry-html.ts";
|
||||
import { copyStaticCast } from "./gather-static.ts";
|
||||
import { genIconsJson } from "./gen-icons-json.ts";
|
||||
import { buildLocaleData } from "./locale-data.ts";
|
||||
import { rspackDevServerCast, rspackProdCast } from "./rspack.ts";
|
||||
import "./service-worker.ts";
|
||||
import {
|
||||
buildTranslations,
|
||||
translationsEnableMergeBackend,
|
||||
} from "./translations.ts";
|
||||
|
||||
// develop-cast
|
||||
export const developCast = series(
|
||||
async () => {
|
||||
process.env.NODE_ENV = "development";
|
||||
},
|
||||
cleanCast,
|
||||
translationsEnableMergeBackend,
|
||||
parallel(genIconsJson, buildTranslations, buildLocaleData),
|
||||
copyStaticCast,
|
||||
genPagesCastDev,
|
||||
rspackDevServerCast
|
||||
);
|
||||
|
||||
// build-cast
|
||||
export const buildCast = series(
|
||||
async () => {
|
||||
process.env.NODE_ENV = "production";
|
||||
},
|
||||
cleanCast,
|
||||
translationsEnableMergeBackend,
|
||||
parallel(genIconsJson, buildTranslations, buildLocaleData),
|
||||
copyStaticCast,
|
||||
rspackProdCast,
|
||||
genPagesCastProd
|
||||
);
|
@@ -1,51 +0,0 @@
|
||||
import { deleteSync } from "del";
|
||||
import gulp from "gulp";
|
||||
import paths from "../paths.cjs";
|
||||
import "./translations.js";
|
||||
|
||||
gulp.task(
|
||||
"clean",
|
||||
gulp.parallel("clean-translations", async () =>
|
||||
deleteSync([paths.app_output_root, paths.build_dir])
|
||||
)
|
||||
);
|
||||
|
||||
gulp.task(
|
||||
"clean-demo",
|
||||
gulp.parallel("clean-translations", async () =>
|
||||
deleteSync([paths.demo_output_root, paths.build_dir])
|
||||
)
|
||||
);
|
||||
|
||||
gulp.task(
|
||||
"clean-cast",
|
||||
gulp.parallel("clean-translations", async () =>
|
||||
deleteSync([paths.cast_output_root, paths.build_dir])
|
||||
)
|
||||
);
|
||||
|
||||
gulp.task("clean-hassio", async () =>
|
||||
deleteSync([paths.hassio_output_root, paths.build_dir])
|
||||
);
|
||||
|
||||
gulp.task(
|
||||
"clean-gallery",
|
||||
gulp.parallel("clean-translations", async () =>
|
||||
deleteSync([
|
||||
paths.gallery_output_root,
|
||||
paths.gallery_build,
|
||||
paths.build_dir,
|
||||
])
|
||||
)
|
||||
);
|
||||
|
||||
gulp.task(
|
||||
"clean-landing-page",
|
||||
gulp.parallel("clean-translations", async () =>
|
||||
deleteSync([
|
||||
paths.landingPage_output_root,
|
||||
paths.landingPage_build,
|
||||
paths.build_dir,
|
||||
])
|
||||
)
|
||||
);
|
31
build-scripts/gulp/clean.ts
Normal file
31
build-scripts/gulp/clean.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { deleteSync } from "del";
|
||||
import { parallel } from "gulp";
|
||||
import paths from "../paths.ts";
|
||||
import { cleanTranslations } from "./translations.ts";
|
||||
|
||||
export const clean = parallel(cleanTranslations, async () =>
|
||||
deleteSync([paths.app_output_root, paths.build_dir])
|
||||
);
|
||||
|
||||
export const cleanDemo = parallel(cleanTranslations, async () =>
|
||||
deleteSync([paths.demo_output_root, paths.build_dir])
|
||||
);
|
||||
|
||||
export const cleanCast = parallel(cleanTranslations, async () =>
|
||||
deleteSync([paths.cast_output_root, paths.build_dir])
|
||||
);
|
||||
|
||||
export const cleanHassio = async () =>
|
||||
deleteSync([paths.hassio_output_root, paths.build_dir]);
|
||||
|
||||
export const cleanGallery = parallel(cleanTranslations, async () =>
|
||||
deleteSync([paths.gallery_output_root, paths.gallery_build, paths.build_dir])
|
||||
);
|
||||
|
||||
export const cleanLandingPage = parallel(cleanTranslations, async () =>
|
||||
deleteSync([
|
||||
paths.landingPage_output_root,
|
||||
paths.landingPage_build,
|
||||
paths.build_dir,
|
||||
])
|
||||
);
|
@@ -1,10 +1,10 @@
|
||||
// Tasks to compress
|
||||
|
||||
import { constants } from "node:zlib";
|
||||
import gulp from "gulp";
|
||||
import { dest, parallel, src } from "gulp";
|
||||
import brotli from "gulp-brotli";
|
||||
import zopfli from "gulp-zopfli-green";
|
||||
import paths from "../paths.cjs";
|
||||
import { constants } from "node:zlib";
|
||||
import paths from "../paths.ts";
|
||||
|
||||
const filesGlob = "*.{js,json,css,svg,xml}";
|
||||
const brotliOptions = {
|
||||
@@ -16,27 +16,25 @@ const brotliOptions = {
|
||||
const zopfliOptions = { threshold: 150 };
|
||||
|
||||
const compressModern = (rootDir, modernDir, compress) =>
|
||||
gulp
|
||||
.src([`${modernDir}/**/${filesGlob}`, `${rootDir}/sw-modern.js`], {
|
||||
base: rootDir,
|
||||
allowEmpty: true,
|
||||
})
|
||||
src([`${modernDir}/**/${filesGlob}`, `${rootDir}/sw-modern.js`], {
|
||||
base: rootDir,
|
||||
allowEmpty: true,
|
||||
})
|
||||
.pipe(compress === "zopfli" ? zopfli(zopfliOptions) : brotli(brotliOptions))
|
||||
.pipe(gulp.dest(rootDir));
|
||||
.pipe(dest(rootDir));
|
||||
|
||||
const compressOther = (rootDir, modernDir, compress) =>
|
||||
gulp
|
||||
.src(
|
||||
[
|
||||
`${rootDir}/**/${filesGlob}`,
|
||||
`!${modernDir}/**/${filesGlob}`,
|
||||
`!${rootDir}/{sw-modern,service_worker}.js`,
|
||||
`${rootDir}/{authorize,onboarding}.html`,
|
||||
],
|
||||
{ base: rootDir, allowEmpty: true }
|
||||
)
|
||||
src(
|
||||
[
|
||||
`${rootDir}/**/${filesGlob}`,
|
||||
`!${modernDir}/**/${filesGlob}`,
|
||||
`!${rootDir}/{sw-modern,service_worker}.js`,
|
||||
`${rootDir}/{authorize,onboarding}.html`,
|
||||
],
|
||||
{ base: rootDir, allowEmpty: true }
|
||||
)
|
||||
.pipe(compress === "zopfli" ? zopfli(zopfliOptions) : brotli(brotliOptions))
|
||||
.pipe(gulp.dest(rootDir));
|
||||
.pipe(dest(rootDir));
|
||||
|
||||
const compressAppModernBrotli = () =>
|
||||
compressModern(paths.app_output_root, paths.app_output_latest, "brotli");
|
||||
@@ -66,21 +64,16 @@ const compressHassioOtherBrotli = () =>
|
||||
const compressHassioOtherZopfli = () =>
|
||||
compressOther(paths.hassio_output_root, paths.hassio_output_latest, "zopfli");
|
||||
|
||||
gulp.task(
|
||||
"compress-app",
|
||||
gulp.parallel(
|
||||
compressAppModernBrotli,
|
||||
compressAppOtherBrotli,
|
||||
compressAppModernZopfli,
|
||||
compressAppOtherZopfli
|
||||
)
|
||||
export const compressApp = parallel(
|
||||
compressAppModernBrotli,
|
||||
compressAppOtherBrotli,
|
||||
compressAppModernZopfli,
|
||||
compressAppOtherZopfli
|
||||
);
|
||||
gulp.task(
|
||||
"compress-hassio",
|
||||
gulp.parallel(
|
||||
compressHassioModernBrotli,
|
||||
compressHassioOtherBrotli,
|
||||
compressHassioModernZopfli,
|
||||
compressHassioOtherZopfli
|
||||
)
|
||||
|
||||
export const compressHassio = parallel(
|
||||
compressHassioModernBrotli,
|
||||
compressHassioOtherBrotli,
|
||||
compressHassioModernZopfli,
|
||||
compressHassioOtherZopfli
|
||||
);
|
@@ -1,54 +0,0 @@
|
||||
import gulp from "gulp";
|
||||
import "./clean.js";
|
||||
import "./entry-html.js";
|
||||
import "./gather-static.js";
|
||||
import "./gen-icons-json.js";
|
||||
import "./service-worker.js";
|
||||
import "./translations.js";
|
||||
import "./rspack.js";
|
||||
|
||||
gulp.task(
|
||||
"develop-demo",
|
||||
gulp.series(
|
||||
async function setEnv() {
|
||||
process.env.NODE_ENV = "development";
|
||||
},
|
||||
"clean-demo",
|
||||
"translations-enable-merge-backend",
|
||||
gulp.parallel(
|
||||
"gen-icons-json",
|
||||
"gen-pages-demo-dev",
|
||||
"build-translations",
|
||||
"build-locale-data"
|
||||
),
|
||||
"copy-static-demo",
|
||||
"rspack-dev-server-demo"
|
||||
)
|
||||
);
|
||||
|
||||
gulp.task(
|
||||
"build-demo",
|
||||
gulp.series(
|
||||
async function setEnv() {
|
||||
process.env.NODE_ENV = "production";
|
||||
},
|
||||
"clean-demo",
|
||||
// Cast needs to be backwards compatible and older HA has no translations
|
||||
"translations-enable-merge-backend",
|
||||
gulp.parallel("gen-icons-json", "build-translations", "build-locale-data"),
|
||||
"copy-static-demo",
|
||||
"rspack-prod-demo",
|
||||
"gen-pages-demo-prod"
|
||||
)
|
||||
);
|
||||
|
||||
gulp.task(
|
||||
"analyze-demo",
|
||||
gulp.series(
|
||||
async function setEnv() {
|
||||
process.env.STATS = "1";
|
||||
},
|
||||
"clean",
|
||||
"rspack-prod-demo"
|
||||
)
|
||||
);
|
47
build-scripts/gulp/demo.ts
Normal file
47
build-scripts/gulp/demo.ts
Normal file
@@ -0,0 +1,47 @@
|
||||
import { parallel, series } from "gulp";
|
||||
import { clean, cleanDemo } from "./clean.ts";
|
||||
import { genPagesDemoDev, genPagesDemoProd } from "./entry-html.ts";
|
||||
import { copyStaticDemo } from "./gather-static.ts";
|
||||
import { genIconsJson } from "./gen-icons-json.ts";
|
||||
import { buildLocaleData } from "./locale-data.ts";
|
||||
import { rspackDevServerDemo, rspackProdDemo } from "./rspack.ts";
|
||||
import "./service-worker.ts";
|
||||
import {
|
||||
buildTranslations,
|
||||
translationsEnableMergeBackend,
|
||||
} from "./translations.ts";
|
||||
|
||||
// develop-demo
|
||||
export const developDemo = series(
|
||||
async function setEnv() {
|
||||
process.env.NODE_ENV = "development";
|
||||
},
|
||||
cleanDemo,
|
||||
translationsEnableMergeBackend,
|
||||
parallel(genIconsJson, genPagesDemoDev, buildTranslations, buildLocaleData),
|
||||
copyStaticDemo,
|
||||
rspackDevServerDemo
|
||||
);
|
||||
|
||||
// build-demo
|
||||
export const buildDemo = series(
|
||||
async function setEnv() {
|
||||
process.env.NODE_ENV = "production";
|
||||
},
|
||||
cleanDemo,
|
||||
// Cast needs to be backwards compatible and older HA has no translations
|
||||
translationsEnableMergeBackend,
|
||||
parallel(genIconsJson, buildTranslations, buildLocaleData),
|
||||
copyStaticDemo,
|
||||
rspackProdDemo,
|
||||
genPagesDemoProd
|
||||
);
|
||||
|
||||
// analyze-demo
|
||||
export const analyzeDemo = series(
|
||||
async function setEnv() {
|
||||
process.env.STATS = "1";
|
||||
},
|
||||
clean,
|
||||
rspackProdDemo
|
||||
);
|
@@ -1,10 +1,10 @@
|
||||
import fs from "fs/promises";
|
||||
import gulp from "gulp";
|
||||
import path from "path";
|
||||
import mapStream from "map-stream";
|
||||
import transform from "gulp-json-transform";
|
||||
import { LokaliseApi } from "@lokalise/node-api";
|
||||
import { dest, series, src } from "gulp";
|
||||
import transform from "gulp-json-transform";
|
||||
import JSZip from "jszip";
|
||||
import mapStream from "map-stream";
|
||||
import fs from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
|
||||
const inDir = "translations";
|
||||
const inDirFrontend = `${inDir}/frontend`;
|
||||
@@ -12,11 +12,14 @@ const inDirBackend = `${inDir}/backend`;
|
||||
const srcMeta = "src/translations/translationMetadata.json";
|
||||
const encoding = "utf8";
|
||||
|
||||
function hasHtml(data) {
|
||||
return /<\S*>/i.test(data);
|
||||
}
|
||||
const hasHtml = (data) => /<\S*>/i.test(data);
|
||||
|
||||
function recursiveCheckHasHtml(file, data, errors, recKey) {
|
||||
const recursiveCheckHasHtml = (
|
||||
file,
|
||||
data,
|
||||
errors: string[],
|
||||
recKey?: string
|
||||
) => {
|
||||
Object.keys(data).forEach(function (key) {
|
||||
if (typeof data[key] === "object") {
|
||||
const nextRecKey = recKey ? `${recKey}.${key}` : key;
|
||||
@@ -25,9 +28,9 @@ function recursiveCheckHasHtml(file, data, errors, recKey) {
|
||||
errors.push(`HTML found in ${file.path} at key ${recKey}.${key}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
function checkHtml() {
|
||||
const checkHtml = () => {
|
||||
const errors = [];
|
||||
|
||||
return mapStream(function (file, cb) {
|
||||
@@ -44,9 +47,9 @@ function checkHtml() {
|
||||
}
|
||||
cb(error, file);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
function convertBackendTranslations(data, _file) {
|
||||
const convertBackendTranslationsTransform = (data, _file) => {
|
||||
const output = { component: {} };
|
||||
if (!data.component) {
|
||||
return output;
|
||||
@@ -62,25 +65,22 @@ function convertBackendTranslations(data, _file) {
|
||||
});
|
||||
});
|
||||
return output;
|
||||
}
|
||||
};
|
||||
|
||||
gulp.task("convert-backend-translations", function () {
|
||||
return gulp
|
||||
.src([`${inDirBackend}/*.json`])
|
||||
.pipe(transform((data, file) => convertBackendTranslations(data, file)))
|
||||
.pipe(gulp.dest(inDirBackend));
|
||||
});
|
||||
const convertBackendTranslations = () =>
|
||||
src([`${inDirBackend}/*.json`])
|
||||
.pipe(
|
||||
transform((data, file) => convertBackendTranslationsTransform(data, file))
|
||||
)
|
||||
.pipe(dest(inDirBackend));
|
||||
|
||||
gulp.task("check-translations-html", function () {
|
||||
return gulp
|
||||
.src([`${inDirFrontend}/*.json`, `${inDirBackend}/*.json`])
|
||||
.pipe(checkHtml());
|
||||
});
|
||||
const checkTranslationsHtml = () =>
|
||||
src([`${inDirFrontend}/*.json`, `${inDirBackend}/*.json`]).pipe(checkHtml());
|
||||
|
||||
gulp.task("check-all-files-exist", async function () {
|
||||
const checkAllFilesExist = async () => {
|
||||
const file = await fs.readFile(srcMeta, { encoding });
|
||||
const meta = JSON.parse(file);
|
||||
const writings = [];
|
||||
const writings: Promise<void>[] = [];
|
||||
Object.keys(meta).forEach((lang) => {
|
||||
writings.push(
|
||||
fs.writeFile(`${inDirFrontend}/${lang}.json`, JSON.stringify({}), {
|
||||
@@ -92,14 +92,14 @@ gulp.task("check-all-files-exist", async function () {
|
||||
);
|
||||
});
|
||||
await Promise.allSettled(writings);
|
||||
});
|
||||
};
|
||||
|
||||
const lokaliseProjects = {
|
||||
backend: "130246255a974bd3b5e8a1.51616605",
|
||||
frontend: "3420425759f6d6d241f598.13594006",
|
||||
};
|
||||
|
||||
gulp.task("fetch-lokalise", async function () {
|
||||
const fetchLokalise = async () => {
|
||||
let apiKey;
|
||||
try {
|
||||
apiKey =
|
||||
@@ -168,14 +168,11 @@ gulp.task("fetch-lokalise", async function () {
|
||||
})
|
||||
)
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
gulp.task(
|
||||
"download-translations",
|
||||
gulp.series(
|
||||
"fetch-lokalise",
|
||||
"convert-backend-translations",
|
||||
"check-translations-html",
|
||||
"check-all-files-exist"
|
||||
)
|
||||
export const downloadTranslations = series(
|
||||
fetchLokalise,
|
||||
convertBackendTranslations,
|
||||
checkTranslationsHtml,
|
||||
checkAllFilesExist
|
||||
);
|
@@ -6,12 +6,11 @@ import {
|
||||
getPreUserAgentRegexes,
|
||||
} from "browserslist-useragent-regexp";
|
||||
import fs from "fs-extra";
|
||||
import gulp from "gulp";
|
||||
import { minify } from "html-minifier-terser";
|
||||
import template from "lodash.template";
|
||||
import { dirname, extname, resolve } from "node:path";
|
||||
import { htmlMinifierOptions, terserOptions } from "../bundle.cjs";
|
||||
import paths from "../paths.cjs";
|
||||
import { htmlMinifierOptions, terserOptions } from "../bundle.ts";
|
||||
import paths from "../paths.ts";
|
||||
|
||||
// macOS companion app has no way to obtain the Safari version used by WKWebView,
|
||||
// and it is not in the default user agent string. So we add an additional regex
|
||||
@@ -34,9 +33,9 @@ const getCommonTemplateVars = () => {
|
||||
mobileToDesktop: true,
|
||||
throwOnMissing: true,
|
||||
});
|
||||
const minSafariVersion = browserRegexes.find(
|
||||
(regex) => regex.family === "safari"
|
||||
)?.matchedVersions[0][0];
|
||||
const minSafariVersion =
|
||||
browserRegexes.find((regex) => regex.family === "safari")
|
||||
?.matchedVersions[0][0] ?? 18;
|
||||
const minMacOSVersion = SAFARI_TO_MACOS[minSafariVersion];
|
||||
if (!minMacOSVersion) {
|
||||
throw Error(
|
||||
@@ -106,10 +105,10 @@ const genPagesDevTask =
|
||||
resolve(inputRoot, inputSub, `${page}.template`),
|
||||
{
|
||||
...commonVars,
|
||||
latestEntryJS: entries.map(
|
||||
latestEntryJS: (entries as string[]).map(
|
||||
(entry) => `${publicRoot}/frontend_latest/${entry}.js`
|
||||
),
|
||||
es5EntryJS: entries.map(
|
||||
es5EntryJS: (entries as string[]).map(
|
||||
(entry) => `${publicRoot}/frontend_es5/${entry}.js`
|
||||
),
|
||||
latestCustomPanelJS: `${publicRoot}/frontend_latest/custom-panel.js`,
|
||||
@@ -128,7 +127,7 @@ const genPagesProdTask =
|
||||
inputRoot,
|
||||
outputRoot,
|
||||
outputLatest,
|
||||
outputES5,
|
||||
outputES5?: string,
|
||||
inputSub = "src/html"
|
||||
) =>
|
||||
async () => {
|
||||
@@ -139,14 +138,18 @@ const genPagesProdTask =
|
||||
? fs.readJsonSync(resolve(outputES5, "manifest.json"))
|
||||
: {};
|
||||
const commonVars = getCommonTemplateVars();
|
||||
const minifiedHTML = [];
|
||||
const minifiedHTML: Promise<void>[] = [];
|
||||
for (const [page, entries] of Object.entries(pageEntries)) {
|
||||
const content = renderTemplate(
|
||||
resolve(inputRoot, inputSub, `${page}.template`),
|
||||
{
|
||||
...commonVars,
|
||||
latestEntryJS: entries.map((entry) => latestManifest[`${entry}.js`]),
|
||||
es5EntryJS: entries.map((entry) => es5Manifest[`${entry}.js`]),
|
||||
latestEntryJS: (entries as string[]).map(
|
||||
(entry) => latestManifest[`${entry}.js`]
|
||||
),
|
||||
es5EntryJS: (entries as string[]).map(
|
||||
(entry) => es5Manifest[`${entry}.js`]
|
||||
),
|
||||
latestCustomPanelJS: latestManifest["custom-panel.js"],
|
||||
es5CustomPanelJS: es5Manifest["custom-panel.js"],
|
||||
}
|
||||
@@ -167,20 +170,18 @@ const APP_PAGE_ENTRIES = {
|
||||
"index.html": ["core", "app"],
|
||||
};
|
||||
|
||||
gulp.task(
|
||||
"gen-pages-app-dev",
|
||||
genPagesDevTask(APP_PAGE_ENTRIES, paths.root_dir, paths.app_output_root)
|
||||
export const genPagesAppDev = genPagesDevTask(
|
||||
APP_PAGE_ENTRIES,
|
||||
paths.root_dir,
|
||||
paths.app_output_root
|
||||
);
|
||||
|
||||
gulp.task(
|
||||
"gen-pages-app-prod",
|
||||
genPagesProdTask(
|
||||
APP_PAGE_ENTRIES,
|
||||
paths.root_dir,
|
||||
paths.app_output_root,
|
||||
paths.app_output_latest,
|
||||
paths.app_output_es5
|
||||
)
|
||||
export const genPagesAppProd = genPagesProdTask(
|
||||
APP_PAGE_ENTRIES,
|
||||
paths.root_dir,
|
||||
paths.app_output_root,
|
||||
paths.app_output_latest,
|
||||
paths.app_output_es5
|
||||
);
|
||||
|
||||
const CAST_PAGE_ENTRIES = {
|
||||
@@ -190,104 +191,82 @@ const CAST_PAGE_ENTRIES = {
|
||||
"receiver.html": ["receiver"],
|
||||
};
|
||||
|
||||
gulp.task(
|
||||
"gen-pages-cast-dev",
|
||||
genPagesDevTask(CAST_PAGE_ENTRIES, paths.cast_dir, paths.cast_output_root)
|
||||
export const genPagesCastDev = genPagesDevTask(
|
||||
CAST_PAGE_ENTRIES,
|
||||
paths.cast_dir,
|
||||
paths.cast_output_root
|
||||
);
|
||||
|
||||
gulp.task(
|
||||
"gen-pages-cast-prod",
|
||||
genPagesProdTask(
|
||||
CAST_PAGE_ENTRIES,
|
||||
paths.cast_dir,
|
||||
paths.cast_output_root,
|
||||
paths.cast_output_latest,
|
||||
paths.cast_output_es5
|
||||
)
|
||||
export const genPagesCastProd = genPagesProdTask(
|
||||
CAST_PAGE_ENTRIES,
|
||||
paths.cast_dir,
|
||||
paths.cast_output_root,
|
||||
paths.cast_output_latest,
|
||||
paths.cast_output_es5
|
||||
);
|
||||
|
||||
const DEMO_PAGE_ENTRIES = { "index.html": ["main"] };
|
||||
|
||||
gulp.task(
|
||||
"gen-pages-demo-dev",
|
||||
genPagesDevTask(DEMO_PAGE_ENTRIES, paths.demo_dir, paths.demo_output_root)
|
||||
export const genPagesDemoDev = genPagesDevTask(
|
||||
DEMO_PAGE_ENTRIES,
|
||||
paths.demo_dir,
|
||||
paths.demo_output_root
|
||||
);
|
||||
|
||||
gulp.task(
|
||||
"gen-pages-demo-prod",
|
||||
genPagesProdTask(
|
||||
DEMO_PAGE_ENTRIES,
|
||||
paths.demo_dir,
|
||||
paths.demo_output_root,
|
||||
paths.demo_output_latest,
|
||||
paths.demo_output_es5
|
||||
)
|
||||
export const genPagesDemoProd = genPagesProdTask(
|
||||
DEMO_PAGE_ENTRIES,
|
||||
paths.demo_dir,
|
||||
paths.demo_output_root,
|
||||
paths.demo_output_latest,
|
||||
paths.demo_output_es5
|
||||
);
|
||||
|
||||
const GALLERY_PAGE_ENTRIES = { "index.html": ["entrypoint"] };
|
||||
|
||||
gulp.task(
|
||||
"gen-pages-gallery-dev",
|
||||
genPagesDevTask(
|
||||
GALLERY_PAGE_ENTRIES,
|
||||
paths.gallery_dir,
|
||||
paths.gallery_output_root
|
||||
)
|
||||
export const genPagesGalleryDev = genPagesDevTask(
|
||||
GALLERY_PAGE_ENTRIES,
|
||||
paths.gallery_dir,
|
||||
paths.gallery_output_root
|
||||
);
|
||||
|
||||
gulp.task(
|
||||
"gen-pages-gallery-prod",
|
||||
genPagesProdTask(
|
||||
GALLERY_PAGE_ENTRIES,
|
||||
paths.gallery_dir,
|
||||
paths.gallery_output_root,
|
||||
paths.gallery_output_latest
|
||||
)
|
||||
export const genPagesGalleryProd = genPagesProdTask(
|
||||
GALLERY_PAGE_ENTRIES,
|
||||
paths.gallery_dir,
|
||||
paths.gallery_output_root,
|
||||
paths.gallery_output_latest
|
||||
);
|
||||
|
||||
const LANDING_PAGE_PAGE_ENTRIES = { "index.html": ["entrypoint"] };
|
||||
|
||||
gulp.task(
|
||||
"gen-pages-landing-page-dev",
|
||||
genPagesDevTask(
|
||||
LANDING_PAGE_PAGE_ENTRIES,
|
||||
paths.landingPage_dir,
|
||||
paths.landingPage_output_root
|
||||
)
|
||||
export const genPagesLandingPageDev = genPagesDevTask(
|
||||
LANDING_PAGE_PAGE_ENTRIES,
|
||||
paths.landingPage_dir,
|
||||
paths.landingPage_output_root
|
||||
);
|
||||
|
||||
gulp.task(
|
||||
"gen-pages-landing-page-prod",
|
||||
genPagesProdTask(
|
||||
LANDING_PAGE_PAGE_ENTRIES,
|
||||
paths.landingPage_dir,
|
||||
paths.landingPage_output_root,
|
||||
paths.landingPage_output_latest,
|
||||
paths.landingPage_output_es5
|
||||
)
|
||||
export const genPagesLandingPageProd = genPagesProdTask(
|
||||
LANDING_PAGE_PAGE_ENTRIES,
|
||||
paths.landingPage_dir,
|
||||
paths.landingPage_output_root,
|
||||
paths.landingPage_output_latest,
|
||||
paths.landingPage_output_es5
|
||||
);
|
||||
|
||||
const HASSIO_PAGE_ENTRIES = { "entrypoint.js": ["entrypoint"] };
|
||||
|
||||
gulp.task(
|
||||
"gen-pages-hassio-dev",
|
||||
genPagesDevTask(
|
||||
HASSIO_PAGE_ENTRIES,
|
||||
paths.hassio_dir,
|
||||
paths.hassio_output_root,
|
||||
"src",
|
||||
paths.hassio_publicPath
|
||||
)
|
||||
export const genPagesHassioDev = genPagesDevTask(
|
||||
HASSIO_PAGE_ENTRIES,
|
||||
paths.hassio_dir,
|
||||
paths.hassio_output_root,
|
||||
"src",
|
||||
paths.hassio_publicPath
|
||||
);
|
||||
|
||||
gulp.task(
|
||||
"gen-pages-hassio-prod",
|
||||
genPagesProdTask(
|
||||
HASSIO_PAGE_ENTRIES,
|
||||
paths.hassio_dir,
|
||||
paths.hassio_output_root,
|
||||
paths.hassio_output_latest,
|
||||
paths.hassio_output_es5,
|
||||
"src"
|
||||
)
|
||||
export const genPagesHassioProd = genPagesProdTask(
|
||||
HASSIO_PAGE_ENTRIES,
|
||||
paths.hassio_dir,
|
||||
paths.hassio_output_root,
|
||||
paths.hassio_output_latest,
|
||||
paths.hassio_output_es5,
|
||||
"src"
|
||||
);
|
@@ -1,14 +1,14 @@
|
||||
// Task to download the latest Lokalise translations from the nightly workflow artifacts
|
||||
// Task to download the latest 00Lokalise translations from the nightly workflow artifacts
|
||||
|
||||
import { createOAuthDeviceAuth } from "@octokit/auth-oauth-device";
|
||||
import { retry } from "@octokit/plugin-retry";
|
||||
import { Octokit } from "@octokit/rest";
|
||||
import { deleteAsync } from "del";
|
||||
import { mkdir, readFile, writeFile } from "fs/promises";
|
||||
import gulp from "gulp";
|
||||
import { series } from "gulp";
|
||||
import jszip from "jszip";
|
||||
import path from "path";
|
||||
import process from "process";
|
||||
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import process from "node:process";
|
||||
import { extract } from "tar";
|
||||
|
||||
const MAX_AGE = 24; // hours
|
||||
@@ -22,12 +22,13 @@ const TOKEN_FILE = path.posix.join(EXTRACT_DIR, "token.json");
|
||||
const ARTIFACT_FILE = path.posix.join(EXTRACT_DIR, "artifact.json");
|
||||
|
||||
let allowTokenSetup = false;
|
||||
gulp.task("allow-setup-fetch-nightly-translations", (done) => {
|
||||
|
||||
export const allowSetupFetchNightlyTranslations = (done) => {
|
||||
allowTokenSetup = true;
|
||||
done();
|
||||
});
|
||||
};
|
||||
|
||||
gulp.task("fetch-nightly-translations", async function () {
|
||||
export const fetchNightlyTranslations = async () => {
|
||||
// Skip all when environment flag is set (assumes translations are already in place)
|
||||
if (process.env?.SKIP_FETCH_NIGHTLY_TRANSLATIONS) {
|
||||
console.log("Skipping fetch due to environment signal");
|
||||
@@ -54,7 +55,7 @@ gulp.task("fetch-nightly-translations", async function () {
|
||||
|
||||
// To store file writing promises
|
||||
const createExtractDir = mkdir(EXTRACT_DIR, { recursive: true });
|
||||
const writings = [];
|
||||
const writings: Promise<void>[] = [];
|
||||
|
||||
// Authenticate to GitHub using GitHub action token if it exists,
|
||||
// otherwise look for a saved user token or generate a new one if none
|
||||
@@ -87,7 +88,7 @@ gulp.task("fetch-nightly-translations", async function () {
|
||||
});
|
||||
tokenAuth = await auth({ type: "oauth" });
|
||||
writings.push(
|
||||
createExtractDir.then(
|
||||
createExtractDir.then(() =>
|
||||
writeFile(TOKEN_FILE, JSON.stringify(tokenAuth, null, 2))
|
||||
)
|
||||
);
|
||||
@@ -131,13 +132,13 @@ gulp.task("fetch-nightly-translations", async function () {
|
||||
throw Error("Latest nightly workflow run has no translations artifact");
|
||||
}
|
||||
writings.push(
|
||||
createExtractDir.then(
|
||||
createExtractDir.then(() =>
|
||||
writeFile(ARTIFACT_FILE, JSON.stringify(latestArtifact, null, 2))
|
||||
)
|
||||
);
|
||||
|
||||
// Remove the current translations
|
||||
const deleteCurrent = Promise.all(writings).then(
|
||||
const deleteCurrent = Promise.all(writings).then(() =>
|
||||
deleteAsync([`${EXTRACT_DIR}/*`, `!${ARTIFACT_FILE}`, `!${TOKEN_FILE}`])
|
||||
);
|
||||
|
||||
@@ -148,24 +149,22 @@ gulp.task("fetch-nightly-translations", async function () {
|
||||
artifact_id: latestArtifact.id,
|
||||
archive_format: "zip",
|
||||
});
|
||||
// @ts-ignore OctokitResponse<unknown, 302> doesn't allow to check for 200
|
||||
if (downloadResponse.status !== 200) {
|
||||
throw Error("Failure downloading translations artifact");
|
||||
}
|
||||
|
||||
// Artifact is a tarball, but GitHub adds it to a zip file
|
||||
console.log("Unpacking downloaded translations...");
|
||||
const zip = await jszip.loadAsync(downloadResponse.data);
|
||||
const zip = await jszip.loadAsync(downloadResponse.data as any);
|
||||
await deleteCurrent;
|
||||
const extractStream = zip.file(/.*/)[0].nodeStream().pipe(extract());
|
||||
await new Promise((resolve, reject) => {
|
||||
extractStream.on("close", resolve).on("error", reject);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
gulp.task(
|
||||
"setup-and-fetch-nightly-translations",
|
||||
gulp.series(
|
||||
"allow-setup-fetch-nightly-translations",
|
||||
"fetch-nightly-translations"
|
||||
)
|
||||
export const setupAndFetchNightlyTranslations = series(
|
||||
allowSetupFetchNightlyTranslations,
|
||||
fetchNightlyTranslations
|
||||
);
|
@@ -1,19 +1,23 @@
|
||||
import fs from "fs";
|
||||
import { glob } from "glob";
|
||||
import gulp from "gulp";
|
||||
import { parallel, series, watch } from "gulp";
|
||||
import yaml from "js-yaml";
|
||||
import { marked } from "marked";
|
||||
import path from "path";
|
||||
import paths from "../paths.cjs";
|
||||
import "./clean.js";
|
||||
import "./entry-html.js";
|
||||
import "./gather-static.js";
|
||||
import "./gen-icons-json.js";
|
||||
import "./service-worker.js";
|
||||
import "./translations.js";
|
||||
import "./rspack.js";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import paths from "../paths.ts";
|
||||
import { cleanGallery } from "./clean.ts";
|
||||
import { genPagesGalleryDev, genPagesGalleryProd } from "./entry-html.ts";
|
||||
import { copyStaticGallery } from "./gather-static.ts";
|
||||
import { genIconsJson } from "./gen-icons-json.ts";
|
||||
import { buildLocaleData } from "./locale-data.ts";
|
||||
import { rspackDevServerGallery, rspackProdGallery } from "./rspack.ts";
|
||||
import {
|
||||
buildTranslations,
|
||||
translationsEnableMergeBackend,
|
||||
} from "./translations.ts";
|
||||
|
||||
gulp.task("gather-gallery-pages", async function gatherPages() {
|
||||
// gather-gallery-pages
|
||||
export const gatherGalleryPages = async function gatherPages() {
|
||||
const pageDir = path.resolve(paths.gallery_dir, "src/pages");
|
||||
const files = await glob(path.resolve(pageDir, "**/*"));
|
||||
|
||||
@@ -22,7 +26,7 @@ gulp.task("gather-gallery-pages", async function gatherPages() {
|
||||
|
||||
let content = "export const PAGES = {\n";
|
||||
|
||||
const processed = new Set();
|
||||
const processed = new Set<string>();
|
||||
|
||||
for (const file of files) {
|
||||
if (fs.lstatSync(file).isDirectory()) {
|
||||
@@ -47,7 +51,9 @@ gulp.task("gather-gallery-pages", async function gatherPages() {
|
||||
|
||||
if (descriptionContent.startsWith("---")) {
|
||||
const metadataEnd = descriptionContent.indexOf("---", 3);
|
||||
metadata = yaml.load(descriptionContent.substring(3, metadataEnd));
|
||||
metadata = yaml.load(
|
||||
descriptionContent.substring(3, metadataEnd)
|
||||
) as any;
|
||||
descriptionContent = descriptionContent
|
||||
.substring(metadataEnd + 3)
|
||||
.trim();
|
||||
@@ -57,7 +63,9 @@ gulp.task("gather-gallery-pages", async function gatherPages() {
|
||||
if (descriptionContent === "") {
|
||||
hasDescription = false;
|
||||
} else {
|
||||
descriptionContent = marked(descriptionContent).replace(/`/g, "\\`");
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
descriptionContent = await marked(descriptionContent);
|
||||
descriptionContent = descriptionContent.replace(/`/g, "\\`");
|
||||
fs.mkdirSync(path.resolve(galleryBuild, category), { recursive: true });
|
||||
fs.writeFileSync(
|
||||
path.resolve(galleryBuild, `${pageId}-description.ts`),
|
||||
@@ -95,7 +103,10 @@ gulp.task("gather-gallery-pages", async function gatherPages() {
|
||||
pagesToProcess[category].add(page);
|
||||
}
|
||||
|
||||
for (const group of Object.values(sidebar)) {
|
||||
for (const group of Object.values(sidebar) as {
|
||||
category: string;
|
||||
pages?: string[];
|
||||
}[]) {
|
||||
const toProcess = pagesToProcess[group.category];
|
||||
delete pagesToProcess[group.category];
|
||||
|
||||
@@ -118,7 +129,7 @@ gulp.task("gather-gallery-pages", async function gatherPages() {
|
||||
group.pages = [];
|
||||
}
|
||||
for (const page of Array.from(toProcess).sort()) {
|
||||
group.pages.push(page);
|
||||
group.pages.push(page as string);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,7 +137,7 @@ gulp.task("gather-gallery-pages", async function gatherPages() {
|
||||
sidebar.push({
|
||||
category,
|
||||
header: category,
|
||||
pages: Array.from(pages).sort(),
|
||||
pages: Array.from(pages as Set<string>).sort(),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -137,55 +148,48 @@ gulp.task("gather-gallery-pages", async function gatherPages() {
|
||||
content,
|
||||
"utf-8"
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
gulp.task(
|
||||
"develop-gallery",
|
||||
gulp.series(
|
||||
async function setEnv() {
|
||||
process.env.NODE_ENV = "development";
|
||||
},
|
||||
"clean-gallery",
|
||||
"translations-enable-merge-backend",
|
||||
gulp.parallel(
|
||||
"gen-icons-json",
|
||||
"build-translations",
|
||||
"build-locale-data",
|
||||
"gather-gallery-pages"
|
||||
),
|
||||
"copy-static-gallery",
|
||||
"gen-pages-gallery-dev",
|
||||
gulp.parallel(
|
||||
"rspack-dev-server-gallery",
|
||||
async function watchMarkdownFiles() {
|
||||
gulp.watch(
|
||||
[
|
||||
path.resolve(paths.gallery_dir, "src/pages/**/*.markdown"),
|
||||
path.resolve(paths.gallery_dir, "sidebar.js"),
|
||||
],
|
||||
gulp.series("gather-gallery-pages")
|
||||
);
|
||||
}
|
||||
)
|
||||
)
|
||||
// develop-gallery
|
||||
export const developGallery = series(
|
||||
async function setEnv() {
|
||||
process.env.NODE_ENV = "development";
|
||||
},
|
||||
cleanGallery,
|
||||
translationsEnableMergeBackend,
|
||||
parallel(
|
||||
genIconsJson,
|
||||
buildTranslations,
|
||||
buildLocaleData,
|
||||
gatherGalleryPages
|
||||
),
|
||||
copyStaticGallery,
|
||||
genPagesGalleryDev,
|
||||
parallel(rspackDevServerGallery, async function watchMarkdownFiles() {
|
||||
watch(
|
||||
[
|
||||
path.resolve(paths.gallery_dir, "src/pages/**/*.markdown"),
|
||||
path.resolve(paths.gallery_dir, "sidebar.js"),
|
||||
],
|
||||
series(gatherGalleryPages)
|
||||
);
|
||||
})
|
||||
);
|
||||
|
||||
gulp.task(
|
||||
"build-gallery",
|
||||
gulp.series(
|
||||
async function setEnv() {
|
||||
process.env.NODE_ENV = "production";
|
||||
},
|
||||
"clean-gallery",
|
||||
"translations-enable-merge-backend",
|
||||
gulp.parallel(
|
||||
"gen-icons-json",
|
||||
"build-translations",
|
||||
"build-locale-data",
|
||||
"gather-gallery-pages"
|
||||
),
|
||||
"copy-static-gallery",
|
||||
"rspack-prod-gallery",
|
||||
"gen-pages-gallery-prod"
|
||||
)
|
||||
// build-gallery
|
||||
export const buildGallery = series(
|
||||
async function setEnv() {
|
||||
process.env.NODE_ENV = "production";
|
||||
},
|
||||
cleanGallery,
|
||||
translationsEnableMergeBackend,
|
||||
parallel(
|
||||
genIconsJson,
|
||||
buildTranslations,
|
||||
buildLocaleData,
|
||||
gatherGalleryPages
|
||||
),
|
||||
copyStaticGallery,
|
||||
rspackProdGallery,
|
||||
genPagesGalleryProd
|
||||
);
|
@@ -1,9 +1,8 @@
|
||||
// Gulp task to gather all static files.
|
||||
|
||||
import fs from "fs-extra";
|
||||
import gulp from "gulp";
|
||||
import path from "path";
|
||||
import paths from "../paths.cjs";
|
||||
import path from "node:path";
|
||||
import paths from "../paths.ts";
|
||||
|
||||
const npmPath = (...parts) =>
|
||||
path.resolve(paths.root_dir, "node_modules", ...parts);
|
||||
@@ -17,7 +16,7 @@ const genStaticPath =
|
||||
(...parts) =>
|
||||
path.resolve(staticDir, ...parts);
|
||||
|
||||
function copyTranslations(staticDir) {
|
||||
const copyTranslations = (staticDir) => {
|
||||
const staticPath = genStaticPath(staticDir);
|
||||
|
||||
// Translation output
|
||||
@@ -25,23 +24,23 @@ function copyTranslations(staticDir) {
|
||||
polyPath("build/translations/output"),
|
||||
staticPath("translations")
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
function copyLocaleData(staticDir) {
|
||||
const copyLocaleData = (staticDir) => {
|
||||
const staticPath = genStaticPath(staticDir);
|
||||
|
||||
// Locale data output
|
||||
fs.copySync(polyPath("build/locale-data"), staticPath("locale-data"));
|
||||
}
|
||||
};
|
||||
|
||||
function copyMdiIcons(staticDir) {
|
||||
const copyMdiIcons = (staticDir) => {
|
||||
const staticPath = genStaticPath(staticDir);
|
||||
|
||||
// MDI icons output
|
||||
fs.copySync(polyPath("build/mdi"), staticPath("mdi"));
|
||||
}
|
||||
};
|
||||
|
||||
function copyPolyfills(staticDir) {
|
||||
const copyPolyfills = (staticDir) => {
|
||||
const staticPath = genStaticPath(staticDir);
|
||||
|
||||
// For custom panels using ES5 builds that don't use Babel 7+
|
||||
@@ -70,9 +69,9 @@ function copyPolyfills(staticDir) {
|
||||
npmPath("dialog-polyfill/dialog-polyfill.css"),
|
||||
staticPath("polyfills/")
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
function copyFonts(staticDir) {
|
||||
const copyFonts = (staticDir) => {
|
||||
const staticPath = genStaticPath(staticDir);
|
||||
// Local fonts
|
||||
fs.copySync(
|
||||
@@ -82,14 +81,14 @@ function copyFonts(staticDir) {
|
||||
filter: (src) => !src.includes(".") || src.endsWith(".woff2"),
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
function copyQrScannerWorker(staticDir) {
|
||||
const copyQrScannerWorker = (staticDir) => {
|
||||
const staticPath = genStaticPath(staticDir);
|
||||
copyFileDir(npmPath("qr-scanner/qr-scanner-worker.min.js"), staticPath("js"));
|
||||
}
|
||||
};
|
||||
|
||||
function copyMapPanel(staticDir) {
|
||||
const copyMapPanel = (staticDir) => {
|
||||
const staticPath = genStaticPath(staticDir);
|
||||
copyFileDir(
|
||||
npmPath("leaflet/dist/leaflet.css"),
|
||||
@@ -103,43 +102,38 @@ function copyMapPanel(staticDir) {
|
||||
npmPath("leaflet/dist/images"),
|
||||
staticPath("images/leaflet/images/")
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
function copyZXingWasm(staticDir) {
|
||||
const copyZXingWasm = (staticDir) => {
|
||||
const staticPath = genStaticPath(staticDir);
|
||||
copyFileDir(
|
||||
npmPath("zxing-wasm/dist/reader/zxing_reader.wasm"),
|
||||
staticPath("js")
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
gulp.task("copy-locale-data", async () => {
|
||||
const staticDir = paths.app_output_static;
|
||||
copyLocaleData(staticDir);
|
||||
});
|
||||
|
||||
gulp.task("copy-translations-app", async () => {
|
||||
export const copyTranslationsApp = async () => {
|
||||
const staticDir = paths.app_output_static;
|
||||
copyTranslations(staticDir);
|
||||
});
|
||||
};
|
||||
|
||||
gulp.task("copy-translations-supervisor", async () => {
|
||||
export const copyTranslationsSupervisor = async () => {
|
||||
const staticDir = paths.hassio_output_static;
|
||||
copyTranslations(staticDir);
|
||||
});
|
||||
};
|
||||
|
||||
gulp.task("copy-translations-landing-page", async () => {
|
||||
export const copyTranslationsLandingPage = async () => {
|
||||
const staticDir = paths.landingPage_output_static;
|
||||
copyTranslations(staticDir);
|
||||
});
|
||||
};
|
||||
|
||||
gulp.task("copy-static-supervisor", async () => {
|
||||
export const copyStaticSupervisor = async () => {
|
||||
const staticDir = paths.hassio_output_static;
|
||||
copyLocaleData(staticDir);
|
||||
copyFonts(staticDir);
|
||||
});
|
||||
};
|
||||
|
||||
gulp.task("copy-static-app", async () => {
|
||||
export const copyStaticApp = async () => {
|
||||
const staticDir = paths.app_output_static;
|
||||
// Basic static files
|
||||
fs.copySync(polyPath("public"), paths.app_output_root);
|
||||
@@ -155,9 +149,9 @@ gulp.task("copy-static-app", async () => {
|
||||
// Qr Scanner assets
|
||||
copyZXingWasm(staticDir);
|
||||
copyQrScannerWorker(staticDir);
|
||||
});
|
||||
};
|
||||
|
||||
gulp.task("copy-static-demo", async () => {
|
||||
export const copyStaticDemo = async () => {
|
||||
// Copy app static files
|
||||
fs.copySync(
|
||||
polyPath("public/static"),
|
||||
@@ -171,9 +165,9 @@ gulp.task("copy-static-demo", async () => {
|
||||
copyTranslations(paths.demo_output_static);
|
||||
copyLocaleData(paths.demo_output_static);
|
||||
copyMdiIcons(paths.demo_output_static);
|
||||
});
|
||||
};
|
||||
|
||||
gulp.task("copy-static-cast", async () => {
|
||||
export const copyStaticCast = async () => {
|
||||
// Copy app static files
|
||||
fs.copySync(polyPath("public/static"), paths.cast_output_static);
|
||||
// Copy cast static files
|
||||
@@ -184,9 +178,9 @@ gulp.task("copy-static-cast", async () => {
|
||||
copyTranslations(paths.cast_output_static);
|
||||
copyLocaleData(paths.cast_output_static);
|
||||
copyMdiIcons(paths.cast_output_static);
|
||||
});
|
||||
};
|
||||
|
||||
gulp.task("copy-static-gallery", async () => {
|
||||
export const copyStaticGallery = async () => {
|
||||
// Copy app static files
|
||||
fs.copySync(polyPath("public/static"), paths.gallery_output_static);
|
||||
// Copy gallery static files
|
||||
@@ -200,9 +194,9 @@ gulp.task("copy-static-gallery", async () => {
|
||||
copyTranslations(paths.gallery_output_static);
|
||||
copyLocaleData(paths.gallery_output_static);
|
||||
copyMdiIcons(paths.gallery_output_static);
|
||||
});
|
||||
};
|
||||
|
||||
gulp.task("copy-static-landing-page", async () => {
|
||||
export const copyStaticLandingPage = async () => {
|
||||
// Copy landing-page static files
|
||||
fs.copySync(
|
||||
path.resolve(paths.landingPage_dir, "public"),
|
||||
@@ -211,4 +205,4 @@ gulp.task("copy-static-landing-page", async () => {
|
||||
|
||||
copyFonts(paths.landingPage_output_static);
|
||||
copyTranslations(paths.landingPage_output_static);
|
||||
});
|
||||
};
|
@@ -1,8 +1,7 @@
|
||||
import fs from "fs";
|
||||
import gulp from "gulp";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import hash from "object-hash";
|
||||
import path from "path";
|
||||
import paths from "../paths.cjs";
|
||||
import paths from "../paths.ts";
|
||||
|
||||
const ICON_PACKAGE_PATH = path.resolve("node_modules/@mdi/svg/");
|
||||
const META_PATH = path.resolve(ICON_PACKAGE_PATH, "meta.json");
|
||||
@@ -21,7 +20,7 @@ const getMeta = () => {
|
||||
encoding,
|
||||
});
|
||||
return {
|
||||
path: svg.match(/ d="([^"]+)"/)[1],
|
||||
path: svg.match(/ d="([^"]+)"/)?.[1],
|
||||
name: icon.name,
|
||||
tags: icon.tags,
|
||||
aliases: icon.aliases,
|
||||
@@ -55,14 +54,14 @@ const orderMeta = (meta) => {
|
||||
};
|
||||
|
||||
const splitBySize = (meta) => {
|
||||
const chunks = [];
|
||||
const chunks: any[] = [];
|
||||
const CHUNK_SIZE = 50000;
|
||||
|
||||
let curSize = 0;
|
||||
let startKey;
|
||||
let icons = [];
|
||||
let icons: any[] = [];
|
||||
|
||||
Object.values(meta).forEach((icon) => {
|
||||
Object.values(meta).forEach((icon: any) => {
|
||||
if (startKey === undefined) {
|
||||
startKey = icon.name;
|
||||
}
|
||||
@@ -94,10 +93,10 @@ const findDifferentiator = (curString, prevString) => {
|
||||
return curString.substring(0, i + 1);
|
||||
}
|
||||
}
|
||||
throw new Error("Cannot find differentiator", curString, prevString);
|
||||
throw new Error(`Cannot find differentiator; ${curString}; ${prevString}`);
|
||||
};
|
||||
|
||||
gulp.task("gen-icons-json", (done) => {
|
||||
export const genIconsJson = (done) => {
|
||||
const meta = getMeta();
|
||||
|
||||
const metaAndRemoved = addRemovedMeta(meta);
|
||||
@@ -106,7 +105,7 @@ gulp.task("gen-icons-json", (done) => {
|
||||
if (!fs.existsSync(OUTPUT_DIR)) {
|
||||
fs.mkdirSync(OUTPUT_DIR, { recursive: true });
|
||||
}
|
||||
const parts = [];
|
||||
const parts: any[] = [];
|
||||
|
||||
let lastEnd;
|
||||
split.forEach((chunk) => {
|
||||
@@ -153,13 +152,13 @@ gulp.task("gen-icons-json", (done) => {
|
||||
);
|
||||
|
||||
done();
|
||||
});
|
||||
};
|
||||
|
||||
gulp.task("gen-dummy-icons-json", (done) => {
|
||||
export const genDummyIconsJson = (done) => {
|
||||
if (!fs.existsSync(OUTPUT_DIR)) {
|
||||
fs.mkdirSync(OUTPUT_DIR, { recursive: true });
|
||||
}
|
||||
|
||||
fs.writeFileSync(path.resolve(OUTPUT_DIR, "iconList.json"), "[]");
|
||||
done();
|
||||
});
|
||||
};
|
@@ -1,45 +0,0 @@
|
||||
import gulp from "gulp";
|
||||
import env from "../env.cjs";
|
||||
import "./clean.js";
|
||||
import "./compress.js";
|
||||
import "./entry-html.js";
|
||||
import "./gather-static.js";
|
||||
import "./gen-icons-json.js";
|
||||
import "./translations.js";
|
||||
import "./rspack.js";
|
||||
|
||||
gulp.task(
|
||||
"develop-hassio",
|
||||
gulp.series(
|
||||
async function setEnv() {
|
||||
process.env.NODE_ENV = "development";
|
||||
},
|
||||
"clean-hassio",
|
||||
"gen-dummy-icons-json",
|
||||
"gen-pages-hassio-dev",
|
||||
"build-supervisor-translations",
|
||||
"copy-translations-supervisor",
|
||||
"build-locale-data",
|
||||
"copy-static-supervisor",
|
||||
"rspack-watch-hassio"
|
||||
)
|
||||
);
|
||||
|
||||
gulp.task(
|
||||
"build-hassio",
|
||||
gulp.series(
|
||||
async function setEnv() {
|
||||
process.env.NODE_ENV = "production";
|
||||
},
|
||||
"clean-hassio",
|
||||
"gen-dummy-icons-json",
|
||||
"build-supervisor-translations",
|
||||
"copy-translations-supervisor",
|
||||
"build-locale-data",
|
||||
"copy-static-supervisor",
|
||||
"rspack-prod-hassio",
|
||||
"gen-pages-hassio-prod",
|
||||
...// Don't compress running tests
|
||||
(env.isTestBuild() ? [] : ["compress-hassio"])
|
||||
)
|
||||
);
|
45
build-scripts/gulp/hassio.ts
Normal file
45
build-scripts/gulp/hassio.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import { series } from "gulp";
|
||||
import { isTestBuild } from "../env.ts";
|
||||
import { cleanHassio } from "./clean.ts";
|
||||
import { compressHassio } from "./compress.ts";
|
||||
import { genPagesHassioDev, genPagesHassioProd } from "./entry-html.ts";
|
||||
import {
|
||||
copyStaticSupervisor,
|
||||
copyTranslationsSupervisor,
|
||||
} from "./gather-static.ts";
|
||||
import { genDummyIconsJson } from "./gen-icons-json.ts";
|
||||
import { buildLocaleData } from "./locale-data.ts";
|
||||
import { rspackProdHassio, rspackWatchHassio } from "./rspack.ts";
|
||||
import { buildSupervisorTranslations } from "./translations.ts";
|
||||
|
||||
// develop-hassio
|
||||
export const developHassio = series(
|
||||
async function setEnv() {
|
||||
process.env.NODE_ENV = "development";
|
||||
},
|
||||
cleanHassio,
|
||||
genDummyIconsJson,
|
||||
genPagesHassioDev,
|
||||
buildSupervisorTranslations,
|
||||
copyTranslationsSupervisor,
|
||||
buildLocaleData,
|
||||
copyStaticSupervisor,
|
||||
rspackWatchHassio
|
||||
);
|
||||
|
||||
// build-hassio
|
||||
export const buildHassio = series(
|
||||
async function setEnv() {
|
||||
process.env.NODE_ENV = "production";
|
||||
},
|
||||
cleanHassio,
|
||||
genDummyIconsJson,
|
||||
buildSupervisorTranslations,
|
||||
copyTranslationsSupervisor,
|
||||
buildLocaleData,
|
||||
copyStaticSupervisor,
|
||||
rspackProdHassio,
|
||||
genPagesHassioProd,
|
||||
...// Don't compress running tests
|
||||
(isTestBuild() ? [] : [compressHassio])
|
||||
);
|
@@ -1,17 +0,0 @@
|
||||
import "./app.js";
|
||||
import "./cast.js";
|
||||
import "./clean.js";
|
||||
import "./compress.js";
|
||||
import "./demo.js";
|
||||
import "./download-translations.js";
|
||||
import "./entry-html.js";
|
||||
import "./fetch-nightly-translations.js";
|
||||
import "./gallery.js";
|
||||
import "./gather-static.js";
|
||||
import "./gen-icons-json.js";
|
||||
import "./hassio.js";
|
||||
import "./landing-page.js";
|
||||
import "./locale-data.js";
|
||||
import "./rspack.js";
|
||||
import "./service-worker.js";
|
||||
import "./translations.js";
|
42
build-scripts/gulp/index.ts
Normal file
42
build-scripts/gulp/index.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import { analyzeApp, buildApp, developApp } from "./app";
|
||||
import { buildCast, developCast } from "./cast";
|
||||
import { analyzeDemo, buildDemo, developDemo } from "./demo";
|
||||
import { downloadTranslations } from "./download-translations";
|
||||
import { setupAndFetchNightlyTranslations } from "./fetch-nightly-translations";
|
||||
import { buildGallery, developGallery, gatherGalleryPages } from "./gallery";
|
||||
import { genIconsJson } from "./gen-icons-json";
|
||||
import { buildHassio, developHassio } from "./hassio";
|
||||
import { buildLandingPage, developLandingPage } from "./landing-page";
|
||||
import { buildLocaleData } from "./locale-data";
|
||||
import { buildTranslations } from "./translations";
|
||||
|
||||
export default {
|
||||
"develop-app": developApp,
|
||||
"build-app": buildApp,
|
||||
"analyze-app": analyzeApp,
|
||||
|
||||
"develop-cast": developCast,
|
||||
"build-cast": buildCast,
|
||||
|
||||
"develop-demo": developDemo,
|
||||
"build-demo": buildDemo,
|
||||
"analyze-demo": analyzeDemo,
|
||||
|
||||
"develop-gallery": developGallery,
|
||||
"build-gallery": buildGallery,
|
||||
"gather-gallery-pages": gatherGalleryPages,
|
||||
|
||||
"develop-hassio": developHassio,
|
||||
"build-hassio": buildHassio,
|
||||
|
||||
"develop-landing-page": developLandingPage,
|
||||
"build-landing-page": buildLandingPage,
|
||||
|
||||
"setup-and-fetch-nightly-translations": setupAndFetchNightlyTranslations,
|
||||
"download-translations": downloadTranslations,
|
||||
"build-translations": buildTranslations,
|
||||
|
||||
"gen-icons-json": genIconsJson,
|
||||
|
||||
"build-locale-data": buildLocaleData,
|
||||
};
|
@@ -1,41 +0,0 @@
|
||||
import gulp from "gulp";
|
||||
import "./clean.js";
|
||||
import "./compress.js";
|
||||
import "./entry-html.js";
|
||||
import "./gather-static.js";
|
||||
import "./gen-icons-json.js";
|
||||
import "./translations.js";
|
||||
import "./rspack.js";
|
||||
|
||||
gulp.task(
|
||||
"develop-landing-page",
|
||||
gulp.series(
|
||||
async function setEnv() {
|
||||
process.env.NODE_ENV = "development";
|
||||
},
|
||||
"clean-landing-page",
|
||||
"translations-enable-merge-backend",
|
||||
"build-landing-page-translations",
|
||||
"copy-translations-landing-page",
|
||||
"build-locale-data",
|
||||
"copy-static-landing-page",
|
||||
"gen-pages-landing-page-dev",
|
||||
"rspack-watch-landing-page"
|
||||
)
|
||||
);
|
||||
|
||||
gulp.task(
|
||||
"build-landing-page",
|
||||
gulp.series(
|
||||
async function setEnv() {
|
||||
process.env.NODE_ENV = "production";
|
||||
},
|
||||
"clean-landing-page",
|
||||
"build-landing-page-translations",
|
||||
"copy-translations-landing-page",
|
||||
"build-locale-data",
|
||||
"copy-static-landing-page",
|
||||
"rspack-prod-landing-page",
|
||||
"gen-pages-landing-page-prod"
|
||||
)
|
||||
);
|
46
build-scripts/gulp/landing-page.ts
Normal file
46
build-scripts/gulp/landing-page.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import { series } from "gulp";
|
||||
import { cleanLandingPage } from "./clean.ts";
|
||||
import "./compress.ts";
|
||||
import {
|
||||
genPagesLandingPageDev,
|
||||
genPagesLandingPageProd,
|
||||
} from "./entry-html.ts";
|
||||
import {
|
||||
copyStaticLandingPage,
|
||||
copyTranslationsLandingPage,
|
||||
} from "./gather-static.ts";
|
||||
import { buildLocaleData } from "./locale-data.ts";
|
||||
import { rspackProdLandingPage, rspackWatchLandingPage } from "./rspack.ts";
|
||||
import {
|
||||
buildLandingPageTranslations,
|
||||
translationsEnableMergeBackend,
|
||||
} from "./translations.ts";
|
||||
|
||||
// develop-landing-page
|
||||
export const developLandingPage = series(
|
||||
async function setEnv() {
|
||||
process.env.NODE_ENV = "development";
|
||||
},
|
||||
cleanLandingPage,
|
||||
translationsEnableMergeBackend,
|
||||
buildLandingPageTranslations,
|
||||
copyTranslationsLandingPage,
|
||||
buildLocaleData,
|
||||
copyStaticLandingPage,
|
||||
genPagesLandingPageDev,
|
||||
rspackWatchLandingPage
|
||||
);
|
||||
|
||||
// build-landing-page
|
||||
export const buildLandingPage = series(
|
||||
async function setEnv() {
|
||||
process.env.NODE_ENV = "production";
|
||||
},
|
||||
cleanLandingPage,
|
||||
buildLandingPageTranslations,
|
||||
copyTranslationsLandingPage,
|
||||
buildLocaleData,
|
||||
copyStaticLandingPage,
|
||||
rspackProdLandingPage,
|
||||
genPagesLandingPageProd
|
||||
);
|
@@ -1,8 +1,8 @@
|
||||
import { deleteSync } from "del";
|
||||
import { mkdir, readFile, writeFile } from "fs/promises";
|
||||
import gulp from "gulp";
|
||||
import { series } from "gulp";
|
||||
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
||||
import { join, resolve } from "node:path";
|
||||
import paths from "../paths.cjs";
|
||||
import paths from "../paths.ts";
|
||||
|
||||
const formatjsDir = join(paths.root_dir, "node_modules", "@formatjs");
|
||||
const outDir = join(paths.build_dir, "locale-data");
|
||||
@@ -31,7 +31,7 @@ const convertToJSON = async (
|
||||
join(formatjsDir, pkg, subDir, `${language}.js`),
|
||||
"utf-8"
|
||||
);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
// Ignore if language is missing (i.e. not supported by @formatjs)
|
||||
if (e.code === "ENOENT" && skipMissing) {
|
||||
console.warn(`Skipped missing data for language ${lang} from ${pkg}`);
|
||||
@@ -54,16 +54,16 @@ const convertToJSON = async (
|
||||
await writeFile(join(outDir, `${pkg}/${lang}.json`), localeData);
|
||||
};
|
||||
|
||||
gulp.task("clean-locale-data", async () => deleteSync([outDir]));
|
||||
const cleanLocaleData = async () => deleteSync([outDir]);
|
||||
|
||||
gulp.task("create-locale-data", async () => {
|
||||
const createLocaleData = async () => {
|
||||
const translationMeta = JSON.parse(
|
||||
await readFile(
|
||||
resolve(paths.translations_src, "translationMetadata.json"),
|
||||
"utf-8"
|
||||
)
|
||||
);
|
||||
const conversions = [];
|
||||
const conversions: any[] = [];
|
||||
for (const pkg of Object.keys(INTL_POLYFILLS)) {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
await mkdir(join(outDir, pkg), { recursive: true });
|
||||
@@ -81,9 +81,6 @@ gulp.task("create-locale-data", async () => {
|
||||
)
|
||||
);
|
||||
await Promise.all(conversions);
|
||||
});
|
||||
};
|
||||
|
||||
gulp.task(
|
||||
"build-locale-data",
|
||||
gulp.series("clean-locale-data", "create-locale-data")
|
||||
);
|
||||
export const buildLocaleData = series(cleanLocaleData, createLocaleData);
|
@@ -1,13 +1,13 @@
|
||||
// Tasks to run rspack.
|
||||
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import log from "fancy-log";
|
||||
import gulp from "gulp";
|
||||
import rspack from "@rspack/core";
|
||||
import { RspackDevServer } from "@rspack/dev-server";
|
||||
import env from "../env.cjs";
|
||||
import paths from "../paths.cjs";
|
||||
import log from "fancy-log";
|
||||
import { series, watch } from "gulp";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { isDevContainer, isStatsBuild, isTestBuild } from "../env.ts";
|
||||
import paths from "../paths.ts";
|
||||
import {
|
||||
createAppConfig,
|
||||
createCastConfig,
|
||||
@@ -15,7 +15,17 @@ import {
|
||||
createGalleryConfig,
|
||||
createHassioConfig,
|
||||
createLandingPageConfig,
|
||||
} from "../rspack.cjs";
|
||||
} from "../rspack.ts";
|
||||
import {
|
||||
copyTranslationsApp,
|
||||
copyTranslationsLandingPage,
|
||||
copyTranslationsSupervisor,
|
||||
} from "./gather-static.ts";
|
||||
import {
|
||||
buildLandingPageTranslations,
|
||||
buildSupervisorTranslations,
|
||||
buildTranslations,
|
||||
} from "./translations.ts";
|
||||
|
||||
const bothBuilds = (createConfigFunc, params) => [
|
||||
createConfigFunc({ ...params, latestBuild: true }),
|
||||
@@ -29,6 +39,14 @@ const isWsl =
|
||||
.toLocaleLowerCase()
|
||||
.includes("microsoft");
|
||||
|
||||
interface RunDevServer {
|
||||
compiler: any;
|
||||
contentBase: string;
|
||||
port: number;
|
||||
listenHost?: string;
|
||||
proxy?: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {{
|
||||
* compiler: import("@rspack/core").Compiler,
|
||||
@@ -41,12 +59,12 @@ const runDevServer = async ({
|
||||
compiler,
|
||||
contentBase,
|
||||
port,
|
||||
listenHost = undefined,
|
||||
proxy = undefined,
|
||||
}) => {
|
||||
listenHost,
|
||||
proxy,
|
||||
}: RunDevServer) => {
|
||||
if (listenHost === undefined) {
|
||||
// For dev container, we need to listen on all hosts
|
||||
listenHost = env.isDevContainer() ? "0.0.0.0" : "localhost";
|
||||
listenHost = isDevContainer() ? "0.0.0.0" : "localhost";
|
||||
}
|
||||
const server = new RspackDevServer(
|
||||
{
|
||||
@@ -68,7 +86,7 @@ const runDevServer = async ({
|
||||
log("[rspack-dev-server]", `Project is running at http://localhost:${port}`);
|
||||
};
|
||||
|
||||
const doneHandler = (done) => (err, stats) => {
|
||||
const doneHandler = (done?: (value?: unknown) => void) => (err, stats) => {
|
||||
if (err) {
|
||||
log.error(err.stack || err);
|
||||
if (err.details) {
|
||||
@@ -97,49 +115,46 @@ const prodBuild = (conf) =>
|
||||
);
|
||||
});
|
||||
|
||||
gulp.task("rspack-watch-app", () => {
|
||||
export const rspackWatchApp = () => {
|
||||
// This command will run forever because we don't close compiler
|
||||
rspack(
|
||||
process.env.ES5
|
||||
? bothBuilds(createAppConfig, { isProdBuild: false })
|
||||
: createAppConfig({ isProdBuild: false, latestBuild: true })
|
||||
).watch({ poll: isWsl }, doneHandler());
|
||||
gulp.watch(
|
||||
watch(
|
||||
path.join(paths.translations_src, "en.json"),
|
||||
gulp.series("build-translations", "copy-translations-app")
|
||||
series(buildTranslations, copyTranslationsApp)
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
gulp.task("rspack-prod-app", () =>
|
||||
export const rspackProdApp = () =>
|
||||
prodBuild(
|
||||
bothBuilds(createAppConfig, {
|
||||
isProdBuild: true,
|
||||
isStatsBuild: env.isStatsBuild(),
|
||||
isTestBuild: env.isTestBuild(),
|
||||
isStatsBuild: isStatsBuild(),
|
||||
isTestBuild: isTestBuild(),
|
||||
})
|
||||
)
|
||||
);
|
||||
);
|
||||
|
||||
gulp.task("rspack-dev-server-demo", () =>
|
||||
export const rspackDevServerDemo = () =>
|
||||
runDevServer({
|
||||
compiler: rspack(
|
||||
createDemoConfig({ isProdBuild: false, latestBuild: true })
|
||||
),
|
||||
contentBase: paths.demo_output_root,
|
||||
port: 8090,
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
gulp.task("rspack-prod-demo", () =>
|
||||
export const rspackProdDemo = () =>
|
||||
prodBuild(
|
||||
bothBuilds(createDemoConfig, {
|
||||
isProdBuild: true,
|
||||
isStatsBuild: env.isStatsBuild(),
|
||||
isStatsBuild: isStatsBuild(),
|
||||
})
|
||||
)
|
||||
);
|
||||
);
|
||||
|
||||
gulp.task("rspack-dev-server-cast", () =>
|
||||
export const rspackDevServerCast = () =>
|
||||
runDevServer({
|
||||
compiler: rspack(
|
||||
createCastConfig({ isProdBuild: false, latestBuild: true })
|
||||
@@ -148,18 +163,16 @@ gulp.task("rspack-dev-server-cast", () =>
|
||||
port: 8080,
|
||||
// Accessible from the network, because that's how Cast hits it.
|
||||
listenHost: "0.0.0.0",
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
gulp.task("rspack-prod-cast", () =>
|
||||
export const rspackProdCast = () =>
|
||||
prodBuild(
|
||||
bothBuilds(createCastConfig, {
|
||||
isProdBuild: true,
|
||||
})
|
||||
)
|
||||
);
|
||||
);
|
||||
|
||||
gulp.task("rspack-watch-hassio", () => {
|
||||
export const rspackWatchHassio = () => {
|
||||
// This command will run forever because we don't close compiler
|
||||
rspack(
|
||||
createHassioConfig({
|
||||
@@ -168,23 +181,22 @@ gulp.task("rspack-watch-hassio", () => {
|
||||
})
|
||||
).watch({ ignored: /build/, poll: isWsl }, doneHandler());
|
||||
|
||||
gulp.watch(
|
||||
watch(
|
||||
path.join(paths.translations_src, "en.json"),
|
||||
gulp.series("build-supervisor-translations", "copy-translations-supervisor")
|
||||
series(buildSupervisorTranslations, copyTranslationsSupervisor)
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
gulp.task("rspack-prod-hassio", () =>
|
||||
export const rspackProdHassio = () =>
|
||||
prodBuild(
|
||||
bothBuilds(createHassioConfig, {
|
||||
isProdBuild: true,
|
||||
isStatsBuild: env.isStatsBuild(),
|
||||
isTestBuild: env.isTestBuild(),
|
||||
isStatsBuild: isStatsBuild(),
|
||||
isTestBuild: isTestBuild(),
|
||||
})
|
||||
)
|
||||
);
|
||||
);
|
||||
|
||||
gulp.task("rspack-dev-server-gallery", () =>
|
||||
export const rspackDevServerGallery = () =>
|
||||
runDevServer({
|
||||
compiler: rspack(
|
||||
createGalleryConfig({ isProdBuild: false, latestBuild: true })
|
||||
@@ -192,19 +204,17 @@ gulp.task("rspack-dev-server-gallery", () =>
|
||||
contentBase: paths.gallery_output_root,
|
||||
port: 8100,
|
||||
listenHost: "0.0.0.0",
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
gulp.task("rspack-prod-gallery", () =>
|
||||
export const rspackProdGallery = () =>
|
||||
prodBuild(
|
||||
createGalleryConfig({
|
||||
isProdBuild: true,
|
||||
latestBuild: true,
|
||||
})
|
||||
)
|
||||
);
|
||||
);
|
||||
|
||||
gulp.task("rspack-watch-landing-page", () => {
|
||||
export const rspackWatchLandingPage = () => {
|
||||
// This command will run forever because we don't close compiler
|
||||
rspack(
|
||||
process.env.ES5
|
||||
@@ -212,21 +222,17 @@ gulp.task("rspack-watch-landing-page", () => {
|
||||
: createLandingPageConfig({ isProdBuild: false, latestBuild: true })
|
||||
).watch({ poll: isWsl }, doneHandler());
|
||||
|
||||
gulp.watch(
|
||||
watch(
|
||||
path.join(paths.translations_src, "en.json"),
|
||||
gulp.series(
|
||||
"build-landing-page-translations",
|
||||
"copy-translations-landing-page"
|
||||
)
|
||||
series(buildLandingPageTranslations, copyTranslationsLandingPage)
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
gulp.task("rspack-prod-landing-page", () =>
|
||||
export const rspackProdLandingPage = () =>
|
||||
prodBuild(
|
||||
bothBuilds(createLandingPageConfig, {
|
||||
isProdBuild: true,
|
||||
isStatsBuild: env.isStatsBuild(),
|
||||
isTestBuild: env.isTestBuild(),
|
||||
isStatsBuild: isStatsBuild(),
|
||||
isTestBuild: isTestBuild(),
|
||||
})
|
||||
)
|
||||
);
|
||||
);
|
@@ -1,11 +1,10 @@
|
||||
// Generate service workers
|
||||
|
||||
import { deleteAsync } from "del";
|
||||
import gulp from "gulp";
|
||||
import { mkdir, readFile, symlink, writeFile } from "node:fs/promises";
|
||||
import { basename, join, relative } from "node:path";
|
||||
import { injectManifest } from "workbox-build";
|
||||
import paths from "../paths.cjs";
|
||||
import paths from "../paths.ts";
|
||||
|
||||
const SW_MAP = {
|
||||
[paths.app_output_latest]: "modern",
|
||||
@@ -23,7 +22,7 @@ self.addEventListener('install', (event) => {
|
||||
});
|
||||
`.trim() + "\n";
|
||||
|
||||
gulp.task("gen-service-worker-app-dev", async () => {
|
||||
export const genServiceWorkerAppDev = async () => {
|
||||
await mkdir(paths.app_output_root, { recursive: true });
|
||||
await Promise.all(
|
||||
Object.values(SW_MAP).map((build) =>
|
||||
@@ -32,9 +31,9 @@ gulp.task("gen-service-worker-app-dev", async () => {
|
||||
})
|
||||
)
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
gulp.task("gen-service-worker-app-prod", () =>
|
||||
export const genServiceWorkerAppProd = () =>
|
||||
Promise.all(
|
||||
Object.entries(SW_MAP).map(async ([outPath, build]) => {
|
||||
const manifest = JSON.parse(
|
||||
@@ -83,5 +82,4 @@ gulp.task("gen-service-worker-app-prod", () =>
|
||||
await symlink(basename(swDest), swOld);
|
||||
}
|
||||
})
|
||||
)
|
||||
);
|
||||
);
|
@@ -2,7 +2,7 @@
|
||||
|
||||
import { deleteAsync } from "del";
|
||||
import { glob } from "glob";
|
||||
import gulp from "gulp";
|
||||
import { src as glupSrc, dest as gulpDest, parallel, series } from "gulp";
|
||||
import rename from "gulp-rename";
|
||||
import merge from "lodash.merge";
|
||||
import { createHash } from "node:crypto";
|
||||
@@ -10,9 +10,12 @@ import { mkdir, readFile } from "node:fs/promises";
|
||||
import { basename, join } from "node:path";
|
||||
import { PassThrough, Transform } from "node:stream";
|
||||
import { finished } from "node:stream/promises";
|
||||
import env from "../env.cjs";
|
||||
import paths from "../paths.cjs";
|
||||
import "./fetch-nightly-translations.js";
|
||||
import { isProdBuild } from "../env.ts";
|
||||
import paths from "../paths.ts";
|
||||
import {
|
||||
allowSetupFetchNightlyTranslations,
|
||||
fetchNightlyTranslations,
|
||||
} from "./fetch-nightly-translations.ts";
|
||||
|
||||
const inFrontendDir = "translations/frontend";
|
||||
const inBackendDir = "translations/backend";
|
||||
@@ -23,18 +26,20 @@ const TEST_LOCALE = "en-x-test";
|
||||
|
||||
let mergeBackend = false;
|
||||
|
||||
gulp.task(
|
||||
"translations-enable-merge-backend",
|
||||
gulp.parallel(async () => {
|
||||
mergeBackend = true;
|
||||
}, "allow-setup-fetch-nightly-translations")
|
||||
);
|
||||
// translations-enable-merge-backend
|
||||
export const translationsEnableMergeBackend = parallel(async () => {
|
||||
mergeBackend = true;
|
||||
}, allowSetupFetchNightlyTranslations);
|
||||
|
||||
// Transform stream to apply a function on Vinyl JSON files (buffer mode only).
|
||||
// The provided function can either return a new object, or an array of
|
||||
// [object, subdirectory] pairs for fragmentizing the JSON.
|
||||
class CustomJSON extends Transform {
|
||||
constructor(func, reviver = null) {
|
||||
_func: any;
|
||||
|
||||
_reviver: any;
|
||||
|
||||
constructor(func, reviver: any = null) {
|
||||
super({ objectMode: true });
|
||||
this._func = func;
|
||||
this._reviver = reviver;
|
||||
@@ -56,9 +61,17 @@ class CustomJSON extends Transform {
|
||||
|
||||
// Transform stream to merge Vinyl JSON files (buffer mode only).
|
||||
class MergeJSON extends Transform {
|
||||
_objects = [];
|
||||
_objects: any[] = [];
|
||||
|
||||
constructor(stem, startObj = {}, reviver = null) {
|
||||
_stem: any;
|
||||
|
||||
_startObj: any;
|
||||
|
||||
_reviver: any;
|
||||
|
||||
_outFile: any;
|
||||
|
||||
constructor(stem, startObj = {}, reviver: any = null) {
|
||||
super({ objectMode: true, allowHalfOpen: false });
|
||||
this._stem = stem;
|
||||
this._startObj = structuredClone(startObj);
|
||||
@@ -111,11 +124,12 @@ const testReviver = (_key, value) =>
|
||||
const KEY_REFERENCE = /\[%key:([^%]+)%\]/;
|
||||
const lokaliseTransform = (data, path, original = data) => {
|
||||
const output = {};
|
||||
for (const [key, value] of Object.entries(data)) {
|
||||
for (const entry of Object.entries(data)) {
|
||||
const [key, value] = entry as [string, string];
|
||||
if (typeof value === "object") {
|
||||
output[key] = lokaliseTransform(value, path, original);
|
||||
} else {
|
||||
output[key] = value.replace(KEY_REFERENCE, (_match, lokalise_key) => {
|
||||
output[key] = value?.replace(KEY_REFERENCE, (_match, lokalise_key) => {
|
||||
const replace = lokalise_key.split("::").reduce((tr, k) => {
|
||||
if (!tr) {
|
||||
throw Error(`Invalid key placeholder ${lokalise_key} in ${path}`);
|
||||
@@ -132,18 +146,17 @@ const lokaliseTransform = (data, path, original = data) => {
|
||||
return output;
|
||||
};
|
||||
|
||||
gulp.task("clean-translations", () => deleteAsync([workDir]));
|
||||
export const cleanTranslations = () => deleteAsync([workDir]);
|
||||
|
||||
const makeWorkDir = () => mkdir(workDir, { recursive: true });
|
||||
|
||||
const createTestTranslation = () =>
|
||||
env.isProdBuild()
|
||||
isProdBuild()
|
||||
? Promise.resolve()
|
||||
: gulp
|
||||
.src(EN_SRC)
|
||||
: glupSrc(EN_SRC)
|
||||
.pipe(new CustomJSON(null, testReviver))
|
||||
.pipe(rename(`${TEST_LOCALE}.json`))
|
||||
.pipe(gulp.dest(workDir));
|
||||
.pipe(gulpDest(workDir));
|
||||
|
||||
/**
|
||||
* This task will build a master translation file, to be used as the base for
|
||||
@@ -155,11 +168,10 @@ const createTestTranslation = () =>
|
||||
* the Lokalise update to translations/en.json will not happen immediately.
|
||||
*/
|
||||
const createMasterTranslation = () =>
|
||||
gulp
|
||||
.src([EN_SRC, ...(mergeBackend ? [`${inBackendDir}/en.json`] : [])])
|
||||
glupSrc([EN_SRC, ...(mergeBackend ? [`${inBackendDir}/en.json`] : [])])
|
||||
.pipe(new CustomJSON(lokaliseTransform))
|
||||
.pipe(new MergeJSON("en"))
|
||||
.pipe(gulp.dest(workDir));
|
||||
.pipe(gulpDest(workDir));
|
||||
|
||||
const FRAGMENTS = ["base"];
|
||||
|
||||
@@ -186,12 +198,12 @@ const createTranslations = async () => {
|
||||
// each locale, then fragmentizes and flattens the data for final output.
|
||||
const translationFiles = await glob([
|
||||
`${inFrontendDir}/!(en).json`,
|
||||
...(env.isProdBuild() ? [] : [`${workDir}/${TEST_LOCALE}.json`]),
|
||||
...(isProdBuild() ? [] : [`${workDir}/${TEST_LOCALE}.json`]),
|
||||
]);
|
||||
const hashStream = new Transform({
|
||||
objectMode: true,
|
||||
transform: async (file, _, callback) => {
|
||||
const hash = env.isProdBuild()
|
||||
const hash = isProdBuild()
|
||||
? createHash("md5").update(file.contents).digest("hex")
|
||||
: "dev";
|
||||
HASHES.set(file.stem, hash);
|
||||
@@ -230,7 +242,7 @@ const createTranslations = async () => {
|
||||
})
|
||||
)
|
||||
)
|
||||
.pipe(gulp.dest(outDir));
|
||||
.pipe(gulpDest(outDir));
|
||||
|
||||
// Send the English master downstream first, then for each other locale
|
||||
// generate merged JSON data to continue piping. It begins with the master
|
||||
@@ -240,15 +252,15 @@ const createTranslations = async () => {
|
||||
// TODO: This is a naive interpretation of BCP47 that should be improved.
|
||||
// Will be OK for now as long as we don't have anything more complicated
|
||||
// than a base translation + region.
|
||||
const masterStream = gulp
|
||||
.src(`${workDir}/en.json`)
|
||||
.pipe(new PassThrough({ objectMode: true }));
|
||||
const masterStream = glupSrc(`${workDir}/en.json`).pipe(
|
||||
new PassThrough({ objectMode: true })
|
||||
);
|
||||
masterStream.pipe(hashStream, { end: false });
|
||||
const mergesFinished = [finished(masterStream)];
|
||||
for (const translationFile of translationFiles) {
|
||||
const locale = basename(translationFile, ".json");
|
||||
const subtags = locale.split("-");
|
||||
const mergeFiles = [];
|
||||
const mergeFiles: string[] = [];
|
||||
for (let i = 1; i <= subtags.length; i++) {
|
||||
const lang = subtags.slice(0, i).join("-");
|
||||
if (lang === TEST_LOCALE) {
|
||||
@@ -260,9 +272,9 @@ const createTranslations = async () => {
|
||||
}
|
||||
}
|
||||
}
|
||||
const mergeStream = gulp
|
||||
.src(mergeFiles, { allowEmpty: true })
|
||||
.pipe(new MergeJSON(locale, enMaster, emptyReviver));
|
||||
const mergeStream = glupSrc(mergeFiles, { allowEmpty: true }).pipe(
|
||||
new MergeJSON(locale, enMaster, emptyReviver)
|
||||
);
|
||||
mergesFinished.push(finished(mergeStream));
|
||||
mergeStream.pipe(hashStream, { end: false });
|
||||
}
|
||||
@@ -275,12 +287,11 @@ const createTranslations = async () => {
|
||||
};
|
||||
|
||||
const writeTranslationMetaData = () =>
|
||||
gulp
|
||||
.src([`${paths.translations_src}/translationMetadata.json`])
|
||||
glupSrc([`${paths.translations_src}/translationMetadata.json`])
|
||||
.pipe(
|
||||
new CustomJSON((meta) => {
|
||||
// Add the test translation in development.
|
||||
if (!env.isProdBuild()) {
|
||||
if (!isProdBuild()) {
|
||||
meta[TEST_LOCALE] = { nativeName: "Translation Test" };
|
||||
}
|
||||
// Filter out locales without a native name, and add the hashes.
|
||||
@@ -300,28 +311,22 @@ const writeTranslationMetaData = () =>
|
||||
};
|
||||
})
|
||||
)
|
||||
.pipe(gulp.dest(workDir));
|
||||
.pipe(gulpDest(workDir));
|
||||
|
||||
gulp.task(
|
||||
"build-translations",
|
||||
gulp.series(
|
||||
gulp.parallel(
|
||||
"fetch-nightly-translations",
|
||||
gulp.series("clean-translations", makeWorkDir)
|
||||
),
|
||||
createTestTranslation,
|
||||
createMasterTranslation,
|
||||
createTranslations,
|
||||
writeTranslationMetaData
|
||||
)
|
||||
export const buildTranslations = series(
|
||||
parallel(fetchNightlyTranslations, series(cleanTranslations, makeWorkDir)),
|
||||
createTestTranslation,
|
||||
createMasterTranslation,
|
||||
createTranslations,
|
||||
writeTranslationMetaData
|
||||
);
|
||||
|
||||
gulp.task(
|
||||
"build-supervisor-translations",
|
||||
gulp.series(setFragment("supervisor"), "build-translations")
|
||||
export const buildSupervisorTranslations = series(
|
||||
setFragment("supervisor"),
|
||||
buildTranslations
|
||||
);
|
||||
|
||||
gulp.task(
|
||||
"build-landing-page-translations",
|
||||
gulp.series(setFragment("landing-page"), "build-translations")
|
||||
export const buildLandingPageTranslations = series(
|
||||
setFragment("landing-page"),
|
||||
buildTranslations
|
||||
);
|
@@ -5,10 +5,11 @@ import { version as babelVersion } from "@babel/core";
|
||||
import presetEnv from "@babel/preset-env";
|
||||
import compilationTargets from "@babel/helper-compilation-targets";
|
||||
import coreJSCompat from "core-js-compat";
|
||||
|
||||
import { logPlugin } from "@babel/preset-env/lib/debug.js";
|
||||
// eslint-disable-next-line import/no-relative-packages
|
||||
import shippedPolyfills from "../node_modules/babel-plugin-polyfill-corejs3/lib/shipped-proposals.js";
|
||||
import { babelOptions } from "./bundle.cjs";
|
||||
import { babelOptions } from "./bundle.ts";
|
||||
|
||||
const detailsOpen = (heading) =>
|
||||
`<details>\n<summary><h4>${heading}</h4></summary>\n`;
|
||||
@@ -50,6 +51,12 @@ for (const buildType of ["Modern", "Legacy"]) {
|
||||
const babelOpts = babelOptions({ latestBuild: browserslistEnv === "modern" });
|
||||
const presetEnvOpts = babelOpts.presets[0][1];
|
||||
|
||||
if (typeof presetEnvOpts !== "object") {
|
||||
throw new Error(
|
||||
"The first preset in babelOptions is not an object. This is unexpected."
|
||||
);
|
||||
}
|
||||
|
||||
// Invoking preset-env in debug mode will log the included plugins
|
||||
console.log(detailsOpen(`${buildType} Build Babel Plugins`));
|
||||
presetEnv.default(dummyAPI, {
|
@@ -1,63 +0,0 @@
|
||||
const path = require("path");
|
||||
|
||||
module.exports = {
|
||||
root_dir: path.resolve(__dirname, ".."),
|
||||
|
||||
build_dir: path.resolve(__dirname, "../build"),
|
||||
app_output_root: path.resolve(__dirname, "../hass_frontend"),
|
||||
app_output_static: path.resolve(__dirname, "../hass_frontend/static"),
|
||||
app_output_latest: path.resolve(
|
||||
__dirname,
|
||||
"../hass_frontend/frontend_latest"
|
||||
),
|
||||
app_output_es5: path.resolve(__dirname, "../hass_frontend/frontend_es5"),
|
||||
|
||||
demo_dir: path.resolve(__dirname, "../demo"),
|
||||
demo_output_root: path.resolve(__dirname, "../demo/dist"),
|
||||
demo_output_static: path.resolve(__dirname, "../demo/dist/static"),
|
||||
demo_output_latest: path.resolve(__dirname, "../demo/dist/frontend_latest"),
|
||||
demo_output_es5: path.resolve(__dirname, "../demo/dist/frontend_es5"),
|
||||
|
||||
cast_dir: path.resolve(__dirname, "../cast"),
|
||||
cast_output_root: path.resolve(__dirname, "../cast/dist"),
|
||||
cast_output_static: path.resolve(__dirname, "../cast/dist/static"),
|
||||
cast_output_latest: path.resolve(__dirname, "../cast/dist/frontend_latest"),
|
||||
cast_output_es5: path.resolve(__dirname, "../cast/dist/frontend_es5"),
|
||||
|
||||
gallery_dir: path.resolve(__dirname, "../gallery"),
|
||||
gallery_build: path.resolve(__dirname, "../gallery/build"),
|
||||
gallery_output_root: path.resolve(__dirname, "../gallery/dist"),
|
||||
gallery_output_latest: path.resolve(
|
||||
__dirname,
|
||||
"../gallery/dist/frontend_latest"
|
||||
),
|
||||
gallery_output_static: path.resolve(__dirname, "../gallery/dist/static"),
|
||||
|
||||
landingPage_dir: path.resolve(__dirname, "../landing-page"),
|
||||
landingPage_build: path.resolve(__dirname, "../landing-page/build"),
|
||||
landingPage_output_root: path.resolve(__dirname, "../landing-page/dist"),
|
||||
landingPage_output_latest: path.resolve(
|
||||
__dirname,
|
||||
"../landing-page/dist/frontend_latest"
|
||||
),
|
||||
landingPage_output_es5: path.resolve(
|
||||
__dirname,
|
||||
"../landing-page/dist/frontend_es5"
|
||||
),
|
||||
landingPage_output_static: path.resolve(
|
||||
__dirname,
|
||||
"../landing-page/dist/static"
|
||||
),
|
||||
|
||||
hassio_dir: path.resolve(__dirname, "../hassio"),
|
||||
hassio_output_root: path.resolve(__dirname, "../hassio/build"),
|
||||
hassio_output_static: path.resolve(__dirname, "../hassio/build/static"),
|
||||
hassio_output_latest: path.resolve(
|
||||
__dirname,
|
||||
"../hassio/build/frontend_latest"
|
||||
),
|
||||
hassio_output_es5: path.resolve(__dirname, "../hassio/build/frontend_es5"),
|
||||
hassio_publicPath: "/api/hassio/app",
|
||||
|
||||
translations_src: path.resolve(__dirname, "../src/translations"),
|
||||
};
|
63
build-scripts/paths.ts
Normal file
63
build-scripts/paths.ts
Normal file
@@ -0,0 +1,63 @@
|
||||
import path, { dirname as pathDirname } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
export const dirname = pathDirname(fileURLToPath(import.meta.url));
|
||||
|
||||
export default {
|
||||
root_dir: path.resolve(dirname, ".."),
|
||||
|
||||
build_dir: path.resolve(dirname, "../build"),
|
||||
app_output_root: path.resolve(dirname, "../hass_frontend"),
|
||||
app_output_static: path.resolve(dirname, "../hass_frontend/static"),
|
||||
app_output_latest: path.resolve(dirname, "../hass_frontend/frontend_latest"),
|
||||
app_output_es5: path.resolve(dirname, "../hass_frontend/frontend_es5"),
|
||||
|
||||
demo_dir: path.resolve(dirname, "../demo"),
|
||||
demo_output_root: path.resolve(dirname, "../demo/dist"),
|
||||
demo_output_static: path.resolve(dirname, "../demo/dist/static"),
|
||||
demo_output_latest: path.resolve(dirname, "../demo/dist/frontend_latest"),
|
||||
demo_output_es5: path.resolve(dirname, "../demo/dist/frontend_es5"),
|
||||
|
||||
cast_dir: path.resolve(dirname, "../cast"),
|
||||
cast_output_root: path.resolve(dirname, "../cast/dist"),
|
||||
cast_output_static: path.resolve(dirname, "../cast/dist/static"),
|
||||
cast_output_latest: path.resolve(dirname, "../cast/dist/frontend_latest"),
|
||||
cast_output_es5: path.resolve(dirname, "../cast/dist/frontend_es5"),
|
||||
|
||||
gallery_dir: path.resolve(dirname, "../gallery"),
|
||||
gallery_build: path.resolve(dirname, "../gallery/build"),
|
||||
gallery_output_root: path.resolve(dirname, "../gallery/dist"),
|
||||
gallery_output_latest: path.resolve(
|
||||
dirname,
|
||||
"../gallery/dist/frontend_latest"
|
||||
),
|
||||
gallery_output_static: path.resolve(dirname, "../gallery/dist/static"),
|
||||
|
||||
landingPage_dir: path.resolve(dirname, "../landing-page"),
|
||||
landingPage_build: path.resolve(dirname, "../landing-page/build"),
|
||||
landingPage_output_root: path.resolve(dirname, "../landing-page/dist"),
|
||||
landingPage_output_latest: path.resolve(
|
||||
dirname,
|
||||
"../landing-page/dist/frontend_latest"
|
||||
),
|
||||
landingPage_output_es5: path.resolve(
|
||||
dirname,
|
||||
"../landing-page/dist/frontend_es5"
|
||||
),
|
||||
landingPage_output_static: path.resolve(
|
||||
dirname,
|
||||
"../landing-page/dist/static"
|
||||
),
|
||||
|
||||
hassio_dir: path.resolve(dirname, "../hassio"),
|
||||
hassio_output_root: path.resolve(dirname, "../hassio/build"),
|
||||
hassio_output_static: path.resolve(dirname, "../hassio/build/static"),
|
||||
hassio_output_latest: path.resolve(
|
||||
dirname,
|
||||
"../hassio/build/frontend_latest"
|
||||
),
|
||||
hassio_output_es5: path.resolve(dirname, "../hassio/build/frontend_es5"),
|
||||
hassio_publicPath: "/api/hassio/app",
|
||||
|
||||
translations_src: path.resolve(dirname, "../src/translations"),
|
||||
};
|
@@ -1,20 +1,25 @@
|
||||
const { existsSync } = require("fs");
|
||||
const path = require("path");
|
||||
const rspack = require("@rspack/core");
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
const { RsdoctorRspackPlugin } = require("@rsdoctor/rspack-plugin");
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
const { StatsWriterPlugin } = require("webpack-stats-plugin");
|
||||
const filterStats = require("@bundle-stats/plugin-webpack-filter");
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
const TerserPlugin = require("terser-webpack-plugin");
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
const { WebpackManifestPlugin } = require("rspack-manifest-plugin");
|
||||
const log = require("fancy-log");
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
const WebpackBar = require("webpackbar/rspack");
|
||||
const paths = require("./paths.cjs");
|
||||
const bundle = require("./bundle.cjs");
|
||||
import filterStats from "@bundle-stats/plugin-webpack-filter";
|
||||
import { RsdoctorRspackPlugin } from "@rsdoctor/rspack-plugin";
|
||||
import { DefinePlugin, NormalModuleReplacementPlugin } from "@rspack/core";
|
||||
import { defineConfig } from "@rspack/cli";
|
||||
import log from "fancy-log";
|
||||
import { existsSync } from "node:fs";
|
||||
import path from "node:path";
|
||||
import { WebpackManifestPlugin } from "rspack-manifest-plugin";
|
||||
import TerserPlugin from "terser-webpack-plugin";
|
||||
import { StatsWriterPlugin } from "webpack-stats-plugin";
|
||||
// @ts-ignore
|
||||
import WebpackBar from "webpackbar/rspack";
|
||||
import {
|
||||
babelOptions,
|
||||
config,
|
||||
definedVars,
|
||||
emptyPackages,
|
||||
sourceMapURL,
|
||||
swcOptions,
|
||||
terserOptions,
|
||||
} from "./bundle.ts";
|
||||
import paths from "./paths.ts";
|
||||
|
||||
class LogStartCompilePlugin {
|
||||
ignoredFirst = false;
|
||||
@@ -30,7 +35,7 @@ class LogStartCompilePlugin {
|
||||
}
|
||||
}
|
||||
|
||||
const createRspackConfig = ({
|
||||
export const createRspackConfig = ({
|
||||
name,
|
||||
entry,
|
||||
outputPath,
|
||||
@@ -42,12 +47,23 @@ const createRspackConfig = ({
|
||||
isTestBuild,
|
||||
isHassioBuild,
|
||||
dontHash,
|
||||
}: {
|
||||
name: string;
|
||||
entry: any;
|
||||
outputPath: string;
|
||||
publicPath: string;
|
||||
defineOverlay?: Record<string, any>;
|
||||
isProdBuild?: boolean;
|
||||
latestBuild?: boolean;
|
||||
isStatsBuild?: boolean;
|
||||
isTestBuild?: boolean;
|
||||
isHassioBuild?: boolean;
|
||||
dontHash?: Set<string>;
|
||||
}) => {
|
||||
if (!dontHash) {
|
||||
dontHash = new Set();
|
||||
}
|
||||
const ignorePackages = bundle.ignorePackages({ latestBuild });
|
||||
return {
|
||||
return defineConfig({
|
||||
name,
|
||||
mode: isProdBuild ? "production" : "development",
|
||||
target: `browserslist:${latestBuild ? "modern" : "legacy"}`,
|
||||
@@ -70,7 +86,7 @@ const createRspackConfig = ({
|
||||
{
|
||||
loader: "babel-loader",
|
||||
options: {
|
||||
...bundle.babelOptions({
|
||||
...babelOptions({
|
||||
latestBuild,
|
||||
isProdBuild,
|
||||
isTestBuild,
|
||||
@@ -82,7 +98,7 @@ const createRspackConfig = ({
|
||||
},
|
||||
{
|
||||
loader: "builtin:swc-loader",
|
||||
options: bundle.swcOptions(),
|
||||
options: swcOptions(),
|
||||
},
|
||||
],
|
||||
resolve: {
|
||||
@@ -103,7 +119,7 @@ const createRspackConfig = ({
|
||||
new TerserPlugin({
|
||||
parallel: true,
|
||||
extractComments: true,
|
||||
terserOptions: bundle.terserOptions({ latestBuild, isTestBuild }),
|
||||
terserOptions: terserOptions({ latestBuild, isTestBuild }),
|
||||
}),
|
||||
],
|
||||
moduleIds: isProdBuild && !isStatsBuild ? "deterministic" : "named",
|
||||
@@ -122,7 +138,7 @@ const createRspackConfig = ({
|
||||
!chunk.canBeInitial() &&
|
||||
!new RegExp(
|
||||
`^.+-work${latestBuild ? "(?:let|er)" : "let"}$`
|
||||
).test(chunk.name),
|
||||
).test(chunk?.name || ""),
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
@@ -131,44 +147,11 @@ const createRspackConfig = ({
|
||||
// Only include the JS of entrypoints
|
||||
filter: (file) => file.isInitial && !file.name.endsWith(".map"),
|
||||
}),
|
||||
new rspack.DefinePlugin(
|
||||
bundle.definedVars({ isProdBuild, latestBuild, defineOverlay })
|
||||
new DefinePlugin(
|
||||
definedVars({ isProdBuild, latestBuild, defineOverlay })
|
||||
),
|
||||
new rspack.IgnorePlugin({
|
||||
checkResource(resource, context) {
|
||||
// Only use ignore to intercept imports that we don't control
|
||||
// inside node_module dependencies.
|
||||
if (
|
||||
!context.includes("/node_modules/") ||
|
||||
// calling define.amd will call require("!!webpack amd options")
|
||||
resource.startsWith("!!webpack") ||
|
||||
// loaded by webpack dev server but doesn't exist.
|
||||
resource === "webpack/hot" ||
|
||||
resource.startsWith("@swc/helpers")
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
let fullPath;
|
||||
try {
|
||||
fullPath = resource.startsWith(".")
|
||||
? path.resolve(context, resource)
|
||||
: require.resolve(resource);
|
||||
} catch (err) {
|
||||
console.error(
|
||||
"Error in Home Assistant ignore plugin",
|
||||
resource,
|
||||
context
|
||||
);
|
||||
throw err;
|
||||
}
|
||||
|
||||
return ignorePackages.some((toIgnorePath) =>
|
||||
fullPath.startsWith(toIgnorePath)
|
||||
);
|
||||
},
|
||||
}),
|
||||
new rspack.NormalModuleReplacementPlugin(
|
||||
new RegExp(bundle.emptyPackages({ isHassioBuild }).join("|")),
|
||||
new NormalModuleReplacementPlugin(
|
||||
new RegExp(emptyPackages({ isHassioBuild }).join("|")),
|
||||
path.resolve(paths.root_dir, "src/util/empty.js")
|
||||
),
|
||||
!isProdBuild && new LogStartCompilePlugin(),
|
||||
@@ -184,7 +167,9 @@ const createRspackConfig = ({
|
||||
isProdBuild &&
|
||||
isStatsBuild &&
|
||||
new RsdoctorRspackPlugin({
|
||||
reportDir: path.join(paths.build_dir, "rsdoctor"),
|
||||
output: {
|
||||
reportDir: path.join(paths.build_dir, "rsdoctor"),
|
||||
},
|
||||
features: ["plugins", "bundle"],
|
||||
supports: {
|
||||
generateTileGraph: true,
|
||||
@@ -219,7 +204,9 @@ const createRspackConfig = ({
|
||||
output: {
|
||||
module: latestBuild,
|
||||
filename: ({ chunk }) =>
|
||||
!isProdBuild || isStatsBuild || dontHash.has(chunk.name)
|
||||
!isProdBuild ||
|
||||
isStatsBuild ||
|
||||
(chunk?.name && dontHash.has(chunk.name))
|
||||
? "[name].js"
|
||||
: "[name].[contenthash].js",
|
||||
chunkFilename:
|
||||
@@ -250,7 +237,7 @@ const createRspackConfig = ({
|
||||
// dev tools, and they stay happy getting 404s with valid requests.
|
||||
return `/unknown${path.resolve("/", info.resourcePath)}`;
|
||||
}
|
||||
return new URL(info.resourcePath, bundle.sourceMapURL()).href;
|
||||
return new URL(info.resourcePath, sourceMapURL()).href;
|
||||
}
|
||||
: undefined,
|
||||
])
|
||||
@@ -260,35 +247,51 @@ const createRspackConfig = ({
|
||||
layers: true,
|
||||
outputModule: true,
|
||||
},
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
const createAppConfig = ({
|
||||
export const createAppConfig = ({
|
||||
isProdBuild,
|
||||
latestBuild,
|
||||
isStatsBuild,
|
||||
isTestBuild,
|
||||
}: {
|
||||
isProdBuild?: boolean;
|
||||
latestBuild?: boolean;
|
||||
isStatsBuild?: boolean;
|
||||
isTestBuild?: boolean;
|
||||
}) =>
|
||||
createRspackConfig(
|
||||
bundle.config.app({ isProdBuild, latestBuild, isStatsBuild, isTestBuild })
|
||||
config.app({ isProdBuild, latestBuild, isStatsBuild, isTestBuild })
|
||||
);
|
||||
|
||||
const createDemoConfig = ({ isProdBuild, latestBuild, isStatsBuild }) =>
|
||||
createRspackConfig(
|
||||
bundle.config.demo({ isProdBuild, latestBuild, isStatsBuild })
|
||||
);
|
||||
export const createDemoConfig = ({
|
||||
isProdBuild,
|
||||
latestBuild,
|
||||
isStatsBuild,
|
||||
}: {
|
||||
isProdBuild?: boolean;
|
||||
latestBuild?: boolean;
|
||||
isStatsBuild?: boolean;
|
||||
}) =>
|
||||
createRspackConfig(config.demo({ isProdBuild, latestBuild, isStatsBuild }));
|
||||
|
||||
const createCastConfig = ({ isProdBuild, latestBuild }) =>
|
||||
createRspackConfig(bundle.config.cast({ isProdBuild, latestBuild }));
|
||||
export const createCastConfig = ({ isProdBuild, latestBuild }) =>
|
||||
createRspackConfig(config.cast({ isProdBuild, latestBuild }));
|
||||
|
||||
const createHassioConfig = ({
|
||||
export const createHassioConfig = ({
|
||||
isProdBuild,
|
||||
latestBuild,
|
||||
isStatsBuild,
|
||||
isTestBuild,
|
||||
}: {
|
||||
isProdBuild?: boolean;
|
||||
latestBuild?: boolean;
|
||||
isStatsBuild?: boolean;
|
||||
isTestBuild?: boolean;
|
||||
}) =>
|
||||
createRspackConfig(
|
||||
bundle.config.hassio({
|
||||
config.hassio({
|
||||
isProdBuild,
|
||||
latestBuild,
|
||||
isStatsBuild,
|
||||
@@ -296,18 +299,8 @@ const createHassioConfig = ({
|
||||
})
|
||||
);
|
||||
|
||||
const createGalleryConfig = ({ isProdBuild, latestBuild }) =>
|
||||
createRspackConfig(bundle.config.gallery({ isProdBuild, latestBuild }));
|
||||
export const createGalleryConfig = ({ isProdBuild, latestBuild }) =>
|
||||
createRspackConfig(config.gallery({ isProdBuild, latestBuild }));
|
||||
|
||||
const createLandingPageConfig = ({ isProdBuild, latestBuild }) =>
|
||||
createRspackConfig(bundle.config.landingPage({ isProdBuild, latestBuild }));
|
||||
|
||||
module.exports = {
|
||||
createAppConfig,
|
||||
createDemoConfig,
|
||||
createCastConfig,
|
||||
createHassioConfig,
|
||||
createGalleryConfig,
|
||||
createRspackConfig,
|
||||
createLandingPageConfig,
|
||||
};
|
||||
export const createLandingPageConfig = ({ isProdBuild, latestBuild }) =>
|
||||
createRspackConfig(config.landingPage({ isProdBuild, latestBuild }));
|
42
build-scripts/runTask.ts
Normal file
42
build-scripts/runTask.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
// run-build.ts
|
||||
import { series } from "gulp";
|
||||
import { availableParallelism } from "node:os";
|
||||
import tasks from "./gulp/index.ts";
|
||||
|
||||
process.env.UV_THREADPOOL_SIZE = availableParallelism().toString();
|
||||
|
||||
const runGulpTask = async (runTasks: string[]) => {
|
||||
try {
|
||||
for (const taskName of runTasks) {
|
||||
if (tasks[taskName] === undefined) {
|
||||
console.error(`Gulp task "${taskName}" does not exist.`);
|
||||
console.log("Available tasks:");
|
||||
Object.keys(tasks).forEach((task) => {
|
||||
console.log(` - ${task}`);
|
||||
});
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
await new Promise((resolve, reject) => {
|
||||
series(...runTasks.map((taskName) => tasks[taskName]))((err?: Error) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
} else {
|
||||
resolve(null);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
process.exit(0);
|
||||
} catch (error: any) {
|
||||
console.error(`Error running Gulp task "${runTasks}":`, error);
|
||||
process.exit(1);
|
||||
}
|
||||
};
|
||||
|
||||
// Get the task name from command line arguments
|
||||
// TODO arg validation
|
||||
const tasksToRun = process.argv.slice(2);
|
||||
|
||||
runGulpTask(tasksToRun);
|
@@ -6,4 +6,4 @@ set -e
|
||||
|
||||
cd "$(dirname "$0")/../.."
|
||||
|
||||
./node_modules/.bin/gulp build-cast
|
||||
yarn run-task build-cast
|
||||
|
@@ -6,4 +6,4 @@ set -e
|
||||
|
||||
cd "$(dirname "$0")/../.."
|
||||
|
||||
./node_modules/.bin/gulp develop-cast
|
||||
yarn run-task develop-cast
|
||||
|
@@ -302,7 +302,7 @@ export class HcConnect extends LitElement {
|
||||
}
|
||||
.error {
|
||||
color: red;
|
||||
font-weight: bold;
|
||||
font-weight: var(--ha-font-weight-bold);
|
||||
}
|
||||
|
||||
.error a {
|
||||
|
@@ -86,9 +86,9 @@ class HcLayout extends LitElement {
|
||||
.card-header {
|
||||
color: var(--ha-card-header-color, var(--primary-text-color));
|
||||
font-family: var(--ha-card-header-font-family, inherit);
|
||||
font-size: var(--ha-card-header-font-size, 24px);
|
||||
font-size: var(--ha-card-header-font-size, var(--ha-font-size-2xl));
|
||||
letter-spacing: -0.012em;
|
||||
line-height: 32px;
|
||||
line-height: var(--ha-line-height-condensed);
|
||||
padding: 24px 16px 16px;
|
||||
display: block;
|
||||
margin: 0;
|
||||
@@ -98,7 +98,7 @@ class HcLayout extends LitElement {
|
||||
border-radius: 4px 4px 0 0;
|
||||
}
|
||||
.subtitle {
|
||||
font-size: 14px;
|
||||
font-size: var(--ha-font-size-m);
|
||||
color: var(--secondary-text-color);
|
||||
line-height: initial;
|
||||
}
|
||||
@@ -113,7 +113,7 @@ class HcLayout extends LitElement {
|
||||
}
|
||||
|
||||
:host ::slotted(.section-header) {
|
||||
font-weight: 500;
|
||||
font-weight: var(--ha-font-weight-medium);
|
||||
padding: 4px 16px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
@@ -135,7 +135,7 @@ class HcLayout extends LitElement {
|
||||
|
||||
.footer {
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
font-size: var(--ha-font-size-s);
|
||||
padding: 8px 0 24px;
|
||||
color: var(--secondary-text-color);
|
||||
}
|
||||
|
@@ -29,7 +29,7 @@ class HcLaunchScreen extends LitElement {
|
||||
display: block;
|
||||
height: 100vh;
|
||||
background-color: #f2f4f9;
|
||||
font-size: 24px;
|
||||
font-size: var(--ha-font-size-2xl);
|
||||
}
|
||||
.container {
|
||||
display: flex;
|
||||
|
@@ -6,4 +6,4 @@ set -e
|
||||
|
||||
cd "$(dirname "$0")/../.."
|
||||
|
||||
./node_modules/.bin/gulp build-demo
|
||||
yarn run-task build-demo
|
||||
|
@@ -6,4 +6,4 @@ set -e
|
||||
|
||||
cd "$(dirname "$0")/../.."
|
||||
|
||||
./node_modules/.bin/gulp develop-demo
|
||||
yarn run-task develop-demo
|
||||
|
@@ -6,4 +6,4 @@ set -e
|
||||
|
||||
cd "$(dirname "$0")/../.."
|
||||
|
||||
./node_modules/.bin/gulp analyze-demo
|
||||
yarn run-task analyze-demo
|
@@ -68,7 +68,7 @@
|
||||
}
|
||||
#ha-launch-screen .ha-launch-screen-spacer-top {
|
||||
flex: 1;
|
||||
margin-top: calc( 2 * max(env(safe-area-inset-bottom), 48px) + 46px );
|
||||
margin-top: calc( 2 * max(var(--safe-area-inset-bottom), 48px) + 46px );
|
||||
padding-top: 48px;
|
||||
}
|
||||
#ha-launch-screen .ha-launch-screen-spacer-bottom {
|
||||
@@ -76,7 +76,7 @@
|
||||
padding-top: 48px;
|
||||
}
|
||||
.ohf-logo {
|
||||
margin: max(env(safe-area-inset-bottom), 48px) 0;
|
||||
margin: max(var(--safe-area-inset-bottom), 48px) 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
|
@@ -1,7 +1,30 @@
|
||||
import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
||||
|
||||
let changeFunction;
|
||||
|
||||
export const mockFrontend = (hass: MockHomeAssistant) => {
|
||||
hass.mockWS("frontend/get_user_data", () => ({
|
||||
value: null,
|
||||
}));
|
||||
hass.mockWS("frontend/set_user_data", ({ key, value }) => {
|
||||
if (key === "sidebar") {
|
||||
changeFunction?.({
|
||||
value: {
|
||||
panelOrder: value.panelOrder || [],
|
||||
hiddenPanels: value.hiddenPanels || [],
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
hass.mockWS("frontend/subscribe_user_data", (_msg, _hass, onChange) => {
|
||||
changeFunction = onChange;
|
||||
onChange?.({
|
||||
value: {
|
||||
panelOrder: [],
|
||||
hiddenPanels: [],
|
||||
},
|
||||
});
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
return () => {};
|
||||
});
|
||||
};
|
||||
|
@@ -11,6 +11,7 @@ import tseslint from "typescript-eslint";
|
||||
import eslintConfigPrettier from "eslint-config-prettier";
|
||||
import { configs as litConfigs } from "eslint-plugin-lit";
|
||||
import { configs as wcConfigs } from "eslint-plugin-wc";
|
||||
import { configs as a11yConfigs } from "eslint-plugin-lit-a11y";
|
||||
|
||||
const _filename = fileURLToPath(import.meta.url);
|
||||
const _dirname = path.dirname(_filename);
|
||||
@@ -21,13 +22,14 @@ const compat = new FlatCompat({
|
||||
});
|
||||
|
||||
export default tseslint.config(
|
||||
...compat.extends("airbnb-base", "plugin:lit-a11y/recommended"),
|
||||
...compat.extends("airbnb-base"),
|
||||
eslintConfigPrettier,
|
||||
litConfigs["flat/all"],
|
||||
tseslint.configs.recommended,
|
||||
tseslint.configs.strict,
|
||||
tseslint.configs.stylistic,
|
||||
wcConfigs["flat/recommended"],
|
||||
a11yConfigs.recommended,
|
||||
{
|
||||
plugins: {
|
||||
"unused-imports": unusedImports,
|
||||
@@ -54,15 +56,6 @@ export default tseslint.config(
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
settings: {
|
||||
"import/resolver": {
|
||||
webpack: {
|
||||
config: "./rspack.config.cjs",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
rules: {
|
||||
"class-methods-use-this": "off",
|
||||
"new-cap": "off",
|
||||
@@ -185,5 +178,12 @@ export default tseslint.config(
|
||||
],
|
||||
"no-use-before-define": "off",
|
||||
},
|
||||
settings: {
|
||||
"import/resolver": {
|
||||
node: {
|
||||
extensions: [".ts", ".js"],
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
);
|
||||
|
@@ -6,4 +6,4 @@ set -e
|
||||
|
||||
cd "$(dirname "$0")/../.."
|
||||
|
||||
./node_modules/.bin/gulp build-gallery
|
||||
yarn run-task build-gallery
|
||||
|
@@ -6,4 +6,4 @@ set -e
|
||||
|
||||
cd "$(dirname "$0")/../.."
|
||||
|
||||
./node_modules/.bin/gulp develop-gallery
|
||||
yarn run-task develop-gallery
|
||||
|
@@ -38,12 +38,12 @@ class PageDescription extends HaMarkdown {
|
||||
}
|
||||
.title {
|
||||
font-size: 42px;
|
||||
line-height: 56px;
|
||||
line-height: var(--ha-line-height-condensed);
|
||||
padding-bottom: 8px;
|
||||
}
|
||||
.subtitle {
|
||||
font-size: 18px;
|
||||
line-height: 24px;
|
||||
font-size: var(--ha-font-size-l);
|
||||
line-height: var(--ha-line-height-normal);
|
||||
}
|
||||
.root {
|
||||
max-width: 800px;
|
||||
|
@@ -34,7 +34,7 @@ class HaDemoOptions extends LitElement {
|
||||
height: 64px;
|
||||
padding: 0 16px;
|
||||
pointer-events: none;
|
||||
font-size: 20px;
|
||||
font-size: var(--ha-font-size-xl);
|
||||
}
|
||||
`,
|
||||
];
|
||||
|
@@ -250,14 +250,14 @@ class HaGallery extends LitElement {
|
||||
}
|
||||
|
||||
.page-footer .header {
|
||||
font-size: 16px;
|
||||
font-weight: 500;
|
||||
line-height: 28px;
|
||||
font-size: var(--ha-font-size-l);
|
||||
font-weight: var(--ha-font-weight-medium);
|
||||
line-height: var(--ha-line-height-normal);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.page-footer .secondary {
|
||||
line-height: 23px;
|
||||
line-height: var(--ha-line-height-normal);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
@@ -150,7 +150,7 @@ export class DemoHaBarButton extends LitElement {
|
||||
margin: 0;
|
||||
}
|
||||
label {
|
||||
font-weight: 600;
|
||||
font-weight: var(--ha-font-weight-bold);
|
||||
}
|
||||
.custom {
|
||||
--control-button-icon-color: var(--primary-color);
|
||||
|
@@ -86,7 +86,7 @@ export class DemoHarControlNumberButtons extends LitElement {
|
||||
margin: 0;
|
||||
}
|
||||
label {
|
||||
font-weight: 600;
|
||||
font-weight: var(--ha-font-weight-bold);
|
||||
}
|
||||
.custom {
|
||||
color: #2196f3;
|
||||
|
@@ -125,7 +125,7 @@ export class DemoHaControlSelectMenu extends LitElement {
|
||||
margin: 0;
|
||||
}
|
||||
label {
|
||||
font-weight: 600;
|
||||
font-weight: var(--ha-font-weight-bold);
|
||||
}
|
||||
.custom {
|
||||
--control-button-icon-color: var(--primary-color);
|
||||
|
@@ -135,7 +135,7 @@ export class DemoHaControlSelect extends LitElement {
|
||||
.options=${options}
|
||||
class=${ifDefined(config.class)}
|
||||
@value-changed=${this.handleValueChanged}
|
||||
aria-labelledby=${id}
|
||||
.label=${label}
|
||||
?disabled=${config.disabled}
|
||||
>
|
||||
</ha-control-select>
|
||||
@@ -156,7 +156,7 @@ export class DemoHaControlSelect extends LitElement {
|
||||
vertical
|
||||
class=${ifDefined(config.class)}
|
||||
@value-changed=${this.handleValueChanged}
|
||||
aria-labelledby=${id}
|
||||
.label=${label}
|
||||
?disabled=${config.disabled}
|
||||
>
|
||||
</ha-control-select>
|
||||
@@ -181,7 +181,7 @@ export class DemoHaControlSelect extends LitElement {
|
||||
margin: 0;
|
||||
}
|
||||
label {
|
||||
font-weight: 600;
|
||||
font-weight: var(--ha-font-weight-bold);
|
||||
}
|
||||
.custom {
|
||||
--mdc-icon-size: 24px;
|
||||
|
@@ -97,7 +97,7 @@ export class DemoHaBarSlider extends LitElement {
|
||||
class=${ifDefined(config.class)}
|
||||
@value-changed=${this.handleValueChanged}
|
||||
@slider-moved=${this.handleSliderMoved}
|
||||
aria-labelledby=${id}
|
||||
.label=${label}
|
||||
.unit=${config.unit}
|
||||
>
|
||||
</ha-control-slider>
|
||||
@@ -119,7 +119,7 @@ export class DemoHaBarSlider extends LitElement {
|
||||
class=${ifDefined(config.class)}
|
||||
@value-changed=${this.handleValueChanged}
|
||||
@slider-moved=${this.handleSliderMoved}
|
||||
aria-label=${label}
|
||||
.label=${label}
|
||||
.unit=${config.unit}
|
||||
>
|
||||
</ha-control-slider>
|
||||
@@ -144,7 +144,7 @@ export class DemoHaBarSlider extends LitElement {
|
||||
margin: 0;
|
||||
}
|
||||
label {
|
||||
font-weight: 600;
|
||||
font-weight: var(--ha-font-weight-bold);
|
||||
}
|
||||
.custom {
|
||||
--control-slider-color: #ffcf4c;
|
||||
|
@@ -63,7 +63,7 @@ export class DemoHaControlSwitch extends LitElement {
|
||||
@change=${this.handleValueChanged}
|
||||
.pathOn=${mdiLightbulb}
|
||||
.pathOff=${mdiLightbulbOff}
|
||||
aria-labelledby=${id}
|
||||
.label=${label}
|
||||
?disabled=${config.disabled}
|
||||
?reversed=${config.reversed}
|
||||
>
|
||||
@@ -84,7 +84,7 @@ export class DemoHaControlSwitch extends LitElement {
|
||||
vertical
|
||||
class=${ifDefined(config.class)}
|
||||
@change=${this.handleValueChanged}
|
||||
aria-label=${label}
|
||||
.label=${label}
|
||||
.pathOn=${mdiGarageOpen}
|
||||
.pathOff=${mdiGarage}
|
||||
?disabled=${config.disabled}
|
||||
@@ -112,7 +112,7 @@ export class DemoHaControlSwitch extends LitElement {
|
||||
margin: 0;
|
||||
}
|
||||
label {
|
||||
font-weight: 600;
|
||||
font-weight: var(--ha-font-weight-bold);
|
||||
}
|
||||
.custom {
|
||||
--control-switch-on-color: var(--green-color);
|
||||
|
@@ -105,8 +105,8 @@ export class DemoHaHsColorPicker extends LitElement {
|
||||
width: 400px;
|
||||
}
|
||||
.value {
|
||||
font-size: 22px;
|
||||
font-weight: bold;
|
||||
font-size: var(--ha-font-size-xl);
|
||||
font-weight: var(--ha-font-weight-bold);
|
||||
margin: 0 0 12px 0;
|
||||
}
|
||||
`;
|
||||
|
@@ -123,7 +123,7 @@ export class DemoHaSelectBox extends LitElement {
|
||||
margin: 0;
|
||||
}
|
||||
label {
|
||||
font-weight: 600;
|
||||
font-weight: var(--ha-font-weight-bold);
|
||||
margin-bottom: 8px;
|
||||
display: block;
|
||||
}
|
||||
|
@@ -416,6 +416,34 @@ const SCHEMAS: {
|
||||
},
|
||||
},
|
||||
},
|
||||
items: {
|
||||
name: "Items",
|
||||
selector: {
|
||||
object: {
|
||||
label_field: "name",
|
||||
description_field: "value",
|
||||
multiple: true,
|
||||
fields: {
|
||||
name: {
|
||||
label: "Name",
|
||||
selector: { text: {} },
|
||||
required: true,
|
||||
},
|
||||
value: {
|
||||
label: "Value",
|
||||
selector: {
|
||||
number: {
|
||||
mode: "slider",
|
||||
min: 0,
|
||||
max: 100,
|
||||
unit_of_measurement: "%",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
|
@@ -1,6 +1,7 @@
|
||||
import type { TemplateResult } from "lit";
|
||||
import { html, css, LitElement } from "lit";
|
||||
import { css, html, LitElement } from "lit";
|
||||
import { customElement, property } from "lit/decorators";
|
||||
import { applyThemesOnElement } from "../../../../src/common/dom/apply_themes_on_element";
|
||||
import "../../../../src/components/ha-bar";
|
||||
import "../../../../src/components/ha-card";
|
||||
import "../../../../src/components/ha-spinner";
|
||||
@@ -11,29 +12,66 @@ export class DemoHaSpinner extends LitElement {
|
||||
@property({ attribute: false }) hass!: HomeAssistant;
|
||||
|
||||
protected render(): TemplateResult {
|
||||
return html`<ha-card header="Basic spinner">
|
||||
<div class="card-content">
|
||||
<ha-spinner></ha-spinner></div
|
||||
></ha-card>
|
||||
<ha-card header="Different spinner sizes">
|
||||
<div class="card-content">
|
||||
<ha-spinner size="tiny"></ha-spinner>
|
||||
<ha-spinner size="small"></ha-spinner>
|
||||
<ha-spinner size="medium"></ha-spinner>
|
||||
<ha-spinner size="large"></ha-spinner></div
|
||||
></ha-card>
|
||||
<ha-card header="Spinner with an aria-label">
|
||||
<div class="card-content">
|
||||
<ha-spinner aria-label="Doing something..."></ha-spinner>
|
||||
<ha-spinner .ariaLabel=${"Doing something..."}></ha-spinner></div
|
||||
></ha-card>`;
|
||||
return html`
|
||||
${["light", "dark"].map(
|
||||
(mode) => html`
|
||||
<div class=${mode}>
|
||||
<ha-card header="ha-badge ${mode} demo">
|
||||
<div class="card-content">
|
||||
<ha-spinner></ha-spinner>
|
||||
<ha-spinner size="tiny"></ha-spinner>
|
||||
<ha-spinner size="small"></ha-spinner>
|
||||
<ha-spinner size="medium"></ha-spinner>
|
||||
<ha-spinner size="large"></ha-spinner>
|
||||
<ha-spinner aria-label="Doing something..."></ha-spinner>
|
||||
<ha-spinner .ariaLabel=${"Doing something..."}></ha-spinner>
|
||||
</div>
|
||||
</ha-card>
|
||||
</div>
|
||||
`
|
||||
)}
|
||||
`;
|
||||
}
|
||||
|
||||
firstUpdated(changedProps) {
|
||||
super.firstUpdated(changedProps);
|
||||
applyThemesOnElement(
|
||||
this.shadowRoot!.querySelector(".dark"),
|
||||
{
|
||||
default_theme: "default",
|
||||
default_dark_theme: "default",
|
||||
themes: {},
|
||||
darkMode: true,
|
||||
theme: "default",
|
||||
},
|
||||
undefined,
|
||||
undefined,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
static styles = css`
|
||||
:host {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
.dark,
|
||||
.light {
|
||||
display: block;
|
||||
background-color: var(--primary-background-color);
|
||||
padding: 0 50px;
|
||||
margin: 16px;
|
||||
border-radius: 8px;
|
||||
}
|
||||
ha-card {
|
||||
max-width: 600px;
|
||||
margin: 24px auto;
|
||||
}
|
||||
.card-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 24px;
|
||||
}
|
||||
`;
|
||||
}
|
||||
|
||||
|
@@ -106,7 +106,7 @@ export class DemoDateTimeDateTimeNumeric extends LitElement {
|
||||
margin: 12px auto;
|
||||
}
|
||||
.header {
|
||||
font-weight: bold;
|
||||
font-weight: var(--ha-font-weight-bold);
|
||||
}
|
||||
.center {
|
||||
text-align: center;
|
||||
|
@@ -106,7 +106,7 @@ export class DemoDateTimeDateTimeSeconds extends LitElement {
|
||||
margin: 12px auto;
|
||||
}
|
||||
.header {
|
||||
font-weight: bold;
|
||||
font-weight: var(--ha-font-weight-bold);
|
||||
}
|
||||
.center {
|
||||
text-align: center;
|
||||
|
@@ -106,7 +106,7 @@ export class DemoDateTimeDateTimeShortYear extends LitElement {
|
||||
margin: 12px auto;
|
||||
}
|
||||
.header {
|
||||
font-weight: bold;
|
||||
font-weight: var(--ha-font-weight-bold);
|
||||
}
|
||||
.center {
|
||||
text-align: center;
|
||||
|
@@ -106,7 +106,7 @@ export class DemoDateTimeDateTimeShort extends LitElement {
|
||||
margin: 12px auto;
|
||||
}
|
||||
.header {
|
||||
font-weight: bold;
|
||||
font-weight: var(--ha-font-weight-bold);
|
||||
}
|
||||
.center {
|
||||
text-align: center;
|
||||
|
@@ -106,7 +106,7 @@ export class DemoDateTimeDateTime extends LitElement {
|
||||
margin: 12px auto;
|
||||
}
|
||||
.header {
|
||||
font-weight: bold;
|
||||
font-weight: var(--ha-font-weight-bold);
|
||||
}
|
||||
.center {
|
||||
text-align: center;
|
||||
|
@@ -92,7 +92,7 @@ export class DemoDateTimeDate extends LitElement {
|
||||
|
||||
static styles = css`
|
||||
.header {
|
||||
font-weight: bold;
|
||||
font-weight: var(--ha-font-weight-bold);
|
||||
}
|
||||
.center {
|
||||
text-align: center;
|
||||
|
@@ -106,7 +106,7 @@ export class DemoDateTimeTimeSeconds extends LitElement {
|
||||
margin: 12px auto;
|
||||
}
|
||||
.header {
|
||||
font-weight: bold;
|
||||
font-weight: var(--ha-font-weight-bold);
|
||||
}
|
||||
.center {
|
||||
text-align: center;
|
||||
|
@@ -106,7 +106,7 @@ export class DemoDateTimeTimeWeekday extends LitElement {
|
||||
margin: 12px auto;
|
||||
}
|
||||
.header {
|
||||
font-weight: bold;
|
||||
font-weight: var(--ha-font-weight-bold);
|
||||
}
|
||||
.center {
|
||||
text-align: center;
|
||||
|
@@ -106,7 +106,7 @@ export class DemoDateTimeTime extends LitElement {
|
||||
margin: 12px auto;
|
||||
}
|
||||
.header {
|
||||
font-weight: bold;
|
||||
font-weight: var(--ha-font-weight-bold);
|
||||
}
|
||||
.center {
|
||||
text-align: center;
|
||||
|
@@ -1,4 +0,0 @@
|
||||
import { availableParallelism } from "node:os";
|
||||
import "./build-scripts/gulp/index.mjs";
|
||||
|
||||
process.env.UV_THREADPOOL_SIZE = availableParallelism();
|
@@ -6,4 +6,4 @@ set -e
|
||||
|
||||
cd "$(dirname "$0")/../.."
|
||||
|
||||
./node_modules/.bin/gulp build-hassio
|
||||
yarn run-task build-hassio
|
||||
|
@@ -6,4 +6,4 @@ set -e
|
||||
|
||||
cd "$(dirname "$0")/../.."
|
||||
|
||||
./node_modules/.bin/gulp develop-hassio
|
||||
yarn run-task develop-hassio
|
||||
|
@@ -428,13 +428,13 @@ class HassioAddonConfig extends LitElement {
|
||||
.header h2 {
|
||||
color: var(--ha-card-header-color, var(--primary-text-color));
|
||||
font-family: var(--ha-card-header-font-family, inherit);
|
||||
font-size: var(--ha-card-header-font-size, 24px);
|
||||
font-size: var(--ha-card-header-font-size, var(--ha-font-size-2xl));
|
||||
letter-spacing: -0.012em;
|
||||
line-height: 48px;
|
||||
line-height: var(--ha-line-height-expanded);
|
||||
padding: 12px 16px 16px;
|
||||
display: block;
|
||||
margin-block: 0px;
|
||||
font-weight: normal;
|
||||
font-weight: var(--ha-font-weight-normal);
|
||||
}
|
||||
.card-actions.right {
|
||||
justify-content: flex-end;
|
||||
|
@@ -1280,12 +1280,12 @@ class HassioAddonInfo extends LitElement {
|
||||
padding-left: 8px;
|
||||
padding-inline-start: 8px;
|
||||
padding-inline-end: initial;
|
||||
font-size: 24px;
|
||||
font-size: var(--ha-font-size-2xl);
|
||||
color: var(--ha-card-header-color, var(--primary-text-color));
|
||||
}
|
||||
.addon-version {
|
||||
float: var(--float-end);
|
||||
font-size: 15px;
|
||||
font-size: var(--ha-font-size-l);
|
||||
vertical-align: middle;
|
||||
}
|
||||
.errors {
|
||||
|
@@ -391,7 +391,7 @@ export class HassioBackups extends LitElement {
|
||||
top: -4px;
|
||||
}
|
||||
.selected-txt {
|
||||
font-weight: bold;
|
||||
font-weight: var(--ha-font-weight-bold);
|
||||
padding-left: 16px;
|
||||
padding-inline-start: 16px;
|
||||
padding-inline-end: initial;
|
||||
@@ -401,7 +401,7 @@ export class HassioBackups extends LitElement {
|
||||
margin-top: 20px;
|
||||
}
|
||||
.header-toolbar .selected-txt {
|
||||
font-size: 16px;
|
||||
font-size: var(--ha-font-size-l);
|
||||
}
|
||||
.header-toolbar .header-btns {
|
||||
margin-right: -12px;
|
||||
|
@@ -101,7 +101,7 @@ class HassioCardContent extends LitElement {
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
height: 2.4em;
|
||||
line-height: 1.2em;
|
||||
line-height: var(--ha-line-height-condensed);
|
||||
}
|
||||
.icon_image img {
|
||||
max-height: 40px;
|
||||
|
@@ -132,9 +132,9 @@ class HassioDashboard extends LitElement {
|
||||
}
|
||||
ha-fab.non-tabs {
|
||||
position: fixed;
|
||||
right: calc(16px + env(safe-area-inset-right));
|
||||
bottom: calc(16px + env(safe-area-inset-bottom));
|
||||
inset-inline-end: calc(16px + env(safe-area-inset-right));
|
||||
right: calc(16px + var(--safe-area-inset-right));
|
||||
bottom: calc(16px + var(--safe-area-inset-bottom));
|
||||
inset-inline-end: calc(16px + var(--safe-area-inset-right));
|
||||
inset-inline-start: initial;
|
||||
z-index: 1;
|
||||
}
|
||||
|
@@ -131,7 +131,7 @@ export class HassioUpdate extends LitElement {
|
||||
}
|
||||
.update-heading {
|
||||
font-size: var(--ha-font-size-l);
|
||||
font-weight: 500;
|
||||
font-weight: var(--ha-font-weight-medium);
|
||||
margin-bottom: 0.5em;
|
||||
color: var(--primary-text-color);
|
||||
}
|
||||
|
@@ -173,7 +173,7 @@ class HassioHardwareDialog extends LitElement {
|
||||
font-family: var(--ha-font-family-code);
|
||||
}
|
||||
code {
|
||||
font-size: 85%;
|
||||
font-size: var(--ha-font-size-s);
|
||||
padding: 0.2em 0.4em;
|
||||
}
|
||||
search-input {
|
||||
|
@@ -610,7 +610,7 @@ export class DialogHassioNetwork
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 8px;
|
||||
padding-bottom: max(env(safe-area-inset-bottom), 8px);
|
||||
padding-bottom: max(var(--safe-area-inset-bottom), 8px);
|
||||
background-color: var(--mdc-theme-surface, #fff);
|
||||
}
|
||||
.warning {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user