mirror of
https://github.com/home-assistant/frontend.git
synced 2025-08-15 04:09:25 +00:00
Compare commits
983 Commits
20250331.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 | ||
![]() |
7f6ce97199 | ||
![]() |
0742aed8e7 | ||
![]() |
f675dd3388 | ||
![]() |
9751cb4e50 | ||
![]() |
7919028780 | ||
![]() |
1508c7c905 | ||
![]() |
3fe907f388 | ||
![]() |
5cc87661b9 | ||
![]() |
fc372172a6 | ||
![]() |
7bd9a39bf5 | ||
![]() |
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 | ||
![]() |
f0341f28ab | ||
![]() |
603663e0cc | ||
![]() |
80dddc9eef | ||
![]() |
b823a3b139 | ||
![]() |
47c9a407e6 | ||
![]() |
8494d0542e | ||
![]() |
467a5bef0b | ||
![]() |
24736e36ff | ||
![]() |
604c00d772 | ||
![]() |
12bbba1bff | ||
![]() |
c0ba48beb6 | ||
![]() |
075e1df204 | ||
![]() |
22c57853b4 | ||
![]() |
fe824062a5 | ||
![]() |
e3221ad4ee | ||
![]() |
7d3a7fa1db | ||
![]() |
5e67bf1fa7 | ||
![]() |
7147c7578d | ||
![]() |
90710fedf2 | ||
![]() |
9629159ef1 | ||
![]() |
bfac6e1516 | ||
![]() |
7c288d1769 | ||
![]() |
39119eeb2a | ||
![]() |
9c16ce3342 | ||
![]() |
3595fab5cb | ||
![]() |
78b2d17f10 | ||
![]() |
92bf9b4979 | ||
![]() |
ac616a4d3d | ||
![]() |
1aa1bfda2c | ||
![]() |
38a5035d68 | ||
![]() |
042cd0d3a3 | ||
![]() |
00d708fbd4 | ||
![]() |
852278e8aa | ||
![]() |
15dcdffe55 | ||
![]() |
0729aaacb8 | ||
![]() |
92b8cd8f45 | ||
![]() |
ad8d3dd598 | ||
![]() |
d618c25095 | ||
![]() |
83289bdd41 | ||
![]() |
7b8b8f9d0b | ||
![]() |
b7f866faff | ||
![]() |
37671fd613 | ||
![]() |
92905c1433 | ||
![]() |
cb7251cb5e | ||
![]() |
44485c0de4 | ||
![]() |
1191a09576 | ||
![]() |
c178488aac | ||
![]() |
9f6463eec0 | ||
![]() |
70fef59401 | ||
![]() |
3e053e07c6 | ||
![]() |
376cac6002 | ||
![]() |
5cd68301ed | ||
![]() |
3121721ac7 | ||
![]() |
868daf692d | ||
![]() |
75e9ac9e73 | ||
![]() |
f6e36f2038 | ||
![]() |
55770f3e02 | ||
![]() |
cfc7f91f03 | ||
![]() |
74488c0b96 | ||
![]() |
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 | ||
![]() |
1154d1769d | ||
![]() |
a820cd4576 | ||
![]() |
678a8a85cb | ||
![]() |
358e450e60 | ||
![]() |
32acef8fad | ||
![]() |
fae619085c | ||
![]() |
5d89563aa5 | ||
![]() |
d7dd11ba7f | ||
![]() |
4624cc609f | ||
![]() |
f24b6a4cb1 | ||
![]() |
2b06742bb9 | ||
![]() |
9e5b7462af | ||
![]() |
a544ff4c8a | ||
![]() |
b81d2013dc | ||
![]() |
9b7e2886b6 | ||
![]() |
69eaf178ca | ||
![]() |
1a14511fa6 | ||
![]() |
b4e8c56f58 | ||
![]() |
17cc63deba | ||
![]() |
b4f1c8755d | ||
![]() |
b0d4c699db | ||
![]() |
c07bf68161 | ||
![]() |
d1a0eaece5 | ||
![]() |
f608783551 | ||
![]() |
dddba58d38 | ||
![]() |
ebc16d6520 | ||
![]() |
4ed8ecad01 | ||
![]() |
c26fb1713d | ||
![]() |
2b7b17625e | ||
![]() |
cd3e4f55e2 | ||
![]() |
1c12aea8f6 | ||
![]() |
3722f971ca | ||
![]() |
409f665641 | ||
![]() |
5b3b17ef6d | ||
![]() |
05b49e8c80 | ||
![]() |
2dbdbb4b64 | ||
![]() |
a825b632bf | ||
![]() |
f8d706277d | ||
![]() |
e517175f68 | ||
![]() |
ee9cbf7370 | ||
![]() |
efd7b380a9 | ||
![]() |
46cc254f77 | ||
![]() |
221bc732fb | ||
![]() |
055c18463c | ||
![]() |
d996ba818f | ||
![]() |
e5f41ceb3e | ||
![]() |
2e4ce71d06 | ||
![]() |
50e39de974 | ||
![]() |
1ba941282c | ||
![]() |
b656ddc1f0 | ||
![]() |
ddd51ff097 | ||
![]() |
55c75096d0 | ||
![]() |
fd3502f3bc | ||
![]() |
7d6bec01ae | ||
![]() |
a699149388 | ||
![]() |
0aeb8fa75c | ||
![]() |
456a44fdfd | ||
![]() |
53a0b311de | ||
![]() |
ded5ade0f2 | ||
![]() |
5d2d6dcd6c | ||
![]() |
92353ebed5 | ||
![]() |
bc582db7fc | ||
![]() |
ab415188ba | ||
![]() |
29c11978b3 | ||
![]() |
574f9e8936 | ||
![]() |
fddc00bfab | ||
![]() |
ff5cbb0613 | ||
![]() |
498d933c06 | ||
![]() |
f9fbb254bf | ||
![]() |
536602580d | ||
![]() |
c111bf1062 | ||
![]() |
0242fbc6f8 | ||
![]() |
f65a0ef4f7 | ||
![]() |
92521d4565 | ||
![]() |
66dbafb5f5 | ||
![]() |
7c46d2d2f4 | ||
![]() |
ca642d46cc | ||
![]() |
9a52185e13 | ||
![]() |
39a73774b0 | ||
![]() |
b25b170539 | ||
![]() |
6442606fc5 | ||
![]() |
1b79869c87 | ||
![]() |
672fbc6007 | ||
![]() |
e1899836bf | ||
![]() |
e90967d200 | ||
![]() |
631bfe46ba | ||
![]() |
a5762f07ac | ||
![]() |
bf7422e4c5 | ||
![]() |
45994e7989 | ||
![]() |
995e3f10ad | ||
![]() |
6464c2b602 | ||
![]() |
8901c1fb31 | ||
![]() |
1f5f18f7e7 | ||
![]() |
51ca3e277c | ||
![]() |
ee495a432f | ||
![]() |
d75ea3bb8d | ||
![]() |
40fbeaae1c | ||
![]() |
dc2c6cee21 | ||
![]() |
3b0cd9e3ae | ||
![]() |
834ece8547 | ||
![]() |
b7aa296be7 | ||
![]() |
0cab6c9e2e | ||
![]() |
94c8665528 | ||
![]() |
c7ca654926 | ||
![]() |
488599905b | ||
![]() |
221e1d9ed8 | ||
![]() |
0229f67751 | ||
![]() |
3a0c367f76 | ||
![]() |
af0854e480 | ||
![]() |
14f4120926 | ||
![]() |
e2bd464001 | ||
![]() |
eb9f81d9a1 | ||
![]() |
078209d154 | ||
![]() |
7a617600ad | ||
![]() |
ae74e3496c | ||
![]() |
c0f304ad40 | ||
![]() |
c794a2734b | ||
![]() |
e156dd36f4 | ||
![]() |
c40bf8f3cd | ||
![]() |
93485d8b57 | ||
![]() |
ce5cdaa496 | ||
![]() |
dcbaa31c96 | ||
![]() |
71b2e5f827 | ||
![]() |
d58590b534 | ||
![]() |
b2044e88b6 | ||
![]() |
94b5ed97c6 | ||
![]() |
11b8f6210f | ||
![]() |
8e778cfc32 | ||
![]() |
4c6a5ed2e3 | ||
![]() |
48c90267df | ||
![]() |
fcab356639 | ||
![]() |
a70a0d4b4a | ||
![]() |
5a34560381 | ||
![]() |
f71245893a | ||
![]() |
1e7bfd59f2 | ||
![]() |
1c15116052 | ||
![]() |
3647722824 | ||
![]() |
713dd68089 | ||
![]() |
53dd0cbaa8 | ||
![]() |
6bf8faa96a | ||
![]() |
09a17131ab | ||
![]() |
7f20b2d6d2 | ||
![]() |
fa05cd0c90 | ||
![]() |
0b7fc330b3 | ||
![]() |
6aa78794a7 | ||
![]() |
3f17548582 | ||
![]() |
0cee3c2882 | ||
![]() |
5753b3e166 | ||
![]() |
7b78d821f9 | ||
![]() |
9a4469588c | ||
![]() |
f9eadf08fd | ||
![]() |
c630176fcf | ||
![]() |
0389fbba52 | ||
![]() |
d56c7c41e2 | ||
![]() |
e74cac697e | ||
![]() |
77216e8e76 | ||
![]() |
02a8924f63 | ||
![]() |
9fc28e5abb | ||
![]() |
933fb1327a | ||
![]() |
c73a9fccb8 | ||
![]() |
38c11e738e | ||
![]() |
93c5632ee0 | ||
![]() |
5459eaff30 | ||
![]() |
b02f1037fb | ||
![]() |
3d130b790c | ||
![]() |
e23d2392d8 | ||
![]() |
d5a6e16bf8 | ||
![]() |
91a5497c60 | ||
![]() |
65dae09a49 | ||
![]() |
7e0f293d1f | ||
![]() |
2682011ae6 | ||
![]() |
1bba103a3d | ||
![]() |
e425375d55 | ||
![]() |
a2689eee63 | ||
![]() |
74741c5d69 | ||
![]() |
53426d647a | ||
![]() |
f6e4f4c0d6 | ||
![]() |
2f086f4d00 | ||
![]() |
cd91e8c07c | ||
![]() |
b3a5ea2893 | ||
![]() |
98ae0295b4 | ||
![]() |
43bb9d3401 | ||
![]() |
8ad4385d67 | ||
![]() |
8fb7c1594a | ||
![]() |
4fca09f9ae | ||
![]() |
6793753755 | ||
![]() |
f4e3fdb98e | ||
![]() |
63f4cc456c | ||
![]() |
33735abfb0 | ||
![]() |
22b59b247e | ||
![]() |
6d7a40368c | ||
![]() |
fbeb457c25 | ||
![]() |
4a6834f0d9 | ||
![]() |
add417a166 | ||
![]() |
ae4f43496e | ||
![]() |
4ce792e5bf | ||
![]() |
b9433b96dc | ||
![]() |
1dfd937c94 | ||
![]() |
6a333a4774 | ||
![]() |
7742ccf631 | ||
![]() |
20f2a8d53e | ||
![]() |
ec9fbe7d77 | ||
![]() |
6fa226d30a | ||
![]() |
b76a723fd9 | ||
![]() |
5237cc72b7 | ||
![]() |
63d2718f67 | ||
![]() |
14e0666c3a | ||
![]() |
929a0b9cd4 | ||
![]() |
0541270695 | ||
![]() |
20d357fb13 | ||
![]() |
6658c10b94 | ||
![]() |
c2ce02652b | ||
![]() |
634db1944f | ||
![]() |
21b3177f95 | ||
![]() |
7383e3247b | ||
![]() |
b33e4bf305 | ||
![]() |
9d9522cade | ||
![]() |
430e47c0fc | ||
![]() |
a6c9702ab2 | ||
![]() |
e3122e8e4d | ||
![]() |
c8e46bd239 | ||
![]() |
4fd87a1d7c | ||
![]() |
80151ff759 | ||
![]() |
5f187c1bb3 | ||
![]() |
ddc04dd48a | ||
![]() |
228acf1fae | ||
![]() |
74acd7ec38 | ||
![]() |
9bc867d0dc | ||
![]() |
590df8dd1a | ||
![]() |
ccee57f4a5 | ||
![]() |
828bf977b2 | ||
![]() |
a2b3ea2ac6 | ||
![]() |
9c3f77532c | ||
![]() |
4a1cf250c4 | ||
![]() |
9df5141aac | ||
![]() |
13aeb02b53 | ||
![]() |
f0f60bae78 | ||
![]() |
d1465a79ae | ||
![]() |
6fe8af7c75 | ||
![]() |
21180d066e | ||
![]() |
dec968af54 | ||
![]() |
2ccc5355c4 | ||
![]() |
316c3f4e1f | ||
![]() |
f88d0ca613 | ||
![]() |
edd4a3c31f | ||
![]() |
a7ee98e7de | ||
![]() |
1b6ed8cdc3 | ||
![]() |
671049beb2 | ||
![]() |
daf4158fa0 | ||
![]() |
848713858f | ||
![]() |
f0ef7e0c53 | ||
![]() |
e10b0fad95 | ||
![]() |
8d50bb1d2b | ||
![]() |
1e26f155a7 | ||
![]() |
27e13017c3 | ||
![]() |
88f1dc9c16 | ||
![]() |
825e707a80 | ||
![]() |
a15f0c7814 | ||
![]() |
e37f7219c2 | ||
![]() |
570076c539 | ||
![]() |
cfeb0336d1 | ||
![]() |
b18cc4dcfb | ||
![]() |
e271989cee | ||
![]() |
ca223f9d73 | ||
![]() |
8fb1cf35ad | ||
![]() |
9f59be492e | ||
![]() |
8429d114a8 | ||
![]() |
4fbc155f8b | ||
![]() |
0bcaa104e7 | ||
![]() |
6b3f807129 | ||
![]() |
c464d344db | ||
![]() |
69f0a4a728 | ||
![]() |
cd39e2d0f2 | ||
![]() |
a23f57256c | ||
![]() |
c279efaa99 | ||
![]() |
c4389ec119 | ||
![]() |
50d632f8d4 | ||
![]() |
dba2fba828 | ||
![]() |
3890afddb9 | ||
![]() |
76f187ee2c | ||
![]() |
488b54cf19 | ||
![]() |
29d2c29af3 | ||
![]() |
a2f9101a9f | ||
![]() |
7893eba7a7 | ||
![]() |
94ced8af32 | ||
![]() |
c4b5882b2d | ||
![]() |
6e8bac2e58 | ||
![]() |
8a2ab2eab4 | ||
![]() |
c7e5be185d | ||
![]() |
e98721aa76 | ||
![]() |
4c8d661c63 | ||
![]() |
b7c60ffc74 | ||
![]() |
db6c728cd6 | ||
![]() |
34f8335a9d | ||
![]() |
ecf5068bd0 | ||
![]() |
0a2a2b8a70 | ||
![]() |
52f4fe6bc0 | ||
![]() |
a781bca94b | ||
![]() |
63b44c25f8 | ||
![]() |
b96319703a | ||
![]() |
9e686190f6 | ||
![]() |
5ca7b1d508 | ||
![]() |
7c1d74c6c3 | ||
![]() |
d257f667c1 | ||
![]() |
842a064682 | ||
![]() |
3d8e146582 | ||
![]() |
78e8bd4305 | ||
![]() |
0152a79bd5 | ||
![]() |
f5bb72f067 | ||
![]() |
9ca6a886f5 | ||
![]() |
f39011f8f4 | ||
![]() |
8b190867e3 | ||
![]() |
321b15a270 | ||
![]() |
6ba235d540 | ||
![]() |
e34fd8161c | ||
![]() |
084cda8218 | ||
![]() |
f06a0fa34c | ||
![]() |
750c59399b | ||
![]() |
a6a17cd70c | ||
![]() |
de1c6a5178 | ||
![]() |
04c3cd7d68 | ||
![]() |
17ef74d680 | ||
![]() |
098c6a2567 | ||
![]() |
899288ae43 | ||
![]() |
a9823f30e3 | ||
![]() |
97966805fa |
@@ -21,7 +21,8 @@
|
|||||||
"esbenp.prettier-vscode",
|
"esbenp.prettier-vscode",
|
||||||
"runem.lit-plugin",
|
"runem.lit-plugin",
|
||||||
"github.vscode-pull-request-github",
|
"github.vscode-pull-request-github",
|
||||||
"eamodio.gitlens"
|
"eamodio.gitlens",
|
||||||
|
"yeion7.styled-global-variables-autocomplete"
|
||||||
],
|
],
|
||||||
"settings": {
|
"settings": {
|
||||||
"files.eol": "\n",
|
"files.eol": "\n",
|
||||||
|
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.**
|
**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
|
[releases]: https://github.com/home-assistant/home-assistant/releases
|
||||||
- type: checkboxes
|
- type: checkboxes
|
||||||
attributes:
|
attributes:
|
||||||
@@ -108,9 +108,9 @@ body:
|
|||||||
render: yaml
|
render: yaml
|
||||||
- type: textarea
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
label: Javascript errors shown in your browser console/inspector
|
label: JavaScript errors shown in your browser console/inspector
|
||||||
description: >
|
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.
|
browser console/inspector please provide them.
|
||||||
render: txt
|
render: txt
|
||||||
- type: textarea
|
- type: textarea
|
||||||
|
2
.github/ISSUE_TEMPLATE/config.yml
vendored
2
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -1,7 +1,7 @@
|
|||||||
blank_issues_enabled: false
|
blank_issues_enabled: false
|
||||||
contact_links:
|
contact_links:
|
||||||
- name: Request a feature for the UI / Dashboards
|
- 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.
|
about: Request a new feature for the Home Assistant frontend.
|
||||||
- name: Report a bug that is NOT related to the UI / Dashboards
|
- name: Report a bug that is NOT related to the UI / Dashboards
|
||||||
url: https://github.com/home-assistant/core/issues
|
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
|
18
.github/workflows/cast_deployment.yaml
vendored
18
.github/workflows/cast_deployment.yaml
vendored
@@ -26,7 +26,7 @@ jobs:
|
|||||||
ref: dev
|
ref: dev
|
||||||
|
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v4.3.0
|
uses: actions/setup-node@v4.4.0
|
||||||
with:
|
with:
|
||||||
node-version-file: ".nvmrc"
|
node-version-file: ".nvmrc"
|
||||||
cache: yarn
|
cache: yarn
|
||||||
@@ -35,15 +35,14 @@ jobs:
|
|||||||
run: yarn install --immutable
|
run: yarn install --immutable
|
||||||
|
|
||||||
- name: Build Cast
|
- name: Build Cast
|
||||||
run: ./node_modules/.bin/gulp build-cast
|
run: yarn run-task build-cast
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Deploy to Netlify
|
- name: Deploy to Netlify
|
||||||
id: deploy
|
id: deploy
|
||||||
uses: netlify/actions/cli@master
|
run: |
|
||||||
with:
|
npx -y netlify-cli deploy --dir=cast/dist --alias dev
|
||||||
args: deploy --dir=cast/dist --alias dev
|
|
||||||
env:
|
env:
|
||||||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_CAST_SITE_ID }}
|
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_CAST_SITE_ID }}
|
||||||
@@ -62,7 +61,7 @@ jobs:
|
|||||||
ref: master
|
ref: master
|
||||||
|
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v4.3.0
|
uses: actions/setup-node@v4.4.0
|
||||||
with:
|
with:
|
||||||
node-version-file: ".nvmrc"
|
node-version-file: ".nvmrc"
|
||||||
cache: yarn
|
cache: yarn
|
||||||
@@ -71,15 +70,14 @@ jobs:
|
|||||||
run: yarn install --immutable
|
run: yarn install --immutable
|
||||||
|
|
||||||
- name: Build Cast
|
- name: Build Cast
|
||||||
run: ./node_modules/.bin/gulp build-cast
|
run: yarn run-task build-cast
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Deploy to Netlify
|
- name: Deploy to Netlify
|
||||||
id: deploy
|
id: deploy
|
||||||
uses: netlify/actions/cli@master
|
run: |
|
||||||
with:
|
npx -y netlify-cli deploy --dir=cast/dist --prod
|
||||||
args: deploy --dir=cast/dist --prod
|
|
||||||
env:
|
env:
|
||||||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_CAST_SITE_ID }}
|
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_CAST_SITE_ID }}
|
||||||
|
16
.github/workflows/ci.yaml
vendored
16
.github/workflows/ci.yaml
vendored
@@ -26,7 +26,7 @@ jobs:
|
|||||||
- name: Check out files from GitHub
|
- name: Check out files from GitHub
|
||||||
uses: actions/checkout@v4.2.2
|
uses: actions/checkout@v4.2.2
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v4.3.0
|
uses: actions/setup-node@v4.4.0
|
||||||
with:
|
with:
|
||||||
node-version-file: ".nvmrc"
|
node-version-file: ".nvmrc"
|
||||||
cache: yarn
|
cache: yarn
|
||||||
@@ -35,7 +35,7 @@ jobs:
|
|||||||
- name: Check for duplicate dependencies
|
- name: Check for duplicate dependencies
|
||||||
run: yarn dedupe --check
|
run: yarn dedupe --check
|
||||||
- name: Build resources
|
- 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
|
- name: Setup lint cache
|
||||||
uses: actions/cache@v4.2.3
|
uses: actions/cache@v4.2.3
|
||||||
with:
|
with:
|
||||||
@@ -60,14 +60,14 @@ jobs:
|
|||||||
- name: Check out files from GitHub
|
- name: Check out files from GitHub
|
||||||
uses: actions/checkout@v4.2.2
|
uses: actions/checkout@v4.2.2
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v4.3.0
|
uses: actions/setup-node@v4.4.0
|
||||||
with:
|
with:
|
||||||
node-version-file: ".nvmrc"
|
node-version-file: ".nvmrc"
|
||||||
cache: yarn
|
cache: yarn
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: yarn install --immutable
|
run: yarn install --immutable
|
||||||
- name: Build resources
|
- 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
|
- name: Run Tests
|
||||||
run: yarn run test
|
run: yarn run test
|
||||||
build:
|
build:
|
||||||
@@ -78,14 +78,14 @@ jobs:
|
|||||||
- name: Check out files from GitHub
|
- name: Check out files from GitHub
|
||||||
uses: actions/checkout@v4.2.2
|
uses: actions/checkout@v4.2.2
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v4.3.0
|
uses: actions/setup-node@v4.4.0
|
||||||
with:
|
with:
|
||||||
node-version-file: ".nvmrc"
|
node-version-file: ".nvmrc"
|
||||||
cache: yarn
|
cache: yarn
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: yarn install --immutable
|
run: yarn install --immutable
|
||||||
- name: Build Application
|
- name: Build Application
|
||||||
run: ./node_modules/.bin/gulp build-app
|
run: yarn run-task build-app
|
||||||
env:
|
env:
|
||||||
IS_TEST: "true"
|
IS_TEST: "true"
|
||||||
- name: Upload bundle stats
|
- name: Upload bundle stats
|
||||||
@@ -102,14 +102,14 @@ jobs:
|
|||||||
- name: Check out files from GitHub
|
- name: Check out files from GitHub
|
||||||
uses: actions/checkout@v4.2.2
|
uses: actions/checkout@v4.2.2
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v4.3.0
|
uses: actions/setup-node@v4.4.0
|
||||||
with:
|
with:
|
||||||
node-version-file: ".nvmrc"
|
node-version-file: ".nvmrc"
|
||||||
cache: yarn
|
cache: yarn
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: yarn install --immutable
|
run: yarn install --immutable
|
||||||
- name: Build Application
|
- name: Build Application
|
||||||
run: ./node_modules/.bin/gulp build-hassio
|
run: yarn run-task build-hassio
|
||||||
env:
|
env:
|
||||||
IS_TEST: "true"
|
IS_TEST: "true"
|
||||||
- name: Upload bundle stats
|
- name: Upload bundle stats
|
||||||
|
18
.github/workflows/demo_deployment.yaml
vendored
18
.github/workflows/demo_deployment.yaml
vendored
@@ -27,7 +27,7 @@ jobs:
|
|||||||
ref: dev
|
ref: dev
|
||||||
|
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v4.3.0
|
uses: actions/setup-node@v4.4.0
|
||||||
with:
|
with:
|
||||||
node-version-file: ".nvmrc"
|
node-version-file: ".nvmrc"
|
||||||
cache: yarn
|
cache: yarn
|
||||||
@@ -36,15 +36,14 @@ jobs:
|
|||||||
run: yarn install --immutable
|
run: yarn install --immutable
|
||||||
|
|
||||||
- name: Build Demo
|
- name: Build Demo
|
||||||
run: ./node_modules/.bin/gulp build-demo
|
run: yarn run-task build-demo
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Deploy to Netlify
|
- name: Deploy to Netlify
|
||||||
id: deploy
|
id: deploy
|
||||||
uses: netlify/actions/cli@master
|
run: |
|
||||||
with:
|
npx -y netlify-cli deploy --dir=demo/dist --prod
|
||||||
args: deploy --dir=demo/dist --prod
|
|
||||||
env:
|
env:
|
||||||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_DEMO_DEV_SITE_ID }}
|
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_DEMO_DEV_SITE_ID }}
|
||||||
@@ -63,7 +62,7 @@ jobs:
|
|||||||
ref: master
|
ref: master
|
||||||
|
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v4.3.0
|
uses: actions/setup-node@v4.4.0
|
||||||
with:
|
with:
|
||||||
node-version-file: ".nvmrc"
|
node-version-file: ".nvmrc"
|
||||||
cache: yarn
|
cache: yarn
|
||||||
@@ -72,15 +71,14 @@ jobs:
|
|||||||
run: yarn install --immutable
|
run: yarn install --immutable
|
||||||
|
|
||||||
- name: Build Demo
|
- name: Build Demo
|
||||||
run: ./node_modules/.bin/gulp build-demo
|
run: yarn run-task build-demo
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Deploy to Netlify
|
- name: Deploy to Netlify
|
||||||
id: deploy
|
id: deploy
|
||||||
uses: netlify/actions/cli@master
|
run: |
|
||||||
with:
|
npx -y netlify-cli deploy --dir=demo/dist --prod
|
||||||
args: deploy --dir=demo/dist --prod
|
|
||||||
env:
|
env:
|
||||||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_DEMO_SITE_ID }}
|
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_DEMO_SITE_ID }}
|
||||||
|
9
.github/workflows/design_deployment.yaml
vendored
9
.github/workflows/design_deployment.yaml
vendored
@@ -19,7 +19,7 @@ jobs:
|
|||||||
uses: actions/checkout@v4.2.2
|
uses: actions/checkout@v4.2.2
|
||||||
|
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v4.3.0
|
uses: actions/setup-node@v4.4.0
|
||||||
with:
|
with:
|
||||||
node-version-file: ".nvmrc"
|
node-version-file: ".nvmrc"
|
||||||
cache: yarn
|
cache: yarn
|
||||||
@@ -28,15 +28,14 @@ jobs:
|
|||||||
run: yarn install --immutable
|
run: yarn install --immutable
|
||||||
|
|
||||||
- name: Build Gallery
|
- name: Build Gallery
|
||||||
run: ./node_modules/.bin/gulp build-gallery
|
run: yarn run-task build-gallery
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Deploy to Netlify
|
- name: Deploy to Netlify
|
||||||
id: deploy
|
id: deploy
|
||||||
uses: netlify/actions/cli@master
|
run: |
|
||||||
with:
|
npx -y netlify-cli deploy --dir=gallery/dist --prod
|
||||||
args: deploy --dir=gallery/dist --prod
|
|
||||||
env:
|
env:
|
||||||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_GALLERY_SITE_ID }}
|
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_GALLERY_SITE_ID }}
|
||||||
|
13
.github/workflows/design_preview.yaml
vendored
13
.github/workflows/design_preview.yaml
vendored
@@ -24,7 +24,7 @@ jobs:
|
|||||||
uses: actions/checkout@v4.2.2
|
uses: actions/checkout@v4.2.2
|
||||||
|
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v4.3.0
|
uses: actions/setup-node@v4.4.0
|
||||||
with:
|
with:
|
||||||
node-version-file: ".nvmrc"
|
node-version-file: ".nvmrc"
|
||||||
cache: yarn
|
cache: yarn
|
||||||
@@ -33,19 +33,20 @@ jobs:
|
|||||||
run: yarn install --immutable
|
run: yarn install --immutable
|
||||||
|
|
||||||
- name: Build Gallery
|
- name: Build Gallery
|
||||||
run: ./node_modules/.bin/gulp build-gallery
|
run: yarn run-task build-gallery
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Deploy preview to Netlify
|
- name: Deploy preview to Netlify
|
||||||
id: deploy
|
id: deploy
|
||||||
uses: netlify/actions/cli@master
|
run: |
|
||||||
with:
|
npx -y netlify-cli deploy --dir=gallery/dist --alias "deploy-preview-${{ github.event.number }}" \
|
||||||
args: deploy --dir=gallery/dist --alias "deploy-preview-${{ github.event.number }}"
|
--json > deploy_output.json
|
||||||
env:
|
env:
|
||||||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_GALLERY_SITE_ID }}
|
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_GALLERY_SITE_ID }}
|
||||||
|
|
||||||
- name: Generate summary
|
- name: Generate summary
|
||||||
run: |
|
run: |
|
||||||
echo "${{ steps.deploy.outputs.NETLIFY_LIVE_URL || steps.deploy.outputs.NETLIFY_URL }}" >> "$GITHUB_STEP_SUMMARY"
|
NETLIFY_LIVE_URL=$(jq -r '.deploy_url' deploy_output.json)
|
||||||
|
echo "$NETLIFY_LIVE_URL" >> "$GITHUB_STEP_SUMMARY"
|
||||||
|
2
.github/workflows/nightly.yaml
vendored
2
.github/workflows/nightly.yaml
vendored
@@ -28,7 +28,7 @@ jobs:
|
|||||||
python-version: ${{ env.PYTHON_VERSION }}
|
python-version: ${{ env.PYTHON_VERSION }}
|
||||||
|
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v4.3.0
|
uses: actions/setup-node@v4.4.0
|
||||||
with:
|
with:
|
||||||
node-version-file: ".nvmrc"
|
node-version-file: ".nvmrc"
|
||||||
cache: yarn
|
cache: yarn
|
||||||
|
2
.github/workflows/relative-ci.yaml
vendored
2
.github/workflows/relative-ci.yaml
vendored
@@ -17,7 +17,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Send bundle stats and build information to RelativeCI
|
- 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:
|
with:
|
||||||
key: ${{ secrets[format('RELATIVE_CI_KEY_{0}_{1}', matrix.bundle, matrix.build)] }}
|
key: ${{ secrets[format('RELATIVE_CI_KEY_{0}_{1}', matrix.bundle, matrix.build)] }}
|
||||||
token: ${{ github.token }}
|
token: ${{ github.token }}
|
||||||
|
14
.github/workflows/release.yaml
vendored
14
.github/workflows/release.yaml
vendored
@@ -34,7 +34,7 @@ jobs:
|
|||||||
uses: home-assistant/actions/helpers/verify-version@master
|
uses: home-assistant/actions/helpers/verify-version@master
|
||||||
|
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v4.3.0
|
uses: actions/setup-node@v4.4.0
|
||||||
with:
|
with:
|
||||||
node-version-file: ".nvmrc"
|
node-version-file: ".nvmrc"
|
||||||
cache: yarn
|
cache: yarn
|
||||||
@@ -55,7 +55,7 @@ jobs:
|
|||||||
script/release
|
script/release
|
||||||
|
|
||||||
- name: Upload release assets
|
- name: Upload release assets
|
||||||
uses: softprops/action-gh-release@v2.2.1
|
uses: softprops/action-gh-release@v2.3.2
|
||||||
with:
|
with:
|
||||||
files: |
|
files: |
|
||||||
dist/*.whl
|
dist/*.whl
|
||||||
@@ -74,7 +74,7 @@ jobs:
|
|||||||
echo "home-assistant-frontend==$version" > ./requirements.txt
|
echo "home-assistant-frontend==$version" > ./requirements.txt
|
||||||
|
|
||||||
- name: Build wheels
|
- name: Build wheels
|
||||||
uses: home-assistant/wheels@2025.02.0
|
uses: home-assistant/wheels@2025.03.0
|
||||||
with:
|
with:
|
||||||
abi: cp313
|
abi: cp313
|
||||||
tag: musllinux_1_2
|
tag: musllinux_1_2
|
||||||
@@ -92,7 +92,7 @@ jobs:
|
|||||||
- name: Checkout the repository
|
- name: Checkout the repository
|
||||||
uses: actions/checkout@v4.2.2
|
uses: actions/checkout@v4.2.2
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v4.3.0
|
uses: actions/setup-node@v4.4.0
|
||||||
with:
|
with:
|
||||||
node-version-file: ".nvmrc"
|
node-version-file: ".nvmrc"
|
||||||
cache: yarn
|
cache: yarn
|
||||||
@@ -107,7 +107,7 @@ jobs:
|
|||||||
- name: Tar folder
|
- name: Tar folder
|
||||||
run: tar -czf landing-page/home_assistant_frontend_landingpage-${{ github.event.release.tag_name }}.tar.gz -C landing-page/dist .
|
run: tar -czf landing-page/home_assistant_frontend_landingpage-${{ github.event.release.tag_name }}.tar.gz -C landing-page/dist .
|
||||||
- name: Upload release asset
|
- name: Upload release asset
|
||||||
uses: softprops/action-gh-release@v2.2.1
|
uses: softprops/action-gh-release@v2.3.2
|
||||||
with:
|
with:
|
||||||
files: landing-page/home_assistant_frontend_landingpage-${{ github.event.release.tag_name }}.tar.gz
|
files: landing-page/home_assistant_frontend_landingpage-${{ github.event.release.tag_name }}.tar.gz
|
||||||
|
|
||||||
@@ -121,7 +121,7 @@ jobs:
|
|||||||
- name: Checkout the repository
|
- name: Checkout the repository
|
||||||
uses: actions/checkout@v4.2.2
|
uses: actions/checkout@v4.2.2
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v4.3.0
|
uses: actions/setup-node@v4.4.0
|
||||||
with:
|
with:
|
||||||
node-version-file: ".nvmrc"
|
node-version-file: ".nvmrc"
|
||||||
cache: yarn
|
cache: yarn
|
||||||
@@ -136,6 +136,6 @@ jobs:
|
|||||||
- name: Tar folder
|
- name: Tar folder
|
||||||
run: tar -czf hassio/home_assistant_frontend_supervisor-${{ github.event.release.tag_name }}.tar.gz -C hassio/build .
|
run: tar -czf hassio/home_assistant_frontend_supervisor-${{ github.event.release.tag_name }}.tar.gz -C hassio/build .
|
||||||
- name: Upload release asset
|
- name: Upload release asset
|
||||||
uses: softprops/action-gh-release@v2.2.1
|
uses: softprops/action-gh-release@v2.3.2
|
||||||
with:
|
with:
|
||||||
files: hassio/home_assistant_frontend_supervisor-${{ github.event.release.tag_name }}.tar.gz
|
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
|
name: Translations
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- dev
|
- dev
|
||||||
|
4
.gitignore
vendored
4
.gitignore
vendored
@@ -53,3 +53,7 @@ src/cast/dev_const.ts
|
|||||||
|
|
||||||
# test coverage
|
# test coverage
|
||||||
test/coverage/
|
test/coverage/
|
||||||
|
|
||||||
|
# AI tooling
|
||||||
|
.claude
|
||||||
|
|
||||||
|
@@ -1 +1 @@
|
|||||||
yarn run lint-staged --relative --shell "/bin/bash"
|
yarn run lint-staged --relative
|
||||||
|
3
.vscode/extensions.json
vendored
3
.vscode/extensions.json
vendored
@@ -5,6 +5,7 @@
|
|||||||
"runem.lit-plugin",
|
"runem.lit-plugin",
|
||||||
"github.vscode-pull-request-github",
|
"github.vscode-pull-request-github",
|
||||||
"eamodio.gitlens",
|
"eamodio.gitlens",
|
||||||
"vitest.explorer"
|
"vitest.explorer",
|
||||||
|
"yeion7.styled-global-variables-autocomplete"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,22 @@
|
|||||||
|
diff --git a/mwc-formfield-base.js b/mwc-formfield-base.js
|
||||||
|
index 7b763326d7d51835ad52646bfbc80fe21989abd3..f2baa8224e6d03df1fdb0b9fd03f5c6d77fc8747 100644
|
||||||
|
--- a/mwc-formfield-base.js
|
||||||
|
+++ b/mwc-formfield-base.js
|
||||||
|
@@ -9,7 +9,7 @@ import { BaseElement } from '@material/mwc-base/base-element.js';
|
||||||
|
import { FormElement } from '@material/mwc-base/form-element.js';
|
||||||
|
import { observer } from '@material/mwc-base/observer.js';
|
||||||
|
import { html } from 'lit';
|
||||||
|
-import { property, query, queryAssignedNodes } from 'lit/decorators.js';
|
||||||
|
+import { property, query, queryAssignedElements } from 'lit/decorators.js';
|
||||||
|
import { classMap } from 'lit/directives/class-map.js';
|
||||||
|
export class FormfieldBase extends BaseElement {
|
||||||
|
constructor() {
|
||||||
|
@@ -96,7 +96,7 @@ __decorate([
|
||||||
|
query('.mdc-form-field')
|
||||||
|
], FormfieldBase.prototype, "mdcRoot", void 0);
|
||||||
|
__decorate([
|
||||||
|
- queryAssignedNodes('', true, '*')
|
||||||
|
+ queryAssignedElements({ slot: "", flatten: true, selector: "*" })
|
||||||
|
], FormfieldBase.prototype, "slottedInputs", void 0);
|
||||||
|
__decorate([
|
||||||
|
query('label')
|
26
.yarn/patches/@material-mwc-list-npm-0.27.0-5344fc9de4.patch
Normal file
26
.yarn/patches/@material-mwc-list-npm-0.27.0-5344fc9de4.patch
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
diff --git a/mwc-list-base.js b/mwc-list-base.js
|
||||||
|
index 1ba95b6a01dcecea4d85b5cbbbcc3dfb04c40d5f..dced13fdb7929c490d6661b1bbe7e9f96dcd2285 100644
|
||||||
|
--- a/mwc-list-base.js
|
||||||
|
+++ b/mwc-list-base.js
|
||||||
|
@@ -11,7 +11,7 @@ import { BaseElement } from '@material/mwc-base/base-element.js';
|
||||||
|
import { observer } from '@material/mwc-base/observer.js';
|
||||||
|
import { deepActiveElementPath, doesElementContainFocus, isNodeElement } from '@material/mwc-base/utils.js';
|
||||||
|
import { html } from 'lit';
|
||||||
|
-import { property, query, queryAssignedNodes } from 'lit/decorators.js';
|
||||||
|
+import { property, query, queryAssignedElements } from 'lit/decorators.js';
|
||||||
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
||||||
|
import MDCListFoundation, { isIndexSet } from './mwc-list-foundation.js';
|
||||||
|
export { createSetFromIndex, isEventMulti, isIndexSet } from './mwc-list-foundation.js';
|
||||||
|
@@ -425,10 +425,10 @@ __decorate([
|
||||||
|
query('.mdc-deprecated-list')
|
||||||
|
], ListBase.prototype, "mdcRoot", void 0);
|
||||||
|
__decorate([
|
||||||
|
- queryAssignedNodes('', true, '*')
|
||||||
|
+ queryAssignedElements({ flatten: true, selector: "*" })
|
||||||
|
], ListBase.prototype, "assignedElements", void 0);
|
||||||
|
__decorate([
|
||||||
|
- queryAssignedNodes('', true, '[tabindex="0"]')
|
||||||
|
+ queryAssignedElements({ flatten: true, selector: '[tabindex="0"]' })
|
||||||
|
], ListBase.prototype, "tabbableElements", void 0);
|
||||||
|
__decorate([
|
||||||
|
property({ type: Boolean }),
|
@@ -1,34 +0,0 @@
|
|||||||
diff --git a/lib/legacy/class.js b/lib/legacy/class.js
|
|
||||||
index aee2511be1cd9bf900ee552bc98190c1631c57c0..f2f499d68bf52034cac9c28307c99e8ce6b8417d 100644
|
|
||||||
--- a/lib/legacy/class.js
|
|
||||||
+++ b/lib/legacy/class.js
|
|
||||||
@@ -304,17 +304,23 @@ function GenerateClassFromInfo(info, Base, behaviors) {
|
|
||||||
// only proceed if the generated class' prototype has not been registered.
|
|
||||||
const generatedProto = PolymerGenerated.prototype;
|
|
||||||
if (!generatedProto.hasOwnProperty(JSCompiler_renameProperty('__hasRegisterFinished', generatedProto))) {
|
|
||||||
- generatedProto.__hasRegisterFinished = true;
|
|
||||||
+ // make sure legacy lifecycle is called on the *element*'s prototype
|
|
||||||
+ // and not the generated class prototype; if the element has been
|
|
||||||
+ // extended, these are *not* the same.
|
|
||||||
+ const proto = Object.getPrototypeOf(this);
|
|
||||||
+ // Only set flag when generated prototype itself is registered,
|
|
||||||
+ // as this element may be extended from, and needs to run `registered`
|
|
||||||
+ // on all behaviors on the subclass as well.
|
|
||||||
+ if (proto === generatedProto) {
|
|
||||||
+ generatedProto.__hasRegisterFinished = true;
|
|
||||||
+ }
|
|
||||||
// ensure superclass is registered first.
|
|
||||||
super._registered();
|
|
||||||
// copy properties onto the generated class lazily if we're optimizing,
|
|
||||||
- if (legacyOptimizations) {
|
|
||||||
+ if (legacyOptimizations && !Object.hasOwnProperty(generatedProto, '__hasCopiedProperties')) {
|
|
||||||
+ generatedProto.__hasCopiedProperties = true;
|
|
||||||
copyPropertiesToProto(generatedProto);
|
|
||||||
}
|
|
||||||
- // make sure legacy lifecycle is called on the *element*'s prototype
|
|
||||||
- // and not the generated class prototype; if the element has been
|
|
||||||
- // extended, these are *not* the same.
|
|
||||||
- const proto = Object.getPrototypeOf(this);
|
|
||||||
let list = lifecycle.beforeRegister;
|
|
||||||
if (list) {
|
|
||||||
for (let i=0; i < list.length; i++) {
|
|
@@ -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
|
|
935
.yarn/releases/yarn-4.7.0.cjs
vendored
935
.yarn/releases/yarn-4.7.0.cjs
vendored
File diff suppressed because one or more lines are too long
942
.yarn/releases/yarn-4.9.2.cjs
vendored
Executable file
942
.yarn/releases/yarn-4.9.2.cjs
vendored
Executable file
File diff suppressed because one or more lines are too long
@@ -6,4 +6,4 @@ enableGlobalCache: false
|
|||||||
|
|
||||||
nodeLinker: node-modules
|
nodeLinker: node-modules
|
||||||
|
|
||||||
yarnPath: .yarn/releases/yarn-4.7.0.cjs
|
yarnPath: .yarn/releases/yarn-4.9.2.cjs
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
import defineProvider from "@babel/helper-define-polyfill-provider";
|
import defineProvider from "@babel/helper-define-polyfill-provider";
|
||||||
import { join } from "node:path";
|
import { join } from "node:path";
|
||||||
import paths from "../paths.cjs";
|
import paths from "../paths";
|
||||||
|
|
||||||
const POLYFILL_DIR = join(paths.polymer_dir, "src/resources/polyfills");
|
const POLYFILL_DIR = join(paths.root_dir, "src/resources/polyfills");
|
||||||
|
|
||||||
// List of polyfill keys with supported browser targets for the functionality
|
// List of polyfill keys with supported browser targets for the functionality
|
||||||
const polyfillSupport = {
|
const polyfillSupport = {
|
@@ -1,48 +1,41 @@
|
|||||||
const path = require("path");
|
import path from "node:path";
|
||||||
const env = require("./env.cjs");
|
import packageJson from "../package.json" assert { type: "json" };
|
||||||
const paths = require("./paths.cjs");
|
import { version } from "./env.ts";
|
||||||
const { dependencies } = require("../package.json");
|
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
|
// 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
|
// Nightly builds use the commit SHA, otherwise assumes there is a tag that matches the version
|
||||||
module.exports.sourceMapURL = () => {
|
export const sourceMapURL = () => {
|
||||||
const ref = env.version().endsWith("dev")
|
const ref = version().endsWith("dev")
|
||||||
? process.env.GITHUB_SHA || "dev"
|
? process.env.GITHUB_SHA || "dev"
|
||||||
: env.version();
|
: version();
|
||||||
return `https://raw.githubusercontent.com/home-assistant/frontend/${ref}/`;
|
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
|
// Files from NPM packages that we should replace with empty file
|
||||||
module.exports.emptyPackages = ({ isHassioBuild }) =>
|
export const emptyPackages = ({ isHassioBuild }) =>
|
||||||
[
|
[
|
||||||
// Contains all color definitions for all material color sets.
|
import.meta.resolve("@vaadin/vaadin-material-styles/typography.js"),
|
||||||
// We don't use it
|
import.meta.resolve("@vaadin/vaadin-material-styles/font-icons.js"),
|
||||||
require.resolve("@polymer/paper-styles/color.js"),
|
|
||||||
require.resolve("@polymer/paper-styles/default-theme.js"),
|
|
||||||
// Loads stuff from a CDN
|
|
||||||
require.resolve("@polymer/font-roboto/roboto.js"),
|
|
||||||
require.resolve("@vaadin/vaadin-material-styles/typography.js"),
|
|
||||||
require.resolve("@vaadin/vaadin-material-styles/font-icons.js"),
|
|
||||||
// Icons in supervisor conflict with icons in HA so we don't load.
|
// Icons in supervisor conflict with icons in HA so we don't load.
|
||||||
isHassioBuild &&
|
isHassioBuild &&
|
||||||
require.resolve(
|
import.meta.resolve(
|
||||||
path.resolve(paths.polymer_dir, "src/components/ha-icon.ts")
|
path.resolve(paths.root_dir, "src/components/ha-icon.ts")
|
||||||
),
|
),
|
||||||
isHassioBuild &&
|
isHassioBuild &&
|
||||||
require.resolve(
|
import.meta.resolve(
|
||||||
path.resolve(paths.polymer_dir, "src/components/ha-icon-picker.ts")
|
path.resolve(paths.root_dir, "src/components/ha-icon-picker.ts")
|
||||||
),
|
),
|
||||||
].filter(Boolean);
|
].filter(Boolean);
|
||||||
|
|
||||||
module.exports.definedVars = ({ isProdBuild, latestBuild, defineOverlay }) => ({
|
export const definedVars = ({ isProdBuild, latestBuild, defineOverlay }) => ({
|
||||||
__DEV__: !isProdBuild,
|
__DEV__: !isProdBuild,
|
||||||
__BUILD__: JSON.stringify(latestBuild ? "modern" : "legacy"),
|
__BUILD__: JSON.stringify(latestBuild ? "modern" : "legacy"),
|
||||||
__VERSION__: JSON.stringify(env.version()),
|
__VERSION__: JSON.stringify(version()),
|
||||||
__DEMO__: false,
|
__DEMO__: false,
|
||||||
__SUPERVISOR__: false,
|
__SUPERVISOR__: false,
|
||||||
__BACKWARDS_COMPAT__: false,
|
__BACKWARDS_COMPAT__: false,
|
||||||
@@ -50,7 +43,8 @@ module.exports.definedVars = ({ isProdBuild, latestBuild, defineOverlay }) => ({
|
|||||||
__HASS_URL__: `\`${
|
__HASS_URL__: `\`${
|
||||||
"HASS_URL" in process.env
|
"HASS_URL" in process.env
|
||||||
? process.env.HASS_URL
|
? process.env.HASS_URL
|
||||||
: "${location.protocol}//${location.host}"
|
: // eslint-disable-next-line no-template-curly-in-string
|
||||||
|
"${location.protocol}//${location.host}"
|
||||||
}\``,
|
}\``,
|
||||||
"process.env.NODE_ENV": JSON.stringify(
|
"process.env.NODE_ENV": JSON.stringify(
|
||||||
isProdBuild ? "production" : "development"
|
isProdBuild ? "production" : "development"
|
||||||
@@ -58,7 +52,7 @@ module.exports.definedVars = ({ isProdBuild, latestBuild, defineOverlay }) => ({
|
|||||||
...defineOverlay,
|
...defineOverlay,
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports.htmlMinifierOptions = {
|
export const htmlMinifierOptions = {
|
||||||
caseSensitive: true,
|
caseSensitive: true,
|
||||||
collapseWhitespace: true,
|
collapseWhitespace: true,
|
||||||
conservativeCollapse: true,
|
conservativeCollapse: true,
|
||||||
@@ -70,19 +64,37 @@ module.exports.htmlMinifierOptions = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.terserOptions = ({ latestBuild, isTestBuild }) => ({
|
export const terserOptions = ({ latestBuild, isTestBuild }) => ({
|
||||||
safari10: !latestBuild,
|
safari10: !latestBuild,
|
||||||
ecma: latestBuild ? 2015 : 5,
|
ecma: latestBuild ? (2015 as const) : (5 as const),
|
||||||
module: latestBuild,
|
module: latestBuild,
|
||||||
format: { comments: false },
|
format: { comments: false },
|
||||||
sourceMap: !isTestBuild,
|
sourceMap: !isTestBuild,
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports.babelOptions = ({
|
/** @type {import('@rspack/core').SwcLoaderOptions} */
|
||||||
|
export const swcOptions = () => ({
|
||||||
|
jsc: {
|
||||||
|
loose: true,
|
||||||
|
externalHelpers: true,
|
||||||
|
target: "ES2021",
|
||||||
|
parser: {
|
||||||
|
syntax: "typescript",
|
||||||
|
decorators: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export const babelOptions = ({
|
||||||
latestBuild,
|
latestBuild,
|
||||||
isProdBuild,
|
isProdBuild,
|
||||||
isTestBuild,
|
isTestBuild,
|
||||||
sw,
|
sw,
|
||||||
|
}: {
|
||||||
|
latestBuild?: boolean;
|
||||||
|
isProdBuild?: boolean;
|
||||||
|
isTestBuild?: boolean;
|
||||||
|
sw?: boolean;
|
||||||
}) => ({
|
}) => ({
|
||||||
babelrc: false,
|
babelrc: false,
|
||||||
compact: false,
|
compact: false,
|
||||||
@@ -102,7 +114,6 @@ module.exports.babelOptions = ({
|
|||||||
shippedProposals: true,
|
shippedProposals: true,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
"@babel/preset-typescript",
|
|
||||||
],
|
],
|
||||||
plugins: [
|
plugins: [
|
||||||
[
|
[
|
||||||
@@ -130,7 +141,7 @@ module.exports.babelOptions = ({
|
|||||||
"@polymer/polymer/lib/utils/html-tag.js": ["html"],
|
"@polymer/polymer/lib/utils/html-tag.js": ["html"],
|
||||||
},
|
},
|
||||||
strictCSS: true,
|
strictCSS: true,
|
||||||
htmlMinifier: module.exports.htmlMinifierOptions,
|
htmlMinifier: htmlMinifierOptions,
|
||||||
failOnError: false, // we can turn this off in case of false positives
|
failOnError: false, // we can turn this off in case of false positives
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -139,12 +150,6 @@ module.exports.babelOptions = ({
|
|||||||
"@babel/plugin-transform-runtime",
|
"@babel/plugin-transform-runtime",
|
||||||
{ version: dependencies["@babel/runtime"] },
|
{ version: dependencies["@babel/runtime"] },
|
||||||
],
|
],
|
||||||
// Transpile decorators (still in TC39 process)
|
|
||||||
// Modern browsers support class fields and private methods, but transform is required with the older decorator version dictated by Lit
|
|
||||||
[
|
|
||||||
"@babel/plugin-proposal-decorators",
|
|
||||||
{ version: "2018-09", decoratorsBeforeExport: true },
|
|
||||||
],
|
|
||||||
"@babel/plugin-transform-class-properties",
|
"@babel/plugin-transform-class-properties",
|
||||||
"@babel/plugin-transform-private-methods",
|
"@babel/plugin-transform-private-methods",
|
||||||
].filter(Boolean),
|
].filter(Boolean),
|
||||||
@@ -159,12 +164,12 @@ module.exports.babelOptions = ({
|
|||||||
// themselves to prevent self-injection.
|
// themselves to prevent self-injection.
|
||||||
plugins: [
|
plugins: [
|
||||||
[
|
[
|
||||||
path.join(BABEL_PLUGINS, "custom-polyfill-plugin.js"),
|
path.join(BABEL_PLUGINS, "custom-polyfill-plugin.ts"),
|
||||||
{ method: "usage-global" },
|
{ method: "usage-global" },
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
exclude: [
|
exclude: [
|
||||||
path.join(paths.polymer_dir, "src/resources/polyfills"),
|
path.join(paths.root_dir, "src/resources/polyfills"),
|
||||||
...[
|
...[
|
||||||
"@formatjs/(?:ecma402-abstract|intl-\\w+)",
|
"@formatjs/(?:ecma402-abstract|intl-\\w+)",
|
||||||
"@lit-labs/virtualizer/polyfills",
|
"@lit-labs/virtualizer/polyfills",
|
||||||
@@ -182,6 +187,7 @@ module.exports.babelOptions = ({
|
|||||||
include: /\/node_modules\//,
|
include: /\/node_modules\//,
|
||||||
exclude: [
|
exclude: [
|
||||||
"element-internals-polyfill",
|
"element-internals-polyfill",
|
||||||
|
"@shoelace-style",
|
||||||
"@?lit(?:-labs|-element|-html)?",
|
"@?lit(?:-labs|-element|-html)?",
|
||||||
].map((p) => new RegExp(`/node_modules/${p}/`)),
|
].map((p) => new RegExp(`/node_modules/${p}/`)),
|
||||||
},
|
},
|
||||||
@@ -219,8 +225,20 @@ const publicPath = (latestBuild, root = "") =>
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
module.exports.config = {
|
export const config = {
|
||||||
app({ isProdBuild, latestBuild, isStatsBuild, isTestBuild, isWDS }) {
|
app({
|
||||||
|
isProdBuild,
|
||||||
|
latestBuild,
|
||||||
|
isStatsBuild,
|
||||||
|
isTestBuild,
|
||||||
|
isWDS,
|
||||||
|
}: {
|
||||||
|
isProdBuild?: boolean;
|
||||||
|
latestBuild?: boolean;
|
||||||
|
isStatsBuild?: boolean;
|
||||||
|
isTestBuild?: boolean;
|
||||||
|
isWDS?: boolean;
|
||||||
|
}) {
|
||||||
return {
|
return {
|
||||||
name: "frontend" + nameSuffix(latestBuild),
|
name: "frontend" + nameSuffix(latestBuild),
|
||||||
entry: {
|
entry: {
|
||||||
@@ -255,7 +273,7 @@ module.exports.config = {
|
|||||||
outputPath: outputPath(paths.demo_output_root, latestBuild),
|
outputPath: outputPath(paths.demo_output_root, latestBuild),
|
||||||
publicPath: publicPath(latestBuild),
|
publicPath: publicPath(latestBuild),
|
||||||
defineOverlay: {
|
defineOverlay: {
|
||||||
__VERSION__: JSON.stringify(`DEMO-${env.version()}`),
|
__VERSION__: JSON.stringify(`DEMO-${version()}`),
|
||||||
__DEMO__: true,
|
__DEMO__: true,
|
||||||
},
|
},
|
||||||
isProdBuild,
|
isProdBuild,
|
||||||
@@ -265,7 +283,7 @@ module.exports.config = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
cast({ isProdBuild, latestBuild }) {
|
cast({ isProdBuild, latestBuild }) {
|
||||||
const entry = {
|
const entry: Record<string, string> = {
|
||||||
launcher: path.resolve(paths.cast_dir, "src/launcher/entrypoint.ts"),
|
launcher: path.resolve(paths.cast_dir, "src/launcher/entrypoint.ts"),
|
||||||
media: path.resolve(paths.cast_dir, "src/media/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.polymer_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
|
// Tasks to compress
|
||||||
|
|
||||||
import { constants } from "node:zlib";
|
import { dest, parallel, src } from "gulp";
|
||||||
import gulp from "gulp";
|
|
||||||
import brotli from "gulp-brotli";
|
import brotli from "gulp-brotli";
|
||||||
import zopfli from "gulp-zopfli-green";
|
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 filesGlob = "*.{js,json,css,svg,xml}";
|
||||||
const brotliOptions = {
|
const brotliOptions = {
|
||||||
@@ -16,27 +16,25 @@ const brotliOptions = {
|
|||||||
const zopfliOptions = { threshold: 150 };
|
const zopfliOptions = { threshold: 150 };
|
||||||
|
|
||||||
const compressModern = (rootDir, modernDir, compress) =>
|
const compressModern = (rootDir, modernDir, compress) =>
|
||||||
gulp
|
src([`${modernDir}/**/${filesGlob}`, `${rootDir}/sw-modern.js`], {
|
||||||
.src([`${modernDir}/**/${filesGlob}`, `${rootDir}/sw-modern.js`], {
|
base: rootDir,
|
||||||
base: rootDir,
|
allowEmpty: true,
|
||||||
allowEmpty: true,
|
})
|
||||||
})
|
|
||||||
.pipe(compress === "zopfli" ? zopfli(zopfliOptions) : brotli(brotliOptions))
|
.pipe(compress === "zopfli" ? zopfli(zopfliOptions) : brotli(brotliOptions))
|
||||||
.pipe(gulp.dest(rootDir));
|
.pipe(dest(rootDir));
|
||||||
|
|
||||||
const compressOther = (rootDir, modernDir, compress) =>
|
const compressOther = (rootDir, modernDir, compress) =>
|
||||||
gulp
|
src(
|
||||||
.src(
|
[
|
||||||
[
|
`${rootDir}/**/${filesGlob}`,
|
||||||
`${rootDir}/**/${filesGlob}`,
|
`!${modernDir}/**/${filesGlob}`,
|
||||||
`!${modernDir}/**/${filesGlob}`,
|
`!${rootDir}/{sw-modern,service_worker}.js`,
|
||||||
`!${rootDir}/{sw-modern,service_worker}.js`,
|
`${rootDir}/{authorize,onboarding}.html`,
|
||||||
`${rootDir}/{authorize,onboarding}.html`,
|
],
|
||||||
],
|
{ base: rootDir, allowEmpty: true }
|
||||||
{ base: rootDir, allowEmpty: true }
|
)
|
||||||
)
|
|
||||||
.pipe(compress === "zopfli" ? zopfli(zopfliOptions) : brotli(brotliOptions))
|
.pipe(compress === "zopfli" ? zopfli(zopfliOptions) : brotli(brotliOptions))
|
||||||
.pipe(gulp.dest(rootDir));
|
.pipe(dest(rootDir));
|
||||||
|
|
||||||
const compressAppModernBrotli = () =>
|
const compressAppModernBrotli = () =>
|
||||||
compressModern(paths.app_output_root, paths.app_output_latest, "brotli");
|
compressModern(paths.app_output_root, paths.app_output_latest, "brotli");
|
||||||
@@ -66,21 +64,16 @@ const compressHassioOtherBrotli = () =>
|
|||||||
const compressHassioOtherZopfli = () =>
|
const compressHassioOtherZopfli = () =>
|
||||||
compressOther(paths.hassio_output_root, paths.hassio_output_latest, "zopfli");
|
compressOther(paths.hassio_output_root, paths.hassio_output_latest, "zopfli");
|
||||||
|
|
||||||
gulp.task(
|
export const compressApp = parallel(
|
||||||
"compress-app",
|
compressAppModernBrotli,
|
||||||
gulp.parallel(
|
compressAppOtherBrotli,
|
||||||
compressAppModernBrotli,
|
compressAppModernZopfli,
|
||||||
compressAppOtherBrotli,
|
compressAppOtherZopfli
|
||||||
compressAppModernZopfli,
|
|
||||||
compressAppOtherZopfli
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
gulp.task(
|
|
||||||
"compress-hassio",
|
export const compressHassio = parallel(
|
||||||
gulp.parallel(
|
compressHassioModernBrotli,
|
||||||
compressHassioModernBrotli,
|
compressHassioOtherBrotli,
|
||||||
compressHassioOtherBrotli,
|
compressHassioModernZopfli,
|
||||||
compressHassioModernZopfli,
|
compressHassioOtherZopfli
|
||||||
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 { LokaliseApi } from "@lokalise/node-api";
|
||||||
|
import { dest, series, src } from "gulp";
|
||||||
|
import transform from "gulp-json-transform";
|
||||||
import JSZip from "jszip";
|
import JSZip from "jszip";
|
||||||
|
import mapStream from "map-stream";
|
||||||
|
import fs from "node:fs/promises";
|
||||||
|
import path from "node:path";
|
||||||
|
|
||||||
const inDir = "translations";
|
const inDir = "translations";
|
||||||
const inDirFrontend = `${inDir}/frontend`;
|
const inDirFrontend = `${inDir}/frontend`;
|
||||||
@@ -12,11 +12,14 @@ const inDirBackend = `${inDir}/backend`;
|
|||||||
const srcMeta = "src/translations/translationMetadata.json";
|
const srcMeta = "src/translations/translationMetadata.json";
|
||||||
const encoding = "utf8";
|
const encoding = "utf8";
|
||||||
|
|
||||||
function hasHtml(data) {
|
const hasHtml = (data) => /<\S*>/i.test(data);
|
||||||
return /<\S*>/i.test(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
function recursiveCheckHasHtml(file, data, errors, recKey) {
|
const recursiveCheckHasHtml = (
|
||||||
|
file,
|
||||||
|
data,
|
||||||
|
errors: string[],
|
||||||
|
recKey?: string
|
||||||
|
) => {
|
||||||
Object.keys(data).forEach(function (key) {
|
Object.keys(data).forEach(function (key) {
|
||||||
if (typeof data[key] === "object") {
|
if (typeof data[key] === "object") {
|
||||||
const nextRecKey = recKey ? `${recKey}.${key}` : key;
|
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}`);
|
errors.push(`HTML found in ${file.path} at key ${recKey}.${key}`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
function checkHtml() {
|
const checkHtml = () => {
|
||||||
const errors = [];
|
const errors = [];
|
||||||
|
|
||||||
return mapStream(function (file, cb) {
|
return mapStream(function (file, cb) {
|
||||||
@@ -44,9 +47,9 @@ function checkHtml() {
|
|||||||
}
|
}
|
||||||
cb(error, file);
|
cb(error, file);
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
function convertBackendTranslations(data, _file) {
|
const convertBackendTranslationsTransform = (data, _file) => {
|
||||||
const output = { component: {} };
|
const output = { component: {} };
|
||||||
if (!data.component) {
|
if (!data.component) {
|
||||||
return output;
|
return output;
|
||||||
@@ -62,25 +65,22 @@ function convertBackendTranslations(data, _file) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
return output;
|
return output;
|
||||||
}
|
};
|
||||||
|
|
||||||
gulp.task("convert-backend-translations", function () {
|
const convertBackendTranslations = () =>
|
||||||
return gulp
|
src([`${inDirBackend}/*.json`])
|
||||||
.src([`${inDirBackend}/*.json`])
|
.pipe(
|
||||||
.pipe(transform((data, file) => convertBackendTranslations(data, file)))
|
transform((data, file) => convertBackendTranslationsTransform(data, file))
|
||||||
.pipe(gulp.dest(inDirBackend));
|
)
|
||||||
});
|
.pipe(dest(inDirBackend));
|
||||||
|
|
||||||
gulp.task("check-translations-html", function () {
|
const checkTranslationsHtml = () =>
|
||||||
return gulp
|
src([`${inDirFrontend}/*.json`, `${inDirBackend}/*.json`]).pipe(checkHtml());
|
||||||
.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 file = await fs.readFile(srcMeta, { encoding });
|
||||||
const meta = JSON.parse(file);
|
const meta = JSON.parse(file);
|
||||||
const writings = [];
|
const writings: Promise<void>[] = [];
|
||||||
Object.keys(meta).forEach((lang) => {
|
Object.keys(meta).forEach((lang) => {
|
||||||
writings.push(
|
writings.push(
|
||||||
fs.writeFile(`${inDirFrontend}/${lang}.json`, JSON.stringify({}), {
|
fs.writeFile(`${inDirFrontend}/${lang}.json`, JSON.stringify({}), {
|
||||||
@@ -92,14 +92,14 @@ gulp.task("check-all-files-exist", async function () {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
await Promise.allSettled(writings);
|
await Promise.allSettled(writings);
|
||||||
});
|
};
|
||||||
|
|
||||||
const lokaliseProjects = {
|
const lokaliseProjects = {
|
||||||
backend: "130246255a974bd3b5e8a1.51616605",
|
backend: "130246255a974bd3b5e8a1.51616605",
|
||||||
frontend: "3420425759f6d6d241f598.13594006",
|
frontend: "3420425759f6d6d241f598.13594006",
|
||||||
};
|
};
|
||||||
|
|
||||||
gulp.task("fetch-lokalise", async function () {
|
const fetchLokalise = async () => {
|
||||||
let apiKey;
|
let apiKey;
|
||||||
try {
|
try {
|
||||||
apiKey =
|
apiKey =
|
||||||
@@ -168,14 +168,11 @@ gulp.task("fetch-lokalise", async function () {
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
});
|
};
|
||||||
|
|
||||||
gulp.task(
|
export const downloadTranslations = series(
|
||||||
"download-translations",
|
fetchLokalise,
|
||||||
gulp.series(
|
convertBackendTranslations,
|
||||||
"fetch-lokalise",
|
checkTranslationsHtml,
|
||||||
"convert-backend-translations",
|
checkAllFilesExist
|
||||||
"check-translations-html",
|
|
||||||
"check-all-files-exist"
|
|
||||||
)
|
|
||||||
);
|
);
|
@@ -6,12 +6,11 @@ import {
|
|||||||
getPreUserAgentRegexes,
|
getPreUserAgentRegexes,
|
||||||
} from "browserslist-useragent-regexp";
|
} from "browserslist-useragent-regexp";
|
||||||
import fs from "fs-extra";
|
import fs from "fs-extra";
|
||||||
import gulp from "gulp";
|
|
||||||
import { minify } from "html-minifier-terser";
|
import { minify } from "html-minifier-terser";
|
||||||
import template from "lodash.template";
|
import template from "lodash.template";
|
||||||
import { dirname, extname, resolve } from "node:path";
|
import { dirname, extname, resolve } from "node:path";
|
||||||
import { htmlMinifierOptions, terserOptions } from "../bundle.cjs";
|
import { htmlMinifierOptions, terserOptions } from "../bundle.ts";
|
||||||
import paths from "../paths.cjs";
|
import paths from "../paths.ts";
|
||||||
|
|
||||||
// macOS companion app has no way to obtain the Safari version used by WKWebView,
|
// 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
|
// and it is not in the default user agent string. So we add an additional regex
|
||||||
@@ -34,9 +33,9 @@ const getCommonTemplateVars = () => {
|
|||||||
mobileToDesktop: true,
|
mobileToDesktop: true,
|
||||||
throwOnMissing: true,
|
throwOnMissing: true,
|
||||||
});
|
});
|
||||||
const minSafariVersion = browserRegexes.find(
|
const minSafariVersion =
|
||||||
(regex) => regex.family === "safari"
|
browserRegexes.find((regex) => regex.family === "safari")
|
||||||
)?.matchedVersions[0][0];
|
?.matchedVersions[0][0] ?? 18;
|
||||||
const minMacOSVersion = SAFARI_TO_MACOS[minSafariVersion];
|
const minMacOSVersion = SAFARI_TO_MACOS[minSafariVersion];
|
||||||
if (!minMacOSVersion) {
|
if (!minMacOSVersion) {
|
||||||
throw Error(
|
throw Error(
|
||||||
@@ -106,10 +105,10 @@ const genPagesDevTask =
|
|||||||
resolve(inputRoot, inputSub, `${page}.template`),
|
resolve(inputRoot, inputSub, `${page}.template`),
|
||||||
{
|
{
|
||||||
...commonVars,
|
...commonVars,
|
||||||
latestEntryJS: entries.map(
|
latestEntryJS: (entries as string[]).map(
|
||||||
(entry) => `${publicRoot}/frontend_latest/${entry}.js`
|
(entry) => `${publicRoot}/frontend_latest/${entry}.js`
|
||||||
),
|
),
|
||||||
es5EntryJS: entries.map(
|
es5EntryJS: (entries as string[]).map(
|
||||||
(entry) => `${publicRoot}/frontend_es5/${entry}.js`
|
(entry) => `${publicRoot}/frontend_es5/${entry}.js`
|
||||||
),
|
),
|
||||||
latestCustomPanelJS: `${publicRoot}/frontend_latest/custom-panel.js`,
|
latestCustomPanelJS: `${publicRoot}/frontend_latest/custom-panel.js`,
|
||||||
@@ -128,7 +127,7 @@ const genPagesProdTask =
|
|||||||
inputRoot,
|
inputRoot,
|
||||||
outputRoot,
|
outputRoot,
|
||||||
outputLatest,
|
outputLatest,
|
||||||
outputES5,
|
outputES5?: string,
|
||||||
inputSub = "src/html"
|
inputSub = "src/html"
|
||||||
) =>
|
) =>
|
||||||
async () => {
|
async () => {
|
||||||
@@ -139,14 +138,18 @@ const genPagesProdTask =
|
|||||||
? fs.readJsonSync(resolve(outputES5, "manifest.json"))
|
? fs.readJsonSync(resolve(outputES5, "manifest.json"))
|
||||||
: {};
|
: {};
|
||||||
const commonVars = getCommonTemplateVars();
|
const commonVars = getCommonTemplateVars();
|
||||||
const minifiedHTML = [];
|
const minifiedHTML: Promise<void>[] = [];
|
||||||
for (const [page, entries] of Object.entries(pageEntries)) {
|
for (const [page, entries] of Object.entries(pageEntries)) {
|
||||||
const content = renderTemplate(
|
const content = renderTemplate(
|
||||||
resolve(inputRoot, inputSub, `${page}.template`),
|
resolve(inputRoot, inputSub, `${page}.template`),
|
||||||
{
|
{
|
||||||
...commonVars,
|
...commonVars,
|
||||||
latestEntryJS: entries.map((entry) => latestManifest[`${entry}.js`]),
|
latestEntryJS: (entries as string[]).map(
|
||||||
es5EntryJS: entries.map((entry) => es5Manifest[`${entry}.js`]),
|
(entry) => latestManifest[`${entry}.js`]
|
||||||
|
),
|
||||||
|
es5EntryJS: (entries as string[]).map(
|
||||||
|
(entry) => es5Manifest[`${entry}.js`]
|
||||||
|
),
|
||||||
latestCustomPanelJS: latestManifest["custom-panel.js"],
|
latestCustomPanelJS: latestManifest["custom-panel.js"],
|
||||||
es5CustomPanelJS: es5Manifest["custom-panel.js"],
|
es5CustomPanelJS: es5Manifest["custom-panel.js"],
|
||||||
}
|
}
|
||||||
@@ -167,20 +170,18 @@ const APP_PAGE_ENTRIES = {
|
|||||||
"index.html": ["core", "app"],
|
"index.html": ["core", "app"],
|
||||||
};
|
};
|
||||||
|
|
||||||
gulp.task(
|
export const genPagesAppDev = genPagesDevTask(
|
||||||
"gen-pages-app-dev",
|
APP_PAGE_ENTRIES,
|
||||||
genPagesDevTask(APP_PAGE_ENTRIES, paths.polymer_dir, paths.app_output_root)
|
paths.root_dir,
|
||||||
|
paths.app_output_root
|
||||||
);
|
);
|
||||||
|
|
||||||
gulp.task(
|
export const genPagesAppProd = genPagesProdTask(
|
||||||
"gen-pages-app-prod",
|
APP_PAGE_ENTRIES,
|
||||||
genPagesProdTask(
|
paths.root_dir,
|
||||||
APP_PAGE_ENTRIES,
|
paths.app_output_root,
|
||||||
paths.polymer_dir,
|
paths.app_output_latest,
|
||||||
paths.app_output_root,
|
paths.app_output_es5
|
||||||
paths.app_output_latest,
|
|
||||||
paths.app_output_es5
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const CAST_PAGE_ENTRIES = {
|
const CAST_PAGE_ENTRIES = {
|
||||||
@@ -190,104 +191,82 @@ const CAST_PAGE_ENTRIES = {
|
|||||||
"receiver.html": ["receiver"],
|
"receiver.html": ["receiver"],
|
||||||
};
|
};
|
||||||
|
|
||||||
gulp.task(
|
export const genPagesCastDev = genPagesDevTask(
|
||||||
"gen-pages-cast-dev",
|
CAST_PAGE_ENTRIES,
|
||||||
genPagesDevTask(CAST_PAGE_ENTRIES, paths.cast_dir, paths.cast_output_root)
|
paths.cast_dir,
|
||||||
|
paths.cast_output_root
|
||||||
);
|
);
|
||||||
|
|
||||||
gulp.task(
|
export const genPagesCastProd = genPagesProdTask(
|
||||||
"gen-pages-cast-prod",
|
CAST_PAGE_ENTRIES,
|
||||||
genPagesProdTask(
|
paths.cast_dir,
|
||||||
CAST_PAGE_ENTRIES,
|
paths.cast_output_root,
|
||||||
paths.cast_dir,
|
paths.cast_output_latest,
|
||||||
paths.cast_output_root,
|
paths.cast_output_es5
|
||||||
paths.cast_output_latest,
|
|
||||||
paths.cast_output_es5
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const DEMO_PAGE_ENTRIES = { "index.html": ["main"] };
|
const DEMO_PAGE_ENTRIES = { "index.html": ["main"] };
|
||||||
|
|
||||||
gulp.task(
|
export const genPagesDemoDev = genPagesDevTask(
|
||||||
"gen-pages-demo-dev",
|
DEMO_PAGE_ENTRIES,
|
||||||
genPagesDevTask(DEMO_PAGE_ENTRIES, paths.demo_dir, paths.demo_output_root)
|
paths.demo_dir,
|
||||||
|
paths.demo_output_root
|
||||||
);
|
);
|
||||||
|
|
||||||
gulp.task(
|
export const genPagesDemoProd = genPagesProdTask(
|
||||||
"gen-pages-demo-prod",
|
DEMO_PAGE_ENTRIES,
|
||||||
genPagesProdTask(
|
paths.demo_dir,
|
||||||
DEMO_PAGE_ENTRIES,
|
paths.demo_output_root,
|
||||||
paths.demo_dir,
|
paths.demo_output_latest,
|
||||||
paths.demo_output_root,
|
paths.demo_output_es5
|
||||||
paths.demo_output_latest,
|
|
||||||
paths.demo_output_es5
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const GALLERY_PAGE_ENTRIES = { "index.html": ["entrypoint"] };
|
const GALLERY_PAGE_ENTRIES = { "index.html": ["entrypoint"] };
|
||||||
|
|
||||||
gulp.task(
|
export const genPagesGalleryDev = genPagesDevTask(
|
||||||
"gen-pages-gallery-dev",
|
GALLERY_PAGE_ENTRIES,
|
||||||
genPagesDevTask(
|
paths.gallery_dir,
|
||||||
GALLERY_PAGE_ENTRIES,
|
paths.gallery_output_root
|
||||||
paths.gallery_dir,
|
|
||||||
paths.gallery_output_root
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
gulp.task(
|
export const genPagesGalleryProd = genPagesProdTask(
|
||||||
"gen-pages-gallery-prod",
|
GALLERY_PAGE_ENTRIES,
|
||||||
genPagesProdTask(
|
paths.gallery_dir,
|
||||||
GALLERY_PAGE_ENTRIES,
|
paths.gallery_output_root,
|
||||||
paths.gallery_dir,
|
paths.gallery_output_latest
|
||||||
paths.gallery_output_root,
|
|
||||||
paths.gallery_output_latest
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const LANDING_PAGE_PAGE_ENTRIES = { "index.html": ["entrypoint"] };
|
const LANDING_PAGE_PAGE_ENTRIES = { "index.html": ["entrypoint"] };
|
||||||
|
|
||||||
gulp.task(
|
export const genPagesLandingPageDev = genPagesDevTask(
|
||||||
"gen-pages-landing-page-dev",
|
LANDING_PAGE_PAGE_ENTRIES,
|
||||||
genPagesDevTask(
|
paths.landingPage_dir,
|
||||||
LANDING_PAGE_PAGE_ENTRIES,
|
paths.landingPage_output_root
|
||||||
paths.landingPage_dir,
|
|
||||||
paths.landingPage_output_root
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
gulp.task(
|
export const genPagesLandingPageProd = genPagesProdTask(
|
||||||
"gen-pages-landing-page-prod",
|
LANDING_PAGE_PAGE_ENTRIES,
|
||||||
genPagesProdTask(
|
paths.landingPage_dir,
|
||||||
LANDING_PAGE_PAGE_ENTRIES,
|
paths.landingPage_output_root,
|
||||||
paths.landingPage_dir,
|
paths.landingPage_output_latest,
|
||||||
paths.landingPage_output_root,
|
paths.landingPage_output_es5
|
||||||
paths.landingPage_output_latest,
|
|
||||||
paths.landingPage_output_es5
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const HASSIO_PAGE_ENTRIES = { "entrypoint.js": ["entrypoint"] };
|
const HASSIO_PAGE_ENTRIES = { "entrypoint.js": ["entrypoint"] };
|
||||||
|
|
||||||
gulp.task(
|
export const genPagesHassioDev = genPagesDevTask(
|
||||||
"gen-pages-hassio-dev",
|
HASSIO_PAGE_ENTRIES,
|
||||||
genPagesDevTask(
|
paths.hassio_dir,
|
||||||
HASSIO_PAGE_ENTRIES,
|
paths.hassio_output_root,
|
||||||
paths.hassio_dir,
|
"src",
|
||||||
paths.hassio_output_root,
|
paths.hassio_publicPath
|
||||||
"src",
|
|
||||||
paths.hassio_publicPath
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
gulp.task(
|
export const genPagesHassioProd = genPagesProdTask(
|
||||||
"gen-pages-hassio-prod",
|
HASSIO_PAGE_ENTRIES,
|
||||||
genPagesProdTask(
|
paths.hassio_dir,
|
||||||
HASSIO_PAGE_ENTRIES,
|
paths.hassio_output_root,
|
||||||
paths.hassio_dir,
|
paths.hassio_output_latest,
|
||||||
paths.hassio_output_root,
|
paths.hassio_output_es5,
|
||||||
paths.hassio_output_latest,
|
"src"
|
||||||
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 { createOAuthDeviceAuth } from "@octokit/auth-oauth-device";
|
||||||
import { retry } from "@octokit/plugin-retry";
|
import { retry } from "@octokit/plugin-retry";
|
||||||
import { Octokit } from "@octokit/rest";
|
import { Octokit } from "@octokit/rest";
|
||||||
import { deleteAsync } from "del";
|
import { deleteAsync } from "del";
|
||||||
import { mkdir, readFile, writeFile } from "fs/promises";
|
import { series } from "gulp";
|
||||||
import gulp from "gulp";
|
|
||||||
import jszip from "jszip";
|
import jszip from "jszip";
|
||||||
import path from "path";
|
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
||||||
import process from "process";
|
import path from "node:path";
|
||||||
|
import process from "node:process";
|
||||||
import { extract } from "tar";
|
import { extract } from "tar";
|
||||||
|
|
||||||
const MAX_AGE = 24; // hours
|
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");
|
const ARTIFACT_FILE = path.posix.join(EXTRACT_DIR, "artifact.json");
|
||||||
|
|
||||||
let allowTokenSetup = false;
|
let allowTokenSetup = false;
|
||||||
gulp.task("allow-setup-fetch-nightly-translations", (done) => {
|
|
||||||
|
export const allowSetupFetchNightlyTranslations = (done) => {
|
||||||
allowTokenSetup = true;
|
allowTokenSetup = true;
|
||||||
done();
|
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)
|
// Skip all when environment flag is set (assumes translations are already in place)
|
||||||
if (process.env?.SKIP_FETCH_NIGHTLY_TRANSLATIONS) {
|
if (process.env?.SKIP_FETCH_NIGHTLY_TRANSLATIONS) {
|
||||||
console.log("Skipping fetch due to environment signal");
|
console.log("Skipping fetch due to environment signal");
|
||||||
@@ -54,7 +55,7 @@ gulp.task("fetch-nightly-translations", async function () {
|
|||||||
|
|
||||||
// To store file writing promises
|
// To store file writing promises
|
||||||
const createExtractDir = mkdir(EXTRACT_DIR, { recursive: true });
|
const createExtractDir = mkdir(EXTRACT_DIR, { recursive: true });
|
||||||
const writings = [];
|
const writings: Promise<void>[] = [];
|
||||||
|
|
||||||
// Authenticate to GitHub using GitHub action token if it exists,
|
// Authenticate to GitHub using GitHub action token if it exists,
|
||||||
// otherwise look for a saved user token or generate a new one if none
|
// 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" });
|
tokenAuth = await auth({ type: "oauth" });
|
||||||
writings.push(
|
writings.push(
|
||||||
createExtractDir.then(
|
createExtractDir.then(() =>
|
||||||
writeFile(TOKEN_FILE, JSON.stringify(tokenAuth, null, 2))
|
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");
|
throw Error("Latest nightly workflow run has no translations artifact");
|
||||||
}
|
}
|
||||||
writings.push(
|
writings.push(
|
||||||
createExtractDir.then(
|
createExtractDir.then(() =>
|
||||||
writeFile(ARTIFACT_FILE, JSON.stringify(latestArtifact, null, 2))
|
writeFile(ARTIFACT_FILE, JSON.stringify(latestArtifact, null, 2))
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Remove the current translations
|
// Remove the current translations
|
||||||
const deleteCurrent = Promise.all(writings).then(
|
const deleteCurrent = Promise.all(writings).then(() =>
|
||||||
deleteAsync([`${EXTRACT_DIR}/*`, `!${ARTIFACT_FILE}`, `!${TOKEN_FILE}`])
|
deleteAsync([`${EXTRACT_DIR}/*`, `!${ARTIFACT_FILE}`, `!${TOKEN_FILE}`])
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -148,24 +149,22 @@ gulp.task("fetch-nightly-translations", async function () {
|
|||||||
artifact_id: latestArtifact.id,
|
artifact_id: latestArtifact.id,
|
||||||
archive_format: "zip",
|
archive_format: "zip",
|
||||||
});
|
});
|
||||||
|
// @ts-ignore OctokitResponse<unknown, 302> doesn't allow to check for 200
|
||||||
if (downloadResponse.status !== 200) {
|
if (downloadResponse.status !== 200) {
|
||||||
throw Error("Failure downloading translations artifact");
|
throw Error("Failure downloading translations artifact");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Artifact is a tarball, but GitHub adds it to a zip file
|
// Artifact is a tarball, but GitHub adds it to a zip file
|
||||||
console.log("Unpacking downloaded translations...");
|
console.log("Unpacking downloaded translations...");
|
||||||
const zip = await jszip.loadAsync(downloadResponse.data);
|
const zip = await jszip.loadAsync(downloadResponse.data as any);
|
||||||
await deleteCurrent;
|
await deleteCurrent;
|
||||||
const extractStream = zip.file(/.*/)[0].nodeStream().pipe(extract());
|
const extractStream = zip.file(/.*/)[0].nodeStream().pipe(extract());
|
||||||
await new Promise((resolve, reject) => {
|
await new Promise((resolve, reject) => {
|
||||||
extractStream.on("close", resolve).on("error", reject);
|
extractStream.on("close", resolve).on("error", reject);
|
||||||
});
|
});
|
||||||
});
|
};
|
||||||
|
|
||||||
gulp.task(
|
export const setupAndFetchNightlyTranslations = series(
|
||||||
"setup-and-fetch-nightly-translations",
|
allowSetupFetchNightlyTranslations,
|
||||||
gulp.series(
|
fetchNightlyTranslations
|
||||||
"allow-setup-fetch-nightly-translations",
|
|
||||||
"fetch-nightly-translations"
|
|
||||||
)
|
|
||||||
);
|
);
|
@@ -1,19 +1,23 @@
|
|||||||
import fs from "fs";
|
|
||||||
import { glob } from "glob";
|
import { glob } from "glob";
|
||||||
import gulp from "gulp";
|
import { parallel, series, watch } from "gulp";
|
||||||
import yaml from "js-yaml";
|
import yaml from "js-yaml";
|
||||||
import { marked } from "marked";
|
import { marked } from "marked";
|
||||||
import path from "path";
|
import fs from "node:fs";
|
||||||
import paths from "../paths.cjs";
|
import path from "node:path";
|
||||||
import "./clean.js";
|
import paths from "../paths.ts";
|
||||||
import "./entry-html.js";
|
import { cleanGallery } from "./clean.ts";
|
||||||
import "./gather-static.js";
|
import { genPagesGalleryDev, genPagesGalleryProd } from "./entry-html.ts";
|
||||||
import "./gen-icons-json.js";
|
import { copyStaticGallery } from "./gather-static.ts";
|
||||||
import "./service-worker.js";
|
import { genIconsJson } from "./gen-icons-json.ts";
|
||||||
import "./translations.js";
|
import { buildLocaleData } from "./locale-data.ts";
|
||||||
import "./rspack.js";
|
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 pageDir = path.resolve(paths.gallery_dir, "src/pages");
|
||||||
const files = await glob(path.resolve(pageDir, "**/*"));
|
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";
|
let content = "export const PAGES = {\n";
|
||||||
|
|
||||||
const processed = new Set();
|
const processed = new Set<string>();
|
||||||
|
|
||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
if (fs.lstatSync(file).isDirectory()) {
|
if (fs.lstatSync(file).isDirectory()) {
|
||||||
@@ -47,7 +51,9 @@ gulp.task("gather-gallery-pages", async function gatherPages() {
|
|||||||
|
|
||||||
if (descriptionContent.startsWith("---")) {
|
if (descriptionContent.startsWith("---")) {
|
||||||
const metadataEnd = descriptionContent.indexOf("---", 3);
|
const metadataEnd = descriptionContent.indexOf("---", 3);
|
||||||
metadata = yaml.load(descriptionContent.substring(3, metadataEnd));
|
metadata = yaml.load(
|
||||||
|
descriptionContent.substring(3, metadataEnd)
|
||||||
|
) as any;
|
||||||
descriptionContent = descriptionContent
|
descriptionContent = descriptionContent
|
||||||
.substring(metadataEnd + 3)
|
.substring(metadataEnd + 3)
|
||||||
.trim();
|
.trim();
|
||||||
@@ -57,7 +63,9 @@ gulp.task("gather-gallery-pages", async function gatherPages() {
|
|||||||
if (descriptionContent === "") {
|
if (descriptionContent === "") {
|
||||||
hasDescription = false;
|
hasDescription = false;
|
||||||
} else {
|
} 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.mkdirSync(path.resolve(galleryBuild, category), { recursive: true });
|
||||||
fs.writeFileSync(
|
fs.writeFileSync(
|
||||||
path.resolve(galleryBuild, `${pageId}-description.ts`),
|
path.resolve(galleryBuild, `${pageId}-description.ts`),
|
||||||
@@ -95,7 +103,10 @@ gulp.task("gather-gallery-pages", async function gatherPages() {
|
|||||||
pagesToProcess[category].add(page);
|
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];
|
const toProcess = pagesToProcess[group.category];
|
||||||
delete pagesToProcess[group.category];
|
delete pagesToProcess[group.category];
|
||||||
|
|
||||||
@@ -118,7 +129,7 @@ gulp.task("gather-gallery-pages", async function gatherPages() {
|
|||||||
group.pages = [];
|
group.pages = [];
|
||||||
}
|
}
|
||||||
for (const page of Array.from(toProcess).sort()) {
|
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({
|
sidebar.push({
|
||||||
category,
|
category,
|
||||||
header: 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,
|
content,
|
||||||
"utf-8"
|
"utf-8"
|
||||||
);
|
);
|
||||||
});
|
};
|
||||||
|
|
||||||
gulp.task(
|
// develop-gallery
|
||||||
"develop-gallery",
|
export const developGallery = series(
|
||||||
gulp.series(
|
async function setEnv() {
|
||||||
async function setEnv() {
|
process.env.NODE_ENV = "development";
|
||||||
process.env.NODE_ENV = "development";
|
},
|
||||||
},
|
cleanGallery,
|
||||||
"clean-gallery",
|
translationsEnableMergeBackend,
|
||||||
"translations-enable-merge-backend",
|
parallel(
|
||||||
gulp.parallel(
|
genIconsJson,
|
||||||
"gen-icons-json",
|
buildTranslations,
|
||||||
"build-translations",
|
buildLocaleData,
|
||||||
"build-locale-data",
|
gatherGalleryPages
|
||||||
"gather-gallery-pages"
|
),
|
||||||
),
|
copyStaticGallery,
|
||||||
"copy-static-gallery",
|
genPagesGalleryDev,
|
||||||
"gen-pages-gallery-dev",
|
parallel(rspackDevServerGallery, async function watchMarkdownFiles() {
|
||||||
gulp.parallel(
|
watch(
|
||||||
"rspack-dev-server-gallery",
|
[
|
||||||
async function watchMarkdownFiles() {
|
path.resolve(paths.gallery_dir, "src/pages/**/*.markdown"),
|
||||||
gulp.watch(
|
path.resolve(paths.gallery_dir, "sidebar.js"),
|
||||||
[
|
],
|
||||||
path.resolve(paths.gallery_dir, "src/pages/**/*.markdown"),
|
series(gatherGalleryPages)
|
||||||
path.resolve(paths.gallery_dir, "sidebar.js"),
|
);
|
||||||
],
|
})
|
||||||
gulp.series("gather-gallery-pages")
|
|
||||||
);
|
|
||||||
}
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
gulp.task(
|
// build-gallery
|
||||||
"build-gallery",
|
export const buildGallery = series(
|
||||||
gulp.series(
|
async function setEnv() {
|
||||||
async function setEnv() {
|
process.env.NODE_ENV = "production";
|
||||||
process.env.NODE_ENV = "production";
|
},
|
||||||
},
|
cleanGallery,
|
||||||
"clean-gallery",
|
translationsEnableMergeBackend,
|
||||||
"translations-enable-merge-backend",
|
parallel(
|
||||||
gulp.parallel(
|
genIconsJson,
|
||||||
"gen-icons-json",
|
buildTranslations,
|
||||||
"build-translations",
|
buildLocaleData,
|
||||||
"build-locale-data",
|
gatherGalleryPages
|
||||||
"gather-gallery-pages"
|
),
|
||||||
),
|
copyStaticGallery,
|
||||||
"copy-static-gallery",
|
rspackProdGallery,
|
||||||
"rspack-prod-gallery",
|
genPagesGalleryProd
|
||||||
"gen-pages-gallery-prod"
|
|
||||||
)
|
|
||||||
);
|
);
|
@@ -1,13 +1,12 @@
|
|||||||
// Gulp task to gather all static files.
|
// Gulp task to gather all static files.
|
||||||
|
|
||||||
import fs from "fs-extra";
|
import fs from "fs-extra";
|
||||||
import gulp from "gulp";
|
import path from "node:path";
|
||||||
import path from "path";
|
import paths from "../paths.ts";
|
||||||
import paths from "../paths.cjs";
|
|
||||||
|
|
||||||
const npmPath = (...parts) =>
|
const npmPath = (...parts) =>
|
||||||
path.resolve(paths.polymer_dir, "node_modules", ...parts);
|
path.resolve(paths.root_dir, "node_modules", ...parts);
|
||||||
const polyPath = (...parts) => path.resolve(paths.polymer_dir, ...parts);
|
const polyPath = (...parts) => path.resolve(paths.root_dir, ...parts);
|
||||||
|
|
||||||
const copyFileDir = (fromFile, toDir) =>
|
const copyFileDir = (fromFile, toDir) =>
|
||||||
fs.copySync(fromFile, path.join(toDir, path.basename(fromFile)));
|
fs.copySync(fromFile, path.join(toDir, path.basename(fromFile)));
|
||||||
@@ -17,7 +16,7 @@ const genStaticPath =
|
|||||||
(...parts) =>
|
(...parts) =>
|
||||||
path.resolve(staticDir, ...parts);
|
path.resolve(staticDir, ...parts);
|
||||||
|
|
||||||
function copyTranslations(staticDir) {
|
const copyTranslations = (staticDir) => {
|
||||||
const staticPath = genStaticPath(staticDir);
|
const staticPath = genStaticPath(staticDir);
|
||||||
|
|
||||||
// Translation output
|
// Translation output
|
||||||
@@ -25,23 +24,23 @@ function copyTranslations(staticDir) {
|
|||||||
polyPath("build/translations/output"),
|
polyPath("build/translations/output"),
|
||||||
staticPath("translations")
|
staticPath("translations")
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
function copyLocaleData(staticDir) {
|
const copyLocaleData = (staticDir) => {
|
||||||
const staticPath = genStaticPath(staticDir);
|
const staticPath = genStaticPath(staticDir);
|
||||||
|
|
||||||
// Locale data output
|
// Locale data output
|
||||||
fs.copySync(polyPath("build/locale-data"), staticPath("locale-data"));
|
fs.copySync(polyPath("build/locale-data"), staticPath("locale-data"));
|
||||||
}
|
};
|
||||||
|
|
||||||
function copyMdiIcons(staticDir) {
|
const copyMdiIcons = (staticDir) => {
|
||||||
const staticPath = genStaticPath(staticDir);
|
const staticPath = genStaticPath(staticDir);
|
||||||
|
|
||||||
// MDI icons output
|
// MDI icons output
|
||||||
fs.copySync(polyPath("build/mdi"), staticPath("mdi"));
|
fs.copySync(polyPath("build/mdi"), staticPath("mdi"));
|
||||||
}
|
};
|
||||||
|
|
||||||
function copyPolyfills(staticDir) {
|
const copyPolyfills = (staticDir) => {
|
||||||
const staticPath = genStaticPath(staticDir);
|
const staticPath = genStaticPath(staticDir);
|
||||||
|
|
||||||
// For custom panels using ES5 builds that don't use Babel 7+
|
// 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"),
|
npmPath("dialog-polyfill/dialog-polyfill.css"),
|
||||||
staticPath("polyfills/")
|
staticPath("polyfills/")
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
function copyFonts(staticDir) {
|
const copyFonts = (staticDir) => {
|
||||||
const staticPath = genStaticPath(staticDir);
|
const staticPath = genStaticPath(staticDir);
|
||||||
// Local fonts
|
// Local fonts
|
||||||
fs.copySync(
|
fs.copySync(
|
||||||
@@ -82,14 +81,14 @@ function copyFonts(staticDir) {
|
|||||||
filter: (src) => !src.includes(".") || src.endsWith(".woff2"),
|
filter: (src) => !src.includes(".") || src.endsWith(".woff2"),
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
function copyQrScannerWorker(staticDir) {
|
const copyQrScannerWorker = (staticDir) => {
|
||||||
const staticPath = genStaticPath(staticDir);
|
const staticPath = genStaticPath(staticDir);
|
||||||
copyFileDir(npmPath("qr-scanner/qr-scanner-worker.min.js"), staticPath("js"));
|
copyFileDir(npmPath("qr-scanner/qr-scanner-worker.min.js"), staticPath("js"));
|
||||||
}
|
};
|
||||||
|
|
||||||
function copyMapPanel(staticDir) {
|
const copyMapPanel = (staticDir) => {
|
||||||
const staticPath = genStaticPath(staticDir);
|
const staticPath = genStaticPath(staticDir);
|
||||||
copyFileDir(
|
copyFileDir(
|
||||||
npmPath("leaflet/dist/leaflet.css"),
|
npmPath("leaflet/dist/leaflet.css"),
|
||||||
@@ -103,43 +102,38 @@ function copyMapPanel(staticDir) {
|
|||||||
npmPath("leaflet/dist/images"),
|
npmPath("leaflet/dist/images"),
|
||||||
staticPath("images/leaflet/images/")
|
staticPath("images/leaflet/images/")
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
function copyZXingWasm(staticDir) {
|
const copyZXingWasm = (staticDir) => {
|
||||||
const staticPath = genStaticPath(staticDir);
|
const staticPath = genStaticPath(staticDir);
|
||||||
copyFileDir(
|
copyFileDir(
|
||||||
npmPath("zxing-wasm/dist/reader/zxing_reader.wasm"),
|
npmPath("zxing-wasm/dist/reader/zxing_reader.wasm"),
|
||||||
staticPath("js")
|
staticPath("js")
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
gulp.task("copy-locale-data", async () => {
|
export const copyTranslationsApp = async () => {
|
||||||
const staticDir = paths.app_output_static;
|
|
||||||
copyLocaleData(staticDir);
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task("copy-translations-app", async () => {
|
|
||||||
const staticDir = paths.app_output_static;
|
const staticDir = paths.app_output_static;
|
||||||
copyTranslations(staticDir);
|
copyTranslations(staticDir);
|
||||||
});
|
};
|
||||||
|
|
||||||
gulp.task("copy-translations-supervisor", async () => {
|
export const copyTranslationsSupervisor = async () => {
|
||||||
const staticDir = paths.hassio_output_static;
|
const staticDir = paths.hassio_output_static;
|
||||||
copyTranslations(staticDir);
|
copyTranslations(staticDir);
|
||||||
});
|
};
|
||||||
|
|
||||||
gulp.task("copy-translations-landing-page", async () => {
|
export const copyTranslationsLandingPage = async () => {
|
||||||
const staticDir = paths.landingPage_output_static;
|
const staticDir = paths.landingPage_output_static;
|
||||||
copyTranslations(staticDir);
|
copyTranslations(staticDir);
|
||||||
});
|
};
|
||||||
|
|
||||||
gulp.task("copy-static-supervisor", async () => {
|
export const copyStaticSupervisor = async () => {
|
||||||
const staticDir = paths.hassio_output_static;
|
const staticDir = paths.hassio_output_static;
|
||||||
copyLocaleData(staticDir);
|
copyLocaleData(staticDir);
|
||||||
copyFonts(staticDir);
|
copyFonts(staticDir);
|
||||||
});
|
};
|
||||||
|
|
||||||
gulp.task("copy-static-app", async () => {
|
export const copyStaticApp = async () => {
|
||||||
const staticDir = paths.app_output_static;
|
const staticDir = paths.app_output_static;
|
||||||
// Basic static files
|
// Basic static files
|
||||||
fs.copySync(polyPath("public"), paths.app_output_root);
|
fs.copySync(polyPath("public"), paths.app_output_root);
|
||||||
@@ -155,9 +149,9 @@ gulp.task("copy-static-app", async () => {
|
|||||||
// Qr Scanner assets
|
// Qr Scanner assets
|
||||||
copyZXingWasm(staticDir);
|
copyZXingWasm(staticDir);
|
||||||
copyQrScannerWorker(staticDir);
|
copyQrScannerWorker(staticDir);
|
||||||
});
|
};
|
||||||
|
|
||||||
gulp.task("copy-static-demo", async () => {
|
export const copyStaticDemo = async () => {
|
||||||
// Copy app static files
|
// Copy app static files
|
||||||
fs.copySync(
|
fs.copySync(
|
||||||
polyPath("public/static"),
|
polyPath("public/static"),
|
||||||
@@ -171,9 +165,9 @@ gulp.task("copy-static-demo", async () => {
|
|||||||
copyTranslations(paths.demo_output_static);
|
copyTranslations(paths.demo_output_static);
|
||||||
copyLocaleData(paths.demo_output_static);
|
copyLocaleData(paths.demo_output_static);
|
||||||
copyMdiIcons(paths.demo_output_static);
|
copyMdiIcons(paths.demo_output_static);
|
||||||
});
|
};
|
||||||
|
|
||||||
gulp.task("copy-static-cast", async () => {
|
export const copyStaticCast = async () => {
|
||||||
// Copy app static files
|
// Copy app static files
|
||||||
fs.copySync(polyPath("public/static"), paths.cast_output_static);
|
fs.copySync(polyPath("public/static"), paths.cast_output_static);
|
||||||
// Copy cast static files
|
// Copy cast static files
|
||||||
@@ -184,9 +178,9 @@ gulp.task("copy-static-cast", async () => {
|
|||||||
copyTranslations(paths.cast_output_static);
|
copyTranslations(paths.cast_output_static);
|
||||||
copyLocaleData(paths.cast_output_static);
|
copyLocaleData(paths.cast_output_static);
|
||||||
copyMdiIcons(paths.cast_output_static);
|
copyMdiIcons(paths.cast_output_static);
|
||||||
});
|
};
|
||||||
|
|
||||||
gulp.task("copy-static-gallery", async () => {
|
export const copyStaticGallery = async () => {
|
||||||
// Copy app static files
|
// Copy app static files
|
||||||
fs.copySync(polyPath("public/static"), paths.gallery_output_static);
|
fs.copySync(polyPath("public/static"), paths.gallery_output_static);
|
||||||
// Copy gallery static files
|
// Copy gallery static files
|
||||||
@@ -200,9 +194,9 @@ gulp.task("copy-static-gallery", async () => {
|
|||||||
copyTranslations(paths.gallery_output_static);
|
copyTranslations(paths.gallery_output_static);
|
||||||
copyLocaleData(paths.gallery_output_static);
|
copyLocaleData(paths.gallery_output_static);
|
||||||
copyMdiIcons(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
|
// Copy landing-page static files
|
||||||
fs.copySync(
|
fs.copySync(
|
||||||
path.resolve(paths.landingPage_dir, "public"),
|
path.resolve(paths.landingPage_dir, "public"),
|
||||||
@@ -211,4 +205,4 @@ gulp.task("copy-static-landing-page", async () => {
|
|||||||
|
|
||||||
copyFonts(paths.landingPage_output_static);
|
copyFonts(paths.landingPage_output_static);
|
||||||
copyTranslations(paths.landingPage_output_static);
|
copyTranslations(paths.landingPage_output_static);
|
||||||
});
|
};
|
@@ -1,8 +1,7 @@
|
|||||||
import fs from "fs";
|
import fs from "node:fs";
|
||||||
import gulp from "gulp";
|
import path from "node:path";
|
||||||
import hash from "object-hash";
|
import hash from "object-hash";
|
||||||
import path from "path";
|
import paths from "../paths.ts";
|
||||||
import paths from "../paths.cjs";
|
|
||||||
|
|
||||||
const ICON_PACKAGE_PATH = path.resolve("node_modules/@mdi/svg/");
|
const ICON_PACKAGE_PATH = path.resolve("node_modules/@mdi/svg/");
|
||||||
const META_PATH = path.resolve(ICON_PACKAGE_PATH, "meta.json");
|
const META_PATH = path.resolve(ICON_PACKAGE_PATH, "meta.json");
|
||||||
@@ -21,7 +20,7 @@ const getMeta = () => {
|
|||||||
encoding,
|
encoding,
|
||||||
});
|
});
|
||||||
return {
|
return {
|
||||||
path: svg.match(/ d="([^"]+)"/)[1],
|
path: svg.match(/ d="([^"]+)"/)?.[1],
|
||||||
name: icon.name,
|
name: icon.name,
|
||||||
tags: icon.tags,
|
tags: icon.tags,
|
||||||
aliases: icon.aliases,
|
aliases: icon.aliases,
|
||||||
@@ -55,14 +54,14 @@ const orderMeta = (meta) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const splitBySize = (meta) => {
|
const splitBySize = (meta) => {
|
||||||
const chunks = [];
|
const chunks: any[] = [];
|
||||||
const CHUNK_SIZE = 50000;
|
const CHUNK_SIZE = 50000;
|
||||||
|
|
||||||
let curSize = 0;
|
let curSize = 0;
|
||||||
let startKey;
|
let startKey;
|
||||||
let icons = [];
|
let icons: any[] = [];
|
||||||
|
|
||||||
Object.values(meta).forEach((icon) => {
|
Object.values(meta).forEach((icon: any) => {
|
||||||
if (startKey === undefined) {
|
if (startKey === undefined) {
|
||||||
startKey = icon.name;
|
startKey = icon.name;
|
||||||
}
|
}
|
||||||
@@ -94,10 +93,10 @@ const findDifferentiator = (curString, prevString) => {
|
|||||||
return curString.substring(0, i + 1);
|
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 meta = getMeta();
|
||||||
|
|
||||||
const metaAndRemoved = addRemovedMeta(meta);
|
const metaAndRemoved = addRemovedMeta(meta);
|
||||||
@@ -106,7 +105,7 @@ gulp.task("gen-icons-json", (done) => {
|
|||||||
if (!fs.existsSync(OUTPUT_DIR)) {
|
if (!fs.existsSync(OUTPUT_DIR)) {
|
||||||
fs.mkdirSync(OUTPUT_DIR, { recursive: true });
|
fs.mkdirSync(OUTPUT_DIR, { recursive: true });
|
||||||
}
|
}
|
||||||
const parts = [];
|
const parts: any[] = [];
|
||||||
|
|
||||||
let lastEnd;
|
let lastEnd;
|
||||||
split.forEach((chunk) => {
|
split.forEach((chunk) => {
|
||||||
@@ -153,13 +152,13 @@ gulp.task("gen-icons-json", (done) => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
done();
|
done();
|
||||||
});
|
};
|
||||||
|
|
||||||
gulp.task("gen-dummy-icons-json", (done) => {
|
export const genDummyIconsJson = (done) => {
|
||||||
if (!fs.existsSync(OUTPUT_DIR)) {
|
if (!fs.existsSync(OUTPUT_DIR)) {
|
||||||
fs.mkdirSync(OUTPUT_DIR, { recursive: true });
|
fs.mkdirSync(OUTPUT_DIR, { recursive: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
fs.writeFileSync(path.resolve(OUTPUT_DIR, "iconList.json"), "[]");
|
fs.writeFileSync(path.resolve(OUTPUT_DIR, "iconList.json"), "[]");
|
||||||
done();
|
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,10 +1,10 @@
|
|||||||
import { deleteSync } from "del";
|
import { deleteSync } from "del";
|
||||||
import { mkdir, readFile, writeFile } from "fs/promises";
|
import { series } from "gulp";
|
||||||
import gulp from "gulp";
|
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
||||||
import { join, resolve } from "node:path";
|
import { join, resolve } from "node:path";
|
||||||
import paths from "../paths.cjs";
|
import paths from "../paths.ts";
|
||||||
|
|
||||||
const formatjsDir = join(paths.polymer_dir, "node_modules", "@formatjs");
|
const formatjsDir = join(paths.root_dir, "node_modules", "@formatjs");
|
||||||
const outDir = join(paths.build_dir, "locale-data");
|
const outDir = join(paths.build_dir, "locale-data");
|
||||||
|
|
||||||
const INTL_POLYFILLS = {
|
const INTL_POLYFILLS = {
|
||||||
@@ -31,7 +31,7 @@ const convertToJSON = async (
|
|||||||
join(formatjsDir, pkg, subDir, `${language}.js`),
|
join(formatjsDir, pkg, subDir, `${language}.js`),
|
||||||
"utf-8"
|
"utf-8"
|
||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e: any) {
|
||||||
// Ignore if language is missing (i.e. not supported by @formatjs)
|
// Ignore if language is missing (i.e. not supported by @formatjs)
|
||||||
if (e.code === "ENOENT" && skipMissing) {
|
if (e.code === "ENOENT" && skipMissing) {
|
||||||
console.warn(`Skipped missing data for language ${lang} from ${pkg}`);
|
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);
|
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(
|
const translationMeta = JSON.parse(
|
||||||
await readFile(
|
await readFile(
|
||||||
resolve(paths.translations_src, "translationMetadata.json"),
|
resolve(paths.translations_src, "translationMetadata.json"),
|
||||||
"utf-8"
|
"utf-8"
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
const conversions = [];
|
const conversions: any[] = [];
|
||||||
for (const pkg of Object.keys(INTL_POLYFILLS)) {
|
for (const pkg of Object.keys(INTL_POLYFILLS)) {
|
||||||
// eslint-disable-next-line no-await-in-loop
|
// eslint-disable-next-line no-await-in-loop
|
||||||
await mkdir(join(outDir, pkg), { recursive: true });
|
await mkdir(join(outDir, pkg), { recursive: true });
|
||||||
@@ -81,9 +81,6 @@ gulp.task("create-locale-data", async () => {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
await Promise.all(conversions);
|
await Promise.all(conversions);
|
||||||
});
|
};
|
||||||
|
|
||||||
gulp.task(
|
export const buildLocaleData = series(cleanLocaleData, createLocaleData);
|
||||||
"build-locale-data",
|
|
||||||
gulp.series("clean-locale-data", "create-locale-data")
|
|
||||||
);
|
|
@@ -1,13 +1,13 @@
|
|||||||
// Tasks to run rspack.
|
// 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 rspack from "@rspack/core";
|
||||||
import { RspackDevServer } from "@rspack/dev-server";
|
import { RspackDevServer } from "@rspack/dev-server";
|
||||||
import env from "../env.cjs";
|
import log from "fancy-log";
|
||||||
import paths from "../paths.cjs";
|
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 {
|
import {
|
||||||
createAppConfig,
|
createAppConfig,
|
||||||
createCastConfig,
|
createCastConfig,
|
||||||
@@ -15,7 +15,17 @@ import {
|
|||||||
createGalleryConfig,
|
createGalleryConfig,
|
||||||
createHassioConfig,
|
createHassioConfig,
|
||||||
createLandingPageConfig,
|
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) => [
|
const bothBuilds = (createConfigFunc, params) => [
|
||||||
createConfigFunc({ ...params, latestBuild: true }),
|
createConfigFunc({ ...params, latestBuild: true }),
|
||||||
@@ -29,6 +39,14 @@ const isWsl =
|
|||||||
.toLocaleLowerCase()
|
.toLocaleLowerCase()
|
||||||
.includes("microsoft");
|
.includes("microsoft");
|
||||||
|
|
||||||
|
interface RunDevServer {
|
||||||
|
compiler: any;
|
||||||
|
contentBase: string;
|
||||||
|
port: number;
|
||||||
|
listenHost?: string;
|
||||||
|
proxy?: any;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {{
|
* @param {{
|
||||||
* compiler: import("@rspack/core").Compiler,
|
* compiler: import("@rspack/core").Compiler,
|
||||||
@@ -41,12 +59,12 @@ const runDevServer = async ({
|
|||||||
compiler,
|
compiler,
|
||||||
contentBase,
|
contentBase,
|
||||||
port,
|
port,
|
||||||
listenHost = undefined,
|
listenHost,
|
||||||
proxy = undefined,
|
proxy,
|
||||||
}) => {
|
}: RunDevServer) => {
|
||||||
if (listenHost === undefined) {
|
if (listenHost === undefined) {
|
||||||
// For dev container, we need to listen on all hosts
|
// 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(
|
const server = new RspackDevServer(
|
||||||
{
|
{
|
||||||
@@ -68,7 +86,7 @@ const runDevServer = async ({
|
|||||||
log("[rspack-dev-server]", `Project is running at http://localhost:${port}`);
|
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) {
|
if (err) {
|
||||||
log.error(err.stack || err);
|
log.error(err.stack || err);
|
||||||
if (err.details) {
|
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
|
// This command will run forever because we don't close compiler
|
||||||
rspack(
|
rspack(
|
||||||
process.env.ES5
|
process.env.ES5
|
||||||
? bothBuilds(createAppConfig, { isProdBuild: false })
|
? bothBuilds(createAppConfig, { isProdBuild: false })
|
||||||
: createAppConfig({ isProdBuild: false, latestBuild: true })
|
: createAppConfig({ isProdBuild: false, latestBuild: true })
|
||||||
).watch({ poll: isWsl }, doneHandler());
|
).watch({ poll: isWsl }, doneHandler());
|
||||||
gulp.watch(
|
watch(
|
||||||
path.join(paths.translations_src, "en.json"),
|
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(
|
prodBuild(
|
||||||
bothBuilds(createAppConfig, {
|
bothBuilds(createAppConfig, {
|
||||||
isProdBuild: true,
|
isProdBuild: true,
|
||||||
isStatsBuild: env.isStatsBuild(),
|
isStatsBuild: isStatsBuild(),
|
||||||
isTestBuild: env.isTestBuild(),
|
isTestBuild: isTestBuild(),
|
||||||
})
|
})
|
||||||
)
|
);
|
||||||
);
|
|
||||||
|
|
||||||
gulp.task("rspack-dev-server-demo", () =>
|
export const rspackDevServerDemo = () =>
|
||||||
runDevServer({
|
runDevServer({
|
||||||
compiler: rspack(
|
compiler: rspack(
|
||||||
createDemoConfig({ isProdBuild: false, latestBuild: true })
|
createDemoConfig({ isProdBuild: false, latestBuild: true })
|
||||||
),
|
),
|
||||||
contentBase: paths.demo_output_root,
|
contentBase: paths.demo_output_root,
|
||||||
port: 8090,
|
port: 8090,
|
||||||
})
|
});
|
||||||
);
|
|
||||||
|
|
||||||
gulp.task("rspack-prod-demo", () =>
|
export const rspackProdDemo = () =>
|
||||||
prodBuild(
|
prodBuild(
|
||||||
bothBuilds(createDemoConfig, {
|
bothBuilds(createDemoConfig, {
|
||||||
isProdBuild: true,
|
isProdBuild: true,
|
||||||
isStatsBuild: env.isStatsBuild(),
|
isStatsBuild: isStatsBuild(),
|
||||||
})
|
})
|
||||||
)
|
);
|
||||||
);
|
|
||||||
|
|
||||||
gulp.task("rspack-dev-server-cast", () =>
|
export const rspackDevServerCast = () =>
|
||||||
runDevServer({
|
runDevServer({
|
||||||
compiler: rspack(
|
compiler: rspack(
|
||||||
createCastConfig({ isProdBuild: false, latestBuild: true })
|
createCastConfig({ isProdBuild: false, latestBuild: true })
|
||||||
@@ -148,18 +163,16 @@ gulp.task("rspack-dev-server-cast", () =>
|
|||||||
port: 8080,
|
port: 8080,
|
||||||
// Accessible from the network, because that's how Cast hits it.
|
// Accessible from the network, because that's how Cast hits it.
|
||||||
listenHost: "0.0.0.0",
|
listenHost: "0.0.0.0",
|
||||||
})
|
});
|
||||||
);
|
|
||||||
|
|
||||||
gulp.task("rspack-prod-cast", () =>
|
export const rspackProdCast = () =>
|
||||||
prodBuild(
|
prodBuild(
|
||||||
bothBuilds(createCastConfig, {
|
bothBuilds(createCastConfig, {
|
||||||
isProdBuild: true,
|
isProdBuild: true,
|
||||||
})
|
})
|
||||||
)
|
);
|
||||||
);
|
|
||||||
|
|
||||||
gulp.task("rspack-watch-hassio", () => {
|
export const rspackWatchHassio = () => {
|
||||||
// This command will run forever because we don't close compiler
|
// This command will run forever because we don't close compiler
|
||||||
rspack(
|
rspack(
|
||||||
createHassioConfig({
|
createHassioConfig({
|
||||||
@@ -168,23 +181,22 @@ gulp.task("rspack-watch-hassio", () => {
|
|||||||
})
|
})
|
||||||
).watch({ ignored: /build/, poll: isWsl }, doneHandler());
|
).watch({ ignored: /build/, poll: isWsl }, doneHandler());
|
||||||
|
|
||||||
gulp.watch(
|
watch(
|
||||||
path.join(paths.translations_src, "en.json"),
|
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(
|
prodBuild(
|
||||||
bothBuilds(createHassioConfig, {
|
bothBuilds(createHassioConfig, {
|
||||||
isProdBuild: true,
|
isProdBuild: true,
|
||||||
isStatsBuild: env.isStatsBuild(),
|
isStatsBuild: isStatsBuild(),
|
||||||
isTestBuild: env.isTestBuild(),
|
isTestBuild: isTestBuild(),
|
||||||
})
|
})
|
||||||
)
|
);
|
||||||
);
|
|
||||||
|
|
||||||
gulp.task("rspack-dev-server-gallery", () =>
|
export const rspackDevServerGallery = () =>
|
||||||
runDevServer({
|
runDevServer({
|
||||||
compiler: rspack(
|
compiler: rspack(
|
||||||
createGalleryConfig({ isProdBuild: false, latestBuild: true })
|
createGalleryConfig({ isProdBuild: false, latestBuild: true })
|
||||||
@@ -192,19 +204,17 @@ gulp.task("rspack-dev-server-gallery", () =>
|
|||||||
contentBase: paths.gallery_output_root,
|
contentBase: paths.gallery_output_root,
|
||||||
port: 8100,
|
port: 8100,
|
||||||
listenHost: "0.0.0.0",
|
listenHost: "0.0.0.0",
|
||||||
})
|
});
|
||||||
);
|
|
||||||
|
|
||||||
gulp.task("rspack-prod-gallery", () =>
|
export const rspackProdGallery = () =>
|
||||||
prodBuild(
|
prodBuild(
|
||||||
createGalleryConfig({
|
createGalleryConfig({
|
||||||
isProdBuild: true,
|
isProdBuild: true,
|
||||||
latestBuild: true,
|
latestBuild: true,
|
||||||
})
|
})
|
||||||
)
|
);
|
||||||
);
|
|
||||||
|
|
||||||
gulp.task("rspack-watch-landing-page", () => {
|
export const rspackWatchLandingPage = () => {
|
||||||
// This command will run forever because we don't close compiler
|
// This command will run forever because we don't close compiler
|
||||||
rspack(
|
rspack(
|
||||||
process.env.ES5
|
process.env.ES5
|
||||||
@@ -212,21 +222,17 @@ gulp.task("rspack-watch-landing-page", () => {
|
|||||||
: createLandingPageConfig({ isProdBuild: false, latestBuild: true })
|
: createLandingPageConfig({ isProdBuild: false, latestBuild: true })
|
||||||
).watch({ poll: isWsl }, doneHandler());
|
).watch({ poll: isWsl }, doneHandler());
|
||||||
|
|
||||||
gulp.watch(
|
watch(
|
||||||
path.join(paths.translations_src, "en.json"),
|
path.join(paths.translations_src, "en.json"),
|
||||||
gulp.series(
|
series(buildLandingPageTranslations, copyTranslationsLandingPage)
|
||||||
"build-landing-page-translations",
|
|
||||||
"copy-translations-landing-page"
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
});
|
};
|
||||||
|
|
||||||
gulp.task("rspack-prod-landing-page", () =>
|
export const rspackProdLandingPage = () =>
|
||||||
prodBuild(
|
prodBuild(
|
||||||
bothBuilds(createLandingPageConfig, {
|
bothBuilds(createLandingPageConfig, {
|
||||||
isProdBuild: true,
|
isProdBuild: true,
|
||||||
isStatsBuild: env.isStatsBuild(),
|
isStatsBuild: isStatsBuild(),
|
||||||
isTestBuild: env.isTestBuild(),
|
isTestBuild: isTestBuild(),
|
||||||
})
|
})
|
||||||
)
|
);
|
||||||
);
|
|
@@ -1,11 +1,10 @@
|
|||||||
// Generate service workers
|
// Generate service workers
|
||||||
|
|
||||||
import { deleteAsync } from "del";
|
import { deleteAsync } from "del";
|
||||||
import gulp from "gulp";
|
|
||||||
import { mkdir, readFile, symlink, writeFile } from "node:fs/promises";
|
import { mkdir, readFile, symlink, writeFile } from "node:fs/promises";
|
||||||
import { basename, join, relative } from "node:path";
|
import { basename, join, relative } from "node:path";
|
||||||
import { injectManifest } from "workbox-build";
|
import { injectManifest } from "workbox-build";
|
||||||
import paths from "../paths.cjs";
|
import paths from "../paths.ts";
|
||||||
|
|
||||||
const SW_MAP = {
|
const SW_MAP = {
|
||||||
[paths.app_output_latest]: "modern",
|
[paths.app_output_latest]: "modern",
|
||||||
@@ -23,7 +22,7 @@ self.addEventListener('install', (event) => {
|
|||||||
});
|
});
|
||||||
`.trim() + "\n";
|
`.trim() + "\n";
|
||||||
|
|
||||||
gulp.task("gen-service-worker-app-dev", async () => {
|
export const genServiceWorkerAppDev = async () => {
|
||||||
await mkdir(paths.app_output_root, { recursive: true });
|
await mkdir(paths.app_output_root, { recursive: true });
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
Object.values(SW_MAP).map((build) =>
|
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(
|
Promise.all(
|
||||||
Object.entries(SW_MAP).map(async ([outPath, build]) => {
|
Object.entries(SW_MAP).map(async ([outPath, build]) => {
|
||||||
const manifest = JSON.parse(
|
const manifest = JSON.parse(
|
||||||
@@ -83,5 +82,4 @@ gulp.task("gen-service-worker-app-prod", () =>
|
|||||||
await symlink(basename(swDest), swOld);
|
await symlink(basename(swDest), swOld);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
)
|
);
|
||||||
);
|
|
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import { deleteAsync } from "del";
|
import { deleteAsync } from "del";
|
||||||
import { glob } from "glob";
|
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 rename from "gulp-rename";
|
||||||
import merge from "lodash.merge";
|
import merge from "lodash.merge";
|
||||||
import { createHash } from "node:crypto";
|
import { createHash } from "node:crypto";
|
||||||
@@ -10,9 +10,12 @@ import { mkdir, readFile } from "node:fs/promises";
|
|||||||
import { basename, join } from "node:path";
|
import { basename, join } from "node:path";
|
||||||
import { PassThrough, Transform } from "node:stream";
|
import { PassThrough, Transform } from "node:stream";
|
||||||
import { finished } from "node:stream/promises";
|
import { finished } from "node:stream/promises";
|
||||||
import env from "../env.cjs";
|
import { isProdBuild } from "../env.ts";
|
||||||
import paths from "../paths.cjs";
|
import paths from "../paths.ts";
|
||||||
import "./fetch-nightly-translations.js";
|
import {
|
||||||
|
allowSetupFetchNightlyTranslations,
|
||||||
|
fetchNightlyTranslations,
|
||||||
|
} from "./fetch-nightly-translations.ts";
|
||||||
|
|
||||||
const inFrontendDir = "translations/frontend";
|
const inFrontendDir = "translations/frontend";
|
||||||
const inBackendDir = "translations/backend";
|
const inBackendDir = "translations/backend";
|
||||||
@@ -23,18 +26,20 @@ const TEST_LOCALE = "en-x-test";
|
|||||||
|
|
||||||
let mergeBackend = false;
|
let mergeBackend = false;
|
||||||
|
|
||||||
gulp.task(
|
// translations-enable-merge-backend
|
||||||
"translations-enable-merge-backend",
|
export const translationsEnableMergeBackend = parallel(async () => {
|
||||||
gulp.parallel(async () => {
|
mergeBackend = true;
|
||||||
mergeBackend = true;
|
}, allowSetupFetchNightlyTranslations);
|
||||||
}, "allow-setup-fetch-nightly-translations")
|
|
||||||
);
|
|
||||||
|
|
||||||
// Transform stream to apply a function on Vinyl JSON files (buffer mode only).
|
// 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
|
// The provided function can either return a new object, or an array of
|
||||||
// [object, subdirectory] pairs for fragmentizing the JSON.
|
// [object, subdirectory] pairs for fragmentizing the JSON.
|
||||||
class CustomJSON extends Transform {
|
class CustomJSON extends Transform {
|
||||||
constructor(func, reviver = null) {
|
_func: any;
|
||||||
|
|
||||||
|
_reviver: any;
|
||||||
|
|
||||||
|
constructor(func, reviver: any = null) {
|
||||||
super({ objectMode: true });
|
super({ objectMode: true });
|
||||||
this._func = func;
|
this._func = func;
|
||||||
this._reviver = reviver;
|
this._reviver = reviver;
|
||||||
@@ -56,9 +61,17 @@ class CustomJSON extends Transform {
|
|||||||
|
|
||||||
// Transform stream to merge Vinyl JSON files (buffer mode only).
|
// Transform stream to merge Vinyl JSON files (buffer mode only).
|
||||||
class MergeJSON extends Transform {
|
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 });
|
super({ objectMode: true, allowHalfOpen: false });
|
||||||
this._stem = stem;
|
this._stem = stem;
|
||||||
this._startObj = structuredClone(startObj);
|
this._startObj = structuredClone(startObj);
|
||||||
@@ -111,11 +124,12 @@ const testReviver = (_key, value) =>
|
|||||||
const KEY_REFERENCE = /\[%key:([^%]+)%\]/;
|
const KEY_REFERENCE = /\[%key:([^%]+)%\]/;
|
||||||
const lokaliseTransform = (data, path, original = data) => {
|
const lokaliseTransform = (data, path, original = data) => {
|
||||||
const output = {};
|
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") {
|
if (typeof value === "object") {
|
||||||
output[key] = lokaliseTransform(value, path, original);
|
output[key] = lokaliseTransform(value, path, original);
|
||||||
} else {
|
} 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) => {
|
const replace = lokalise_key.split("::").reduce((tr, k) => {
|
||||||
if (!tr) {
|
if (!tr) {
|
||||||
throw Error(`Invalid key placeholder ${lokalise_key} in ${path}`);
|
throw Error(`Invalid key placeholder ${lokalise_key} in ${path}`);
|
||||||
@@ -132,18 +146,17 @@ const lokaliseTransform = (data, path, original = data) => {
|
|||||||
return output;
|
return output;
|
||||||
};
|
};
|
||||||
|
|
||||||
gulp.task("clean-translations", () => deleteAsync([workDir]));
|
export const cleanTranslations = () => deleteAsync([workDir]);
|
||||||
|
|
||||||
const makeWorkDir = () => mkdir(workDir, { recursive: true });
|
const makeWorkDir = () => mkdir(workDir, { recursive: true });
|
||||||
|
|
||||||
const createTestTranslation = () =>
|
const createTestTranslation = () =>
|
||||||
env.isProdBuild()
|
isProdBuild()
|
||||||
? Promise.resolve()
|
? Promise.resolve()
|
||||||
: gulp
|
: glupSrc(EN_SRC)
|
||||||
.src(EN_SRC)
|
|
||||||
.pipe(new CustomJSON(null, testReviver))
|
.pipe(new CustomJSON(null, testReviver))
|
||||||
.pipe(rename(`${TEST_LOCALE}.json`))
|
.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
|
* 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.
|
* the Lokalise update to translations/en.json will not happen immediately.
|
||||||
*/
|
*/
|
||||||
const createMasterTranslation = () =>
|
const createMasterTranslation = () =>
|
||||||
gulp
|
glupSrc([EN_SRC, ...(mergeBackend ? [`${inBackendDir}/en.json`] : [])])
|
||||||
.src([EN_SRC, ...(mergeBackend ? [`${inBackendDir}/en.json`] : [])])
|
|
||||||
.pipe(new CustomJSON(lokaliseTransform))
|
.pipe(new CustomJSON(lokaliseTransform))
|
||||||
.pipe(new MergeJSON("en"))
|
.pipe(new MergeJSON("en"))
|
||||||
.pipe(gulp.dest(workDir));
|
.pipe(gulpDest(workDir));
|
||||||
|
|
||||||
const FRAGMENTS = ["base"];
|
const FRAGMENTS = ["base"];
|
||||||
|
|
||||||
@@ -186,12 +198,12 @@ const createTranslations = async () => {
|
|||||||
// each locale, then fragmentizes and flattens the data for final output.
|
// each locale, then fragmentizes and flattens the data for final output.
|
||||||
const translationFiles = await glob([
|
const translationFiles = await glob([
|
||||||
`${inFrontendDir}/!(en).json`,
|
`${inFrontendDir}/!(en).json`,
|
||||||
...(env.isProdBuild() ? [] : [`${workDir}/${TEST_LOCALE}.json`]),
|
...(isProdBuild() ? [] : [`${workDir}/${TEST_LOCALE}.json`]),
|
||||||
]);
|
]);
|
||||||
const hashStream = new Transform({
|
const hashStream = new Transform({
|
||||||
objectMode: true,
|
objectMode: true,
|
||||||
transform: async (file, _, callback) => {
|
transform: async (file, _, callback) => {
|
||||||
const hash = env.isProdBuild()
|
const hash = isProdBuild()
|
||||||
? createHash("md5").update(file.contents).digest("hex")
|
? createHash("md5").update(file.contents).digest("hex")
|
||||||
: "dev";
|
: "dev";
|
||||||
HASHES.set(file.stem, hash);
|
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
|
// Send the English master downstream first, then for each other locale
|
||||||
// generate merged JSON data to continue piping. It begins with the master
|
// 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.
|
// 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
|
// Will be OK for now as long as we don't have anything more complicated
|
||||||
// than a base translation + region.
|
// than a base translation + region.
|
||||||
const masterStream = gulp
|
const masterStream = glupSrc(`${workDir}/en.json`).pipe(
|
||||||
.src(`${workDir}/en.json`)
|
new PassThrough({ objectMode: true })
|
||||||
.pipe(new PassThrough({ objectMode: true }));
|
);
|
||||||
masterStream.pipe(hashStream, { end: false });
|
masterStream.pipe(hashStream, { end: false });
|
||||||
const mergesFinished = [finished(masterStream)];
|
const mergesFinished = [finished(masterStream)];
|
||||||
for (const translationFile of translationFiles) {
|
for (const translationFile of translationFiles) {
|
||||||
const locale = basename(translationFile, ".json");
|
const locale = basename(translationFile, ".json");
|
||||||
const subtags = locale.split("-");
|
const subtags = locale.split("-");
|
||||||
const mergeFiles = [];
|
const mergeFiles: string[] = [];
|
||||||
for (let i = 1; i <= subtags.length; i++) {
|
for (let i = 1; i <= subtags.length; i++) {
|
||||||
const lang = subtags.slice(0, i).join("-");
|
const lang = subtags.slice(0, i).join("-");
|
||||||
if (lang === TEST_LOCALE) {
|
if (lang === TEST_LOCALE) {
|
||||||
@@ -260,9 +272,9 @@ const createTranslations = async () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const mergeStream = gulp
|
const mergeStream = glupSrc(mergeFiles, { allowEmpty: true }).pipe(
|
||||||
.src(mergeFiles, { allowEmpty: true })
|
new MergeJSON(locale, enMaster, emptyReviver)
|
||||||
.pipe(new MergeJSON(locale, enMaster, emptyReviver));
|
);
|
||||||
mergesFinished.push(finished(mergeStream));
|
mergesFinished.push(finished(mergeStream));
|
||||||
mergeStream.pipe(hashStream, { end: false });
|
mergeStream.pipe(hashStream, { end: false });
|
||||||
}
|
}
|
||||||
@@ -275,12 +287,11 @@ const createTranslations = async () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const writeTranslationMetaData = () =>
|
const writeTranslationMetaData = () =>
|
||||||
gulp
|
glupSrc([`${paths.translations_src}/translationMetadata.json`])
|
||||||
.src([`${paths.translations_src}/translationMetadata.json`])
|
|
||||||
.pipe(
|
.pipe(
|
||||||
new CustomJSON((meta) => {
|
new CustomJSON((meta) => {
|
||||||
// Add the test translation in development.
|
// Add the test translation in development.
|
||||||
if (!env.isProdBuild()) {
|
if (!isProdBuild()) {
|
||||||
meta[TEST_LOCALE] = { nativeName: "Translation Test" };
|
meta[TEST_LOCALE] = { nativeName: "Translation Test" };
|
||||||
}
|
}
|
||||||
// Filter out locales without a native name, and add the hashes.
|
// 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(
|
export const buildTranslations = series(
|
||||||
"build-translations",
|
parallel(fetchNightlyTranslations, series(cleanTranslations, makeWorkDir)),
|
||||||
gulp.series(
|
createTestTranslation,
|
||||||
gulp.parallel(
|
createMasterTranslation,
|
||||||
"fetch-nightly-translations",
|
createTranslations,
|
||||||
gulp.series("clean-translations", makeWorkDir)
|
writeTranslationMetaData
|
||||||
),
|
|
||||||
createTestTranslation,
|
|
||||||
createMasterTranslation,
|
|
||||||
createTranslations,
|
|
||||||
writeTranslationMetaData
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
gulp.task(
|
export const buildSupervisorTranslations = series(
|
||||||
"build-supervisor-translations",
|
setFragment("supervisor"),
|
||||||
gulp.series(setFragment("supervisor"), "build-translations")
|
buildTranslations
|
||||||
);
|
);
|
||||||
|
|
||||||
gulp.task(
|
export const buildLandingPageTranslations = series(
|
||||||
"build-landing-page-translations",
|
setFragment("landing-page"),
|
||||||
gulp.series(setFragment("landing-page"), "build-translations")
|
buildTranslations
|
||||||
);
|
);
|
@@ -5,10 +5,11 @@ import { version as babelVersion } from "@babel/core";
|
|||||||
import presetEnv from "@babel/preset-env";
|
import presetEnv from "@babel/preset-env";
|
||||||
import compilationTargets from "@babel/helper-compilation-targets";
|
import compilationTargets from "@babel/helper-compilation-targets";
|
||||||
import coreJSCompat from "core-js-compat";
|
import coreJSCompat from "core-js-compat";
|
||||||
|
|
||||||
import { logPlugin } from "@babel/preset-env/lib/debug.js";
|
import { logPlugin } from "@babel/preset-env/lib/debug.js";
|
||||||
// eslint-disable-next-line import/no-relative-packages
|
// eslint-disable-next-line import/no-relative-packages
|
||||||
import shippedPolyfills from "../node_modules/babel-plugin-polyfill-corejs3/lib/shipped-proposals.js";
|
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) =>
|
const detailsOpen = (heading) =>
|
||||||
`<details>\n<summary><h4>${heading}</h4></summary>\n`;
|
`<details>\n<summary><h4>${heading}</h4></summary>\n`;
|
||||||
@@ -16,6 +17,7 @@ const detailsClose = "</details>\n";
|
|||||||
|
|
||||||
const dummyAPI = {
|
const dummyAPI = {
|
||||||
version: babelVersion,
|
version: babelVersion,
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||||
assertVersion: () => {},
|
assertVersion: () => {},
|
||||||
caller: (callback) =>
|
caller: (callback) =>
|
||||||
callback({
|
callback({
|
||||||
@@ -49,6 +51,12 @@ for (const buildType of ["Modern", "Legacy"]) {
|
|||||||
const babelOpts = babelOptions({ latestBuild: browserslistEnv === "modern" });
|
const babelOpts = babelOptions({ latestBuild: browserslistEnv === "modern" });
|
||||||
const presetEnvOpts = babelOpts.presets[0][1];
|
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
|
// Invoking preset-env in debug mode will log the included plugins
|
||||||
console.log(detailsOpen(`${buildType} Build Babel Plugins`));
|
console.log(detailsOpen(`${buildType} Build Babel Plugins`));
|
||||||
presetEnv.default(dummyAPI, {
|
presetEnv.default(dummyAPI, {
|
@@ -1,63 +0,0 @@
|
|||||||
const path = require("path");
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
polymer_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");
|
import filterStats from "@bundle-stats/plugin-webpack-filter";
|
||||||
const path = require("path");
|
import { RsdoctorRspackPlugin } from "@rsdoctor/rspack-plugin";
|
||||||
const rspack = require("@rspack/core");
|
import { DefinePlugin, NormalModuleReplacementPlugin } from "@rspack/core";
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
import { defineConfig } from "@rspack/cli";
|
||||||
const { RsdoctorRspackPlugin } = require("@rsdoctor/rspack-plugin");
|
import log from "fancy-log";
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
import { existsSync } from "node:fs";
|
||||||
const { StatsWriterPlugin } = require("webpack-stats-plugin");
|
import path from "node:path";
|
||||||
const filterStats = require("@bundle-stats/plugin-webpack-filter");
|
import { WebpackManifestPlugin } from "rspack-manifest-plugin";
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
import TerserPlugin from "terser-webpack-plugin";
|
||||||
const TerserPlugin = require("terser-webpack-plugin");
|
import { StatsWriterPlugin } from "webpack-stats-plugin";
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
// @ts-ignore
|
||||||
const { WebpackManifestPlugin } = require("rspack-manifest-plugin");
|
import WebpackBar from "webpackbar/rspack";
|
||||||
const log = require("fancy-log");
|
import {
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
babelOptions,
|
||||||
const WebpackBar = require("webpackbar/rspack");
|
config,
|
||||||
const paths = require("./paths.cjs");
|
definedVars,
|
||||||
const bundle = require("./bundle.cjs");
|
emptyPackages,
|
||||||
|
sourceMapURL,
|
||||||
|
swcOptions,
|
||||||
|
terserOptions,
|
||||||
|
} from "./bundle.ts";
|
||||||
|
import paths from "./paths.ts";
|
||||||
|
|
||||||
class LogStartCompilePlugin {
|
class LogStartCompilePlugin {
|
||||||
ignoredFirst = false;
|
ignoredFirst = false;
|
||||||
@@ -30,7 +35,7 @@ class LogStartCompilePlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const createRspackConfig = ({
|
export const createRspackConfig = ({
|
||||||
name,
|
name,
|
||||||
entry,
|
entry,
|
||||||
outputPath,
|
outputPath,
|
||||||
@@ -42,12 +47,23 @@ const createRspackConfig = ({
|
|||||||
isTestBuild,
|
isTestBuild,
|
||||||
isHassioBuild,
|
isHassioBuild,
|
||||||
dontHash,
|
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) {
|
if (!dontHash) {
|
||||||
dontHash = new Set();
|
dontHash = new Set();
|
||||||
}
|
}
|
||||||
const ignorePackages = bundle.ignorePackages({ latestBuild });
|
return defineConfig({
|
||||||
return {
|
|
||||||
name,
|
name,
|
||||||
mode: isProdBuild ? "production" : "development",
|
mode: isProdBuild ? "production" : "development",
|
||||||
target: `browserslist:${latestBuild ? "modern" : "legacy"}`,
|
target: `browserslist:${latestBuild ? "modern" : "legacy"}`,
|
||||||
@@ -65,19 +81,26 @@ const createRspackConfig = ({
|
|||||||
rules: [
|
rules: [
|
||||||
{
|
{
|
||||||
test: /\.m?js$|\.ts$/,
|
test: /\.m?js$|\.ts$/,
|
||||||
use: (info) => ({
|
exclude: /node_modules[\\/]core-js/,
|
||||||
loader: "babel-loader",
|
use: (info) => [
|
||||||
options: {
|
{
|
||||||
...bundle.babelOptions({
|
loader: "babel-loader",
|
||||||
latestBuild,
|
options: {
|
||||||
isProdBuild,
|
...babelOptions({
|
||||||
isTestBuild,
|
latestBuild,
|
||||||
sw: info.issuerLayer === "sw",
|
isProdBuild,
|
||||||
}),
|
isTestBuild,
|
||||||
cacheDirectory: !isProdBuild,
|
sw: info.issuerLayer === "sw",
|
||||||
cacheCompression: false,
|
}),
|
||||||
|
cacheDirectory: !isProdBuild,
|
||||||
|
cacheCompression: false,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}),
|
{
|
||||||
|
loader: "builtin:swc-loader",
|
||||||
|
options: swcOptions(),
|
||||||
|
},
|
||||||
|
],
|
||||||
resolve: {
|
resolve: {
|
||||||
fullySpecified: false,
|
fullySpecified: false,
|
||||||
},
|
},
|
||||||
@@ -96,7 +119,7 @@ const createRspackConfig = ({
|
|||||||
new TerserPlugin({
|
new TerserPlugin({
|
||||||
parallel: true,
|
parallel: true,
|
||||||
extractComments: true,
|
extractComments: true,
|
||||||
terserOptions: bundle.terserOptions({ latestBuild, isTestBuild }),
|
terserOptions: terserOptions({ latestBuild, isTestBuild }),
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
moduleIds: isProdBuild && !isStatsBuild ? "deterministic" : "named",
|
moduleIds: isProdBuild && !isStatsBuild ? "deterministic" : "named",
|
||||||
@@ -115,7 +138,7 @@ const createRspackConfig = ({
|
|||||||
!chunk.canBeInitial() &&
|
!chunk.canBeInitial() &&
|
||||||
!new RegExp(
|
!new RegExp(
|
||||||
`^.+-work${latestBuild ? "(?:let|er)" : "let"}$`
|
`^.+-work${latestBuild ? "(?:let|er)" : "let"}$`
|
||||||
).test(chunk.name),
|
).test(chunk?.name || ""),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
@@ -124,44 +147,12 @@ const createRspackConfig = ({
|
|||||||
// Only include the JS of entrypoints
|
// Only include the JS of entrypoints
|
||||||
filter: (file) => file.isInitial && !file.name.endsWith(".map"),
|
filter: (file) => file.isInitial && !file.name.endsWith(".map"),
|
||||||
}),
|
}),
|
||||||
new rspack.DefinePlugin(
|
new DefinePlugin(
|
||||||
bundle.definedVars({ isProdBuild, latestBuild, defineOverlay })
|
definedVars({ isProdBuild, latestBuild, defineOverlay })
|
||||||
),
|
),
|
||||||
new rspack.IgnorePlugin({
|
new NormalModuleReplacementPlugin(
|
||||||
checkResource(resource, context) {
|
new RegExp(emptyPackages({ isHassioBuild }).join("|")),
|
||||||
// Only use ignore to intercept imports that we don't control
|
path.resolve(paths.root_dir, "src/util/empty.js")
|
||||||
// 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"
|
|
||||||
) {
|
|
||||||
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("|")),
|
|
||||||
path.resolve(paths.polymer_dir, "src/util/empty.js")
|
|
||||||
),
|
),
|
||||||
!isProdBuild && new LogStartCompilePlugin(),
|
!isProdBuild && new LogStartCompilePlugin(),
|
||||||
isProdBuild &&
|
isProdBuild &&
|
||||||
@@ -176,7 +167,9 @@ const createRspackConfig = ({
|
|||||||
isProdBuild &&
|
isProdBuild &&
|
||||||
isStatsBuild &&
|
isStatsBuild &&
|
||||||
new RsdoctorRspackPlugin({
|
new RsdoctorRspackPlugin({
|
||||||
reportDir: path.join(paths.build_dir, "rsdoctor"),
|
output: {
|
||||||
|
reportDir: path.join(paths.build_dir, "rsdoctor"),
|
||||||
|
},
|
||||||
features: ["plugins", "bundle"],
|
features: ["plugins", "bundle"],
|
||||||
supports: {
|
supports: {
|
||||||
generateTileGraph: true,
|
generateTileGraph: true,
|
||||||
@@ -211,7 +204,9 @@ const createRspackConfig = ({
|
|||||||
output: {
|
output: {
|
||||||
module: latestBuild,
|
module: latestBuild,
|
||||||
filename: ({ chunk }) =>
|
filename: ({ chunk }) =>
|
||||||
!isProdBuild || isStatsBuild || dontHash.has(chunk.name)
|
!isProdBuild ||
|
||||||
|
isStatsBuild ||
|
||||||
|
(chunk?.name && dontHash.has(chunk.name))
|
||||||
? "[name].js"
|
? "[name].js"
|
||||||
: "[name].[contenthash].js",
|
: "[name].[contenthash].js",
|
||||||
chunkFilename:
|
chunkFilename:
|
||||||
@@ -242,7 +237,7 @@ const createRspackConfig = ({
|
|||||||
// dev tools, and they stay happy getting 404s with valid requests.
|
// dev tools, and they stay happy getting 404s with valid requests.
|
||||||
return `/unknown${path.resolve("/", info.resourcePath)}`;
|
return `/unknown${path.resolve("/", info.resourcePath)}`;
|
||||||
}
|
}
|
||||||
return new URL(info.resourcePath, bundle.sourceMapURL()).href;
|
return new URL(info.resourcePath, sourceMapURL()).href;
|
||||||
}
|
}
|
||||||
: undefined,
|
: undefined,
|
||||||
])
|
])
|
||||||
@@ -252,35 +247,51 @@ const createRspackConfig = ({
|
|||||||
layers: true,
|
layers: true,
|
||||||
outputModule: true,
|
outputModule: true,
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const createAppConfig = ({
|
export const createAppConfig = ({
|
||||||
isProdBuild,
|
isProdBuild,
|
||||||
latestBuild,
|
latestBuild,
|
||||||
isStatsBuild,
|
isStatsBuild,
|
||||||
isTestBuild,
|
isTestBuild,
|
||||||
|
}: {
|
||||||
|
isProdBuild?: boolean;
|
||||||
|
latestBuild?: boolean;
|
||||||
|
isStatsBuild?: boolean;
|
||||||
|
isTestBuild?: boolean;
|
||||||
}) =>
|
}) =>
|
||||||
createRspackConfig(
|
createRspackConfig(
|
||||||
bundle.config.app({ isProdBuild, latestBuild, isStatsBuild, isTestBuild })
|
config.app({ isProdBuild, latestBuild, isStatsBuild, isTestBuild })
|
||||||
);
|
);
|
||||||
|
|
||||||
const createDemoConfig = ({ isProdBuild, latestBuild, isStatsBuild }) =>
|
export const createDemoConfig = ({
|
||||||
createRspackConfig(
|
isProdBuild,
|
||||||
bundle.config.demo({ isProdBuild, latestBuild, isStatsBuild })
|
latestBuild,
|
||||||
);
|
isStatsBuild,
|
||||||
|
}: {
|
||||||
|
isProdBuild?: boolean;
|
||||||
|
latestBuild?: boolean;
|
||||||
|
isStatsBuild?: boolean;
|
||||||
|
}) =>
|
||||||
|
createRspackConfig(config.demo({ isProdBuild, latestBuild, isStatsBuild }));
|
||||||
|
|
||||||
const createCastConfig = ({ isProdBuild, latestBuild }) =>
|
export const createCastConfig = ({ isProdBuild, latestBuild }) =>
|
||||||
createRspackConfig(bundle.config.cast({ isProdBuild, latestBuild }));
|
createRspackConfig(config.cast({ isProdBuild, latestBuild }));
|
||||||
|
|
||||||
const createHassioConfig = ({
|
export const createHassioConfig = ({
|
||||||
isProdBuild,
|
isProdBuild,
|
||||||
latestBuild,
|
latestBuild,
|
||||||
isStatsBuild,
|
isStatsBuild,
|
||||||
isTestBuild,
|
isTestBuild,
|
||||||
|
}: {
|
||||||
|
isProdBuild?: boolean;
|
||||||
|
latestBuild?: boolean;
|
||||||
|
isStatsBuild?: boolean;
|
||||||
|
isTestBuild?: boolean;
|
||||||
}) =>
|
}) =>
|
||||||
createRspackConfig(
|
createRspackConfig(
|
||||||
bundle.config.hassio({
|
config.hassio({
|
||||||
isProdBuild,
|
isProdBuild,
|
||||||
latestBuild,
|
latestBuild,
|
||||||
isStatsBuild,
|
isStatsBuild,
|
||||||
@@ -288,18 +299,8 @@ const createHassioConfig = ({
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
const createGalleryConfig = ({ isProdBuild, latestBuild }) =>
|
export const createGalleryConfig = ({ isProdBuild, latestBuild }) =>
|
||||||
createRspackConfig(bundle.config.gallery({ isProdBuild, latestBuild }));
|
createRspackConfig(config.gallery({ isProdBuild, latestBuild }));
|
||||||
|
|
||||||
const createLandingPageConfig = ({ isProdBuild, latestBuild }) =>
|
export const createLandingPageConfig = ({ isProdBuild, latestBuild }) =>
|
||||||
createRspackConfig(bundle.config.landingPage({ isProdBuild, latestBuild }));
|
createRspackConfig(config.landingPage({ isProdBuild, latestBuild }));
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
createAppConfig,
|
|
||||||
createDemoConfig,
|
|
||||||
createCastConfig,
|
|
||||||
createHassioConfig,
|
|
||||||
createGalleryConfig,
|
|
||||||
createRspackConfig,
|
|
||||||
createLandingPageConfig,
|
|
||||||
};
|
|
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")/../.."
|
cd "$(dirname "$0")/../.."
|
||||||
|
|
||||||
./node_modules/.bin/gulp build-cast
|
yarn run-task build-cast
|
||||||
|
@@ -6,4 +6,4 @@ set -e
|
|||||||
|
|
||||||
cd "$(dirname "$0")/../.."
|
cd "$(dirname "$0")/../.."
|
||||||
|
|
||||||
./node_modules/.bin/gulp develop-cast
|
yarn run-task develop-cast
|
||||||
|
@@ -1,3 +1,3 @@
|
|||||||
import "./layout/hc-connect";
|
import "./layout/hc-connect";
|
||||||
|
|
||||||
import("../../../src/resources/ha-style");
|
import("../../../src/resources/append-ha-style");
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import "@material/mwc-button/mwc-button";
|
import "@material/mwc-button/mwc-button";
|
||||||
import "@material/mwc-list/mwc-list";
|
|
||||||
import type { ActionDetail } from "@material/mwc-list/mwc-list";
|
import type { ActionDetail } from "@material/mwc-list/mwc-list";
|
||||||
import { mdiCast, mdiCastConnected, mdiViewDashboard } from "@mdi/js";
|
import { mdiCast, mdiCastConnected, mdiViewDashboard } from "@mdi/js";
|
||||||
import type { Auth, Connection } from "home-assistant-js-websocket";
|
import type { Auth, Connection } from "home-assistant-js-websocket";
|
||||||
@@ -19,6 +19,8 @@ import {
|
|||||||
import { atLeastVersion } from "../../../../src/common/config/version";
|
import { atLeastVersion } from "../../../../src/common/config/version";
|
||||||
import { toggleAttribute } from "../../../../src/common/dom/toggle_attribute";
|
import { toggleAttribute } from "../../../../src/common/dom/toggle_attribute";
|
||||||
import "../../../../src/components/ha-icon";
|
import "../../../../src/components/ha-icon";
|
||||||
|
import "../../../../src/components/ha-list";
|
||||||
|
import "../../../../src/components/ha-list-item";
|
||||||
import "../../../../src/components/ha-svg-icon";
|
import "../../../../src/components/ha-svg-icon";
|
||||||
import {
|
import {
|
||||||
getLegacyLovelaceCollection,
|
getLegacyLovelaceCollection,
|
||||||
@@ -29,7 +31,6 @@ import type { LovelaceViewConfig } from "../../../../src/data/lovelace/config/vi
|
|||||||
import "../../../../src/layouts/hass-loading-screen";
|
import "../../../../src/layouts/hass-loading-screen";
|
||||||
import { generateDefaultViewConfig } from "../../../../src/panels/lovelace/common/generate-lovelace-config";
|
import { generateDefaultViewConfig } from "../../../../src/panels/lovelace/common/generate-lovelace-config";
|
||||||
import "./hc-layout";
|
import "./hc-layout";
|
||||||
import "../../../../src/components/ha-list-item";
|
|
||||||
|
|
||||||
@customElement("hc-cast")
|
@customElement("hc-cast")
|
||||||
class HcCast extends LitElement {
|
class HcCast extends LitElement {
|
||||||
@@ -85,7 +86,7 @@ class HcCast extends LitElement {
|
|||||||
`
|
`
|
||||||
: html`
|
: html`
|
||||||
<div class="section-header">PICK A VIEW</div>
|
<div class="section-header">PICK A VIEW</div>
|
||||||
<mwc-list @action=${this._handlePickView} activatable>
|
<ha-list @action=${this._handlePickView} activatable>
|
||||||
${(
|
${(
|
||||||
this.lovelaceViews ?? [
|
this.lovelaceViews ?? [
|
||||||
generateDefaultViewConfig({}, {}, {}, {}, () => ""),
|
generateDefaultViewConfig({}, {}, {}, {}, () => ""),
|
||||||
@@ -113,7 +114,7 @@ class HcCast extends LitElement {
|
|||||||
></ha-svg-icon>`}
|
></ha-svg-icon>`}
|
||||||
</ha-list-item>
|
</ha-list-item>
|
||||||
`
|
`
|
||||||
)}</mwc-list
|
)}</ha-list
|
||||||
>
|
>
|
||||||
`}
|
`}
|
||||||
|
|
||||||
|
@@ -302,7 +302,7 @@ export class HcConnect extends LitElement {
|
|||||||
}
|
}
|
||||||
.error {
|
.error {
|
||||||
color: red;
|
color: red;
|
||||||
font-weight: bold;
|
font-weight: var(--ha-font-weight-bold);
|
||||||
}
|
}
|
||||||
|
|
||||||
.error a {
|
.error a {
|
||||||
|
@@ -86,9 +86,9 @@ class HcLayout extends LitElement {
|
|||||||
.card-header {
|
.card-header {
|
||||||
color: var(--ha-card-header-color, var(--primary-text-color));
|
color: var(--ha-card-header-color, var(--primary-text-color));
|
||||||
font-family: var(--ha-card-header-font-family, inherit);
|
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;
|
letter-spacing: -0.012em;
|
||||||
line-height: 32px;
|
line-height: var(--ha-line-height-condensed);
|
||||||
padding: 24px 16px 16px;
|
padding: 24px 16px 16px;
|
||||||
display: block;
|
display: block;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
@@ -98,7 +98,7 @@ class HcLayout extends LitElement {
|
|||||||
border-radius: 4px 4px 0 0;
|
border-radius: 4px 4px 0 0;
|
||||||
}
|
}
|
||||||
.subtitle {
|
.subtitle {
|
||||||
font-size: 14px;
|
font-size: var(--ha-font-size-m);
|
||||||
color: var(--secondary-text-color);
|
color: var(--secondary-text-color);
|
||||||
line-height: initial;
|
line-height: initial;
|
||||||
}
|
}
|
||||||
@@ -113,7 +113,7 @@ class HcLayout extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
:host ::slotted(.section-header) {
|
:host ::slotted(.section-header) {
|
||||||
font-weight: 500;
|
font-weight: var(--ha-font-weight-medium);
|
||||||
padding: 4px 16px;
|
padding: 4px 16px;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
}
|
}
|
||||||
@@ -135,7 +135,7 @@ class HcLayout extends LitElement {
|
|||||||
|
|
||||||
.footer {
|
.footer {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 12px;
|
font-size: var(--ha-font-size-s);
|
||||||
padding: 8px 0 24px;
|
padding: 8px 0 24px;
|
||||||
color: var(--secondary-text-color);
|
color: var(--secondary-text-color);
|
||||||
}
|
}
|
||||||
|
@@ -29,7 +29,7 @@ class HcLaunchScreen extends LitElement {
|
|||||||
display: block;
|
display: block;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
background-color: #f2f4f9;
|
background-color: #f2f4f9;
|
||||||
font-size: 24px;
|
font-size: var(--ha-font-size-2xl);
|
||||||
}
|
}
|
||||||
.container {
|
.container {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@@ -109,7 +109,7 @@ export class HcMain extends HassElement {
|
|||||||
protected firstUpdated(changedProps) {
|
protected firstUpdated(changedProps) {
|
||||||
super.firstUpdated(changedProps);
|
super.firstUpdated(changedProps);
|
||||||
import("./hc-lovelace");
|
import("./hc-lovelace");
|
||||||
import("../../../../src/resources/ha-style");
|
import("../../../../src/resources/append-ha-style");
|
||||||
|
|
||||||
window.addEventListener("location-changed", () => {
|
window.addEventListener("location-changed", () => {
|
||||||
const panelPath = `/${this._urlPath || "lovelace"}/`;
|
const panelPath = `/${this._urlPath || "lovelace"}/`;
|
||||||
|
@@ -6,4 +6,4 @@ set -e
|
|||||||
|
|
||||||
cd "$(dirname "$0")/../.."
|
cd "$(dirname "$0")/../.."
|
||||||
|
|
||||||
./node_modules/.bin/gulp build-demo
|
yarn run-task build-demo
|
||||||
|
@@ -6,4 +6,4 @@ set -e
|
|||||||
|
|
||||||
cd "$(dirname "$0")/../.."
|
cd "$(dirname "$0")/../.."
|
||||||
|
|
||||||
./node_modules/.bin/gulp develop-demo
|
yarn run-task develop-demo
|
||||||
|
@@ -6,4 +6,4 @@ set -e
|
|||||||
|
|
||||||
cd "$(dirname "$0")/../.."
|
cd "$(dirname "$0")/../.."
|
||||||
|
|
||||||
./node_modules/.bin/gulp analyze-demo
|
yarn run-task analyze-demo
|
@@ -1,37 +1,28 @@
|
|||||||
export const demoThemeJimpower = () => ({
|
export const demoThemeJimpower = () => ({
|
||||||
"text-primary-color": "var(--primary-text-color)",
|
"text-primary-color": "var(--primary-text-color)",
|
||||||
"paper-item-icon-color": "var(--primary-text-color)",
|
|
||||||
"primary-color": "#5294E2",
|
"primary-color": "#5294E2",
|
||||||
"label-badge-red": "var(--accent-color)",
|
"label-badge-red": "var(--accent-color)",
|
||||||
"paper-tabs-selection-bar-color": "green",
|
|
||||||
"light-primary-color": "var(--accent-color)",
|
"light-primary-color": "var(--accent-color)",
|
||||||
"primary-background-color": "#383C45",
|
"primary-background-color": "#383C45",
|
||||||
"primary-text-color": "#FFFFFF",
|
"primary-text-color": "#FFFFFF",
|
||||||
"paper-item-selected_-_background-color": "#434954",
|
|
||||||
"secondary-background-color": "#383C45",
|
"secondary-background-color": "#383C45",
|
||||||
"disabled-text-color": "#7F848E",
|
"disabled-text-color": "#7F848E",
|
||||||
"paper-item-icon_-_color": "green",
|
|
||||||
"paper-grey-200": "#414A59",
|
"paper-grey-200": "#414A59",
|
||||||
"label-badge-background-color": "#2E333A",
|
"label-badge-background-color": "#2E333A",
|
||||||
"paper-card-header-color": "var(--accent-color)",
|
"sidebar-icon-color": "var(--state-icon-color)",
|
||||||
"sidebar-icon-color": "var(--paper-item-icon-color)",
|
|
||||||
"paper-listbox-background-color": "#2E333A",
|
|
||||||
"table-row-background-color": "#353840",
|
"table-row-background-color": "#353840",
|
||||||
"paper-grey-50": "var(--primary-text-color)",
|
"paper-grey-50": "var(--primary-text-color)",
|
||||||
"switch-checked-color": "var(--accent-color)",
|
"switch-checked-color": "var(--accent-color)",
|
||||||
"paper-dialog-background-color": "#434954",
|
|
||||||
"secondary-text-color": "#5294E2",
|
"secondary-text-color": "#5294E2",
|
||||||
"error-color": "#E45E65",
|
"error-color": "#E45E65",
|
||||||
"divider-color": "rgba(0, 0, 0, .12)",
|
"divider-color": "rgba(0, 0, 0, .12)",
|
||||||
"success-color": "#39E949",
|
"success-color": "#39E949",
|
||||||
"switch-unchecked-button-color": "var(--disabled-text-color)",
|
"switch-unchecked-button-color": "var(--disabled-text-color)",
|
||||||
"label-badge-border-color": "green",
|
"label-badge-border-color": "green",
|
||||||
"paper-listbox-color": "var(--primary-color)",
|
|
||||||
"card-background-color": "#434954",
|
"card-background-color": "#434954",
|
||||||
"label-badge-text-color": "var(--primary-text-color)",
|
"label-badge-text-color": "var(--primary-text-color)",
|
||||||
"switch-unchecked-track-color": "var(--disabled-text-color)",
|
"switch-unchecked-track-color": "var(--disabled-text-color)",
|
||||||
"dark-primary-color": "var(--accent-color)",
|
"dark-primary-color": "var(--accent-color)",
|
||||||
"paper-item-icon-active-color": "#F9C536",
|
|
||||||
"accent-color": "#E45E65",
|
"accent-color": "#E45E65",
|
||||||
"table-row-alternative-background-color": "#3E424B",
|
"table-row-alternative-background-color": "#3E424B",
|
||||||
});
|
});
|
||||||
|
@@ -1,38 +1,29 @@
|
|||||||
// https://community.home-assistant.io/t/slate-a-new-dark-theme/86410
|
// https://community.home-assistant.io/t/slate-a-new-dark-theme/86410
|
||||||
export const demoThemeKernehed = () => ({
|
export const demoThemeKernehed = () => ({
|
||||||
"text-primary-color": "var(--primary-text-color)",
|
"text-primary-color": "var(--primary-text-color)",
|
||||||
"paper-item-icon-color": "var(--primary-text-color)",
|
|
||||||
"primary-color": "#2980b9",
|
"primary-color": "#2980b9",
|
||||||
"label-badge-red": "var(--accent-color)",
|
"label-badge-red": "var(--accent-color)",
|
||||||
"paper-tabs-selection-bar-color": "green",
|
|
||||||
"primary-text-color": "#FFFFFF",
|
"primary-text-color": "#FFFFFF",
|
||||||
"light-primary-color": "var(--accent-color)",
|
"light-primary-color": "var(--accent-color)",
|
||||||
"primary-background-color": "#222222",
|
"primary-background-color": "#222222",
|
||||||
"sidebar-icon-color": "#777777",
|
"sidebar-icon-color": "#777777",
|
||||||
"paper-item-selected_-_background-color": "#292929",
|
|
||||||
"secondary-background-color": "#222222",
|
"secondary-background-color": "#222222",
|
||||||
"disabled-text-color": "#777777",
|
"disabled-text-color": "#777777",
|
||||||
"paper-item-icon_-_color": "green",
|
|
||||||
"paper-grey-200": "#222222",
|
"paper-grey-200": "#222222",
|
||||||
"label-badge-background-color": "#222222",
|
"label-badge-background-color": "#222222",
|
||||||
"paper-card-header-color": "var(--accent-color)",
|
|
||||||
"paper-listbox-background-color": "#141414",
|
|
||||||
"table-row-background-color": "#292929",
|
"table-row-background-color": "#292929",
|
||||||
"paper-grey-50": "var(--primary-text-color)",
|
"paper-grey-50": "var(--primary-text-color)",
|
||||||
"switch-checked-color": "var(--accent-color)",
|
"switch-checked-color": "var(--accent-color)",
|
||||||
"paper-dialog-background-color": "#292929",
|
|
||||||
"secondary-text-color": "#b58e31",
|
"secondary-text-color": "#b58e31",
|
||||||
"error-color": "#b58e31",
|
"error-color": "#b58e31",
|
||||||
"divider-color": "rgba(0, 0, 0, .12)",
|
"divider-color": "rgba(0, 0, 0, .12)",
|
||||||
"success-color": "#2980b9",
|
"success-color": "#2980b9",
|
||||||
"switch-unchecked-button-color": "var(--disabled-text-color)",
|
"switch-unchecked-button-color": "var(--disabled-text-color)",
|
||||||
"label-badge-border-color": "green",
|
"label-badge-border-color": "green",
|
||||||
"paper-listbox-color": "#777777",
|
|
||||||
"card-background-color": "#292929",
|
"card-background-color": "#292929",
|
||||||
"label-badge-text-color": "var(--primary-text-color)",
|
"label-badge-text-color": "var(--primary-text-color)",
|
||||||
"switch-unchecked-track-color": "var(--disabled-text-color)",
|
"switch-unchecked-track-color": "var(--disabled-text-color)",
|
||||||
"dark-primary-color": "var(--accent-color)",
|
"dark-primary-color": "var(--accent-color)",
|
||||||
"paper-item-icon-active-color": "#b58e31",
|
|
||||||
"accent-color": "#2980b9",
|
"accent-color": "#2980b9",
|
||||||
"table-row-alternative-background-color": "#292929",
|
"table-row-alternative-background-color": "#292929",
|
||||||
});
|
});
|
||||||
|
@@ -1,26 +1,18 @@
|
|||||||
export const demoThemeTeachingbirds = () => ({
|
export const demoThemeTeachingbirds = () => ({
|
||||||
"paper-card-header-color": "var(--paper-item-icon-color)",
|
|
||||||
"paper-listbox-background-color": "#202020",
|
|
||||||
"paper-grey-50": "var(--primary-text-color)",
|
"paper-grey-50": "var(--primary-text-color)",
|
||||||
"paper-item-icon-color": "#d3d3d3",
|
|
||||||
"divider-color": "rgba(255, 255, 255, 0.12)",
|
"divider-color": "rgba(255, 255, 255, 0.12)",
|
||||||
"primary-color": "#389638",
|
"primary-color": "#389638",
|
||||||
"light-primary-color": "#6f956f",
|
"light-primary-color": "#6f956f",
|
||||||
"label-badge-red": "var(--primary-color)",
|
"label-badge-red": "var(--primary-color)",
|
||||||
"paper-listbox-color": "#FFFFFF",
|
|
||||||
"paper-toggle-button-checked-bar-color": "var(--light-primary-color)",
|
|
||||||
"switch-unchecked-track-color": "var(--primary-text-color)",
|
"switch-unchecked-track-color": "var(--primary-text-color)",
|
||||||
"card-background-color": "#4e4e4e",
|
"card-background-color": "#4e4e4e",
|
||||||
"label-badge-text-color": "var(--text-primary-color)",
|
"label-badge-text-color": "var(--text-primary-color)",
|
||||||
"primary-background-color": "#303030",
|
"primary-background-color": "#303030",
|
||||||
"sidebar-icon-color": "var(--paper-item-icon-color)",
|
"sidebar-icon-color": "#d3d3d3",
|
||||||
"secondary-background-color": "#2b2b2b",
|
"secondary-background-color": "#2b2b2b",
|
||||||
"paper-item-icon-active-color": "#d8bf50",
|
|
||||||
"switch-checked-color": "var(--primary-color)",
|
"switch-checked-color": "var(--primary-color)",
|
||||||
"secondary-text-color": "#389638",
|
"secondary-text-color": "#389638",
|
||||||
"disabled-text-color": "#545454",
|
"disabled-text-color": "#545454",
|
||||||
"paper-item-icon_-_color": "var(--primary-text-color)",
|
|
||||||
"paper-grey-200": "#191919",
|
"paper-grey-200": "#191919",
|
||||||
"primary-text-color": "#cfcfcf",
|
|
||||||
"label-badge-background-color": "var(--secondary-background-color)",
|
"label-badge-background-color": "var(--secondary-background-color)",
|
||||||
});
|
});
|
||||||
|
@@ -73,7 +73,7 @@ class CastDemoRow extends LitElement implements LovelaceRow {
|
|||||||
}
|
}
|
||||||
ha-svg-icon {
|
ha-svg-icon {
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
color: var(--paper-item-icon-color);
|
color: var(--state-icon-color);
|
||||||
}
|
}
|
||||||
.flex {
|
.flex {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import "./util/is_frontpage";
|
import "./util/is_frontpage";
|
||||||
import "./ha-demo";
|
import "./ha-demo";
|
||||||
|
|
||||||
import("../../src/resources/ha-style");
|
import("../../src/resources/append-ha-style");
|
||||||
|
@@ -68,7 +68,7 @@
|
|||||||
}
|
}
|
||||||
#ha-launch-screen .ha-launch-screen-spacer-top {
|
#ha-launch-screen .ha-launch-screen-spacer-top {
|
||||||
flex: 1;
|
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;
|
padding-top: 48px;
|
||||||
}
|
}
|
||||||
#ha-launch-screen .ha-launch-screen-spacer-bottom {
|
#ha-launch-screen .ha-launch-screen-spacer-bottom {
|
||||||
@@ -76,7 +76,7 @@
|
|||||||
padding-top: 48px;
|
padding-top: 48px;
|
||||||
}
|
}
|
||||||
.ohf-logo {
|
.ohf-logo {
|
||||||
margin: max(env(safe-area-inset-bottom), 48px) 0;
|
margin: max(var(--safe-area-inset-bottom), 48px) 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
@@ -1,7 +1,30 @@
|
|||||||
import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
||||||
|
|
||||||
|
let changeFunction;
|
||||||
|
|
||||||
export const mockFrontend = (hass: MockHomeAssistant) => {
|
export const mockFrontend = (hass: MockHomeAssistant) => {
|
||||||
hass.mockWS("frontend/get_user_data", () => ({
|
hass.mockWS("frontend/get_user_data", () => ({
|
||||||
value: null,
|
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 () => {};
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
@@ -2,26 +2,36 @@ import type { TodoItem } from "../../../src/data/todo";
|
|||||||
import { TodoItemStatus } from "../../../src/data/todo";
|
import { TodoItemStatus } from "../../../src/data/todo";
|
||||||
import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
||||||
|
|
||||||
export const mockTodo = (hass: MockHomeAssistant) => {
|
const items = {
|
||||||
hass.mockWS("todo/item/list", () => ({
|
items: [
|
||||||
items: [
|
{
|
||||||
{
|
uid: "12",
|
||||||
uid: "12",
|
summary: "Milk",
|
||||||
summary: "Milk",
|
status: TodoItemStatus.NeedsAction,
|
||||||
status: TodoItemStatus.NeedsAction,
|
},
|
||||||
},
|
{
|
||||||
{
|
uid: "13",
|
||||||
uid: "13",
|
summary: "Eggs",
|
||||||
summary: "Eggs",
|
status: TodoItemStatus.NeedsAction,
|
||||||
status: TodoItemStatus.NeedsAction,
|
},
|
||||||
},
|
{
|
||||||
{
|
uid: "14",
|
||||||
uid: "14",
|
summary: "Oranges",
|
||||||
summary: "Oranges",
|
status: TodoItemStatus.Completed,
|
||||||
status: TodoItemStatus.Completed,
|
},
|
||||||
},
|
{
|
||||||
] as TodoItem[],
|
uid: "15",
|
||||||
}));
|
summary: "Beer",
|
||||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
},
|
||||||
hass.mockWS("todo/item/subscribe", (_msg, _hass) => () => {});
|
] as TodoItem[],
|
||||||
|
};
|
||||||
|
|
||||||
|
export const mockTodo = (hass: MockHomeAssistant) => {
|
||||||
|
hass.mockWS("todo/item/list", () => items);
|
||||||
|
hass.mockWS("todo/item/move", () => undefined);
|
||||||
|
hass.mockWS("todo/item/subscribe", (_msg, _hass, onChange) => {
|
||||||
|
onChange!(items);
|
||||||
|
// 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 eslintConfigPrettier from "eslint-config-prettier";
|
||||||
import { configs as litConfigs } from "eslint-plugin-lit";
|
import { configs as litConfigs } from "eslint-plugin-lit";
|
||||||
import { configs as wcConfigs } from "eslint-plugin-wc";
|
import { configs as wcConfigs } from "eslint-plugin-wc";
|
||||||
|
import { configs as a11yConfigs } from "eslint-plugin-lit-a11y";
|
||||||
|
|
||||||
const _filename = fileURLToPath(import.meta.url);
|
const _filename = fileURLToPath(import.meta.url);
|
||||||
const _dirname = path.dirname(_filename);
|
const _dirname = path.dirname(_filename);
|
||||||
@@ -21,13 +22,14 @@ const compat = new FlatCompat({
|
|||||||
});
|
});
|
||||||
|
|
||||||
export default tseslint.config(
|
export default tseslint.config(
|
||||||
...compat.extends("airbnb-base", "plugin:lit-a11y/recommended"),
|
...compat.extends("airbnb-base"),
|
||||||
eslintConfigPrettier,
|
eslintConfigPrettier,
|
||||||
litConfigs["flat/all"],
|
litConfigs["flat/all"],
|
||||||
tseslint.configs.recommended,
|
tseslint.configs.recommended,
|
||||||
tseslint.configs.strict,
|
tseslint.configs.strict,
|
||||||
tseslint.configs.stylistic,
|
tseslint.configs.stylistic,
|
||||||
wcConfigs["flat/recommended"],
|
wcConfigs["flat/recommended"],
|
||||||
|
a11yConfigs.recommended,
|
||||||
{
|
{
|
||||||
plugins: {
|
plugins: {
|
||||||
"unused-imports": unusedImports,
|
"unused-imports": unusedImports,
|
||||||
@@ -42,7 +44,6 @@ export default tseslint.config(
|
|||||||
__VERSION__: false,
|
__VERSION__: false,
|
||||||
__STATIC_PATH__: false,
|
__STATIC_PATH__: false,
|
||||||
__SUPERVISOR__: false,
|
__SUPERVISOR__: false,
|
||||||
Polymer: true,
|
|
||||||
},
|
},
|
||||||
|
|
||||||
parser: tseslint.parser,
|
parser: tseslint.parser,
|
||||||
@@ -55,15 +56,6 @@ export default tseslint.config(
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
settings: {
|
|
||||||
"import/resolver": {
|
|
||||||
webpack: {
|
|
||||||
config: "./rspack.config.cjs",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
rules: {
|
rules: {
|
||||||
"class-methods-use-this": "off",
|
"class-methods-use-this": "off",
|
||||||
"new-cap": "off",
|
"new-cap": "off",
|
||||||
@@ -186,5 +178,12 @@ export default tseslint.config(
|
|||||||
],
|
],
|
||||||
"no-use-before-define": "off",
|
"no-use-before-define": "off",
|
||||||
},
|
},
|
||||||
|
settings: {
|
||||||
|
"import/resolver": {
|
||||||
|
node: {
|
||||||
|
extensions: [".ts", ".js"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@@ -6,4 +6,4 @@ set -e
|
|||||||
|
|
||||||
cd "$(dirname "$0")/../.."
|
cd "$(dirname "$0")/../.."
|
||||||
|
|
||||||
./node_modules/.bin/gulp build-gallery
|
yarn run-task build-gallery
|
||||||
|
@@ -6,4 +6,4 @@ set -e
|
|||||||
|
|
||||||
cd "$(dirname "$0")/../.."
|
cd "$(dirname "$0")/../.."
|
||||||
|
|
||||||
./node_modules/.bin/gulp develop-gallery
|
yarn run-task develop-gallery
|
||||||
|
@@ -38,12 +38,12 @@ class PageDescription extends HaMarkdown {
|
|||||||
}
|
}
|
||||||
.title {
|
.title {
|
||||||
font-size: 42px;
|
font-size: 42px;
|
||||||
line-height: 56px;
|
line-height: var(--ha-line-height-condensed);
|
||||||
padding-bottom: 8px;
|
padding-bottom: 8px;
|
||||||
}
|
}
|
||||||
.subtitle {
|
.subtitle {
|
||||||
font-size: 18px;
|
font-size: var(--ha-font-size-l);
|
||||||
line-height: 24px;
|
line-height: var(--ha-line-height-normal);
|
||||||
}
|
}
|
||||||
.root {
|
.root {
|
||||||
max-width: 800px;
|
max-width: 800px;
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import "./ha-gallery";
|
import "./ha-gallery";
|
||||||
|
|
||||||
import("../../src/resources/ha-style");
|
import("../../src/resources/append-ha-style");
|
||||||
|
|
||||||
document.body.appendChild(document.createElement("ha-gallery"));
|
document.body.appendChild(document.createElement("ha-gallery"));
|
||||||
|
@@ -34,7 +34,7 @@ class HaDemoOptions extends LitElement {
|
|||||||
height: 64px;
|
height: 64px;
|
||||||
padding: 0 16px;
|
padding: 0 16px;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
font-size: 20px;
|
font-size: var(--ha-font-size-xl);
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
];
|
];
|
||||||
|
@@ -250,14 +250,14 @@ class HaGallery extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.page-footer .header {
|
.page-footer .header {
|
||||||
font-size: 16px;
|
font-size: var(--ha-font-size-l);
|
||||||
font-weight: 500;
|
font-weight: var(--ha-font-weight-medium);
|
||||||
line-height: 28px;
|
line-height: var(--ha-line-height-normal);
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.page-footer .secondary {
|
.page-footer .secondary {
|
||||||
line-height: 23px;
|
line-height: var(--ha-line-height-normal);
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,29 +1,30 @@
|
|||||||
import type { TemplateResult } from "lit";
|
import type { TemplateResult } from "lit";
|
||||||
import { LitElement, html, css } from "lit";
|
import { LitElement, css, html } from "lit";
|
||||||
import { customElement, state } from "lit/decorators";
|
import { customElement, state } from "lit/decorators";
|
||||||
|
import "../../../../src/components/ha-formfield";
|
||||||
import { provideHass } from "../../../../src/fake_data/provide_hass";
|
import { provideHass } from "../../../../src/fake_data/provide_hass";
|
||||||
import type { HomeAssistant } from "../../../../src/types";
|
import type { HomeAssistant } from "../../../../src/types";
|
||||||
import "../../components/demo-black-white-row";
|
import "../../components/demo-black-white-row";
|
||||||
import { mockEntityRegistry } from "../../../../demo/src/stubs/entity_registry";
|
|
||||||
import { mockDeviceRegistry } from "../../../../demo/src/stubs/device_registry";
|
|
||||||
import { mockAreaRegistry } from "../../../../demo/src/stubs/area_registry";
|
import { mockAreaRegistry } from "../../../../demo/src/stubs/area_registry";
|
||||||
|
import { mockDeviceRegistry } from "../../../../demo/src/stubs/device_registry";
|
||||||
|
import { mockEntityRegistry } from "../../../../demo/src/stubs/entity_registry";
|
||||||
import { mockHassioSupervisor } from "../../../../demo/src/stubs/hassio_supervisor";
|
import { mockHassioSupervisor } from "../../../../demo/src/stubs/hassio_supervisor";
|
||||||
|
import type { Action } from "../../../../src/data/script";
|
||||||
import "../../../../src/panels/config/automation/action/ha-automation-action";
|
import "../../../../src/panels/config/automation/action/ha-automation-action";
|
||||||
import { HaChooseAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-choose";
|
import { HaChooseAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-choose";
|
||||||
|
import { HaConditionAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-condition";
|
||||||
import { HaDelayAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-delay";
|
import { HaDelayAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-delay";
|
||||||
import { HaDeviceAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-device_id";
|
import { HaDeviceAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-device_id";
|
||||||
import { HaEventAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-event";
|
import { HaEventAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-event";
|
||||||
|
import { HaIfAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-if";
|
||||||
|
import { HaParallelAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-parallel";
|
||||||
|
import { HaPlayMediaAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-play_media";
|
||||||
import { HaRepeatAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-repeat";
|
import { HaRepeatAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-repeat";
|
||||||
|
import { HaSequenceAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-sequence";
|
||||||
import { HaServiceAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-service";
|
import { HaServiceAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-service";
|
||||||
|
import { HaStopAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-stop";
|
||||||
import { HaWaitForTriggerAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-wait_for_trigger";
|
import { HaWaitForTriggerAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-wait_for_trigger";
|
||||||
import { HaWaitAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-wait_template";
|
import { HaWaitAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-wait_template";
|
||||||
import type { Action } from "../../../../src/data/script";
|
|
||||||
import { HaConditionAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-condition";
|
|
||||||
import { HaSequenceAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-sequence";
|
|
||||||
import { HaParallelAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-parallel";
|
|
||||||
import { HaIfAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-if";
|
|
||||||
import { HaStopAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-stop";
|
|
||||||
import { HaPlayMediaAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-play_media";
|
|
||||||
|
|
||||||
const SCHEMAS: { name: string; actions: Action[] }[] = [
|
const SCHEMAS: { name: string; actions: Action[] }[] = [
|
||||||
{ name: "Event", actions: [HaEventAction.defaultConfig] },
|
{ name: "Event", actions: [HaEventAction.defaultConfig] },
|
||||||
|
@@ -1,26 +1,27 @@
|
|||||||
import type { TemplateResult } from "lit";
|
import type { TemplateResult } from "lit";
|
||||||
import { LitElement, html, css } from "lit";
|
import { LitElement, css, html } from "lit";
|
||||||
import { customElement, state } from "lit/decorators";
|
import { customElement, state } from "lit/decorators";
|
||||||
import { provideHass } from "../../../../src/fake_data/provide_hass";
|
|
||||||
import type { HomeAssistant } from "../../../../src/types";
|
|
||||||
import "../../components/demo-black-white-row";
|
|
||||||
import { mockEntityRegistry } from "../../../../demo/src/stubs/entity_registry";
|
|
||||||
import { mockDeviceRegistry } from "../../../../demo/src/stubs/device_registry";
|
|
||||||
import { mockAreaRegistry } from "../../../../demo/src/stubs/area_registry";
|
import { mockAreaRegistry } from "../../../../demo/src/stubs/area_registry";
|
||||||
|
import { mockDeviceRegistry } from "../../../../demo/src/stubs/device_registry";
|
||||||
|
import { mockEntityRegistry } from "../../../../demo/src/stubs/entity_registry";
|
||||||
import { mockHassioSupervisor } from "../../../../demo/src/stubs/hassio_supervisor";
|
import { mockHassioSupervisor } from "../../../../demo/src/stubs/hassio_supervisor";
|
||||||
|
import "../../../../src/components/ha-formfield";
|
||||||
import type { ConditionWithShorthand } from "../../../../src/data/automation";
|
import type { ConditionWithShorthand } from "../../../../src/data/automation";
|
||||||
|
import { provideHass } from "../../../../src/fake_data/provide_hass";
|
||||||
import "../../../../src/panels/config/automation/condition/ha-automation-condition";
|
import "../../../../src/panels/config/automation/condition/ha-automation-condition";
|
||||||
|
import { HaAndCondition } from "../../../../src/panels/config/automation/condition/types/ha-automation-condition-and";
|
||||||
import { HaDeviceCondition } from "../../../../src/panels/config/automation/condition/types/ha-automation-condition-device";
|
import { HaDeviceCondition } from "../../../../src/panels/config/automation/condition/types/ha-automation-condition-device";
|
||||||
|
import { HaNotCondition } from "../../../../src/panels/config/automation/condition/types/ha-automation-condition-not";
|
||||||
import HaNumericStateCondition from "../../../../src/panels/config/automation/condition/types/ha-automation-condition-numeric_state";
|
import HaNumericStateCondition from "../../../../src/panels/config/automation/condition/types/ha-automation-condition-numeric_state";
|
||||||
|
import { HaOrCondition } from "../../../../src/panels/config/automation/condition/types/ha-automation-condition-or";
|
||||||
import { HaStateCondition } from "../../../../src/panels/config/automation/condition/types/ha-automation-condition-state";
|
import { HaStateCondition } from "../../../../src/panels/config/automation/condition/types/ha-automation-condition-state";
|
||||||
import { HaSunCondition } from "../../../../src/panels/config/automation/condition/types/ha-automation-condition-sun";
|
import { HaSunCondition } from "../../../../src/panels/config/automation/condition/types/ha-automation-condition-sun";
|
||||||
import { HaTemplateCondition } from "../../../../src/panels/config/automation/condition/types/ha-automation-condition-template";
|
import { HaTemplateCondition } from "../../../../src/panels/config/automation/condition/types/ha-automation-condition-template";
|
||||||
import { HaTimeCondition } from "../../../../src/panels/config/automation/condition/types/ha-automation-condition-time";
|
import { HaTimeCondition } from "../../../../src/panels/config/automation/condition/types/ha-automation-condition-time";
|
||||||
import { HaTriggerCondition } from "../../../../src/panels/config/automation/condition/types/ha-automation-condition-trigger";
|
import { HaTriggerCondition } from "../../../../src/panels/config/automation/condition/types/ha-automation-condition-trigger";
|
||||||
import { HaZoneCondition } from "../../../../src/panels/config/automation/condition/types/ha-automation-condition-zone";
|
import { HaZoneCondition } from "../../../../src/panels/config/automation/condition/types/ha-automation-condition-zone";
|
||||||
import { HaAndCondition } from "../../../../src/panels/config/automation/condition/types/ha-automation-condition-and";
|
import type { HomeAssistant } from "../../../../src/types";
|
||||||
import { HaOrCondition } from "../../../../src/panels/config/automation/condition/types/ha-automation-condition-or";
|
import "../../components/demo-black-white-row";
|
||||||
import { HaNotCondition } from "../../../../src/panels/config/automation/condition/types/ha-automation-condition-not";
|
|
||||||
|
|
||||||
const SCHEMAS: { name: string; conditions: ConditionWithShorthand[] }[] = [
|
const SCHEMAS: { name: string; conditions: ConditionWithShorthand[] }[] = [
|
||||||
{
|
{
|
||||||
|
@@ -1,35 +1,36 @@
|
|||||||
import type { TemplateResult } from "lit";
|
import type { TemplateResult } from "lit";
|
||||||
import { LitElement, html, css } from "lit";
|
import { LitElement, css, html } from "lit";
|
||||||
import { customElement, state } from "lit/decorators";
|
import { customElement, state } from "lit/decorators";
|
||||||
import { provideHass } from "../../../../src/fake_data/provide_hass";
|
|
||||||
import type { HomeAssistant } from "../../../../src/types";
|
|
||||||
import "../../components/demo-black-white-row";
|
|
||||||
import { mockEntityRegistry } from "../../../../demo/src/stubs/entity_registry";
|
|
||||||
import { mockDeviceRegistry } from "../../../../demo/src/stubs/device_registry";
|
|
||||||
import { mockAreaRegistry } from "../../../../demo/src/stubs/area_registry";
|
import { mockAreaRegistry } from "../../../../demo/src/stubs/area_registry";
|
||||||
import { mockHassioSupervisor } from "../../../../demo/src/stubs/hassio_supervisor";
|
|
||||||
import { mockConfig } from "../../../../demo/src/stubs/config";
|
|
||||||
import { mockTags } from "../../../../demo/src/stubs/tags";
|
|
||||||
import { mockAuth } from "../../../../demo/src/stubs/auth";
|
import { mockAuth } from "../../../../demo/src/stubs/auth";
|
||||||
|
import { mockConfig } from "../../../../demo/src/stubs/config";
|
||||||
|
import { mockDeviceRegistry } from "../../../../demo/src/stubs/device_registry";
|
||||||
|
import { mockEntityRegistry } from "../../../../demo/src/stubs/entity_registry";
|
||||||
|
import { mockHassioSupervisor } from "../../../../demo/src/stubs/hassio_supervisor";
|
||||||
|
import { mockTags } from "../../../../demo/src/stubs/tags";
|
||||||
|
import "../../../../src/components/ha-formfield";
|
||||||
import type { Trigger } from "../../../../src/data/automation";
|
import type { Trigger } from "../../../../src/data/automation";
|
||||||
import { HaGeolocationTrigger } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-geo_location";
|
import { provideHass } from "../../../../src/fake_data/provide_hass";
|
||||||
|
import "../../../../src/panels/config/automation/trigger/ha-automation-trigger";
|
||||||
|
import { HaConversationTrigger } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-conversation";
|
||||||
|
import { HaDeviceTrigger } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-device";
|
||||||
import { HaEventTrigger } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-event";
|
import { HaEventTrigger } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-event";
|
||||||
|
import { HaGeolocationTrigger } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-geo_location";
|
||||||
import { HaHassTrigger } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-homeassistant";
|
import { HaHassTrigger } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-homeassistant";
|
||||||
|
import { HaTriggerList } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-list";
|
||||||
|
import { HaMQTTTrigger } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-mqtt";
|
||||||
import { HaNumericStateTrigger } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-numeric_state";
|
import { HaNumericStateTrigger } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-numeric_state";
|
||||||
|
import { HaPersistentNotificationTrigger } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-persistent_notification";
|
||||||
|
import { HaStateTrigger } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-state";
|
||||||
import { HaSunTrigger } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-sun";
|
import { HaSunTrigger } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-sun";
|
||||||
import { HaTagTrigger } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-tag";
|
import { HaTagTrigger } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-tag";
|
||||||
import { HaTemplateTrigger } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-template";
|
import { HaTemplateTrigger } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-template";
|
||||||
import { HaTimeTrigger } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-time";
|
import { HaTimeTrigger } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-time";
|
||||||
import { HaTimePatternTrigger } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-time_pattern";
|
import { HaTimePatternTrigger } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-time_pattern";
|
||||||
import { HaWebhookTrigger } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-webhook";
|
import { HaWebhookTrigger } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-webhook";
|
||||||
import { HaPersistentNotificationTrigger } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-persistent_notification";
|
|
||||||
import { HaZoneTrigger } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-zone";
|
import { HaZoneTrigger } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-zone";
|
||||||
import { HaDeviceTrigger } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-device";
|
import type { HomeAssistant } from "../../../../src/types";
|
||||||
import { HaStateTrigger } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-state";
|
import "../../components/demo-black-white-row";
|
||||||
import { HaMQTTTrigger } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-mqtt";
|
|
||||||
import "../../../../src/panels/config/automation/trigger/ha-automation-trigger";
|
|
||||||
import { HaConversationTrigger } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-conversation";
|
|
||||||
import { HaTriggerList } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-list";
|
|
||||||
|
|
||||||
const SCHEMAS: { name: string; triggers: Trigger[] }[] = [
|
const SCHEMAS: { name: string; triggers: Trigger[] }[] = [
|
||||||
{
|
{
|
||||||
|
65
gallery/src/pages/components/ha-badge.markdown
Normal file
65
gallery/src/pages/components/ha-badge.markdown
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
---
|
||||||
|
title: Badge
|
||||||
|
subtitle: Lovelace dashboard badge
|
||||||
|
---
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.wrapper {
|
||||||
|
display: flex;
|
||||||
|
gap: 24px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
# Badge `<ha-badge>`
|
||||||
|
|
||||||
|
The badge component is a small component that displays a number or status information. It is used in the lovelace dashboard on the top.
|
||||||
|
|
||||||
|
## Implementation
|
||||||
|
|
||||||
|
### Example Usage
|
||||||
|
|
||||||
|
<div class="wrapper">
|
||||||
|
<ha-badge>
|
||||||
|
simple badge
|
||||||
|
</ha-badge>
|
||||||
|
|
||||||
|
<ha-badge label="Info">
|
||||||
|
With a label
|
||||||
|
</ha-badge>
|
||||||
|
|
||||||
|
<ha-badge type="button">
|
||||||
|
Type button
|
||||||
|
</ha-badge>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
```html
|
||||||
|
<ha-badge> simple badge </ha-badge>
|
||||||
|
|
||||||
|
<ha-badge label="Info"> With a label </ha-badge>
|
||||||
|
|
||||||
|
<ha-badge type="button"> Type button </ha-badge>
|
||||||
|
```
|
||||||
|
|
||||||
|
### API
|
||||||
|
|
||||||
|
**Slots**
|
||||||
|
|
||||||
|
- default slot is the content of the badge
|
||||||
|
- no default
|
||||||
|
- `icon` set the icon of the badge
|
||||||
|
- no default
|
||||||
|
|
||||||
|
**Properties/Attributes**
|
||||||
|
|
||||||
|
| Name | Type | Default | Description |
|
||||||
|
| -------- | ----------------------- | ----------- | ------------------------------------------------------------ |
|
||||||
|
| type | `"badge"` or `"button"` | `"badge"` | If it's button it shows a ripple effect |
|
||||||
|
| label | string | `undefined` | Text label for the badge, only visible if `iconOnly = false` |
|
||||||
|
| iconOnly | boolean | `false` | Only show label |
|
||||||
|
|
||||||
|
**CSS Custom Properties**
|
||||||
|
|
||||||
|
- `--ha-badge-size` (default `36px`)
|
||||||
|
- `--ha-badge-border-radius` (default `calc(var(--ha-badge-size, 36px) / 2)`)
|
||||||
|
- `--ha-badge-font-size` (default `var(--ha-font-size-s)`)
|
||||||
|
- `--ha-badge-icon-size` (default `18px`)
|
129
gallery/src/pages/components/ha-badge.ts
Normal file
129
gallery/src/pages/components/ha-badge.ts
Normal file
@@ -0,0 +1,129 @@
|
|||||||
|
import { mdiButtonCursor, mdiHome } from "@mdi/js";
|
||||||
|
import type { TemplateResult } from "lit";
|
||||||
|
import { css, html, LitElement } from "lit";
|
||||||
|
import { customElement } from "lit/decorators";
|
||||||
|
import { applyThemesOnElement } from "../../../../src/common/dom/apply_themes_on_element";
|
||||||
|
import "../../../../src/components/ha-badge";
|
||||||
|
import "../../../../src/components/ha-card";
|
||||||
|
import "../../../../src/components/ha-svg-icon";
|
||||||
|
import { mdiHomeAssistant } from "../../../../src/resources/home-assistant-logo-svg";
|
||||||
|
|
||||||
|
const badges: {
|
||||||
|
type?: "badge" | "button";
|
||||||
|
label?: string;
|
||||||
|
iconOnly?: boolean;
|
||||||
|
slot?: TemplateResult;
|
||||||
|
iconSlot?: TemplateResult;
|
||||||
|
}[] = [
|
||||||
|
{
|
||||||
|
slot: html`<span>Badge</span>`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "badge",
|
||||||
|
label: "Badge",
|
||||||
|
iconSlot: html`<ha-svg-icon slot="icon" .path=${mdiHome}></ha-svg-icon>`,
|
||||||
|
slot: html`<span>Badge</span>`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "button",
|
||||||
|
label: "Button",
|
||||||
|
iconSlot: html`<ha-svg-icon
|
||||||
|
slot="icon"
|
||||||
|
.path=${mdiButtonCursor}
|
||||||
|
></ha-svg-icon>`,
|
||||||
|
slot: html`<span>Button</span>`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "button",
|
||||||
|
label: "Label only",
|
||||||
|
iconSlot: html`<ha-svg-icon
|
||||||
|
slot="icon"
|
||||||
|
.path=${mdiButtonCursor}
|
||||||
|
></ha-svg-icon>`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "button",
|
||||||
|
label: "Label",
|
||||||
|
slot: html`<span>Button no label</span>`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Icon only",
|
||||||
|
iconOnly: true,
|
||||||
|
iconSlot: html`<ha-svg-icon
|
||||||
|
slot="icon"
|
||||||
|
.path=${mdiHomeAssistant}
|
||||||
|
></ha-svg-icon>`,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
@customElement("demo-components-ha-badge")
|
||||||
|
export class DemoHaBadge extends LitElement {
|
||||||
|
protected render(): TemplateResult {
|
||||||
|
return html`
|
||||||
|
${["light", "dark"].map(
|
||||||
|
(mode) => html`
|
||||||
|
<div class=${mode}>
|
||||||
|
<ha-card header="ha-badge ${mode} demo">
|
||||||
|
<div class="card-content">
|
||||||
|
${badges.map(
|
||||||
|
(badge) => html`
|
||||||
|
<ha-badge
|
||||||
|
.type=${badge.type || undefined}
|
||||||
|
.label=${badge.label}
|
||||||
|
.iconOnly=${badge.iconOnly || false}
|
||||||
|
>
|
||||||
|
${badge.iconSlot} ${badge.slot}
|
||||||
|
</ha-badge>
|
||||||
|
`
|
||||||
|
)}
|
||||||
|
</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;
|
||||||
|
}
|
||||||
|
ha-card {
|
||||||
|
margin: 24px auto;
|
||||||
|
}
|
||||||
|
.card-content {
|
||||||
|
display: flex;
|
||||||
|
gap: 24px;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface HTMLElementTagNameMap {
|
||||||
|
"demo-components-ha-badge": DemoHaBadge;
|
||||||
|
}
|
||||||
|
}
|
@@ -150,7 +150,7 @@ export class DemoHaBarButton extends LitElement {
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
label {
|
label {
|
||||||
font-weight: 600;
|
font-weight: var(--ha-font-weight-bold);
|
||||||
}
|
}
|
||||||
.custom {
|
.custom {
|
||||||
--control-button-icon-color: var(--primary-color);
|
--control-button-icon-color: var(--primary-color);
|
||||||
|
@@ -86,7 +86,7 @@ export class DemoHarControlNumberButtons extends LitElement {
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
label {
|
label {
|
||||||
font-weight: 600;
|
font-weight: var(--ha-font-weight-bold);
|
||||||
}
|
}
|
||||||
.custom {
|
.custom {
|
||||||
color: #2196f3;
|
color: #2196f3;
|
||||||
|
@@ -125,7 +125,7 @@ export class DemoHaControlSelectMenu extends LitElement {
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
label {
|
label {
|
||||||
font-weight: 600;
|
font-weight: var(--ha-font-weight-bold);
|
||||||
}
|
}
|
||||||
.custom {
|
.custom {
|
||||||
--control-button-icon-color: var(--primary-color);
|
--control-button-icon-color: var(--primary-color);
|
||||||
|
@@ -135,7 +135,7 @@ export class DemoHaControlSelect extends LitElement {
|
|||||||
.options=${options}
|
.options=${options}
|
||||||
class=${ifDefined(config.class)}
|
class=${ifDefined(config.class)}
|
||||||
@value-changed=${this.handleValueChanged}
|
@value-changed=${this.handleValueChanged}
|
||||||
aria-labelledby=${id}
|
.label=${label}
|
||||||
?disabled=${config.disabled}
|
?disabled=${config.disabled}
|
||||||
>
|
>
|
||||||
</ha-control-select>
|
</ha-control-select>
|
||||||
@@ -156,7 +156,7 @@ export class DemoHaControlSelect extends LitElement {
|
|||||||
vertical
|
vertical
|
||||||
class=${ifDefined(config.class)}
|
class=${ifDefined(config.class)}
|
||||||
@value-changed=${this.handleValueChanged}
|
@value-changed=${this.handleValueChanged}
|
||||||
aria-labelledby=${id}
|
.label=${label}
|
||||||
?disabled=${config.disabled}
|
?disabled=${config.disabled}
|
||||||
>
|
>
|
||||||
</ha-control-select>
|
</ha-control-select>
|
||||||
@@ -181,7 +181,7 @@ export class DemoHaControlSelect extends LitElement {
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
label {
|
label {
|
||||||
font-weight: 600;
|
font-weight: var(--ha-font-weight-bold);
|
||||||
}
|
}
|
||||||
.custom {
|
.custom {
|
||||||
--mdc-icon-size: 24px;
|
--mdc-icon-size: 24px;
|
||||||
|
@@ -97,7 +97,7 @@ export class DemoHaBarSlider extends LitElement {
|
|||||||
class=${ifDefined(config.class)}
|
class=${ifDefined(config.class)}
|
||||||
@value-changed=${this.handleValueChanged}
|
@value-changed=${this.handleValueChanged}
|
||||||
@slider-moved=${this.handleSliderMoved}
|
@slider-moved=${this.handleSliderMoved}
|
||||||
aria-labelledby=${id}
|
.label=${label}
|
||||||
.unit=${config.unit}
|
.unit=${config.unit}
|
||||||
>
|
>
|
||||||
</ha-control-slider>
|
</ha-control-slider>
|
||||||
@@ -119,7 +119,7 @@ export class DemoHaBarSlider extends LitElement {
|
|||||||
class=${ifDefined(config.class)}
|
class=${ifDefined(config.class)}
|
||||||
@value-changed=${this.handleValueChanged}
|
@value-changed=${this.handleValueChanged}
|
||||||
@slider-moved=${this.handleSliderMoved}
|
@slider-moved=${this.handleSliderMoved}
|
||||||
aria-label=${label}
|
.label=${label}
|
||||||
.unit=${config.unit}
|
.unit=${config.unit}
|
||||||
>
|
>
|
||||||
</ha-control-slider>
|
</ha-control-slider>
|
||||||
@@ -144,7 +144,7 @@ export class DemoHaBarSlider extends LitElement {
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
label {
|
label {
|
||||||
font-weight: 600;
|
font-weight: var(--ha-font-weight-bold);
|
||||||
}
|
}
|
||||||
.custom {
|
.custom {
|
||||||
--control-slider-color: #ffcf4c;
|
--control-slider-color: #ffcf4c;
|
||||||
|
@@ -63,7 +63,7 @@ export class DemoHaControlSwitch extends LitElement {
|
|||||||
@change=${this.handleValueChanged}
|
@change=${this.handleValueChanged}
|
||||||
.pathOn=${mdiLightbulb}
|
.pathOn=${mdiLightbulb}
|
||||||
.pathOff=${mdiLightbulbOff}
|
.pathOff=${mdiLightbulbOff}
|
||||||
aria-labelledby=${id}
|
.label=${label}
|
||||||
?disabled=${config.disabled}
|
?disabled=${config.disabled}
|
||||||
?reversed=${config.reversed}
|
?reversed=${config.reversed}
|
||||||
>
|
>
|
||||||
@@ -84,7 +84,7 @@ export class DemoHaControlSwitch extends LitElement {
|
|||||||
vertical
|
vertical
|
||||||
class=${ifDefined(config.class)}
|
class=${ifDefined(config.class)}
|
||||||
@change=${this.handleValueChanged}
|
@change=${this.handleValueChanged}
|
||||||
aria-label=${label}
|
.label=${label}
|
||||||
.pathOn=${mdiGarageOpen}
|
.pathOn=${mdiGarageOpen}
|
||||||
.pathOff=${mdiGarage}
|
.pathOff=${mdiGarage}
|
||||||
?disabled=${config.disabled}
|
?disabled=${config.disabled}
|
||||||
@@ -112,7 +112,7 @@ export class DemoHaControlSwitch extends LitElement {
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
label {
|
label {
|
||||||
font-weight: 600;
|
font-weight: var(--ha-font-weight-bold);
|
||||||
}
|
}
|
||||||
.custom {
|
.custom {
|
||||||
--control-switch-on-color: var(--green-color);
|
--control-switch-on-color: var(--green-color);
|
||||||
|
@@ -105,8 +105,8 @@ export class DemoHaHsColorPicker extends LitElement {
|
|||||||
width: 400px;
|
width: 400px;
|
||||||
}
|
}
|
||||||
.value {
|
.value {
|
||||||
font-size: 22px;
|
font-size: var(--ha-font-size-xl);
|
||||||
font-weight: bold;
|
font-weight: var(--ha-font-weight-bold);
|
||||||
margin: 0 0 12px 0;
|
margin: 0 0 12px 0;
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
@@ -123,7 +123,7 @@ export class DemoHaSelectBox extends LitElement {
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
label {
|
label {
|
||||||
font-weight: 600;
|
font-weight: var(--ha-font-weight-bold);
|
||||||
margin-bottom: 8px;
|
margin-bottom: 8px;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user