Compare commits
1078 Commits
20191204.1
...
restore-co
Author | SHA1 | Date | |
---|---|---|---|
![]() |
3272c32f87 | ||
![]() |
2c1b25b00b | ||
![]() |
407f305d21 | ||
![]() |
77bd7c37c1 | ||
![]() |
783ea0f5c8 | ||
![]() |
33f1b45f30 | ||
![]() |
e1df50ad3b | ||
![]() |
6a9a4cf65f | ||
![]() |
443634ecf0 | ||
![]() |
2a17870d6d | ||
![]() |
486ed7dcaa | ||
![]() |
19c13096dc | ||
![]() |
49b4271a47 | ||
![]() |
7461d8f806 | ||
![]() |
362236d7df | ||
![]() |
ba384b9eee | ||
![]() |
d94df728e5 | ||
![]() |
d0a53d1760 | ||
![]() |
2e5ec1f0c1 | ||
![]() |
6c8aedfb8b | ||
![]() |
f354e1eb0f | ||
![]() |
49b1e5897e | ||
![]() |
1a58c17180 | ||
![]() |
7fb852893c | ||
![]() |
aa9a354746 | ||
![]() |
78f5429c92 | ||
![]() |
79de8e0f32 | ||
![]() |
70f59eeec6 | ||
![]() |
b75792a3bf | ||
![]() |
5cb7117656 | ||
![]() |
3a5bd7474b | ||
![]() |
304fad3f49 | ||
![]() |
fb929a089c | ||
![]() |
6076a0cdc4 | ||
![]() |
a3736683eb | ||
![]() |
413f1c31bb | ||
![]() |
20baff380b | ||
![]() |
582d159884 | ||
![]() |
9c43c5806d | ||
![]() |
8ad2bf5401 | ||
![]() |
66409f0fa5 | ||
![]() |
68172e006f | ||
![]() |
cf5e808a96 | ||
![]() |
3faebaeb4b | ||
![]() |
6b8cfe661c | ||
![]() |
2fd64af737 | ||
![]() |
050cdf3783 | ||
![]() |
d73b3d77ea | ||
![]() |
acc024bcf9 | ||
![]() |
deb179ad38 | ||
![]() |
bfb11790a2 | ||
![]() |
af23110074 | ||
![]() |
b8e71609db | ||
![]() |
1876b3827f | ||
![]() |
38d3b8d087 | ||
![]() |
c5ef33cc78 | ||
![]() |
7427b209a7 | ||
![]() |
71397e5199 | ||
![]() |
1bc3b3befc | ||
![]() |
872e46a076 | ||
![]() |
ad386c0e22 | ||
![]() |
7e281f66c2 | ||
![]() |
7daafcbe1b | ||
![]() |
c5b223988a | ||
![]() |
6cc9ce573b | ||
![]() |
23192226dd | ||
![]() |
736444201b | ||
![]() |
785f49b005 | ||
![]() |
55dd1f4aa1 | ||
![]() |
6d0490d7d9 | ||
![]() |
06667455ae | ||
![]() |
3640960486 | ||
![]() |
4ad3dbf3e2 | ||
![]() |
10957deb1f | ||
![]() |
0a128db269 | ||
![]() |
6bb3b84377 | ||
![]() |
b8d2c551e0 | ||
![]() |
34e06351fb | ||
![]() |
e179404a9e | ||
![]() |
9c574995ac | ||
![]() |
3f35c603d2 | ||
![]() |
8e0688140e | ||
![]() |
5f81a204f2 | ||
![]() |
df3b70a533 | ||
![]() |
0c57c05a22 | ||
![]() |
c6be3be45a | ||
![]() |
9689db9605 | ||
![]() |
e4607735ff | ||
![]() |
389b7def0b | ||
![]() |
e35bd30ed3 | ||
![]() |
4b8f7e1fe9 | ||
![]() |
5cc4e2bb16 | ||
![]() |
e165a96689 | ||
![]() |
91a655a81e | ||
![]() |
612811e2c2 | ||
![]() |
11bd72915c | ||
![]() |
339221e793 | ||
![]() |
9be864b45e | ||
![]() |
3a453f5843 | ||
![]() |
28e0384b55 | ||
![]() |
dcd6c6f06f | ||
![]() |
28d26065e4 | ||
![]() |
300c8d06c4 | ||
![]() |
d2a1d11d16 | ||
![]() |
6ae717bbfe | ||
![]() |
21296b4224 | ||
![]() |
fafad302ba | ||
![]() |
0c94ad46b2 | ||
![]() |
d9bb40f934 | ||
![]() |
bbc16b6bc8 | ||
![]() |
16154e9d8b | ||
![]() |
61bd536d7b | ||
![]() |
02c798a8bc | ||
![]() |
c37a691b9b | ||
![]() |
23c68d17e8 | ||
![]() |
0a7f610ad3 | ||
![]() |
c9e8bd2e5d | ||
![]() |
a66d2ca1b9 | ||
![]() |
d38a0f0366 | ||
![]() |
29759de021 | ||
![]() |
264759ddf0 | ||
![]() |
91b0bd5b5e | ||
![]() |
a0e2cc7a3a | ||
![]() |
9e1eb41cbe | ||
![]() |
c37eb023b0 | ||
![]() |
840948ba4a | ||
![]() |
8fbdd88b24 | ||
![]() |
512d35d2e0 | ||
![]() |
0321e55a42 | ||
![]() |
a1ee9ad48b | ||
![]() |
1ad1fd28f1 | ||
![]() |
007f8b50b9 | ||
![]() |
6fe8a87cca | ||
![]() |
5f46679d94 | ||
![]() |
18a3f212f3 | ||
![]() |
67a3f5d87b | ||
![]() |
c88439ba2f | ||
![]() |
67e17d4016 | ||
![]() |
b61cf60faf | ||
![]() |
5503853445 | ||
![]() |
259726f5be | ||
![]() |
bec42d941b | ||
![]() |
dcbbaf08f9 | ||
![]() |
349355584a | ||
![]() |
7ce0b34774 | ||
![]() |
dd894758a4 | ||
![]() |
2aa1eb97fd | ||
![]() |
4c43ae7b2f | ||
![]() |
34e516e0be | ||
![]() |
7bd3427e76 | ||
![]() |
6853db693a | ||
![]() |
252ce1e467 | ||
![]() |
221c12bd61 | ||
![]() |
12edd68874 | ||
![]() |
f469753fb1 | ||
![]() |
c894ecd0e6 | ||
![]() |
2153bc536c | ||
![]() |
86bbac430c | ||
![]() |
16ad8a3c01 | ||
![]() |
b2af91c83e | ||
![]() |
4c0810f530 | ||
![]() |
f70130e21f | ||
![]() |
6bb7b01d00 | ||
![]() |
51e7aaa805 | ||
![]() |
54704e53b3 | ||
![]() |
cc46797576 | ||
![]() |
7f1fb6f75f | ||
![]() |
2c2a1d204b | ||
![]() |
581fafdcc9 | ||
![]() |
10358abbec | ||
![]() |
de1ffe67b1 | ||
![]() |
eb2b24d57c | ||
![]() |
825db8a56a | ||
![]() |
577a21fc5c | ||
![]() |
1b2841eef9 | ||
![]() |
845511e322 | ||
![]() |
96ab057853 | ||
![]() |
f85cf0a238 | ||
![]() |
84a2676a9c | ||
![]() |
466a1af902 | ||
![]() |
ebbe7e805f | ||
![]() |
c861ee025e | ||
![]() |
6d0823328d | ||
![]() |
60be14dc77 | ||
![]() |
2d627819d9 | ||
![]() |
cf575f83f5 | ||
![]() |
79935b2d4c | ||
![]() |
d1cceb2013 | ||
![]() |
f5da130d51 | ||
![]() |
8768304ec5 | ||
![]() |
f10a5dcdbe | ||
![]() |
a27428ebcd | ||
![]() |
d19acf17c2 | ||
![]() |
1a0bf861ee | ||
![]() |
db906ad4d0 | ||
![]() |
75ed0f2f99 | ||
![]() |
29ed1144d5 | ||
![]() |
fa445d4066 | ||
![]() |
d10be4ef2d | ||
![]() |
7f66d5b8e9 | ||
![]() |
0c8cd680c2 | ||
![]() |
a7ba1977b4 | ||
![]() |
a960b39235 | ||
![]() |
3febf059ec | ||
![]() |
20203f7bdb | ||
![]() |
a399d76d06 | ||
![]() |
1ca097c5a0 | ||
![]() |
e83ede245d | ||
![]() |
05ac275780 | ||
![]() |
966c0bc06c | ||
![]() |
abf136dd63 | ||
![]() |
b6309cfd16 | ||
![]() |
b69d5e0fa3 | ||
![]() |
5084cde6b9 | ||
![]() |
ca1cc7ed0d | ||
![]() |
808a31db2b | ||
![]() |
44ad75aead | ||
![]() |
0961c9d05e | ||
![]() |
56754b4d43 | ||
![]() |
661779ad4e | ||
![]() |
cf37ebb652 | ||
![]() |
82741e490b | ||
![]() |
5fed28808e | ||
![]() |
321c0cfc84 | ||
![]() |
eba7cedaa6 | ||
![]() |
71492d0467 | ||
![]() |
9630a58ea7 | ||
![]() |
89f6f16ba2 | ||
![]() |
2d646da97f | ||
![]() |
39b5460598 | ||
![]() |
636429ccfa | ||
![]() |
e5abb95f5c | ||
![]() |
c631554eb0 | ||
![]() |
db07eeb916 | ||
![]() |
3216a46e76 | ||
![]() |
ae6243b7bf | ||
![]() |
df002d7a67 | ||
![]() |
e8a0632108 | ||
![]() |
0a92c28bac | ||
![]() |
d419547463 | ||
![]() |
da392912b3 | ||
![]() |
9ebee02727 | ||
![]() |
0bdcfcc42f | ||
![]() |
43623a30bc | ||
![]() |
99e73054a9 | ||
![]() |
108233f3b8 | ||
![]() |
8f2a7c95b3 | ||
![]() |
7fdd525dac | ||
![]() |
7ed24137eb | ||
![]() |
07cd30eaca | ||
![]() |
df8cf66e02 | ||
![]() |
f067bcd877 | ||
![]() |
e11ef55dd8 | ||
![]() |
fa8bd30e83 | ||
![]() |
04a2ff7506 | ||
![]() |
bc68e20041 | ||
![]() |
786da25b9f | ||
![]() |
c3832d56c3 | ||
![]() |
79d1a2f458 | ||
![]() |
f16a674a39 | ||
![]() |
6e38a80efc | ||
![]() |
6a3a1297ad | ||
![]() |
5ca63a8052 | ||
![]() |
8b04df093c | ||
![]() |
d2a5494335 | ||
![]() |
de545e90e2 | ||
![]() |
57ab7e829b | ||
![]() |
6847830575 | ||
![]() |
2084ecc4c6 | ||
![]() |
b0c27e587e | ||
![]() |
1687d90d02 | ||
![]() |
dfd9bf3c64 | ||
![]() |
5a25b9c2f1 | ||
![]() |
bf68101754 | ||
![]() |
487bd8d3fc | ||
![]() |
3ba9c931b9 | ||
![]() |
8484f7595a | ||
![]() |
ee889d59d4 | ||
![]() |
ae10330844 | ||
![]() |
f3e88f6f2e | ||
![]() |
2abfd0392d | ||
![]() |
462c1f94d6 | ||
![]() |
f4710891d0 | ||
![]() |
1fdb6b8034 | ||
![]() |
8029c3d672 | ||
![]() |
61fdee14c6 | ||
![]() |
117e4e468f | ||
![]() |
869ec113f4 | ||
![]() |
00e7b93011 | ||
![]() |
03e581870a | ||
![]() |
b04fe141ac | ||
![]() |
b0168fbb85 | ||
![]() |
75ba343b5e | ||
![]() |
88217473f7 | ||
![]() |
01e5dfc9b3 | ||
![]() |
58869677bd | ||
![]() |
032b01aec1 | ||
![]() |
a47c3fa854 | ||
![]() |
7c6ba1a782 | ||
![]() |
0d08f5413b | ||
![]() |
949cc17a9e | ||
![]() |
607c1a1ef0 | ||
![]() |
db2dab8227 | ||
![]() |
eb4ba4fc78 | ||
![]() |
bf888b1547 | ||
![]() |
c468aab9b2 | ||
![]() |
a0dae802f2 | ||
![]() |
14330fbd93 | ||
![]() |
bf55be7f7f | ||
![]() |
e10987a705 | ||
![]() |
355f40d740 | ||
![]() |
2503fabe1d | ||
![]() |
32c7c0b4f0 | ||
![]() |
301a964a65 | ||
![]() |
49f2fd2af7 | ||
![]() |
4f518cac2c | ||
![]() |
8420f73919 | ||
![]() |
1ef2d3c7f2 | ||
![]() |
fc20fd32f1 | ||
![]() |
13a8bf6993 | ||
![]() |
b2f424a6f8 | ||
![]() |
a9d927551c | ||
![]() |
fdf7b516a0 | ||
![]() |
9a00078169 | ||
![]() |
1dfb632fc4 | ||
![]() |
1c1f9a6a89 | ||
![]() |
2b76b3887e | ||
![]() |
a49c84032b | ||
![]() |
c72bb5b22b | ||
![]() |
24a844dddc | ||
![]() |
ae903973a7 | ||
![]() |
82442bb5ec | ||
![]() |
8786302190 | ||
![]() |
d27a17cf8e | ||
![]() |
b4b90ca59d | ||
![]() |
ecd967a68d | ||
![]() |
8812340768 | ||
![]() |
659da7bf80 | ||
![]() |
91eabf3c38 | ||
![]() |
e355c81e41 | ||
![]() |
d45a674652 | ||
![]() |
f91b46e88c | ||
![]() |
f57754212c | ||
![]() |
97c454aa0d | ||
![]() |
b516f10a35 | ||
![]() |
0ccc788148 | ||
![]() |
5c941e0afb | ||
![]() |
492e4d2df4 | ||
![]() |
66f33ad497 | ||
![]() |
ff81536463 | ||
![]() |
ba0cba1a2b | ||
![]() |
fc7771ec13 | ||
![]() |
4c3069e5b7 | ||
![]() |
ed54a185e4 | ||
![]() |
4f81085d0f | ||
![]() |
8383caf6a6 | ||
![]() |
1b9f224569 | ||
![]() |
05495af74f | ||
![]() |
d62da5e924 | ||
![]() |
57d72bd80f | ||
![]() |
681c05c323 | ||
![]() |
3d20d8b208 | ||
![]() |
4f9d77b906 | ||
![]() |
82f80db558 | ||
![]() |
b17490f0de | ||
![]() |
d33c0b4bd1 | ||
![]() |
7f528c90c3 | ||
![]() |
c4c4782429 | ||
![]() |
5414092309 | ||
![]() |
b632ea6f86 | ||
![]() |
bd98ce8c25 | ||
![]() |
0c1714ef78 | ||
![]() |
ee278f111f | ||
![]() |
47e9eb5a0d | ||
![]() |
baf5dcbd03 | ||
![]() |
2e2915ec09 | ||
![]() |
5f3a6740c1 | ||
![]() |
b17074d68b | ||
![]() |
ac4b2ea70f | ||
![]() |
4e2a9e3d7b | ||
![]() |
75525b9866 | ||
![]() |
1e39f22009 | ||
![]() |
7ba55ab666 | ||
![]() |
0c06517dcc | ||
![]() |
cd1bfe1b20 | ||
![]() |
35c2d8966b | ||
![]() |
cb255ef137 | ||
![]() |
f9d78a95ad | ||
![]() |
14eb496b1d | ||
![]() |
b390e7bed1 | ||
![]() |
903f92f94a | ||
![]() |
ebb20abee0 | ||
![]() |
2253275640 | ||
![]() |
7ddfe3c80b | ||
![]() |
4388d82076 | ||
![]() |
4f70ec7dc2 | ||
![]() |
a71f42366a | ||
![]() |
e9bb9fdafe | ||
![]() |
dd49ea6f20 | ||
![]() |
92de202e0b | ||
![]() |
1d02b69f52 | ||
![]() |
1dcd913c04 | ||
![]() |
471a5f8407 | ||
![]() |
7b97ac2f6f | ||
![]() |
e673d90b3f | ||
![]() |
764234f744 | ||
![]() |
6ca944b7ef | ||
![]() |
c574556deb | ||
![]() |
c04e1adea2 | ||
![]() |
5eb11349fc | ||
![]() |
b3beb7ef85 | ||
![]() |
ec95000fbc | ||
![]() |
53f0c01073 | ||
![]() |
42d5349db7 | ||
![]() |
f36a1bbf4a | ||
![]() |
e9945abf2f | ||
![]() |
71ba192c38 | ||
![]() |
e8a7671c25 | ||
![]() |
17138f78b8 | ||
![]() |
46c6f86d6a | ||
![]() |
ae1c519d3a | ||
![]() |
fd9299cb3d | ||
![]() |
a9be870fd3 | ||
![]() |
34f61fd6dc | ||
![]() |
e568e2ae21 | ||
![]() |
0656343a91 | ||
![]() |
fa2773af9b | ||
![]() |
a438439ce0 | ||
![]() |
da73c9d83d | ||
![]() |
a8f9f7ac7a | ||
![]() |
006d989943 | ||
![]() |
82d6909957 | ||
![]() |
12a7fc9337 | ||
![]() |
0241334656 | ||
![]() |
b217291b04 | ||
![]() |
aa211df0ad | ||
![]() |
8eebf51447 | ||
![]() |
f5d834d130 | ||
![]() |
0f2eae4091 | ||
![]() |
81d2334f48 | ||
![]() |
45384205eb | ||
![]() |
4150ac045d | ||
![]() |
793a704871 | ||
![]() |
9e2606f1c8 | ||
![]() |
4c4549eb37 | ||
![]() |
96f7a4231b | ||
![]() |
c4cf248a1e | ||
![]() |
50717b4d19 | ||
![]() |
da80a3896d | ||
![]() |
cc374e0478 | ||
![]() |
26d27f8be9 | ||
![]() |
4767fcbdfc | ||
![]() |
e1b48dd2a2 | ||
![]() |
087492fc0b | ||
![]() |
525703d376 | ||
![]() |
236bc6aefa | ||
![]() |
ec4c29c52c | ||
![]() |
d5ed1c4c41 | ||
![]() |
dfe808cfb4 | ||
![]() |
da229d9b65 | ||
![]() |
e54d904e4c | ||
![]() |
2e17c96866 | ||
![]() |
ddeb16463d | ||
![]() |
465efa460e | ||
![]() |
c351402556 | ||
![]() |
5f765e8b96 | ||
![]() |
6f556f69d6 | ||
![]() |
2439827eff | ||
![]() |
5f467f82e0 | ||
![]() |
6692fa439a | ||
![]() |
0535247bb3 | ||
![]() |
a0a4fcaf5f | ||
![]() |
454d81facc | ||
![]() |
0bfa8260fa | ||
![]() |
f2124f1c95 | ||
![]() |
451bc2370a | ||
![]() |
0b17642c31 | ||
![]() |
214dc25576 | ||
![]() |
158eddfd44 | ||
![]() |
5daa6dbd25 | ||
![]() |
645ef3e61f | ||
![]() |
3be4b9d79b | ||
![]() |
5dcea51712 | ||
![]() |
6995968d50 | ||
![]() |
c4cb42f3c2 | ||
![]() |
0d4a7a2b3e | ||
![]() |
20cc9c9b42 | ||
![]() |
8a6bd04543 | ||
![]() |
263138a388 | ||
![]() |
e645342131 | ||
![]() |
6e4c707f9e | ||
![]() |
fca286d6c0 | ||
![]() |
5a2e08647f | ||
![]() |
f6dac98abd | ||
![]() |
ddb525f6cd | ||
![]() |
f7ee712456 | ||
![]() |
ff873e2f71 | ||
![]() |
54b57e6222 | ||
![]() |
375abfb95e | ||
![]() |
30a38fa6d1 | ||
![]() |
554c0b692d | ||
![]() |
61ac831882 | ||
![]() |
59e89a0daf | ||
![]() |
1e3950cd1d | ||
![]() |
f514ea453c | ||
![]() |
cc046478e5 | ||
![]() |
a17c1052cd | ||
![]() |
2408f9b8fa | ||
![]() |
6aae1b3378 | ||
![]() |
ed51223226 | ||
![]() |
013808b7f5 | ||
![]() |
af584e1d12 | ||
![]() |
3763d7a1d0 | ||
![]() |
ce92add096 | ||
![]() |
40c94b6596 | ||
![]() |
c894bc2e40 | ||
![]() |
415a4fa1af | ||
![]() |
b9367a33a8 | ||
![]() |
7170f06c08 | ||
![]() |
f2578a58b4 | ||
![]() |
1950656bd5 | ||
![]() |
eed3263c70 | ||
![]() |
02e01626f5 | ||
![]() |
41a2d9604e | ||
![]() |
7d6f188bfc | ||
![]() |
15a144f17a | ||
![]() |
c54f2b66da | ||
![]() |
685a0807d8 | ||
![]() |
0d404e0e37 | ||
![]() |
39bb859f57 | ||
![]() |
90e32b7e45 | ||
![]() |
63a2d9dd18 | ||
![]() |
4982693883 | ||
![]() |
f4211e3fa3 | ||
![]() |
eacf58b5a5 | ||
![]() |
f9349bc731 | ||
![]() |
3840671764 | ||
![]() |
fd62cf02d6 | ||
![]() |
254744cd7d | ||
![]() |
595d04c922 | ||
![]() |
a3969fe2c8 | ||
![]() |
220e4134b7 | ||
![]() |
56e176a6f1 | ||
![]() |
780c15d6b3 | ||
![]() |
55ff848b78 | ||
![]() |
dbe829bc7d | ||
![]() |
8d0508f320 | ||
![]() |
2741bb8b38 | ||
![]() |
16cadd53cf | ||
![]() |
a8d21c6112 | ||
![]() |
6b2e707653 | ||
![]() |
205b7451fa | ||
![]() |
1d3aeec0de | ||
![]() |
ac911dcd31 | ||
![]() |
89a94b3efc | ||
![]() |
71793dcfa5 | ||
![]() |
1e527a8350 | ||
![]() |
262b12eb93 | ||
![]() |
7fb1e699ae | ||
![]() |
9ee647329b | ||
![]() |
cd6dcec644 | ||
![]() |
d8f248c60e | ||
![]() |
2925b930ad | ||
![]() |
127aaba47b | ||
![]() |
8bc8761af6 | ||
![]() |
a88321d243 | ||
![]() |
4e19232960 | ||
![]() |
5b95bdb6b7 | ||
![]() |
0fc59ccb16 | ||
![]() |
a9daf9835a | ||
![]() |
2110d9c3b9 | ||
![]() |
b77e0b8125 | ||
![]() |
5197f102ea | ||
![]() |
447d4604c6 | ||
![]() |
5a84e34f93 | ||
![]() |
fb6d3cccdc | ||
![]() |
fad3cb185b | ||
![]() |
f61ce395f5 | ||
![]() |
17f3299152 | ||
![]() |
17e04589d0 | ||
![]() |
4b2edde81b | ||
![]() |
5d3d766f56 | ||
![]() |
94e2a0dea0 | ||
![]() |
21fe68add0 | ||
![]() |
af6ebea4a3 | ||
![]() |
3c17ee03b6 | ||
![]() |
0c3c007faf | ||
![]() |
330eb0957b | ||
![]() |
02923475e6 | ||
![]() |
01ff97b366 | ||
![]() |
f0a4a99654 | ||
![]() |
02d2368654 | ||
![]() |
e19d07e434 | ||
![]() |
669ed5cb28 | ||
![]() |
785ae4a83d | ||
![]() |
d327045802 | ||
![]() |
785ef19cce | ||
![]() |
f5653d0da5 | ||
![]() |
e0a6d2efe5 | ||
![]() |
9971e2e934 | ||
![]() |
558802c7dd | ||
![]() |
91edcf9b52 | ||
![]() |
f401aa2897 | ||
![]() |
1d0389327f | ||
![]() |
06cd7556f3 | ||
![]() |
3b1f9a5dab | ||
![]() |
f54cd18da4 | ||
![]() |
73e0fd614e | ||
![]() |
9b220cc6ce | ||
![]() |
c7a5f63e33 | ||
![]() |
11192e6065 | ||
![]() |
d83b308100 | ||
![]() |
f67bf6908f | ||
![]() |
2784edc689 | ||
![]() |
8f41e99464 | ||
![]() |
7c2b37e8ca | ||
![]() |
dbdbad2deb | ||
![]() |
e5db86363c | ||
![]() |
b2026c1cd7 | ||
![]() |
b12f29afad | ||
![]() |
04b23388b5 | ||
![]() |
7309a937e8 | ||
![]() |
5dbcd1f726 | ||
![]() |
3338459139 | ||
![]() |
35f17fc1d4 | ||
![]() |
e062940639 | ||
![]() |
ff4d5265c5 | ||
![]() |
906f417436 | ||
![]() |
1c75fe3bb8 | ||
![]() |
283e858576 | ||
![]() |
2b4ab6320b | ||
![]() |
2085260ce7 | ||
![]() |
1f143176ad | ||
![]() |
dd2163a837 | ||
![]() |
0e1eca8a3e | ||
![]() |
9da32880ec | ||
![]() |
15aee6a66a | ||
![]() |
aba74f074a | ||
![]() |
75860508de | ||
![]() |
52160a367a | ||
![]() |
5651a61604 | ||
![]() |
959d8c3181 | ||
![]() |
64ee7456dc | ||
![]() |
814fcf63a8 | ||
![]() |
b72d8cf7d7 | ||
![]() |
8e7ef58715 | ||
![]() |
56bfa01c56 | ||
![]() |
4a0fc3e087 | ||
![]() |
f3c371996f | ||
![]() |
e5467181cb | ||
![]() |
0b3d2ea4ad | ||
![]() |
9648aa3588 | ||
![]() |
1b92cbbf74 | ||
![]() |
9979c046b3 | ||
![]() |
9ad121f9e6 | ||
![]() |
a0900afba3 | ||
![]() |
1cb614c8a8 | ||
![]() |
e63723f39e | ||
![]() |
720bd03173 | ||
![]() |
9e07cf67a5 | ||
![]() |
503dec7345 | ||
![]() |
5a2649a65b | ||
![]() |
1599dc9e16 | ||
![]() |
84dc8188c4 | ||
![]() |
74657ae815 | ||
![]() |
1a3b747d17 | ||
![]() |
802db71400 | ||
![]() |
4f98524258 | ||
![]() |
b17ea09b8b | ||
![]() |
8abbc71e91 | ||
![]() |
1db31fb0f7 | ||
![]() |
e9b5725d7b | ||
![]() |
d3105b6846 | ||
![]() |
196540afc7 | ||
![]() |
2b8b9f8311 | ||
![]() |
b4f0fce600 | ||
![]() |
c6f101a487 | ||
![]() |
54739c7ccd | ||
![]() |
aa2e632df3 | ||
![]() |
f3445d99cf | ||
![]() |
7e48b21767 | ||
![]() |
1d1688093a | ||
![]() |
d392695ab7 | ||
![]() |
5066560411 | ||
![]() |
7fa6686e8c | ||
![]() |
d74fe6ed52 | ||
![]() |
319a3b4943 | ||
![]() |
226e6e9f59 | ||
![]() |
42f311a457 | ||
![]() |
e50ec2e2e2 | ||
![]() |
b72a3361c0 | ||
![]() |
7b057eaa77 | ||
![]() |
d7aaed05b7 | ||
![]() |
c5fe5565bb | ||
![]() |
a1a1763897 | ||
![]() |
724357683c | ||
![]() |
0d6de9fe73 | ||
![]() |
5646045e9e | ||
![]() |
17c7a3bbac | ||
![]() |
8d65eb1fdf | ||
![]() |
2298a55b16 | ||
![]() |
33d65bcefc | ||
![]() |
3cc7deda04 | ||
![]() |
e2de660bec | ||
![]() |
6b1e5a525f | ||
![]() |
93565f0ed9 | ||
![]() |
143d1162b6 | ||
![]() |
788d616fa2 | ||
![]() |
0de9471a5d | ||
![]() |
b229071248 | ||
![]() |
6d145730a5 | ||
![]() |
f02bb67485 | ||
![]() |
52ded635ff | ||
![]() |
a6d73828b8 | ||
![]() |
1d052fa5bb | ||
![]() |
38d758b52f | ||
![]() |
9162e9c318 | ||
![]() |
189ea00768 | ||
![]() |
25d6427aed | ||
![]() |
8a61442cf2 | ||
![]() |
106d405699 | ||
![]() |
1f23e9062f | ||
![]() |
231b498ea5 | ||
![]() |
a256e5abfa | ||
![]() |
028b370ead | ||
![]() |
18abc6adf7 | ||
![]() |
95aa29d6ca | ||
![]() |
5d2242dd16 | ||
![]() |
de8bca6967 | ||
![]() |
12234de20e | ||
![]() |
b41369a2ad | ||
![]() |
6e35c79c14 | ||
![]() |
22e4c0512e | ||
![]() |
3606b8077f | ||
![]() |
3a90a65ba8 | ||
![]() |
e59987a8ed | ||
![]() |
22d8ce0fd9 | ||
![]() |
01eae3876b | ||
![]() |
2e43f390a4 | ||
![]() |
65421fa551 | ||
![]() |
fc88922ce3 | ||
![]() |
52609dded9 | ||
![]() |
6d54496187 | ||
![]() |
2a6c38066d | ||
![]() |
924c7804c9 | ||
![]() |
23f34fa7ae | ||
![]() |
7046cba1f7 | ||
![]() |
4be1040a14 | ||
![]() |
68baeb83cb | ||
![]() |
aa94e45582 | ||
![]() |
2c58a9f802 | ||
![]() |
0a41a4f066 | ||
![]() |
e265d9581c | ||
![]() |
4675579f79 | ||
![]() |
52ae01ea74 | ||
![]() |
099430238c | ||
![]() |
af3626b215 | ||
![]() |
52ea3a5ce8 | ||
![]() |
2ab2ade642 | ||
![]() |
1cc3936ec3 | ||
![]() |
322eef1c0f | ||
![]() |
0964130782 | ||
![]() |
be9ec50e3a | ||
![]() |
da1dd45169 | ||
![]() |
9a7f7f119d | ||
![]() |
b1a414c840 | ||
![]() |
2718ada9f9 | ||
![]() |
46a596ce34 | ||
![]() |
7036cefa72 | ||
![]() |
fb7fbf2dac | ||
![]() |
49b0c8d549 | ||
![]() |
8f9a6bd544 | ||
![]() |
24e4b0b772 | ||
![]() |
1c86bd2f8b | ||
![]() |
363f548f13 | ||
![]() |
51ce481e77 | ||
![]() |
30e5611812 | ||
![]() |
67706a312d | ||
![]() |
f4eb3380b4 | ||
![]() |
73934afc7d | ||
![]() |
9d2a0c0502 | ||
![]() |
9ec75531a8 | ||
![]() |
91bdb8f742 | ||
![]() |
d8ae3439de | ||
![]() |
2d018fff6c | ||
![]() |
7d37dc6cde | ||
![]() |
c60033027d | ||
![]() |
3f7c29a6f6 | ||
![]() |
b2243f480c | ||
![]() |
f5384e8bc8 | ||
![]() |
ecc6fcf862 | ||
![]() |
46cc2aec94 | ||
![]() |
c62a5a6dcd | ||
![]() |
f6b10232ec | ||
![]() |
87559c0938 | ||
![]() |
7903541689 | ||
![]() |
c93e1b0123 | ||
![]() |
e261fafdb3 | ||
![]() |
485e2fde25 | ||
![]() |
6feaf64c90 | ||
![]() |
6b115bf06a | ||
![]() |
f45785fafe | ||
![]() |
ec046bc925 | ||
![]() |
ab5733718b | ||
![]() |
1077fb2945 | ||
![]() |
b7a84cdd60 | ||
![]() |
78102f5882 | ||
![]() |
4ea11bd928 | ||
![]() |
785aefa028 | ||
![]() |
5c2004bcc1 | ||
![]() |
156d944ca1 | ||
![]() |
97a6354a72 | ||
![]() |
49422c3f63 | ||
![]() |
0b8700f725 | ||
![]() |
c5aa000a97 | ||
![]() |
4cdc4765f7 | ||
![]() |
a95290235d | ||
![]() |
fb9d7ac2d8 | ||
![]() |
d48a4e0ac6 | ||
![]() |
d33e035db7 | ||
![]() |
1437b4c4b6 | ||
![]() |
9fce60065b | ||
![]() |
d052b9ede8 | ||
![]() |
8cee5c729e | ||
![]() |
88bdf7c7ec | ||
![]() |
2c006e99f2 | ||
![]() |
e7e8dff0ec | ||
![]() |
981c798e22 | ||
![]() |
4613d8b1f6 | ||
![]() |
ba4e1949c4 | ||
![]() |
cc6686a790 | ||
![]() |
f791412f73 | ||
![]() |
0c8ac17dcb | ||
![]() |
9e11fe868e | ||
![]() |
7d91515bf5 | ||
![]() |
e0565c35ab | ||
![]() |
e5387e5806 | ||
![]() |
8a4c52aeb7 | ||
![]() |
15e7b8117c | ||
![]() |
d1703ba3e8 | ||
![]() |
c977f22047 | ||
![]() |
2e47aa1905 | ||
![]() |
c72105dca3 | ||
![]() |
e01f1cfcac | ||
![]() |
2e4c73c087 | ||
![]() |
c7f7ef28bf | ||
![]() |
aac7dbab58 | ||
![]() |
8518f774d4 | ||
![]() |
cb0d91d124 | ||
![]() |
107f428dd3 | ||
![]() |
7758ddba56 | ||
![]() |
e0376c803f | ||
![]() |
788c490bbc | ||
![]() |
cdf6e9eb75 | ||
![]() |
4aa49f66bc | ||
![]() |
50d0671abe | ||
![]() |
e176357fbf | ||
![]() |
de1b127ac2 | ||
![]() |
1dad7c81da | ||
![]() |
e980e93969 | ||
![]() |
57fc56f836 | ||
![]() |
05113e1809 | ||
![]() |
1bf82f216a | ||
![]() |
004ff58c21 | ||
![]() |
f1a1654371 | ||
![]() |
862044ca23 | ||
![]() |
c54b474838 | ||
![]() |
42cbe863bb | ||
![]() |
ccc42dad79 | ||
![]() |
82ff444cec | ||
![]() |
24c591fbf3 | ||
![]() |
ad676d7fd3 | ||
![]() |
cbe4782d78 | ||
![]() |
3fdcc1c0ea | ||
![]() |
f9d64e51c4 | ||
![]() |
b082828a75 | ||
![]() |
25f5bf0042 | ||
![]() |
f5dec3c6d5 | ||
![]() |
3215437bb8 | ||
![]() |
33176d8f3d | ||
![]() |
f82b62f45c | ||
![]() |
edfdd0da89 | ||
![]() |
33d9bf4660 | ||
![]() |
1479ce9d56 | ||
![]() |
1912bda60d | ||
![]() |
2e25db4d1b | ||
![]() |
ec08b2ef65 | ||
![]() |
2c740cedb8 | ||
![]() |
e3984d7bf9 | ||
![]() |
2f86b6ec3d | ||
![]() |
d10045eac1 | ||
![]() |
41da68290e | ||
![]() |
593a2de07b | ||
![]() |
59540bdf63 | ||
![]() |
616df070a4 | ||
![]() |
ef62f1956b | ||
![]() |
b41f25ef12 | ||
![]() |
ce8caa34f5 | ||
![]() |
3ed538276e | ||
![]() |
c1a29e8091 | ||
![]() |
4e8bf434f1 | ||
![]() |
dd8c568a2c | ||
![]() |
7ab9257f5e | ||
![]() |
7021fd5809 | ||
![]() |
adec2fc2df | ||
![]() |
27ebcc1bda | ||
![]() |
2fb7a31c76 | ||
![]() |
65994e7280 | ||
![]() |
036eedc69d | ||
![]() |
7937714ce6 | ||
![]() |
cdbd51f6f7 | ||
![]() |
d5a8105718 | ||
![]() |
1c9eab7ca0 | ||
![]() |
6e624b394b | ||
![]() |
1cb10694e7 | ||
![]() |
d496b9742f | ||
![]() |
72e5375795 | ||
![]() |
04f8f0f74f | ||
![]() |
82fb622904 | ||
![]() |
95ba1fd0cb | ||
![]() |
c7b3a517e8 | ||
![]() |
523dc881bb | ||
![]() |
1123adc584 | ||
![]() |
15be1688ad | ||
![]() |
0c0e82a3ba | ||
![]() |
8abe8d7615 | ||
![]() |
f95ba4c04c | ||
![]() |
6874788cc0 | ||
![]() |
f77bd79387 | ||
![]() |
67a91b7c19 | ||
![]() |
30211fe61d | ||
![]() |
9de80b2947 | ||
![]() |
b7a3fe6e91 | ||
![]() |
1f38d13b3b | ||
![]() |
ef6e468a7f | ||
![]() |
729a5e385f | ||
![]() |
32fd7a51f4 | ||
![]() |
f3f32c800e | ||
![]() |
1f44b4b5a9 | ||
![]() |
971538e9c2 | ||
![]() |
db9924bd87 | ||
![]() |
74c6b9077a | ||
![]() |
23865c31e6 | ||
![]() |
8641a701cb | ||
![]() |
3ca99e5c90 | ||
![]() |
753804f463 | ||
![]() |
9aedeab4fa | ||
![]() |
fc4e3e90b2 | ||
![]() |
ae8a9940ed | ||
![]() |
a544295167 | ||
![]() |
8a9e149d33 | ||
![]() |
49611e285f | ||
![]() |
def0c51669 | ||
![]() |
572215b359 | ||
![]() |
0f8cf574d3 | ||
![]() |
312f1df368 | ||
![]() |
5bfacb3bf0 | ||
![]() |
2103866c48 | ||
![]() |
61cf1bf1eb | ||
![]() |
9c407caf2c | ||
![]() |
323cf72be3 | ||
![]() |
eeced628b3 | ||
![]() |
38be488f86 | ||
![]() |
83756a338a | ||
![]() |
b9415cb5f0 | ||
![]() |
fd49e26120 | ||
![]() |
3474e92eb7 | ||
![]() |
913299998c | ||
![]() |
d9e522e4d7 | ||
![]() |
22c8e4a455 | ||
![]() |
02fe5144d8 | ||
![]() |
9d333fb557 | ||
![]() |
ef2ca4a07f | ||
![]() |
f74ee76ae2 | ||
![]() |
6fb9a7636d | ||
![]() |
56249110d6 | ||
![]() |
1a2ebabd22 | ||
![]() |
28511d0cbf | ||
![]() |
b01bdec973 | ||
![]() |
ecee5980af | ||
![]() |
3e1b85e6b5 | ||
![]() |
ce94d1ea7c | ||
![]() |
62654ec598 | ||
![]() |
fbe4550c78 | ||
![]() |
a082667c24 | ||
![]() |
fc29b519ae | ||
![]() |
c391b19c0e | ||
![]() |
8c49e3c4ef | ||
![]() |
67022b9ffc | ||
![]() |
eb9023595d | ||
![]() |
8262d1617f | ||
![]() |
581a803cc4 | ||
![]() |
5ff8fe68ba | ||
![]() |
a2a039ebc5 | ||
![]() |
1064aed1b0 | ||
![]() |
7025592e8e | ||
![]() |
4966354b62 | ||
![]() |
68d6faf4af | ||
![]() |
e3346483b9 | ||
![]() |
e8fb79e5ce | ||
![]() |
d612162ab1 | ||
![]() |
86f8ef3a70 | ||
![]() |
0e43435362 | ||
![]() |
aaefe0b09f | ||
![]() |
bc731a9dc3 | ||
![]() |
da25701dca | ||
![]() |
21ae483dc9 | ||
![]() |
38b6e9ca10 | ||
![]() |
d31245866c | ||
![]() |
4e08d8f3b3 | ||
![]() |
1e717ab33e | ||
![]() |
995fb4974e | ||
![]() |
ffb76132f8 | ||
![]() |
acba3af54b | ||
![]() |
40ac456937 | ||
![]() |
5c32413bf7 | ||
![]() |
22792c70c5 | ||
![]() |
a8ed87298a | ||
![]() |
b15270dfe2 | ||
![]() |
58ad949bc8 | ||
![]() |
adce40de56 | ||
![]() |
0f487ae4bf | ||
![]() |
2848e3a63b | ||
![]() |
5a172a64c5 | ||
![]() |
433aa16ea6 | ||
![]() |
50cb8cf3cc | ||
![]() |
4e5406b27b | ||
![]() |
80eb80619a | ||
![]() |
bf71b3a869 | ||
![]() |
ff270c4b7d | ||
![]() |
8b659498b6 | ||
![]() |
5415068917 | ||
![]() |
357a67c00d | ||
![]() |
cbe4269320 | ||
![]() |
fbd5185ce2 | ||
![]() |
a33cf97e2c | ||
![]() |
7e7da26543 | ||
![]() |
79058e893b | ||
![]() |
e9231fc17e | ||
![]() |
2eb548bb74 | ||
![]() |
08baf8a757 | ||
![]() |
f02fa6a94b | ||
![]() |
2ed6d0e73c | ||
![]() |
35d9b2ac3c | ||
![]() |
18d09c6f04 | ||
![]() |
70b81de49d | ||
![]() |
f0808c1f54 | ||
![]() |
e779f0747e | ||
![]() |
bdd18775c3 | ||
![]() |
711d51c022 | ||
![]() |
1b0d8bba29 | ||
![]() |
2988cc512f | ||
![]() |
a2f8e5f3e7 | ||
![]() |
680bf06a4b | ||
![]() |
ff0b1881e2 | ||
![]() |
de653e1f7b | ||
![]() |
bb41170765 | ||
![]() |
0ed2bc93aa | ||
![]() |
04770f8ee2 | ||
![]() |
15a2790b9f | ||
![]() |
83880791b1 | ||
![]() |
4dca3289f6 | ||
![]() |
083a3ebfc4 | ||
![]() |
6117c4e989 | ||
![]() |
609763e658 | ||
![]() |
2c57ab60f1 | ||
![]() |
dd17a153d2 | ||
![]() |
c2d551bb7c | ||
![]() |
e0b1921108 | ||
![]() |
fcf39ceb96 | ||
![]() |
3cc979a077 | ||
![]() |
d1990a4bac | ||
![]() |
cbba1849e2 | ||
![]() |
43393d1647 | ||
![]() |
b47ee1051c | ||
![]() |
393adacc9e | ||
![]() |
073428849e | ||
![]() |
e6ac0258e3 |
@@ -1,80 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": ["airbnb-base", "prettier"],
|
|
||||||
"parserOptions": {
|
|
||||||
"ecmaVersion": "2020",
|
|
||||||
"ecmaFeatures": {
|
|
||||||
"jsx": true,
|
|
||||||
"modules": true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"settings": {
|
|
||||||
"react": {
|
|
||||||
"pragma": "h",
|
|
||||||
"version": "15.0"
|
|
||||||
},
|
|
||||||
"import/resolver": {
|
|
||||||
"webpack": {
|
|
||||||
"config": "webpack.config.js"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"globals": {
|
|
||||||
"__DEV__": false,
|
|
||||||
"__DEMO__": false,
|
|
||||||
"__BUILD__": false,
|
|
||||||
"__VERSION__": false,
|
|
||||||
"__STATIC_PATH__": false,
|
|
||||||
"Polymer": true,
|
|
||||||
"webkitSpeechRecognition": false,
|
|
||||||
"ResizeObserver": false
|
|
||||||
},
|
|
||||||
"env": {
|
|
||||||
"browser": true,
|
|
||||||
"mocha": true
|
|
||||||
},
|
|
||||||
"rules": {
|
|
||||||
"class-methods-use-this": 0,
|
|
||||||
"new-cap": 0,
|
|
||||||
"prefer-template": 0,
|
|
||||||
"object-shorthand": 0,
|
|
||||||
"func-names": 0,
|
|
||||||
"prefer-arrow-callback": 0,
|
|
||||||
"no-underscore-dangle": 0,
|
|
||||||
"no-var": 0,
|
|
||||||
"strict": 0,
|
|
||||||
"prefer-spread": 0,
|
|
||||||
"no-plusplus": 0,
|
|
||||||
"no-bitwise": 0,
|
|
||||||
"comma-dangle": 0,
|
|
||||||
"vars-on-top": 0,
|
|
||||||
"no-continue": 0,
|
|
||||||
"no-param-reassign": 0,
|
|
||||||
"no-multi-assign": 0,
|
|
||||||
"radix": 0,
|
|
||||||
"no-alert": 0,
|
|
||||||
"no-return-await": 0,
|
|
||||||
"prefer-destructuring": 0,
|
|
||||||
"no-restricted-globals": [2, "event"],
|
|
||||||
"prefer-promise-reject-errors": 0,
|
|
||||||
"import/prefer-default-export": 0,
|
|
||||||
"import/no-unresolved": 0,
|
|
||||||
"import/extensions": [2, "ignorePackages"],
|
|
||||||
"object-curly-newline": 0,
|
|
||||||
"default-case": 0,
|
|
||||||
"react/jsx-no-bind": [2, { "ignoreRefs": true }],
|
|
||||||
"react/jsx-no-duplicate-props": 2,
|
|
||||||
"react/self-closing-comp": 2,
|
|
||||||
"react/prefer-es6-class": 2,
|
|
||||||
"react/no-string-refs": 2,
|
|
||||||
"react/require-render-return": 2,
|
|
||||||
"react/no-find-dom-node": 2,
|
|
||||||
"react/no-is-mounted": 2,
|
|
||||||
"react/jsx-no-comment-textnodes": 2,
|
|
||||||
"react/jsx-no-undef": 2,
|
|
||||||
"react/jsx-uses-react": 2,
|
|
||||||
"react/jsx-uses-vars": 2,
|
|
||||||
"no-restricted-syntax": [0, "ForOfStatement"],
|
|
||||||
"prettier/prettier": "error"
|
|
||||||
},
|
|
||||||
"plugins": ["react", "prettier"]
|
|
||||||
}
|
|
@@ -1,12 +1,88 @@
|
|||||||
{
|
{
|
||||||
"extends": "./.eslintrc-hound.json",
|
"extends": [
|
||||||
"plugins": ["react"],
|
"plugin:@typescript-eslint/recommended",
|
||||||
|
"airbnb-typescript/base",
|
||||||
|
"plugin:wc/recommended",
|
||||||
|
"plugin:lit/recommended",
|
||||||
|
"prettier",
|
||||||
|
"prettier/@typescript-eslint"
|
||||||
|
],
|
||||||
|
"parser": "@typescript-eslint/parser",
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaVersion": 2020,
|
||||||
|
"ecmaFeatures": {
|
||||||
|
"modules": true
|
||||||
|
},
|
||||||
|
"sourceType": "module",
|
||||||
|
"project": "./tsconfig.json"
|
||||||
|
},
|
||||||
|
"settings": {
|
||||||
|
"import/resolver": {
|
||||||
|
"webpack": {
|
||||||
|
"config": "./webpack.config.js"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"globals": {
|
||||||
|
"__DEV__": false,
|
||||||
|
"__DEMO__": false,
|
||||||
|
"__BUILD__": false,
|
||||||
|
"__VERSION__": false,
|
||||||
|
"__STATIC_PATH__": false,
|
||||||
|
"Polymer": true,
|
||||||
|
"webkitSpeechRecognition": false,
|
||||||
|
"ResizeObserver": false
|
||||||
|
},
|
||||||
"env": {
|
"env": {
|
||||||
"browser": true
|
"browser": true,
|
||||||
|
"es6": true
|
||||||
},
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
"import/no-unresolved": 2,
|
"class-methods-use-this": 0,
|
||||||
"linebreak-style": 0,
|
"new-cap": 0,
|
||||||
"implicit-arrow-linebreak": 0
|
"prefer-template": 0,
|
||||||
}
|
"object-shorthand": 0,
|
||||||
|
"func-names": 0,
|
||||||
|
"prefer-arrow-callback": 0,
|
||||||
|
"no-underscore-dangle": 0,
|
||||||
|
"no-var": 0,
|
||||||
|
"strict": 0,
|
||||||
|
"prefer-spread": 0,
|
||||||
|
"no-plusplus": 0,
|
||||||
|
"no-bitwise": 0,
|
||||||
|
"comma-dangle": 0,
|
||||||
|
"vars-on-top": 0,
|
||||||
|
"no-continue": 0,
|
||||||
|
"no-param-reassign": 0,
|
||||||
|
"no-multi-assign": 0,
|
||||||
|
"radix": 0,
|
||||||
|
"no-alert": 0,
|
||||||
|
"no-return-await": 0,
|
||||||
|
"no-nested-ternary": 0,
|
||||||
|
"prefer-destructuring": 0,
|
||||||
|
"no-restricted-globals": [2, "event"],
|
||||||
|
"prefer-promise-reject-errors": 0,
|
||||||
|
"import/order": 0,
|
||||||
|
"import/prefer-default-export": 0,
|
||||||
|
"import/no-unresolved": 0,
|
||||||
|
"import/no-cycle": 0,
|
||||||
|
"import/extensions": [
|
||||||
|
2,
|
||||||
|
"ignorePackages",
|
||||||
|
{ "ts": "never", "js": "never" }
|
||||||
|
],
|
||||||
|
"no-restricted-syntax": ["error", "LabeledStatement", "WithStatement"],
|
||||||
|
"object-curly-newline": 0,
|
||||||
|
"default-case": 0,
|
||||||
|
"wc/no-self-class": 0,
|
||||||
|
"@typescript-eslint/camelcase": 0,
|
||||||
|
"@typescript-eslint/ban-ts-ignore": 0,
|
||||||
|
"@typescript-eslint/no-use-before-define": 0,
|
||||||
|
"@typescript-eslint/no-non-null-assertion": 0,
|
||||||
|
"@typescript-eslint/no-explicit-any": 0,
|
||||||
|
"@typescript-eslint/no-unused-vars": 0,
|
||||||
|
"@typescript-eslint/explicit-function-return-type": 0
|
||||||
|
},
|
||||||
|
"plugins": ["disable", "import", "lit", "prettier", "@typescript-eslint"],
|
||||||
|
"processor": "disable/disable"
|
||||||
}
|
}
|
||||||
|
1
.gitattributes
vendored
@@ -11,3 +11,4 @@
|
|||||||
*.mp3 binary
|
*.mp3 binary
|
||||||
|
|
||||||
demo/public/api/camera_proxy_stream/* binary
|
demo/public/api/camera_proxy_stream/* binary
|
||||||
|
demo/public/api/media_player_proxy/* binary
|
||||||
|
100
.github/ISSUE_TEMPLATE/BUG_REPORT.md
vendored
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
---
|
||||||
|
name: Report a bug with the UI, Frontend or Lovelace
|
||||||
|
about: Report an issue related to the Home Assistant frontend.
|
||||||
|
labels: bug
|
||||||
|
---
|
||||||
|
|
||||||
|
<!-- READ THIS FIRST:
|
||||||
|
- If you need additional help with this template please refer to https://www.home-assistant.io/help/reporting_issues/
|
||||||
|
- Make sure you are running the latest version of Home Assistant before reporting an issue: https://github.com/home-assistant/home-assistant/releases
|
||||||
|
- Do not report issues for custom Lovelace cards.
|
||||||
|
- Provide as many details as possible. Paste logs, configuration samples and code into the backticks.
|
||||||
|
DO NOT DELETE ANY TEXT from this template! Otherwise, your issue may be closed without comment.
|
||||||
|
-->
|
||||||
|
|
||||||
|
## Checklist
|
||||||
|
|
||||||
|
- [ ] I have updated to the latest available Home Assistant version.
|
||||||
|
- [ ] I have cleared the cache of my browser.
|
||||||
|
- [ ] I have tried a different browser to see if it is related to my browser.
|
||||||
|
|
||||||
|
## The problem
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Describe the issue you are experiencing here to communicate to the
|
||||||
|
maintainers. Tell us about the current behavior.
|
||||||
|
If possible provide a screenshot with a description.
|
||||||
|
-->
|
||||||
|
|
||||||
|
## Expected behavior
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Describe what you expected to happen or it should look/behave.
|
||||||
|
If possible provide a screenshot with a description.
|
||||||
|
-->
|
||||||
|
|
||||||
|
## Steps to reproduce
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Provide steps for us, that helps reproducing your issue.
|
||||||
|
For example:
|
||||||
|
1. Add a climate integration
|
||||||
|
2. Navigate to Lovelace
|
||||||
|
3. Click more info of the climate entity
|
||||||
|
4. Set the HVAC action to heat
|
||||||
|
5. Set the temperature higher than the current temperature
|
||||||
|
6. Set the HVAC action to cool
|
||||||
|
-->
|
||||||
|
|
||||||
|
## Environment
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Provide details about the versions you are using, which helps us reproducing
|
||||||
|
and finding the issue quicker. Version information is found in the
|
||||||
|
Home Assistant frontend: Developer tools -> Info.
|
||||||
|
|
||||||
|
Browser version and operating system is important! Please try to replicate
|
||||||
|
your issue in a different browser and be sure to include your findings.
|
||||||
|
-->
|
||||||
|
|
||||||
|
- Home Assistant release with the issue:
|
||||||
|
- Last working Home Assistant release (if known):
|
||||||
|
- Browser and browser version:
|
||||||
|
- Operating system:
|
||||||
|
|
||||||
|
## State of relevant entities
|
||||||
|
|
||||||
|
<!--
|
||||||
|
If your issue is about how an entity is shown in the UI, please add the state
|
||||||
|
and attributes for all situations with a screenshot of the UI.
|
||||||
|
You can find this information at `/developer-tools/state`
|
||||||
|
-->
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
## Problem-relevant configuration
|
||||||
|
|
||||||
|
<!--
|
||||||
|
An example configuration that caused the problem for you. Fill this out even
|
||||||
|
if it seems unimportant to you. Please be sure to remove personal information
|
||||||
|
like passwords, private URLs and other credentials.
|
||||||
|
-->
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
## Javascript errors shown in your browser console/inspector
|
||||||
|
|
||||||
|
<!--
|
||||||
|
If you come across any javascript or other error logs, e.g., in your browser
|
||||||
|
console/inspector please provide them.
|
||||||
|
-->
|
||||||
|
|
||||||
|
```txt
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
## Additional information
|
26
.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md
vendored
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
---
|
||||||
|
name: Request a feature for the UI, Frontend or Lovelace
|
||||||
|
about: Request an new feature for the Home Assistant frontend.
|
||||||
|
labels: feature request
|
||||||
|
---
|
||||||
|
|
||||||
|
<!--
|
||||||
|
DO NOT DELETE ANY TEXT from this template!
|
||||||
|
Otherwise, your request may be closed without comment.
|
||||||
|
-->
|
||||||
|
|
||||||
|
## The request
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Describe to our maintainers, the feature you would like to be added.
|
||||||
|
Please be clear and concise and, if possible, provide a screenshot or mockup.
|
||||||
|
-->
|
||||||
|
|
||||||
|
## The alternatives
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Are you currently using, or have you considered alternatives?
|
||||||
|
If so, could you please describe those?
|
||||||
|
-->
|
||||||
|
|
||||||
|
## Additional information
|
78
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -1,78 +0,0 @@
|
|||||||
---
|
|
||||||
name: Bug report
|
|
||||||
about: Create a report to help us improve
|
|
||||||
title: ""
|
|
||||||
labels: bug
|
|
||||||
assignees: ""
|
|
||||||
---
|
|
||||||
|
|
||||||
<!-- READ THIS FIRST:
|
|
||||||
- If you need additional help with this template please refer to https://www.home-assistant.io/help/reporting_issues/
|
|
||||||
- Make sure you are running the latest version of Home Assistant before reporting an issue: https://github.com/home-assistant/home-assistant/releases
|
|
||||||
- Provide as many details as possible. Do not delete any text from this template!
|
|
||||||
-->
|
|
||||||
|
|
||||||
**Checklist:**
|
|
||||||
|
|
||||||
- [ ] I updated to the latest version available
|
|
||||||
- [ ] I cleared the cache of my browser
|
|
||||||
|
|
||||||
**Home Assistant release with the issue:**
|
|
||||||
|
|
||||||
<!--
|
|
||||||
- Frontend -> Developer tools -> Info
|
|
||||||
- Or use this command: hass --version
|
|
||||||
-->
|
|
||||||
|
|
||||||
**Last working Home Assistant release (if known):**
|
|
||||||
|
|
||||||
**UI (States or Lovelace UI?):**
|
|
||||||
|
|
||||||
<!--
|
|
||||||
- Frontend -> Developer tools -> Info
|
|
||||||
-->
|
|
||||||
|
|
||||||
**Browser and Operating System:**
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Provide details about what browser (and version) you are seeing the issue in. And also which operating system this is on. If possible try to replicate the issue in other browsers and include your findings here.
|
|
||||||
-->
|
|
||||||
|
|
||||||
**Description of problem:**
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Explain what the issue is, and what is the current behaviour. If possible provide a screenshot with a description.
|
|
||||||
-->
|
|
||||||
|
|
||||||
**Expected behaviour:**
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Explain how things should look/behave. If possible provide a screenshot with a description.
|
|
||||||
-->
|
|
||||||
|
|
||||||
**Relevant config:**
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Give the config of both the integration that is used, the Lovelace config, scene, automation or otherwise relevant configuration.
|
|
||||||
-->
|
|
||||||
|
|
||||||
**Steps to reproduce this problem:**
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Sum up all steps that are necesarry to reproduce this bug.
|
|
||||||
For example:
|
|
||||||
1. Add a climate integration
|
|
||||||
2. Navigate to Lovelace
|
|
||||||
3. Click more info of the climate entity
|
|
||||||
4. Set the hvac action to heat
|
|
||||||
5. Set the temperature higher than the current temperature
|
|
||||||
6. Set the hvac action to cool
|
|
||||||
-->
|
|
||||||
|
|
||||||
**Javascript errors shown in the web inspector (if applicable):**
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
**Additional information:**
|
|
14
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
blank_issues_enabled: false
|
||||||
|
contact_links:
|
||||||
|
- name: Report a bug that is NOT related to the UI, Frontend or Lovelace
|
||||||
|
url: https://github.com/home-assistant/core/issues
|
||||||
|
about: This is the issue tracker for our frontend. Please report other issues with the backend repository.
|
||||||
|
- name: Report incorrect or missing information on our website
|
||||||
|
url: https://github.com/home-assistant/home-assistant.io/issues
|
||||||
|
about: Our documentation has its own issue tracker. Please report issues with the website there.
|
||||||
|
- name: I have a question or need support
|
||||||
|
url: https://www.home-assistant.io/help
|
||||||
|
about: We use GitHub for tracking bugs, check our website for resources on getting help.
|
||||||
|
- name: I'm unsure where to go
|
||||||
|
url: https://www.home-assistant.io/join-chat
|
||||||
|
about: If you are unsure where to go, then joining our chat is recommended; Just ask!
|
19
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@@ -1,19 +0,0 @@
|
|||||||
---
|
|
||||||
name: Feature request
|
|
||||||
about: Suggest an idea for this project
|
|
||||||
title: ""
|
|
||||||
labels: feature request
|
|
||||||
assignees: ""
|
|
||||||
---
|
|
||||||
|
|
||||||
**Is your feature request related to a problem? Please describe.**
|
|
||||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
|
||||||
|
|
||||||
**Describe the solution you'd like**
|
|
||||||
A clear and concise description of what you want to happen.
|
|
||||||
|
|
||||||
**Describe alternatives you've considered**
|
|
||||||
A clear and concise description of any alternative solutions or features you've considered.
|
|
||||||
|
|
||||||
**Additional context**
|
|
||||||
Add any other context or screenshots about the feature request here.
|
|
83
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
<!--
|
||||||
|
You are amazing! Thanks for contributing to our project!
|
||||||
|
Please, DO NOT DELETE ANY TEXT from this template! (unless instructed).
|
||||||
|
-->
|
||||||
|
|
||||||
|
## Breaking change
|
||||||
|
|
||||||
|
<!--
|
||||||
|
If your PR contains a breaking change for existing users, it is important
|
||||||
|
to tell them what breaks, how to make it work again and why we did this.
|
||||||
|
This piece of text is published with the release notes, so it helps if you
|
||||||
|
write it towards our users, not us.
|
||||||
|
Note: Remove this section if this PR is NOT a breaking change.
|
||||||
|
-->
|
||||||
|
|
||||||
|
## Proposed change
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Describe the big picture of your changes here to communicate to the
|
||||||
|
maintainers why we should accept this pull request. If it fixes a bug
|
||||||
|
or resolves a feature request, be sure to link to that issue in the
|
||||||
|
additional information section.
|
||||||
|
-->
|
||||||
|
|
||||||
|
## Type of change
|
||||||
|
|
||||||
|
<!--
|
||||||
|
What type of change does your PR introduce to the Home Assistant frontend?
|
||||||
|
NOTE: Please, check only 1! box!
|
||||||
|
If your PR requires multiple boxes to be checked, you'll most likely need to
|
||||||
|
split it into multiple PRs. This makes things easier and faster to code review.
|
||||||
|
-->
|
||||||
|
|
||||||
|
- [ ] Dependency upgrade
|
||||||
|
- [ ] Bugfix (non-breaking change which fixes an issue)
|
||||||
|
- [ ] New feature (thank you!)
|
||||||
|
- [ ] Breaking change (fix/feature causing existing functionality to break)
|
||||||
|
- [ ] Code quality improvements to existing code or addition of tests
|
||||||
|
|
||||||
|
## Example configuration
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Supplying a configuration snippet, makes it easier for a maintainer to test
|
||||||
|
your PR.
|
||||||
|
-->
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
## Additional information
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Details are important, and help maintainers processing your PR.
|
||||||
|
Please be sure to fill out additional details, if applicable.
|
||||||
|
-->
|
||||||
|
|
||||||
|
- This PR fixes or closes issue: fixes #
|
||||||
|
- This PR is related to issue:
|
||||||
|
- Link to documentation pull request:
|
||||||
|
|
||||||
|
## Checklist
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Put an `x` in the boxes that apply. You can also fill these out after
|
||||||
|
creating the PR. If you're unsure about any of them, don't hesitate to ask.
|
||||||
|
We're here to help! This is simply a reminder of what we are going to look
|
||||||
|
for before merging your code.
|
||||||
|
-->
|
||||||
|
|
||||||
|
- [ ] The code change is tested and works locally.
|
||||||
|
- [ ] There is no commented out code in this PR.
|
||||||
|
- [ ] Tests have been added to verify that the new code works.
|
||||||
|
|
||||||
|
If user exposed functionality or configuration variables are added/changed:
|
||||||
|
|
||||||
|
- [ ] Documentation added/updated for [www.home-assistant.io][docs-repository]
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Thank you for contributing <3
|
||||||
|
-->
|
||||||
|
|
||||||
|
[docs-repository]: https://github.com/home-assistant/home-assistant.io
|
27
.github/lock.yml
vendored
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
# Configuration for Lock Threads - https://github.com/dessant/lock-threads
|
||||||
|
|
||||||
|
# Number of days of inactivity before a closed issue or pull request is locked
|
||||||
|
daysUntilLock: 1
|
||||||
|
|
||||||
|
# Skip issues and pull requests created before a given timestamp. Timestamp must
|
||||||
|
# follow ISO 8601 (`YYYY-MM-DD`). Set to `false` to disable
|
||||||
|
skipCreatedBefore: 2020-01-01
|
||||||
|
|
||||||
|
# Issues and pull requests with these labels will be ignored. Set to `[]` to disable
|
||||||
|
exemptLabels: []
|
||||||
|
|
||||||
|
# Label to add before locking, such as `outdated`. Set to `false` to disable
|
||||||
|
lockLabel: false
|
||||||
|
|
||||||
|
# Comment to post before locking. Set to `false` to disable
|
||||||
|
lockComment: false
|
||||||
|
|
||||||
|
# Assign `resolved` as the reason for locking. Set to `false` to disable
|
||||||
|
setLockReason: false
|
||||||
|
|
||||||
|
# Limit to only `issues` or `pulls`
|
||||||
|
only: pulls
|
||||||
|
|
||||||
|
# Optionally, specify configuration settings just for `issues` or `pulls`
|
||||||
|
issues:
|
||||||
|
daysUntilLock: 30
|
56
.github/stale.yml
vendored
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
# Configuration for probot-stale - https://github.com/probot/stale
|
||||||
|
|
||||||
|
# Number of days of inactivity before an Issue or Pull Request becomes stale
|
||||||
|
daysUntilStale: 90
|
||||||
|
|
||||||
|
# Number of days of inactivity before an Issue or Pull Request with the stale label is closed.
|
||||||
|
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
|
||||||
|
daysUntilClose: 7
|
||||||
|
|
||||||
|
# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled)
|
||||||
|
onlyLabels: []
|
||||||
|
|
||||||
|
# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
|
||||||
|
exemptLabels:
|
||||||
|
- feature request
|
||||||
|
- Help wanted
|
||||||
|
- to do
|
||||||
|
|
||||||
|
# Set to true to ignore issues in a project (defaults to false)
|
||||||
|
exemptProjects: true
|
||||||
|
|
||||||
|
# Set to true to ignore issues in a milestone (defaults to false)
|
||||||
|
exemptMilestones: true
|
||||||
|
|
||||||
|
# Set to true to ignore issues with an assignee (defaults to false)
|
||||||
|
exemptAssignees: false
|
||||||
|
|
||||||
|
# Label to use when marking as stale
|
||||||
|
staleLabel: stale
|
||||||
|
|
||||||
|
# Comment to post when marking as stale. Set to `false` to disable
|
||||||
|
markComment: >
|
||||||
|
There hasn't been any activity on this issue recently. Due to the high number
|
||||||
|
of incoming GitHub notifications, we have to clean some of the old issues,
|
||||||
|
as many of them have already been resolved with the latest updates.
|
||||||
|
|
||||||
|
Please make sure to update to the latest Home Assistant version and check
|
||||||
|
if that solves the issue. Let us know if that works for you by adding a
|
||||||
|
comment 👍
|
||||||
|
|
||||||
|
This issue now has been marked as stale and will be closed if no further
|
||||||
|
activity occurs. Thank you for your contributions.
|
||||||
|
|
||||||
|
# Comment to post when removing the stale label.
|
||||||
|
# unmarkComment: >
|
||||||
|
# Your comment here.
|
||||||
|
|
||||||
|
# Comment to post when closing a stale Issue or Pull Request.
|
||||||
|
# closeComment: >
|
||||||
|
# Your comment here.
|
||||||
|
|
||||||
|
# Limit the number of actions per hour, from 1-30. Default is 30
|
||||||
|
limitPerRun: 30
|
||||||
|
|
||||||
|
# Limit to only `issues` or `pulls`
|
||||||
|
only: issues
|
125
.github/workflows/ci.yaml
vendored
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- dev
|
||||||
|
- master
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- dev
|
||||||
|
- master
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check out files from GitHub
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Setting up Node.js
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: 12.x
|
||||||
|
- name: Get yarn cache path
|
||||||
|
id: yarn-cache-dir-path
|
||||||
|
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||||
|
- name: Fetching Yarn cache
|
||||||
|
uses: actions/cache@v1
|
||||||
|
with:
|
||||||
|
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||||
|
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-yarn-
|
||||||
|
- name: Install dependencies
|
||||||
|
run: yarn install
|
||||||
|
env:
|
||||||
|
CI: true
|
||||||
|
- name: Build icons
|
||||||
|
run: ./node_modules/.bin/gulp gen-icons-json
|
||||||
|
- name: Build translations
|
||||||
|
run: ./node_modules/.bin/gulp build-translations
|
||||||
|
- name: Run eslint
|
||||||
|
run: ./node_modules/.bin/eslint '{**/src,src}/**/*.{js,ts,html}' --ignore-path .gitignore
|
||||||
|
- name: Run tsc
|
||||||
|
run: ./node_modules/.bin/tsc
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check out files from GitHub
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Setting up Node.js
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: 12.x
|
||||||
|
- name: Get yarn cache path
|
||||||
|
id: yarn-cache-dir-path
|
||||||
|
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||||
|
- name: Fetching Yarn cache
|
||||||
|
uses: actions/cache@v1
|
||||||
|
with:
|
||||||
|
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||||
|
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-yarn-
|
||||||
|
- name: Install dependencies
|
||||||
|
run: yarn install
|
||||||
|
env:
|
||||||
|
CI: true
|
||||||
|
- name: Run Mocha
|
||||||
|
run: npm run mocha
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [lint, test]
|
||||||
|
steps:
|
||||||
|
- name: Check out files from GitHub
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Setting up Node.js
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: 12.x
|
||||||
|
- name: Get yarn cache path
|
||||||
|
id: yarn-cache-dir-path
|
||||||
|
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||||
|
- name: Fetching Yarn cache
|
||||||
|
uses: actions/cache@v1
|
||||||
|
with:
|
||||||
|
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||||
|
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-yarn-
|
||||||
|
- name: Install dependencies
|
||||||
|
run: yarn install
|
||||||
|
env:
|
||||||
|
CI: true
|
||||||
|
- name: Build Application
|
||||||
|
run: ./node_modules/.bin/gulp build-app
|
||||||
|
env:
|
||||||
|
IS_TEST: "true"
|
||||||
|
supervisor:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [lint, test]
|
||||||
|
steps:
|
||||||
|
- name: Check out files from GitHub
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Setting up Node.js
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: 12.x
|
||||||
|
- name: Get yarn cache path
|
||||||
|
id: yarn-cache-dir-path
|
||||||
|
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||||
|
- name: Fetching Yarn cache
|
||||||
|
uses: actions/cache@v1
|
||||||
|
with:
|
||||||
|
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||||
|
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-yarn-
|
||||||
|
- name: Install dependencies
|
||||||
|
run: yarn install
|
||||||
|
env:
|
||||||
|
CI: true
|
||||||
|
- name: Build Application
|
||||||
|
run: ./node_modules/.bin/gulp build-hassio
|
||||||
|
env:
|
||||||
|
IS_TEST: "true"
|
39
.github/workflows/demo.yaml
vendored
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
name: Demo
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- dev
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check out files from GitHub
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Setting up Node.js
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: 12.x
|
||||||
|
- name: Get yarn cache path
|
||||||
|
id: yarn-cache-dir-path
|
||||||
|
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||||
|
- name: Fetching Yarn cache
|
||||||
|
uses: actions/cache@v1
|
||||||
|
with:
|
||||||
|
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||||
|
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-yarn-
|
||||||
|
- name: Install dependencies
|
||||||
|
run: yarn install
|
||||||
|
env:
|
||||||
|
CI: true
|
||||||
|
- name: Build Demo
|
||||||
|
run: ./node_modules/.bin/gulp build-demo
|
||||||
|
- name: Deploy to Netlify
|
||||||
|
uses: netlify/actions/cli@master
|
||||||
|
env:
|
||||||
|
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||||
|
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_DEMO_DEV_SITE_ID }}
|
||||||
|
with:
|
||||||
|
args: deploy --dir=demo/dist --prod
|
14
.github/workflows/release-drafter.yaml
vendored
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
name: Release Drafter
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- dev
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
update_release_draft:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: release-drafter/release-drafter@v5
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
4
.gitignore
vendored
@@ -5,7 +5,6 @@ npm-debug.log
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
hass_frontend/*
|
hass_frontend/*
|
||||||
.reify-cache
|
.reify-cache
|
||||||
demo/hademo-icons.html
|
|
||||||
|
|
||||||
# Python stuff
|
# Python stuff
|
||||||
*.py[cod]
|
*.py[cod]
|
||||||
@@ -31,3 +30,6 @@ src/cast/dev_const.ts
|
|||||||
# Secrets
|
# Secrets
|
||||||
.lokalise_token
|
.lokalise_token
|
||||||
yarn-error.log
|
yarn-error.log
|
||||||
|
|
||||||
|
#asdf
|
||||||
|
.tool-versions
|
||||||
|
10
.prettierignore
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
build
|
||||||
|
build-translations/*
|
||||||
|
translations/*
|
||||||
|
node_modules/*
|
||||||
|
hass_frontend/*
|
||||||
|
pip-selfcheck.json
|
||||||
|
|
||||||
|
# vscode
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/extensions.json
|
27
.travis.yml
@@ -1,27 +0,0 @@
|
|||||||
sudo: false
|
|
||||||
language: node_js
|
|
||||||
cache:
|
|
||||||
yarn: true
|
|
||||||
directories:
|
|
||||||
- bower_components
|
|
||||||
install: yarn install
|
|
||||||
script:
|
|
||||||
- npm run build
|
|
||||||
- hassio/script/build_hassio
|
|
||||||
# Because else eslint fails because hassio has cleaned that build
|
|
||||||
- ./node_modules/.bin/gulp gen-icons-app
|
|
||||||
- npm run test
|
|
||||||
# - xvfb-run wct --module-resolution=node --npm
|
|
||||||
# - 'if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then wct --module-resolution=node --npm --plugin sauce; fi'
|
|
||||||
services:
|
|
||||||
- docker
|
|
||||||
before_deploy:
|
|
||||||
- "docker pull lokalise/lokalise-cli@sha256:2198814ebddfda56ee041a4b427521757dd57f75415ea9693696a64c550cef21"
|
|
||||||
deploy:
|
|
||||||
provider: script
|
|
||||||
script: script/travis_deploy
|
|
||||||
"on":
|
|
||||||
branch: master
|
|
||||||
dist: trusty
|
|
||||||
addons:
|
|
||||||
sauce_connect: true
|
|
1
.vscode/extensions.json
vendored
@@ -1,7 +1,6 @@
|
|||||||
{
|
{
|
||||||
"recommendations": [
|
"recommendations": [
|
||||||
"dbaeumer.vscode-eslint",
|
"dbaeumer.vscode-eslint",
|
||||||
"ms-vscode.vscode-typescript-tslint-plugin",
|
|
||||||
"esbenp.prettier-vscode",
|
"esbenp.prettier-vscode",
|
||||||
"bierner.lit-html",
|
"bierner.lit-html",
|
||||||
"runem.lit-plugin"
|
"runem.lit-plugin"
|
||||||
|
@@ -2,79 +2,139 @@
|
|||||||
|
|
||||||
## Our Pledge
|
## Our Pledge
|
||||||
|
|
||||||
In the interest of fostering an open and welcoming environment, we as
|
We as members, contributors, and leaders pledge to make participation in our
|
||||||
contributors and maintainers pledge to making participation in our project and
|
community a harassment-free experience for everyone, regardless of age, body
|
||||||
our community a harassment-free experience for everyone, regardless of age, body
|
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
||||||
size, disability, ethnicity, gender identity and expression, level of experience,
|
identity and expression, level of experience, education, socio-economic status,
|
||||||
nationality, personal appearance, race, religion, or sexual identity and
|
nationality, personal appearance, race, religion, or sexual identity
|
||||||
orientation.
|
and orientation.
|
||||||
|
|
||||||
|
We pledge to act and interact in ways that contribute to an open, welcoming,
|
||||||
|
diverse, inclusive, and healthy community.
|
||||||
|
|
||||||
## Our Standards
|
## Our Standards
|
||||||
|
|
||||||
Examples of behavior that contributes to creating a positive environment
|
Examples of behavior that contributes to a positive environment for our
|
||||||
include:
|
community include:
|
||||||
|
|
||||||
* Using welcoming and inclusive language
|
* Demonstrating empathy and kindness toward other people
|
||||||
* Being respectful of differing viewpoints and experiences
|
* Being respectful of differing opinions, viewpoints, and experiences
|
||||||
* Gracefully accepting constructive criticism
|
* Giving and gracefully accepting constructive feedback
|
||||||
* Focusing on what is best for the community
|
* Accepting responsibility and apologizing to those affected by our mistakes,
|
||||||
* Showing empathy towards other community members
|
and learning from the experience
|
||||||
|
* Focusing on what is best not just for us as individuals, but for the
|
||||||
|
overall community
|
||||||
|
|
||||||
Examples of unacceptable behavior by participants include:
|
Examples of unacceptable behavior include:
|
||||||
|
|
||||||
* The use of sexualized language or imagery and unwelcome sexual attention or
|
* The use of sexualized language or imagery, and sexual attention or
|
||||||
advances
|
advances of any kind
|
||||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
* Trolling, insulting or derogatory comments, and personal or political attacks
|
||||||
* Public or private harassment
|
* Public or private harassment
|
||||||
* Publishing others' private information, such as a physical or electronic
|
* Publishing others' private information, such as a physical or email
|
||||||
address, without explicit permission
|
address, without their explicit permission
|
||||||
* Other conduct which could reasonably be considered inappropriate in a
|
* Other conduct which could reasonably be considered inappropriate in a
|
||||||
professional setting
|
professional setting
|
||||||
|
|
||||||
## Our Responsibilities
|
## Enforcement Responsibilities
|
||||||
|
|
||||||
Project maintainers are responsible for clarifying the standards of acceptable
|
Community leaders are responsible for clarifying and enforcing our standards of
|
||||||
behavior and are expected to take appropriate and fair corrective action in
|
acceptable behavior and will take appropriate and fair corrective action in
|
||||||
response to any instances of unacceptable behavior.
|
response to any behavior that they deem inappropriate, threatening, offensive,
|
||||||
|
or harmful.
|
||||||
|
|
||||||
Project maintainers have the right and responsibility to remove, edit, or
|
Community leaders have the right and responsibility to remove, edit, or reject
|
||||||
reject comments, commits, code, wiki edits, issues, and other contributions
|
comments, commits, code, wiki edits, issues, and other contributions that are
|
||||||
that are not aligned to this Code of Conduct, or to ban temporarily or
|
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
||||||
permanently any contributor for other behaviors that they deem inappropriate,
|
decisions when appropriate.
|
||||||
threatening, offensive, or harmful.
|
|
||||||
|
|
||||||
## Scope
|
## Scope
|
||||||
|
|
||||||
This Code of Conduct applies both within project spaces and in public spaces
|
This Code of Conduct applies within all community spaces, and also applies when
|
||||||
when an individual is representing the project or its community. Examples of
|
an individual is officially representing the community in public spaces.
|
||||||
representing a project or community include using an official project e-mail
|
Examples of representing our community include using an official e-mail address,
|
||||||
address, posting via an official social media account, or acting as an appointed
|
posting via an official social media account, or acting as an appointed
|
||||||
representative at an online or offline event. Representation of a project may be
|
representative at an online or offline event.
|
||||||
further defined and clarified by project maintainers.
|
|
||||||
|
|
||||||
## Enforcement
|
## Enforcement
|
||||||
|
|
||||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||||
reported by contacting the project team at [safety@home-assistant.io][email]. All
|
reported to the community leaders responsible for enforcement at
|
||||||
complaints will be reviewed and investigated and will result in a response that
|
[safety@home-assistant.io][email] or by using the report/flag feature of
|
||||||
is deemed necessary and appropriate to the circumstances. The project team is
|
the medium used. All complaints will be reviewed and investigated promptly and
|
||||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
fairly.
|
||||||
Further details of specific enforcement policies may be posted separately.
|
|
||||||
|
|
||||||
Project maintainers who do not follow or enforce the Code of Conduct in good
|
All community leaders are obligated to respect the privacy and security of the
|
||||||
faith may face temporary or permanent repercussions as determined by other
|
reporter of any incident.
|
||||||
members of the project's leadership.
|
|
||||||
|
## Enforcement Guidelines
|
||||||
|
|
||||||
|
Community leaders will follow these Community Impact Guidelines in determining
|
||||||
|
the consequences for any action they deem in violation of this Code of Conduct:
|
||||||
|
|
||||||
|
### 1. Correction
|
||||||
|
|
||||||
|
**Community Impact**: Use of inappropriate language or other behavior deemed
|
||||||
|
unprofessional or unwelcome in the community.
|
||||||
|
|
||||||
|
**Consequence**: A private, written warning from community leaders, providing
|
||||||
|
clarity around the nature of the violation and an explanation of why the
|
||||||
|
behavior was inappropriate. A public apology may be requested.
|
||||||
|
|
||||||
|
### 2. Warning
|
||||||
|
|
||||||
|
**Community Impact**: A violation through a single incident or series
|
||||||
|
of actions.
|
||||||
|
|
||||||
|
**Consequence**: A warning with consequences for continued behavior. No
|
||||||
|
interaction with the people involved, including unsolicited interaction with
|
||||||
|
those enforcing the Code of Conduct, for a specified period of time. This
|
||||||
|
includes avoiding interactions in community spaces as well as external channels
|
||||||
|
like social media. Violating these terms may lead to a temporary or
|
||||||
|
permanent ban.
|
||||||
|
|
||||||
|
### 3. Temporary Ban
|
||||||
|
|
||||||
|
**Community Impact**: A serious violation of community standards, including
|
||||||
|
sustained inappropriate behavior.
|
||||||
|
|
||||||
|
**Consequence**: A temporary ban from any sort of interaction or public
|
||||||
|
communication with the community for a specified period of time. No public or
|
||||||
|
private interaction with the people involved, including unsolicited interaction
|
||||||
|
with those enforcing the Code of Conduct, is allowed during this period.
|
||||||
|
Violating these terms may lead to a permanent ban.
|
||||||
|
|
||||||
|
### 4. Permanent Ban
|
||||||
|
|
||||||
|
**Community Impact**: Demonstrating a pattern of violation of community
|
||||||
|
standards, including sustained inappropriate behavior, harassment of an
|
||||||
|
individual, or aggression toward or disparagement of classes of individuals.
|
||||||
|
|
||||||
|
**Consequence**: A permanent ban from any sort of public interaction within
|
||||||
|
the community.
|
||||||
|
|
||||||
## Attribution
|
## Attribution
|
||||||
|
|
||||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||||
available [here][version].
|
version 2.0, available [here][version].
|
||||||
|
|
||||||
|
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
||||||
|
enforcement ladder][mozilla].
|
||||||
|
|
||||||
## Adoption
|
## Adoption
|
||||||
|
|
||||||
This Code of Conduct was first adopted January 21st, 2017 and announced in [this][coc-blog] blog post.
|
This Code of Conduct was first adopted January 21st, 2017 and announced in
|
||||||
|
[this][coc-blog] blog post and has been updated on May 25th, 2020 to version
|
||||||
|
2.0 of the [Contributor Covenant][homepage] as announced in [this][coc2-blog]
|
||||||
|
blog post.
|
||||||
|
|
||||||
[homepage]: http://contributor-covenant.org
|
For answers to common questions about this code of conduct, see the FAQ at
|
||||||
[version]: http://contributor-covenant.org/version/1/4/
|
<https://www.contributor-covenant.org/faq>. Translations are available at
|
||||||
|
<https://www.contributor-covenant.org/translations>.
|
||||||
|
|
||||||
|
[coc-blog]: /blog/2017/01/21/home-assistant-governance/
|
||||||
|
[coc2-blog]: /blog/2020/05/25/code-of-conduct-updated/
|
||||||
[email]: mailto:safety@home-assistant.io
|
[email]: mailto:safety@home-assistant.io
|
||||||
[coc-blog]: https://home-assistant.io/blog/2017/01/21/home-assistant-governance/
|
[homepage]: http://contributor-covenant.org
|
||||||
|
[mozilla]: https://github.com/mozilla/diversity
|
||||||
|
[version]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html
|
||||||
|
13
README.md
@@ -1,4 +1,4 @@
|
|||||||
# Home Assistant Polymer [](https://travis-ci.org/home-assistant/home-assistant-polymer)
|
# Home Assistant Frontend
|
||||||
|
|
||||||
This is the repository for the official [Home Assistant](https://home-assistant.io) frontend.
|
This is the repository for the official [Home Assistant](https://home-assistant.io) frontend.
|
||||||
|
|
||||||
@@ -6,12 +6,12 @@ This is the repository for the official [Home Assistant](https://home-assistant.
|
|||||||
|
|
||||||
- [View demo of Home Assistant](https://demo.home-assistant.io/)
|
- [View demo of Home Assistant](https://demo.home-assistant.io/)
|
||||||
- [More information about Home Assistant](https://home-assistant.io)
|
- [More information about Home Assistant](https://home-assistant.io)
|
||||||
- [Frontend development instructions](https://developers.home-assistant.io/docs/en/frontend_index.html)
|
- [Frontend development instructions](https://developers.home-assistant.io/docs/frontend/development/)
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
- Initial setup: `script/setup`
|
- Initial setup: `script/setup`
|
||||||
- Development: [Instructions](https://developers.home-assistant.io/docs/en/frontend_development.html)
|
- Development: [Instructions](https://developers.home-assistant.io/docs/frontend/development/)
|
||||||
- Production build: `script/build_frontend`
|
- Production build: `script/build_frontend`
|
||||||
- Gallery: `cd gallery && script/develop_gallery`
|
- Gallery: `cd gallery && script/develop_gallery`
|
||||||
- Hass.io: [Instructions](https://developers.home-assistant.io/docs/en/hassio_hass.html)
|
- Hass.io: [Instructions](https://developers.home-assistant.io/docs/en/hassio_hass.html)
|
||||||
@@ -19,12 +19,15 @@ This is the repository for the official [Home Assistant](https://home-assistant.
|
|||||||
## Frontend development
|
## Frontend development
|
||||||
|
|
||||||
### Classic environment
|
### Classic environment
|
||||||
|
|
||||||
A complete guide can be found at the following [link](https://www.home-assistant.io/developers/frontend/). It describes a short guide for the build of project.
|
A complete guide can be found at the following [link](https://www.home-assistant.io/developers/frontend/). It describes a short guide for the build of project.
|
||||||
|
|
||||||
### Docker environment
|
### Docker environment
|
||||||
|
|
||||||
It is possible to compile the project and/or run commands in the development environment having only the [Docker](https://www.docker.com) pre-installed in the system. On the root of project you can do:
|
It is possible to compile the project and/or run commands in the development environment having only the [Docker](https://www.docker.com) pre-installed in the system. On the root of project you can do:
|
||||||
* `sh ./script/docker_run.sh build` Build all the project with one command
|
|
||||||
* `sh ./script/docker_run.sh bash` Open an interactive shell (the same environment generated by the *classic environment*) where you can run commands. This bash work on your project directory and any change on your file is automatically present within your build bash.
|
- `sh ./script/docker_run.sh build` Build all the project with one command
|
||||||
|
- `sh ./script/docker_run.sh bash` Open an interactive shell (the same environment generated by the _classic environment_) where you can run commands. This bash work on your project directory and any change on your file is automatically present within your build bash.
|
||||||
|
|
||||||
**Note**: if you have installed `npm` in addition to the `docker`, you can use the commands `npm run docker_build` and `npm run bash` to get a full build or bash as explained above
|
**Note**: if you have installed `npm` in addition to the `docker`, you can use the commands `npm run docker_build` and `npm run bash` to get a full build or bash as explained above
|
||||||
|
|
||||||
|
30
azure-pipelines-netlify.yml
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
# https://dev.azure.com/home-assistant
|
||||||
|
|
||||||
|
trigger: none
|
||||||
|
pr: none
|
||||||
|
schedules:
|
||||||
|
- cron: "0 0 * * *"
|
||||||
|
displayName: "build preview"
|
||||||
|
branches:
|
||||||
|
include:
|
||||||
|
- dev
|
||||||
|
always: true
|
||||||
|
variables:
|
||||||
|
- group: netlify
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
- job: 'Netlify_preview'
|
||||||
|
pool:
|
||||||
|
vmImage: 'ubuntu-latest'
|
||||||
|
steps:
|
||||||
|
- script: |
|
||||||
|
# Cast
|
||||||
|
curl -X POST -d {} https://api.netlify.com/build_hooks/${NETLIFY_CAST}
|
||||||
|
|
||||||
|
# Demo
|
||||||
|
curl -X POST -d {} https://api.netlify.com/build_hooks/${NETLIFY_DEMO}
|
||||||
|
|
||||||
|
# Gallery
|
||||||
|
curl -X POST -d {} https://api.netlify.com/build_hooks/${NETLIFY_GALLERY}
|
||||||
|
displayName: 'Trigger netlify build preview'
|
@@ -8,7 +8,7 @@ trigger:
|
|||||||
pr: none
|
pr: none
|
||||||
variables:
|
variables:
|
||||||
- name: versionWheels
|
- name: versionWheels
|
||||||
value: '1.3-3.7-alpine3.10'
|
value: '1.10.1-3.7-alpine3.11'
|
||||||
- name: versionNode
|
- name: versionNode
|
||||||
value: '12.1'
|
value: '12.1'
|
||||||
- group: twine
|
- group: twine
|
||||||
@@ -47,18 +47,13 @@ stages:
|
|||||||
|
|
||||||
script/release
|
script/release
|
||||||
displayName: "Build and release package"
|
displayName: "Build and release package"
|
||||||
|
- stage: "Wheels"
|
||||||
|
jobs:
|
||||||
- template: templates/azp-job-wheels.yaml@azure
|
- template: templates/azp-job-wheels.yaml@azure
|
||||||
parameters:
|
parameters:
|
||||||
builderVersion: '$(versionWheels)'
|
builderVersion: '$(versionWheels)'
|
||||||
builderApk: 'build-base'
|
wheelsRequirement: 'requirement.txt'
|
||||||
wheelsLocal: true
|
|
||||||
preBuild:
|
preBuild:
|
||||||
- task: NodeTool@0
|
|
||||||
displayName: "Use Node $(versionNode)"
|
|
||||||
inputs:
|
|
||||||
versionSpec: "$(versionNode)"
|
|
||||||
- script: |
|
- script: |
|
||||||
set -e
|
sleep 240
|
||||||
|
echo "home-assistant-frontend==$(Build.SourceBranchName)" > requirement.txt
|
||||||
yarn install
|
|
||||||
script/build_frontend
|
|
||||||
|
70
azure-pipelines-translation.yml
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
# https://dev.azure.com/home-assistant
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
batch: true
|
||||||
|
branches:
|
||||||
|
include:
|
||||||
|
- dev
|
||||||
|
paths:
|
||||||
|
include:
|
||||||
|
- translations/en.json
|
||||||
|
pr: none
|
||||||
|
schedules:
|
||||||
|
- cron: "30 0 * * *"
|
||||||
|
displayName: "frontend translation update"
|
||||||
|
branches:
|
||||||
|
include:
|
||||||
|
- dev
|
||||||
|
always: true
|
||||||
|
variables:
|
||||||
|
- group: translation
|
||||||
|
resources:
|
||||||
|
repositories:
|
||||||
|
- repository: azure
|
||||||
|
type: github
|
||||||
|
name: 'home-assistant/ci-azure'
|
||||||
|
endpoint: 'home-assistant'
|
||||||
|
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
- job: 'Upload'
|
||||||
|
pool:
|
||||||
|
vmImage: 'ubuntu-latest'
|
||||||
|
steps:
|
||||||
|
- task: NodeTool@0
|
||||||
|
displayName: 'Use Node 12.x'
|
||||||
|
inputs:
|
||||||
|
versionSpec: '12.x'
|
||||||
|
- script: |
|
||||||
|
export LOKALISE_TOKEN="$(lokaliseToken)"
|
||||||
|
export AZURE_BRANCH="$(Build.SourceBranchName)"
|
||||||
|
|
||||||
|
./script/translations_upload_base
|
||||||
|
displayName: 'Upload Translation'
|
||||||
|
|
||||||
|
- job: 'Download'
|
||||||
|
dependsOn:
|
||||||
|
- 'Upload'
|
||||||
|
condition: or(eq(variables['Build.Reason'], 'Schedule'), eq(variables['Build.Reason'], 'Manual'))
|
||||||
|
pool:
|
||||||
|
vmImage: 'ubuntu-latest'
|
||||||
|
steps:
|
||||||
|
- task: NodeTool@0
|
||||||
|
displayName: 'Use Node 12.x'
|
||||||
|
inputs:
|
||||||
|
versionSpec: '12.x'
|
||||||
|
- template: templates/azp-step-git-init.yaml@azure
|
||||||
|
- script: |
|
||||||
|
export LOKALISE_TOKEN="$(lokaliseToken)"
|
||||||
|
export AZURE_BRANCH="$(Build.SourceBranchName)"
|
||||||
|
|
||||||
|
npm install
|
||||||
|
./script/translations_download
|
||||||
|
displayName: 'Download Translation'
|
||||||
|
- script: |
|
||||||
|
git checkout dev
|
||||||
|
git add translation
|
||||||
|
git commit -am "[ci skip] Translation update"
|
||||||
|
git push
|
||||||
|
displayName: 'Update translation'
|
@@ -1,49 +0,0 @@
|
|||||||
module.exports.babelLoaderConfig = ({ latestBuild }) => {
|
|
||||||
if (latestBuild === undefined) {
|
|
||||||
throw Error("latestBuild not defined for babel loader config");
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
test: /\.m?js$|\.tsx?$/,
|
|
||||||
use: {
|
|
||||||
loader: "babel-loader",
|
|
||||||
options: {
|
|
||||||
presets: [
|
|
||||||
!latestBuild && [
|
|
||||||
require("@babel/preset-env").default,
|
|
||||||
{ modules: false },
|
|
||||||
],
|
|
||||||
[
|
|
||||||
require("@babel/preset-typescript").default,
|
|
||||||
{
|
|
||||||
jsxPragma: "h",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
].filter(Boolean),
|
|
||||||
plugins: [
|
|
||||||
// Part of ES2018. Converts {...a, b: 2} to Object.assign({}, a, {b: 2})
|
|
||||||
[
|
|
||||||
"@babel/plugin-proposal-object-rest-spread",
|
|
||||||
{ loose: true, useBuiltIns: true },
|
|
||||||
],
|
|
||||||
// Only support the syntax, Webpack will handle it.
|
|
||||||
"@babel/syntax-dynamic-import",
|
|
||||||
[
|
|
||||||
"@babel/transform-react-jsx",
|
|
||||||
{
|
|
||||||
pragma: "h",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
"@babel/plugin-proposal-optional-chaining",
|
|
||||||
[
|
|
||||||
require("@babel/plugin-proposal-decorators").default,
|
|
||||||
{ decoratorsBeforeExport: true },
|
|
||||||
],
|
|
||||||
[
|
|
||||||
require("@babel/plugin-proposal-class-properties").default,
|
|
||||||
{ loose: true },
|
|
||||||
],
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
};
|
|
198
build-scripts/bundle.js
Normal file
@@ -0,0 +1,198 @@
|
|||||||
|
const path = require("path");
|
||||||
|
const env = require("./env.js");
|
||||||
|
const paths = require("./paths.js");
|
||||||
|
|
||||||
|
// Files from NPM Packages that should not be imported
|
||||||
|
module.exports.ignorePackages = ({ latestBuild }) => [
|
||||||
|
// Bloats bundle and it's not used.
|
||||||
|
path.resolve(require.resolve("moment"), "../locale"),
|
||||||
|
// Part of yaml.js and only used for !!js functions that we don't use
|
||||||
|
require.resolve("esprima"),
|
||||||
|
];
|
||||||
|
|
||||||
|
// Files from NPM packages that we should replace with empty file
|
||||||
|
module.exports.emptyPackages = ({ latestBuild }) =>
|
||||||
|
[
|
||||||
|
// Contains all color definitions for all material color sets.
|
||||||
|
// We don't use it
|
||||||
|
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/font-roboto.js"),
|
||||||
|
// Polyfill only needed for ES5 workers so filter out in latestBuild
|
||||||
|
latestBuild && require.resolve("proxy-polyfill/src/index.js"),
|
||||||
|
].filter(Boolean);
|
||||||
|
|
||||||
|
module.exports.definedVars = ({ isProdBuild, latestBuild, defineOverlay }) => ({
|
||||||
|
__DEV__: !isProdBuild,
|
||||||
|
__BUILD__: JSON.stringify(latestBuild ? "latest" : "es5"),
|
||||||
|
__VERSION__: JSON.stringify(env.version()),
|
||||||
|
__DEMO__: false,
|
||||||
|
__BACKWARDS_COMPAT__: false,
|
||||||
|
__STATIC_PATH__: "/static/",
|
||||||
|
"process.env.NODE_ENV": JSON.stringify(
|
||||||
|
isProdBuild ? "production" : "development"
|
||||||
|
),
|
||||||
|
...defineOverlay,
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports.terserOptions = (latestBuild) => ({
|
||||||
|
safari10: true,
|
||||||
|
ecma: latestBuild ? undefined : 5,
|
||||||
|
output: { comments: false },
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports.babelOptions = ({ latestBuild }) => ({
|
||||||
|
babelrc: false,
|
||||||
|
presets: [
|
||||||
|
!latestBuild && [require("@babel/preset-env").default, { modules: false }],
|
||||||
|
require("@babel/preset-typescript").default,
|
||||||
|
].filter(Boolean),
|
||||||
|
plugins: [
|
||||||
|
// Part of ES2018. Converts {...a, b: 2} to Object.assign({}, a, {b: 2})
|
||||||
|
[
|
||||||
|
"@babel/plugin-proposal-object-rest-spread",
|
||||||
|
{ loose: true, useBuiltIns: true },
|
||||||
|
],
|
||||||
|
// Only support the syntax, Webpack will handle it.
|
||||||
|
"@babel/syntax-dynamic-import",
|
||||||
|
"@babel/plugin-proposal-optional-chaining",
|
||||||
|
"@babel/plugin-proposal-nullish-coalescing-operator",
|
||||||
|
[
|
||||||
|
require("@babel/plugin-proposal-decorators").default,
|
||||||
|
{ decoratorsBeforeExport: true },
|
||||||
|
],
|
||||||
|
[
|
||||||
|
require("@babel/plugin-proposal-class-properties").default,
|
||||||
|
{ loose: true },
|
||||||
|
],
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
// Are already ES5, cause warnings when babelified.
|
||||||
|
module.exports.babelExclude = () => [
|
||||||
|
require.resolve("@mdi/js/mdi.js"),
|
||||||
|
require.resolve("hls.js"),
|
||||||
|
];
|
||||||
|
|
||||||
|
const outputPath = (outputRoot, latestBuild) =>
|
||||||
|
path.resolve(outputRoot, latestBuild ? "frontend_latest" : "frontend_es5");
|
||||||
|
|
||||||
|
const publicPath = (latestBuild) =>
|
||||||
|
latestBuild ? "/frontend_latest/" : "/frontend_es5/";
|
||||||
|
|
||||||
|
/*
|
||||||
|
BundleConfig {
|
||||||
|
// Object with entrypoints that need to be bundled
|
||||||
|
entry: { [name: string]: pathToFile },
|
||||||
|
// Folder where bundled files need to be written
|
||||||
|
outputPath: string,
|
||||||
|
// absolute url-path where bundled files can be found
|
||||||
|
publicPath: string,
|
||||||
|
// extra definitions that we need to replace in source
|
||||||
|
defineOverlay: {[name: string]: value },
|
||||||
|
// if this is a production build
|
||||||
|
isProdBuild: boolean,
|
||||||
|
// If we're targeting latest browsers
|
||||||
|
latestBuild: boolean,
|
||||||
|
// If we're doing a stats build (create nice chunk names)
|
||||||
|
isStatsBuild: boolean,
|
||||||
|
// Names of entrypoints that should not be hashed
|
||||||
|
dontHash: Set<string>
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
module.exports.config = {
|
||||||
|
app({ isProdBuild, latestBuild, isStatsBuild }) {
|
||||||
|
return {
|
||||||
|
entry: {
|
||||||
|
service_worker: "./src/entrypoints/service_worker.ts",
|
||||||
|
app: "./src/entrypoints/app.ts",
|
||||||
|
authorize: "./src/entrypoints/authorize.ts",
|
||||||
|
onboarding: "./src/entrypoints/onboarding.ts",
|
||||||
|
core: "./src/entrypoints/core.ts",
|
||||||
|
compatibility: "./src/entrypoints/compatibility.ts",
|
||||||
|
"custom-panel": "./src/entrypoints/custom-panel.ts",
|
||||||
|
},
|
||||||
|
outputPath: outputPath(paths.app_output_root, latestBuild),
|
||||||
|
publicPath: publicPath(latestBuild),
|
||||||
|
isProdBuild,
|
||||||
|
latestBuild,
|
||||||
|
isStatsBuild,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
demo({ isProdBuild, latestBuild, isStatsBuild }) {
|
||||||
|
return {
|
||||||
|
entry: {
|
||||||
|
main: path.resolve(paths.demo_dir, "src/entrypoint.ts"),
|
||||||
|
compatibility: path.resolve(
|
||||||
|
paths.polymer_dir,
|
||||||
|
"src/entrypoints/compatibility.ts"
|
||||||
|
),
|
||||||
|
},
|
||||||
|
outputPath: outputPath(paths.demo_output_root, latestBuild),
|
||||||
|
publicPath: publicPath(latestBuild),
|
||||||
|
defineOverlay: {
|
||||||
|
__VERSION__: JSON.stringify(`DEMO-${env.version()}`),
|
||||||
|
__DEMO__: true,
|
||||||
|
},
|
||||||
|
isProdBuild,
|
||||||
|
latestBuild,
|
||||||
|
isStatsBuild,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
cast({ isProdBuild, latestBuild }) {
|
||||||
|
const entry = {
|
||||||
|
launcher: path.resolve(paths.cast_dir, "src/launcher/entrypoint.ts"),
|
||||||
|
};
|
||||||
|
|
||||||
|
if (latestBuild) {
|
||||||
|
entry.receiver = path.resolve(
|
||||||
|
paths.cast_dir,
|
||||||
|
"src/receiver/entrypoint.ts"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
entry,
|
||||||
|
outputPath: outputPath(paths.cast_output_root, latestBuild),
|
||||||
|
publicPath: publicPath(latestBuild),
|
||||||
|
isProdBuild,
|
||||||
|
latestBuild,
|
||||||
|
defineOverlay: {
|
||||||
|
__BACKWARDS_COMPAT__: true,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
hassio({ isProdBuild, latestBuild }) {
|
||||||
|
if (latestBuild) {
|
||||||
|
throw new Error("Hass.io does not support latest build!");
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
entry: {
|
||||||
|
entrypoint: path.resolve(paths.hassio_dir, "src/entrypoint.ts"),
|
||||||
|
},
|
||||||
|
outputPath: paths.hassio_output_root,
|
||||||
|
publicPath: paths.hassio_publicPath,
|
||||||
|
isProdBuild,
|
||||||
|
latestBuild,
|
||||||
|
dontHash: new Set(["entrypoint"]),
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
gallery({ isProdBuild, latestBuild }) {
|
||||||
|
return {
|
||||||
|
entry: {
|
||||||
|
entrypoint: path.resolve(paths.gallery_dir, "src/entrypoint.js"),
|
||||||
|
},
|
||||||
|
outputPath: outputPath(paths.gallery_output_root, latestBuild),
|
||||||
|
publicPath: publicPath(latestBuild),
|
||||||
|
isProdBuild,
|
||||||
|
latestBuild,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
};
|
@@ -1,6 +1,32 @@
|
|||||||
|
const fs = require("fs");
|
||||||
|
const path = require("path");
|
||||||
|
const paths = require("./paths.js");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
isProdBuild: process.env.NODE_ENV === "production",
|
useRollup() {
|
||||||
isStatsBuild: process.env.STATS === "1",
|
return process.env.ROLLUP === "1";
|
||||||
isTravis: process.env.TRAVIS === "true",
|
},
|
||||||
isNetlify: process.env.NETLIFY === "true",
|
isProdBuild() {
|
||||||
|
return (
|
||||||
|
process.env.NODE_ENV === "production" || module.exports.isStatsBuild()
|
||||||
|
);
|
||||||
|
},
|
||||||
|
isStatsBuild() {
|
||||||
|
return process.env.STATS === "1";
|
||||||
|
},
|
||||||
|
isTest() {
|
||||||
|
return process.env.IS_TEST === "true";
|
||||||
|
},
|
||||||
|
isNetlify() {
|
||||||
|
return process.env.NETLIFY === "true";
|
||||||
|
},
|
||||||
|
version() {
|
||||||
|
const version = fs
|
||||||
|
.readFileSync(path.resolve(paths.polymer_dir, "setup.py"), "utf8")
|
||||||
|
.match(/\d{8}\.\d+/);
|
||||||
|
if (!version) {
|
||||||
|
throw Error("Version not found");
|
||||||
|
}
|
||||||
|
return version[0];
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
@@ -1,16 +1,17 @@
|
|||||||
// Run HA develop mode
|
// Run HA develop mode
|
||||||
const gulp = require("gulp");
|
const gulp = require("gulp");
|
||||||
|
|
||||||
const envVars = require("../env");
|
const env = require("../env");
|
||||||
|
|
||||||
require("./clean.js");
|
require("./clean.js");
|
||||||
require("./translations.js");
|
require("./translations.js");
|
||||||
require("./gen-icons.js");
|
require("./gen-icons-json.js");
|
||||||
require("./gather-static.js");
|
require("./gather-static.js");
|
||||||
require("./compress.js");
|
require("./compress.js");
|
||||||
require("./webpack.js");
|
require("./webpack.js");
|
||||||
require("./service-worker.js");
|
require("./service-worker.js");
|
||||||
require("./entry-html.js");
|
require("./entry-html.js");
|
||||||
|
require("./rollup.js");
|
||||||
|
|
||||||
gulp.task(
|
gulp.task(
|
||||||
"develop-app",
|
"develop-app",
|
||||||
@@ -20,14 +21,14 @@ gulp.task(
|
|||||||
},
|
},
|
||||||
"clean",
|
"clean",
|
||||||
gulp.parallel(
|
gulp.parallel(
|
||||||
"gen-service-worker-dev",
|
"gen-service-worker-app-dev",
|
||||||
gulp.parallel("gen-icons-app", "gen-icons-mdi"),
|
"gen-icons-json",
|
||||||
"gen-pages-dev",
|
"gen-pages-dev",
|
||||||
"gen-index-app-dev",
|
"gen-index-app-dev",
|
||||||
gulp.series("create-test-translation", "build-translations")
|
"build-translations"
|
||||||
),
|
),
|
||||||
"copy-static",
|
"copy-static-app",
|
||||||
"webpack-watch-app"
|
env.useRollup() ? "rollup-watch-app" : "webpack-watch-app"
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -38,15 +39,15 @@ gulp.task(
|
|||||||
process.env.NODE_ENV = "production";
|
process.env.NODE_ENV = "production";
|
||||||
},
|
},
|
||||||
"clean",
|
"clean",
|
||||||
gulp.parallel("gen-icons-app", "gen-icons-mdi", "build-translations"),
|
gulp.parallel("gen-icons-json", "build-translations"),
|
||||||
"copy-static",
|
"copy-static-app",
|
||||||
"webpack-prod-app",
|
env.useRollup() ? "rollup-prod-app" : "webpack-prod-app",
|
||||||
...// Don't compress running tests
|
...// Don't compress running tests
|
||||||
(envVars.isTravis ? [] : ["compress-app"]),
|
(env.isTest() ? [] : ["compress-app"]),
|
||||||
gulp.parallel(
|
gulp.parallel(
|
||||||
"gen-pages-prod",
|
"gen-pages-prod",
|
||||||
"gen-index-app-prod",
|
"gen-index-app-prod",
|
||||||
"gen-service-worker-prod"
|
"gen-service-worker-app-prod"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@@ -1,12 +1,14 @@
|
|||||||
const gulp = require("gulp");
|
const gulp = require("gulp");
|
||||||
|
|
||||||
|
const env = require("../env");
|
||||||
|
|
||||||
require("./clean.js");
|
require("./clean.js");
|
||||||
require("./translations.js");
|
require("./translations.js");
|
||||||
require("./gen-icons.js");
|
|
||||||
require("./gather-static.js");
|
require("./gather-static.js");
|
||||||
require("./webpack.js");
|
require("./webpack.js");
|
||||||
require("./service-worker.js");
|
require("./service-worker.js");
|
||||||
require("./entry-html.js");
|
require("./entry-html.js");
|
||||||
|
require("./rollup.js");
|
||||||
|
|
||||||
gulp.task(
|
gulp.task(
|
||||||
"develop-cast",
|
"develop-cast",
|
||||||
@@ -15,14 +17,10 @@ gulp.task(
|
|||||||
process.env.NODE_ENV = "development";
|
process.env.NODE_ENV = "development";
|
||||||
},
|
},
|
||||||
"clean-cast",
|
"clean-cast",
|
||||||
gulp.parallel(
|
"translations-enable-merge-backend",
|
||||||
"gen-icons-app",
|
gulp.parallel("gen-icons-json", "build-translations"),
|
||||||
"gen-icons-mdi",
|
|
||||||
"gen-index-cast-dev",
|
|
||||||
"build-translations"
|
|
||||||
),
|
|
||||||
"copy-static-cast",
|
"copy-static-cast",
|
||||||
"webpack-dev-server-cast"
|
env.useRollup() ? "rollup-dev-server-cast" : "webpack-dev-server-cast"
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -33,9 +31,10 @@ gulp.task(
|
|||||||
process.env.NODE_ENV = "production";
|
process.env.NODE_ENV = "production";
|
||||||
},
|
},
|
||||||
"clean-cast",
|
"clean-cast",
|
||||||
gulp.parallel("gen-icons-app", "gen-icons-mdi", "build-translations"),
|
"translations-enable-merge-backend",
|
||||||
|
gulp.parallel("gen-icons-json", "build-translations"),
|
||||||
"copy-static-cast",
|
"copy-static-cast",
|
||||||
"webpack-prod-cast",
|
env.useRollup() ? "rollup-prod-cast" : "webpack-prod-cast",
|
||||||
"gen-index-cast-prod"
|
"gen-index-cast-prod"
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@@ -1,39 +1,36 @@
|
|||||||
const del = require("del");
|
const del = require("del");
|
||||||
const gulp = require("gulp");
|
const gulp = require("gulp");
|
||||||
const config = require("../paths");
|
const paths = require("../paths");
|
||||||
require("./translations");
|
require("./translations");
|
||||||
|
|
||||||
gulp.task(
|
gulp.task(
|
||||||
"clean",
|
"clean",
|
||||||
gulp.parallel("clean-translations", function cleanOutputAndBuildDir() {
|
gulp.parallel("clean-translations", function cleanOutputAndBuildDir() {
|
||||||
return del([config.root, config.build_dir]);
|
return del([paths.app_output_root, paths.build_dir]);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
gulp.task(
|
gulp.task(
|
||||||
"clean-demo",
|
"clean-demo",
|
||||||
gulp.parallel("clean-translations", function cleanOutputAndBuildDir() {
|
gulp.parallel("clean-translations", function cleanOutputAndBuildDir() {
|
||||||
return del([config.demo_root, config.build_dir]);
|
return del([paths.demo_output_root, paths.build_dir]);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
gulp.task(
|
gulp.task(
|
||||||
"clean-cast",
|
"clean-cast",
|
||||||
gulp.parallel("clean-translations", function cleanOutputAndBuildDir() {
|
gulp.parallel("clean-translations", function cleanOutputAndBuildDir() {
|
||||||
return del([config.cast_root, config.build_dir]);
|
return del([paths.cast_output_root, paths.build_dir]);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
gulp.task(
|
gulp.task("clean-hassio", function cleanOutputAndBuildDir() {
|
||||||
"clean-hassio",
|
return del([paths.hassio_output_root, paths.build_dir]);
|
||||||
gulp.parallel("clean-translations", function cleanOutputAndBuildDir() {
|
});
|
||||||
return del([config.hassio_root, config.build_dir]);
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
gulp.task(
|
gulp.task(
|
||||||
"clean-gallery",
|
"clean-gallery",
|
||||||
gulp.parallel("clean-translations", function cleanOutputAndBuildDir() {
|
gulp.parallel("clean-translations", function cleanOutputAndBuildDir() {
|
||||||
return del([config.gallery_root, config.build_dir]);
|
return del([paths.gallery_output_root, paths.build_dir]);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
@@ -8,31 +8,36 @@ const paths = require("../paths");
|
|||||||
|
|
||||||
gulp.task("compress-app", function compressApp() {
|
gulp.task("compress-app", function compressApp() {
|
||||||
const jsLatest = gulp
|
const jsLatest = gulp
|
||||||
.src(path.resolve(paths.output, "**/*.js"))
|
.src(path.resolve(paths.app_output_latest, "**/*.js"))
|
||||||
.pipe(zopfli())
|
.pipe(zopfli({ threshold: 150 }))
|
||||||
.pipe(gulp.dest(paths.output));
|
.pipe(gulp.dest(paths.app_output_latest));
|
||||||
|
|
||||||
const jsEs5 = gulp
|
const jsEs5 = gulp
|
||||||
.src(path.resolve(paths.output_es5, "**/*.js"))
|
.src(path.resolve(paths.app_output_es5, "**/*.js"))
|
||||||
.pipe(zopfli())
|
.pipe(zopfli({ threshold: 150 }))
|
||||||
.pipe(gulp.dest(paths.output_es5));
|
.pipe(gulp.dest(paths.app_output_es5));
|
||||||
|
|
||||||
const polyfills = gulp
|
const polyfills = gulp
|
||||||
.src(path.resolve(paths.static, "polyfills/*.js"))
|
.src(path.resolve(paths.app_output_static, "polyfills/*.js"))
|
||||||
.pipe(zopfli())
|
.pipe(zopfli({ threshold: 150 }))
|
||||||
.pipe(gulp.dest(path.resolve(paths.static, "polyfills")));
|
.pipe(gulp.dest(path.resolve(paths.app_output_static, "polyfills")));
|
||||||
|
|
||||||
const translations = gulp
|
const translations = gulp
|
||||||
.src(path.resolve(paths.static, "translations/*.json"))
|
.src(path.resolve(paths.app_output_static, "translations/**/*.json"))
|
||||||
.pipe(zopfli())
|
.pipe(zopfli({ threshold: 150 }))
|
||||||
.pipe(gulp.dest(path.resolve(paths.static, "translations")));
|
.pipe(gulp.dest(path.resolve(paths.app_output_static, "translations")));
|
||||||
|
|
||||||
return merge(jsLatest, jsEs5, polyfills, translations);
|
const icons = gulp
|
||||||
|
.src(path.resolve(paths.app_output_static, "mdi/*.json"))
|
||||||
|
.pipe(zopfli({ threshold: 150 }))
|
||||||
|
.pipe(gulp.dest(path.resolve(paths.app_output_static, "mdi")));
|
||||||
|
|
||||||
|
return merge(jsLatest, jsEs5, polyfills, translations, icons);
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task("compress-hassio", function compressApp() {
|
gulp.task("compress-hassio", function compressApp() {
|
||||||
return gulp
|
return gulp
|
||||||
.src(path.resolve(paths.hassio_root, "**/*.js"))
|
.src(path.resolve(paths.hassio_output_root, "**/*.js"))
|
||||||
.pipe(zopfli())
|
.pipe(zopfli())
|
||||||
.pipe(gulp.dest(paths.hassio_root));
|
.pipe(gulp.dest(paths.hassio_output_root));
|
||||||
});
|
});
|
||||||
|
@@ -1,13 +1,16 @@
|
|||||||
// Run demo develop mode
|
// Run demo develop mode
|
||||||
const gulp = require("gulp");
|
const gulp = require("gulp");
|
||||||
|
|
||||||
|
const env = require("../env");
|
||||||
|
|
||||||
require("./clean.js");
|
require("./clean.js");
|
||||||
require("./translations.js");
|
require("./translations.js");
|
||||||
require("./gen-icons.js");
|
require("./gen-icons-json.js");
|
||||||
require("./gather-static.js");
|
require("./gather-static.js");
|
||||||
require("./webpack.js");
|
require("./webpack.js");
|
||||||
require("./service-worker.js");
|
require("./service-worker.js");
|
||||||
require("./entry-html.js");
|
require("./entry-html.js");
|
||||||
|
require("./rollup.js");
|
||||||
|
|
||||||
gulp.task(
|
gulp.task(
|
||||||
"develop-demo",
|
"develop-demo",
|
||||||
@@ -16,15 +19,10 @@ gulp.task(
|
|||||||
process.env.NODE_ENV = "development";
|
process.env.NODE_ENV = "development";
|
||||||
},
|
},
|
||||||
"clean-demo",
|
"clean-demo",
|
||||||
gulp.parallel(
|
"translations-enable-merge-backend",
|
||||||
"gen-icons-app",
|
gulp.parallel("gen-icons-json", "gen-index-demo-dev", "build-translations"),
|
||||||
"gen-icons-mdi",
|
|
||||||
"gen-icons-demo",
|
|
||||||
"gen-index-demo-dev",
|
|
||||||
"build-translations"
|
|
||||||
),
|
|
||||||
"copy-static-demo",
|
"copy-static-demo",
|
||||||
"webpack-dev-server-demo"
|
env.useRollup() ? "rollup-dev-server-demo" : "webpack-dev-server-demo"
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -35,14 +33,11 @@ gulp.task(
|
|||||||
process.env.NODE_ENV = "production";
|
process.env.NODE_ENV = "production";
|
||||||
},
|
},
|
||||||
"clean-demo",
|
"clean-demo",
|
||||||
gulp.parallel(
|
// Cast needs to be backwards compatible and older HA has no translations
|
||||||
"gen-icons-app",
|
"translations-enable-merge-backend",
|
||||||
"gen-icons-mdi",
|
gulp.parallel("gen-icons-json", "build-translations"),
|
||||||
"gen-icons-demo",
|
|
||||||
"build-translations"
|
|
||||||
),
|
|
||||||
"copy-static-demo",
|
"copy-static-demo",
|
||||||
"webpack-prod-demo",
|
env.useRollup() ? "rollup-prod-demo" : "webpack-prod-demo",
|
||||||
"gen-index-demo-prod"
|
"gen-index-demo-prod"
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@@ -1,9 +1,14 @@
|
|||||||
const del = require("del");
|
const del = require("del");
|
||||||
const gulp = require("gulp");
|
const gulp = require("gulp");
|
||||||
|
const fs = require("fs");
|
||||||
const mapStream = require("map-stream");
|
const mapStream = require("map-stream");
|
||||||
|
|
||||||
const inDir = "translations";
|
const inDirFrontend = "translations/frontend";
|
||||||
const downloadDir = inDir + "/downloads";
|
const inDirBackend = "translations/backend";
|
||||||
|
const downloadDir = "translations/downloads";
|
||||||
|
const srcMeta = "src/translations/translationMetadata.json";
|
||||||
|
|
||||||
|
const encoding = "utf8";
|
||||||
|
|
||||||
const tasks = [];
|
const tasks = [];
|
||||||
|
|
||||||
@@ -12,7 +17,7 @@ function hasHtml(data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function recursiveCheckHasHtml(file, data, errors, recKey) {
|
function recursiveCheckHasHtml(file, data, errors, recKey) {
|
||||||
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;
|
||||||
recursiveCheckHasHtml(file, data[key], errors, nextRecKey);
|
recursiveCheckHasHtml(file, data[key], errors, nextRecKey);
|
||||||
@@ -25,7 +30,7 @@ function recursiveCheckHasHtml(file, data, errors, recKey) {
|
|||||||
function checkHtml() {
|
function checkHtml() {
|
||||||
const errors = [];
|
const errors = [];
|
||||||
|
|
||||||
return mapStream(function(file, cb) {
|
return mapStream(function (file, cb) {
|
||||||
const content = file.contents;
|
const content = file.contents;
|
||||||
let error;
|
let error;
|
||||||
if (content) {
|
if (content) {
|
||||||
@@ -42,20 +47,36 @@ function checkHtml() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let taskName = "clean-downloaded-translations";
|
let taskName = "clean-downloaded-translations";
|
||||||
gulp.task(taskName, function() {
|
gulp.task(taskName, function () {
|
||||||
return del([`${downloadDir}/**`]);
|
return del([`${downloadDir}/**`]);
|
||||||
});
|
});
|
||||||
tasks.push(taskName);
|
tasks.push(taskName);
|
||||||
|
|
||||||
taskName = "check-translations-html";
|
taskName = "check-translations-html";
|
||||||
gulp.task(taskName, function() {
|
gulp.task(taskName, function () {
|
||||||
return gulp.src(`${downloadDir}/*.json`).pipe(checkHtml());
|
return gulp.src(`${downloadDir}/*.json`).pipe(checkHtml());
|
||||||
});
|
});
|
||||||
tasks.push(taskName);
|
tasks.push(taskName);
|
||||||
|
|
||||||
|
taskName = "check-all-files-exist";
|
||||||
|
gulp.task(taskName, function () {
|
||||||
|
const file = fs.readFileSync(srcMeta, { encoding });
|
||||||
|
const meta = JSON.parse(file);
|
||||||
|
Object.keys(meta).forEach((lang) => {
|
||||||
|
if (!fs.existsSync(`${inDirFrontend}/${lang}.json`)) {
|
||||||
|
fs.writeFileSync(`${inDirFrontend}/${lang}.json`, JSON.stringify({}));
|
||||||
|
}
|
||||||
|
if (!fs.existsSync(`${inDirBackend}/${lang}.json`)) {
|
||||||
|
fs.writeFileSync(`${inDirBackend}/${lang}.json`, JSON.stringify({}));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return Promise.resolve();
|
||||||
|
});
|
||||||
|
tasks.push(taskName);
|
||||||
|
|
||||||
taskName = "move-downloaded-translations";
|
taskName = "move-downloaded-translations";
|
||||||
gulp.task(taskName, function() {
|
gulp.task(taskName, function () {
|
||||||
return gulp.src(`${downloadDir}/*.json`).pipe(gulp.dest(inDir));
|
return gulp.src(`${downloadDir}/*.json`).pipe(gulp.dest(inDirFrontend));
|
||||||
});
|
});
|
||||||
tasks.push(taskName);
|
tasks.push(taskName);
|
||||||
|
|
||||||
@@ -65,6 +86,7 @@ gulp.task(
|
|||||||
gulp.series(
|
gulp.series(
|
||||||
"check-translations-html",
|
"check-translations-html",
|
||||||
"move-downloaded-translations",
|
"move-downloaded-translations",
|
||||||
|
"check-all-files-exist",
|
||||||
"clean-downloaded-translations"
|
"clean-downloaded-translations"
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@@ -6,31 +6,36 @@ const fs = require("fs-extra");
|
|||||||
const path = require("path");
|
const path = require("path");
|
||||||
const template = require("lodash.template");
|
const template = require("lodash.template");
|
||||||
const minify = require("html-minifier").minify;
|
const minify = require("html-minifier").minify;
|
||||||
const config = require("../paths.js");
|
const paths = require("../paths.js");
|
||||||
|
const env = require("../env.js");
|
||||||
|
|
||||||
const templatePath = (tpl) =>
|
const templatePath = (tpl) =>
|
||||||
path.resolve(config.polymer_dir, "src/html/", `${tpl}.html.template`);
|
path.resolve(paths.polymer_dir, "src/html/", `${tpl}.html.template`);
|
||||||
|
|
||||||
const readFile = (pth) => fs.readFileSync(pth).toString();
|
const readFile = (pth) => fs.readFileSync(pth).toString();
|
||||||
|
|
||||||
const renderTemplate = (pth, data = {}, pathFunc = templatePath) => {
|
const renderTemplate = (pth, data = {}, pathFunc = templatePath) => {
|
||||||
const compiled = template(readFile(pathFunc(pth)));
|
const compiled = template(readFile(pathFunc(pth)));
|
||||||
return compiled({ ...data, renderTemplate });
|
return compiled({
|
||||||
|
...data,
|
||||||
|
useRollup: env.useRollup(),
|
||||||
|
renderTemplate,
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const renderDemoTemplate = (pth, data = {}) =>
|
const renderDemoTemplate = (pth, data = {}) =>
|
||||||
renderTemplate(pth, data, (tpl) =>
|
renderTemplate(pth, data, (tpl) =>
|
||||||
path.resolve(config.demo_dir, "src/html/", `${tpl}.html.template`)
|
path.resolve(paths.demo_dir, "src/html/", `${tpl}.html.template`)
|
||||||
);
|
);
|
||||||
|
|
||||||
const renderCastTemplate = (pth, data = {}) =>
|
const renderCastTemplate = (pth, data = {}) =>
|
||||||
renderTemplate(pth, data, (tpl) =>
|
renderTemplate(pth, data, (tpl) =>
|
||||||
path.resolve(config.cast_dir, "src/html/", `${tpl}.html.template`)
|
path.resolve(paths.cast_dir, "src/html/", `${tpl}.html.template`)
|
||||||
);
|
);
|
||||||
|
|
||||||
const renderGalleryTemplate = (pth, data = {}) =>
|
const renderGalleryTemplate = (pth, data = {}) =>
|
||||||
renderTemplate(pth, data, (tpl) =>
|
renderTemplate(pth, data, (tpl) =>
|
||||||
path.resolve(config.gallery_dir, "src/html/", `${tpl}.html.template`)
|
path.resolve(paths.gallery_dir, "src/html/", `${tpl}.html.template`)
|
||||||
);
|
);
|
||||||
|
|
||||||
const minifyHtml = (content) =>
|
const minifyHtml = (content) =>
|
||||||
@@ -47,34 +52,39 @@ gulp.task("gen-pages-dev", (done) => {
|
|||||||
for (const page of PAGES) {
|
for (const page of PAGES) {
|
||||||
const content = renderTemplate(page, {
|
const content = renderTemplate(page, {
|
||||||
latestPageJS: `/frontend_latest/${page}.js`,
|
latestPageJS: `/frontend_latest/${page}.js`,
|
||||||
latestHassIconsJS: "/frontend_latest/hass-icons.js",
|
|
||||||
|
|
||||||
es5Compatibility: "/frontend_es5/compatibility.js",
|
es5Compatibility: "/frontend_es5/compatibility.js",
|
||||||
es5PageJS: `/frontend_es5/${page}.js`,
|
es5PageJS: `/frontend_es5/${page}.js`,
|
||||||
es5HassIconsJS: "/frontend_es5/hass-icons.js",
|
|
||||||
});
|
});
|
||||||
|
|
||||||
fs.outputFileSync(path.resolve(config.root, `${page}.html`), content);
|
fs.outputFileSync(
|
||||||
|
path.resolve(paths.app_output_root, `${page}.html`),
|
||||||
|
content
|
||||||
|
);
|
||||||
}
|
}
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task("gen-pages-prod", (done) => {
|
gulp.task("gen-pages-prod", (done) => {
|
||||||
const latestManifest = require(path.resolve(config.output, "manifest.json"));
|
const latestManifest = require(path.resolve(
|
||||||
const es5Manifest = require(path.resolve(config.output_es5, "manifest.json"));
|
paths.app_output_latest,
|
||||||
|
"manifest.json"
|
||||||
|
));
|
||||||
|
const es5Manifest = require(path.resolve(
|
||||||
|
paths.app_output_es5,
|
||||||
|
"manifest.json"
|
||||||
|
));
|
||||||
|
|
||||||
for (const page of PAGES) {
|
for (const page of PAGES) {
|
||||||
const content = renderTemplate(page, {
|
const content = renderTemplate(page, {
|
||||||
latestPageJS: latestManifest[`${page}.js`],
|
latestPageJS: latestManifest[`${page}.js`],
|
||||||
latestHassIconsJS: latestManifest["hass-icons.js"],
|
|
||||||
|
|
||||||
es5Compatibility: es5Manifest["compatibility.js"],
|
es5Compatibility: es5Manifest["compatibility.js"],
|
||||||
es5PageJS: es5Manifest[`${page}.js`],
|
es5PageJS: es5Manifest[`${page}.js`],
|
||||||
es5HassIconsJS: es5Manifest["hass-icons.js"],
|
|
||||||
});
|
});
|
||||||
|
|
||||||
fs.outputFileSync(
|
fs.outputFileSync(
|
||||||
path.resolve(config.root, `${page}.html`),
|
path.resolve(paths.app_output_root, `${page}.html`),
|
||||||
minifyHtml(content)
|
minifyHtml(content)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -88,37 +98,42 @@ gulp.task("gen-index-app-dev", (done) => {
|
|||||||
latestAppJS: "/frontend_latest/app.js",
|
latestAppJS: "/frontend_latest/app.js",
|
||||||
latestCoreJS: "/frontend_latest/core.js",
|
latestCoreJS: "/frontend_latest/core.js",
|
||||||
latestCustomPanelJS: "/frontend_latest/custom-panel.js",
|
latestCustomPanelJS: "/frontend_latest/custom-panel.js",
|
||||||
latestHassIconsJS: "/frontend_latest/hass-icons.js",
|
|
||||||
|
|
||||||
es5Compatibility: "/frontend_es5/compatibility.js",
|
es5Compatibility: "/frontend_es5/compatibility.js",
|
||||||
es5AppJS: "/frontend_es5/app.js",
|
es5AppJS: "/frontend_es5/app.js",
|
||||||
es5CoreJS: "/frontend_es5/core.js",
|
es5CoreJS: "/frontend_es5/core.js",
|
||||||
es5CustomPanelJS: "/frontend_es5/custom-panel.js",
|
es5CustomPanelJS: "/frontend_es5/custom-panel.js",
|
||||||
es5HassIconsJS: "/frontend_es5/hass-icons.js",
|
|
||||||
}).replace(/#THEMEC/g, "{{ theme_color }}");
|
}).replace(/#THEMEC/g, "{{ theme_color }}");
|
||||||
|
|
||||||
fs.outputFileSync(path.resolve(config.root, "index.html"), content);
|
fs.outputFileSync(path.resolve(paths.app_output_root, "index.html"), content);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task("gen-index-app-prod", (done) => {
|
gulp.task("gen-index-app-prod", (done) => {
|
||||||
const latestManifest = require(path.resolve(config.output, "manifest.json"));
|
const latestManifest = require(path.resolve(
|
||||||
const es5Manifest = require(path.resolve(config.output_es5, "manifest.json"));
|
paths.app_output_latest,
|
||||||
|
"manifest.json"
|
||||||
|
));
|
||||||
|
const es5Manifest = require(path.resolve(
|
||||||
|
paths.app_output_es5,
|
||||||
|
"manifest.json"
|
||||||
|
));
|
||||||
const content = renderTemplate("index", {
|
const content = renderTemplate("index", {
|
||||||
latestAppJS: latestManifest["app.js"],
|
latestAppJS: latestManifest["app.js"],
|
||||||
latestCoreJS: latestManifest["core.js"],
|
latestCoreJS: latestManifest["core.js"],
|
||||||
latestCustomPanelJS: latestManifest["custom-panel.js"],
|
latestCustomPanelJS: latestManifest["custom-panel.js"],
|
||||||
latestHassIconsJS: latestManifest["hass-icons.js"],
|
|
||||||
|
|
||||||
es5Compatibility: es5Manifest["compatibility.js"],
|
es5Compatibility: es5Manifest["compatibility.js"],
|
||||||
es5AppJS: es5Manifest["app.js"],
|
es5AppJS: es5Manifest["app.js"],
|
||||||
es5CoreJS: es5Manifest["core.js"],
|
es5CoreJS: es5Manifest["core.js"],
|
||||||
es5CustomPanelJS: es5Manifest["custom-panel.js"],
|
es5CustomPanelJS: es5Manifest["custom-panel.js"],
|
||||||
es5HassIconsJS: es5Manifest["hass-icons.js"],
|
|
||||||
});
|
});
|
||||||
const minified = minifyHtml(content).replace(/#THEMEC/g, "{{ theme_color }}");
|
const minified = minifyHtml(content).replace(/#THEMEC/g, "{{ theme_color }}");
|
||||||
|
|
||||||
fs.outputFileSync(path.resolve(config.root, "index.html"), minified);
|
fs.outputFileSync(
|
||||||
|
path.resolve(paths.app_output_root, "index.html"),
|
||||||
|
minified
|
||||||
|
);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -127,7 +142,7 @@ gulp.task("gen-index-cast-dev", (done) => {
|
|||||||
latestReceiverJS: "/frontend_latest/receiver.js",
|
latestReceiverJS: "/frontend_latest/receiver.js",
|
||||||
});
|
});
|
||||||
fs.outputFileSync(
|
fs.outputFileSync(
|
||||||
path.resolve(config.cast_root, "receiver.html"),
|
path.resolve(paths.cast_output_root, "receiver.html"),
|
||||||
contentReceiver
|
contentReceiver
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -135,14 +150,17 @@ gulp.task("gen-index-cast-dev", (done) => {
|
|||||||
latestLauncherJS: "/frontend_latest/launcher.js",
|
latestLauncherJS: "/frontend_latest/launcher.js",
|
||||||
es5LauncherJS: "/frontend_es5/launcher.js",
|
es5LauncherJS: "/frontend_es5/launcher.js",
|
||||||
});
|
});
|
||||||
fs.outputFileSync(path.resolve(config.cast_root, "faq.html"), contentFAQ);
|
fs.outputFileSync(
|
||||||
|
path.resolve(paths.cast_output_root, "faq.html"),
|
||||||
|
contentFAQ
|
||||||
|
);
|
||||||
|
|
||||||
const contentLauncher = renderCastTemplate("launcher", {
|
const contentLauncher = renderCastTemplate("launcher", {
|
||||||
latestLauncherJS: "/frontend_latest/launcher.js",
|
latestLauncherJS: "/frontend_latest/launcher.js",
|
||||||
es5LauncherJS: "/frontend_es5/launcher.js",
|
es5LauncherJS: "/frontend_es5/launcher.js",
|
||||||
});
|
});
|
||||||
fs.outputFileSync(
|
fs.outputFileSync(
|
||||||
path.resolve(config.cast_root, "index.html"),
|
path.resolve(paths.cast_output_root, "index.html"),
|
||||||
contentLauncher
|
contentLauncher
|
||||||
);
|
);
|
||||||
done();
|
done();
|
||||||
@@ -150,11 +168,11 @@ gulp.task("gen-index-cast-dev", (done) => {
|
|||||||
|
|
||||||
gulp.task("gen-index-cast-prod", (done) => {
|
gulp.task("gen-index-cast-prod", (done) => {
|
||||||
const latestManifest = require(path.resolve(
|
const latestManifest = require(path.resolve(
|
||||||
config.cast_output,
|
paths.cast_output_latest,
|
||||||
"manifest.json"
|
"manifest.json"
|
||||||
));
|
));
|
||||||
const es5Manifest = require(path.resolve(
|
const es5Manifest = require(path.resolve(
|
||||||
config.cast_output_es5,
|
paths.cast_output_es5,
|
||||||
"manifest.json"
|
"manifest.json"
|
||||||
));
|
));
|
||||||
|
|
||||||
@@ -162,7 +180,7 @@ gulp.task("gen-index-cast-prod", (done) => {
|
|||||||
latestReceiverJS: latestManifest["receiver.js"],
|
latestReceiverJS: latestManifest["receiver.js"],
|
||||||
});
|
});
|
||||||
fs.outputFileSync(
|
fs.outputFileSync(
|
||||||
path.resolve(config.cast_root, "receiver.html"),
|
path.resolve(paths.cast_output_root, "receiver.html"),
|
||||||
contentReceiver
|
contentReceiver
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -170,14 +188,17 @@ gulp.task("gen-index-cast-prod", (done) => {
|
|||||||
latestLauncherJS: latestManifest["launcher.js"],
|
latestLauncherJS: latestManifest["launcher.js"],
|
||||||
es5LauncherJS: es5Manifest["launcher.js"],
|
es5LauncherJS: es5Manifest["launcher.js"],
|
||||||
});
|
});
|
||||||
fs.outputFileSync(path.resolve(config.cast_root, "faq.html"), contentFAQ);
|
fs.outputFileSync(
|
||||||
|
path.resolve(paths.cast_output_root, "faq.html"),
|
||||||
|
contentFAQ
|
||||||
|
);
|
||||||
|
|
||||||
const contentLauncher = renderCastTemplate("launcher", {
|
const contentLauncher = renderCastTemplate("launcher", {
|
||||||
latestLauncherJS: latestManifest["launcher.js"],
|
latestLauncherJS: latestManifest["launcher.js"],
|
||||||
es5LauncherJS: es5Manifest["launcher.js"],
|
es5LauncherJS: es5Manifest["launcher.js"],
|
||||||
});
|
});
|
||||||
fs.outputFileSync(
|
fs.outputFileSync(
|
||||||
path.resolve(config.cast_root, "index.html"),
|
path.resolve(paths.cast_output_root, "index.html"),
|
||||||
contentLauncher
|
contentLauncher
|
||||||
);
|
);
|
||||||
done();
|
done();
|
||||||
@@ -193,17 +214,20 @@ gulp.task("gen-index-demo-dev", (done) => {
|
|||||||
es5DemoJS: "/frontend_es5/main.js",
|
es5DemoJS: "/frontend_es5/main.js",
|
||||||
});
|
});
|
||||||
|
|
||||||
fs.outputFileSync(path.resolve(config.demo_root, "index.html"), content);
|
fs.outputFileSync(
|
||||||
|
path.resolve(paths.demo_output_root, "index.html"),
|
||||||
|
content
|
||||||
|
);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task("gen-index-demo-prod", (done) => {
|
gulp.task("gen-index-demo-prod", (done) => {
|
||||||
const latestManifest = require(path.resolve(
|
const latestManifest = require(path.resolve(
|
||||||
config.demo_output,
|
paths.demo_output_latest,
|
||||||
"manifest.json"
|
"manifest.json"
|
||||||
));
|
));
|
||||||
const es5Manifest = require(path.resolve(
|
const es5Manifest = require(path.resolve(
|
||||||
config.demo_output_es5,
|
paths.demo_output_es5,
|
||||||
"manifest.json"
|
"manifest.json"
|
||||||
));
|
));
|
||||||
const content = renderDemoTemplate("index", {
|
const content = renderDemoTemplate("index", {
|
||||||
@@ -214,7 +238,10 @@ gulp.task("gen-index-demo-prod", (done) => {
|
|||||||
});
|
});
|
||||||
const minified = minifyHtml(content);
|
const minified = minifyHtml(content);
|
||||||
|
|
||||||
fs.outputFileSync(path.resolve(config.demo_root, "index.html"), minified);
|
fs.outputFileSync(
|
||||||
|
path.resolve(paths.demo_output_root, "index.html"),
|
||||||
|
minified
|
||||||
|
);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -222,16 +249,19 @@ gulp.task("gen-index-gallery-dev", (done) => {
|
|||||||
// In dev mode we don't mangle names, so we hardcode urls. That way we can
|
// In dev mode we don't mangle names, so we hardcode urls. That way we can
|
||||||
// run webpack as last in watch mode, which blocks output.
|
// run webpack as last in watch mode, which blocks output.
|
||||||
const content = renderGalleryTemplate("index", {
|
const content = renderGalleryTemplate("index", {
|
||||||
latestGalleryJS: "./entrypoint.js",
|
latestGalleryJS: "./frontend_latest/entrypoint.js",
|
||||||
});
|
});
|
||||||
|
|
||||||
fs.outputFileSync(path.resolve(config.gallery_root, "index.html"), content);
|
fs.outputFileSync(
|
||||||
|
path.resolve(paths.gallery_output_root, "index.html"),
|
||||||
|
content
|
||||||
|
);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task("gen-index-gallery-prod", (done) => {
|
gulp.task("gen-index-gallery-prod", (done) => {
|
||||||
const latestManifest = require(path.resolve(
|
const latestManifest = require(path.resolve(
|
||||||
config.gallery_output,
|
paths.gallery_output_latest,
|
||||||
"manifest.json"
|
"manifest.json"
|
||||||
));
|
));
|
||||||
const content = renderGalleryTemplate("index", {
|
const content = renderGalleryTemplate("index", {
|
||||||
@@ -239,6 +269,9 @@ gulp.task("gen-index-gallery-prod", (done) => {
|
|||||||
});
|
});
|
||||||
const minified = minifyHtml(content);
|
const minified = minifyHtml(content);
|
||||||
|
|
||||||
fs.outputFileSync(path.resolve(config.gallery_root, "index.html"), minified);
|
fs.outputFileSync(
|
||||||
|
path.resolve(paths.gallery_output_root, "index.html"),
|
||||||
|
minified
|
||||||
|
);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
@@ -1,13 +1,16 @@
|
|||||||
// Run demo develop mode
|
// Run demo develop mode
|
||||||
const gulp = require("gulp");
|
const gulp = require("gulp");
|
||||||
|
|
||||||
|
const env = require("../env");
|
||||||
|
|
||||||
require("./clean.js");
|
require("./clean.js");
|
||||||
require("./translations.js");
|
require("./translations.js");
|
||||||
require("./gen-icons.js");
|
require("./gen-icons-json.js");
|
||||||
require("./gather-static.js");
|
require("./gather-static.js");
|
||||||
require("./webpack.js");
|
require("./webpack.js");
|
||||||
require("./service-worker.js");
|
require("./service-worker.js");
|
||||||
require("./entry-html.js");
|
require("./entry-html.js");
|
||||||
|
require("./rollup.js");
|
||||||
|
|
||||||
gulp.task(
|
gulp.task(
|
||||||
"develop-gallery",
|
"develop-gallery",
|
||||||
@@ -16,10 +19,11 @@ gulp.task(
|
|||||||
process.env.NODE_ENV = "development";
|
process.env.NODE_ENV = "development";
|
||||||
},
|
},
|
||||||
"clean-gallery",
|
"clean-gallery",
|
||||||
gulp.parallel("gen-icons-app", "gen-icons-app", "build-translations"),
|
"translations-enable-merge-backend",
|
||||||
|
gulp.parallel("gen-icons-json", "build-translations"),
|
||||||
"copy-static-gallery",
|
"copy-static-gallery",
|
||||||
"gen-index-gallery-dev",
|
"gen-index-gallery-dev",
|
||||||
"webpack-dev-server-gallery"
|
env.useRollup() ? "rollup-dev-server-gallery" : "webpack-dev-server-gallery"
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -30,9 +34,10 @@ gulp.task(
|
|||||||
process.env.NODE_ENV = "production";
|
process.env.NODE_ENV = "production";
|
||||||
},
|
},
|
||||||
"clean-gallery",
|
"clean-gallery",
|
||||||
gulp.parallel("gen-icons-app", "gen-icons-mdi", "build-translations"),
|
"translations-enable-merge-backend",
|
||||||
|
gulp.parallel("gen-icons-json", "build-translations"),
|
||||||
"copy-static-gallery",
|
"copy-static-gallery",
|
||||||
"webpack-prod-gallery",
|
env.useRollup() ? "rollup-prod-gallery" : "webpack-prod-gallery",
|
||||||
"gen-index-gallery-prod"
|
"gen-index-gallery-prod"
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@@ -26,6 +26,13 @@ function copyTranslations(staticDir) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function copyMdiIcons(staticDir) {
|
||||||
|
const staticPath = genStaticPath(staticDir);
|
||||||
|
|
||||||
|
// MDI icons output
|
||||||
|
fs.copySync(polyPath("build/mdi"), staticPath("mdi"));
|
||||||
|
}
|
||||||
|
|
||||||
function copyPolyfills(staticDir) {
|
function copyPolyfills(staticDir) {
|
||||||
const staticPath = genStaticPath(staticDir);
|
const staticPath = genStaticPath(staticDir);
|
||||||
|
|
||||||
@@ -44,6 +51,12 @@ function copyPolyfills(staticDir) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function copyLoaderJS(staticDir) {
|
||||||
|
const staticPath = genStaticPath(staticDir);
|
||||||
|
copyFileDir(npmPath("systemjs/dist/s.min.js"), staticPath("js"));
|
||||||
|
copyFileDir(npmPath("systemjs/dist/s.min.js.map"), staticPath("js"));
|
||||||
|
}
|
||||||
|
|
||||||
function copyFonts(staticDir) {
|
function copyFonts(staticDir) {
|
||||||
const staticPath = genStaticPath(staticDir);
|
const staticPath = genStaticPath(staticDir);
|
||||||
// Local fonts
|
// Local fonts
|
||||||
@@ -65,61 +78,68 @@ function copyMapPanel(staticDir) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
gulp.task("copy-static", (done) => {
|
gulp.task("copy-translations-app", async () => {
|
||||||
const staticDir = paths.static;
|
const staticDir = paths.app_output_static;
|
||||||
const staticPath = genStaticPath(paths.static);
|
copyTranslations(staticDir);
|
||||||
// Basic static files
|
});
|
||||||
fs.copySync(polyPath("public"), paths.root);
|
|
||||||
|
|
||||||
|
gulp.task("copy-static-app", async () => {
|
||||||
|
const staticDir = paths.app_output_static;
|
||||||
|
// Basic static files
|
||||||
|
fs.copySync(polyPath("public"), paths.app_output_root);
|
||||||
|
|
||||||
|
copyLoaderJS(staticDir);
|
||||||
copyPolyfills(staticDir);
|
copyPolyfills(staticDir);
|
||||||
copyFonts(staticDir);
|
copyFonts(staticDir);
|
||||||
copyTranslations(staticDir);
|
copyTranslations(staticDir);
|
||||||
|
copyMdiIcons(staticDir);
|
||||||
|
|
||||||
// Panel assets
|
// Panel assets
|
||||||
copyFileDir(
|
|
||||||
npmPath("react-big-calendar/lib/css/react-big-calendar.css"),
|
|
||||||
staticPath("panels/calendar/")
|
|
||||||
);
|
|
||||||
copyMapPanel(staticDir);
|
copyMapPanel(staticDir);
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task("copy-static-demo", (done) => {
|
gulp.task("copy-static-demo", async () => {
|
||||||
// Copy app static files
|
// Copy app static files
|
||||||
fs.copySync(
|
fs.copySync(
|
||||||
polyPath("public/static"),
|
polyPath("public/static"),
|
||||||
path.resolve(paths.demo_root, "static")
|
path.resolve(paths.demo_output_root, "static")
|
||||||
);
|
);
|
||||||
// Copy demo static files
|
// Copy demo static files
|
||||||
fs.copySync(path.resolve(paths.demo_dir, "public"), paths.demo_root);
|
fs.copySync(path.resolve(paths.demo_dir, "public"), paths.demo_output_root);
|
||||||
|
|
||||||
copyPolyfills(paths.demo_static);
|
copyLoaderJS(paths.demo_output_static);
|
||||||
copyMapPanel(paths.demo_static);
|
copyPolyfills(paths.demo_output_static);
|
||||||
copyFonts(paths.demo_static);
|
copyMapPanel(paths.demo_output_static);
|
||||||
copyTranslations(paths.demo_static);
|
copyFonts(paths.demo_output_static);
|
||||||
done();
|
copyTranslations(paths.demo_output_static);
|
||||||
|
copyMdiIcons(paths.demo_output_static);
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task("copy-static-cast", (done) => {
|
gulp.task("copy-static-cast", async () => {
|
||||||
// Copy app static files
|
// Copy app static files
|
||||||
fs.copySync(polyPath("public/static"), paths.cast_static);
|
fs.copySync(polyPath("public/static"), paths.cast_output_static);
|
||||||
// Copy cast static files
|
// Copy cast static files
|
||||||
fs.copySync(path.resolve(paths.cast_dir, "public"), paths.cast_root);
|
fs.copySync(path.resolve(paths.cast_dir, "public"), paths.cast_output_root);
|
||||||
|
|
||||||
copyMapPanel(paths.cast_static);
|
copyLoaderJS(paths.cast_output_static);
|
||||||
copyFonts(paths.cast_static);
|
copyPolyfills(paths.cast_output_static);
|
||||||
copyTranslations(paths.cast_static);
|
copyMapPanel(paths.cast_output_static);
|
||||||
done();
|
copyFonts(paths.cast_output_static);
|
||||||
|
copyTranslations(paths.cast_output_static);
|
||||||
|
copyMdiIcons(paths.cast_output_static);
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task("copy-static-gallery", (done) => {
|
gulp.task("copy-static-gallery", async () => {
|
||||||
// Copy app static files
|
// Copy app static files
|
||||||
fs.copySync(polyPath("public/static"), paths.gallery_static);
|
fs.copySync(polyPath("public/static"), paths.gallery_output_static);
|
||||||
// Copy gallery static files
|
// Copy gallery static files
|
||||||
fs.copySync(path.resolve(paths.gallery_dir, "public"), paths.gallery_root);
|
fs.copySync(
|
||||||
|
path.resolve(paths.gallery_dir, "public"),
|
||||||
|
paths.gallery_output_root
|
||||||
|
);
|
||||||
|
|
||||||
copyMapPanel(paths.gallery_static);
|
copyMapPanel(paths.gallery_output_static);
|
||||||
copyFonts(paths.gallery_static);
|
copyFonts(paths.gallery_output_static);
|
||||||
copyTranslations(paths.gallery_static);
|
copyTranslations(paths.gallery_output_static);
|
||||||
done();
|
copyMdiIcons(paths.gallery_output_static);
|
||||||
});
|
});
|
||||||
|
112
build-scripts/gulp/gen-icons-json.js
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
const gulp = require("gulp");
|
||||||
|
const path = require("path");
|
||||||
|
const fs = require("fs");
|
||||||
|
const hash = require("object-hash");
|
||||||
|
|
||||||
|
const ICON_PACKAGE_PATH = path.resolve(
|
||||||
|
__dirname,
|
||||||
|
"../../node_modules/@mdi/svg/"
|
||||||
|
);
|
||||||
|
const META_PATH = path.resolve(ICON_PACKAGE_PATH, "meta.json");
|
||||||
|
const PACKAGE_PATH = path.resolve(ICON_PACKAGE_PATH, "package.json");
|
||||||
|
const ICON_PATH = path.resolve(ICON_PACKAGE_PATH, "svg");
|
||||||
|
const OUTPUT_DIR = path.resolve(__dirname, "../../build/mdi");
|
||||||
|
|
||||||
|
const encoding = "utf8";
|
||||||
|
|
||||||
|
const getMeta = () => {
|
||||||
|
const file = fs.readFileSync(META_PATH, { encoding });
|
||||||
|
const meta = JSON.parse(file);
|
||||||
|
return meta.map((icon) => {
|
||||||
|
const svg = fs.readFileSync(`${ICON_PATH}/${icon.name}.svg`, {
|
||||||
|
encoding,
|
||||||
|
});
|
||||||
|
return { path: svg.match(/ d="([^"]+)"/)[1], name: icon.name };
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const splitBySize = (meta) => {
|
||||||
|
const chunks = [];
|
||||||
|
const CHUNK_SIZE = 50000;
|
||||||
|
|
||||||
|
let curSize = 0;
|
||||||
|
let startKey;
|
||||||
|
let icons = [];
|
||||||
|
|
||||||
|
Object.values(meta).forEach((icon) => {
|
||||||
|
if (startKey === undefined) {
|
||||||
|
startKey = icon.name;
|
||||||
|
}
|
||||||
|
curSize += icon.path.length;
|
||||||
|
icons.push(icon);
|
||||||
|
if (curSize > CHUNK_SIZE) {
|
||||||
|
chunks.push({
|
||||||
|
startKey,
|
||||||
|
endKey: icon.name,
|
||||||
|
icons,
|
||||||
|
});
|
||||||
|
curSize = 0;
|
||||||
|
startKey = undefined;
|
||||||
|
icons = [];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
chunks.push({
|
||||||
|
startKey,
|
||||||
|
icons,
|
||||||
|
});
|
||||||
|
|
||||||
|
return chunks;
|
||||||
|
};
|
||||||
|
|
||||||
|
const findDifferentiator = (curString, prevString) => {
|
||||||
|
for (let i = 0; i < curString.length; i++) {
|
||||||
|
if (curString[i] !== prevString[i]) {
|
||||||
|
return curString.substring(0, i + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new Error("Cannot find differentiator", curString, prevString);
|
||||||
|
};
|
||||||
|
|
||||||
|
gulp.task("gen-icons-json", (done) => {
|
||||||
|
const meta = getMeta();
|
||||||
|
const split = splitBySize(meta);
|
||||||
|
|
||||||
|
if (!fs.existsSync(OUTPUT_DIR)) {
|
||||||
|
fs.mkdirSync(OUTPUT_DIR, { recursive: true });
|
||||||
|
}
|
||||||
|
const parts = [];
|
||||||
|
|
||||||
|
let lastEnd;
|
||||||
|
split.forEach((chunk) => {
|
||||||
|
let startKey;
|
||||||
|
if (lastEnd === undefined) {
|
||||||
|
chunk.startKey = undefined;
|
||||||
|
startKey = undefined;
|
||||||
|
} else {
|
||||||
|
startKey = findDifferentiator(chunk.startKey, lastEnd);
|
||||||
|
}
|
||||||
|
lastEnd = chunk.endKey;
|
||||||
|
|
||||||
|
const output = {};
|
||||||
|
chunk.icons.forEach((icon) => {
|
||||||
|
output[icon.name] = icon.path;
|
||||||
|
});
|
||||||
|
const filename = hash(output);
|
||||||
|
parts.push({ start: startKey, file: filename });
|
||||||
|
fs.writeFileSync(
|
||||||
|
path.resolve(OUTPUT_DIR, `${filename}.json`),
|
||||||
|
JSON.stringify(output)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
const file = fs.readFileSync(PACKAGE_PATH, { encoding });
|
||||||
|
const package = JSON.parse(file);
|
||||||
|
|
||||||
|
fs.writeFileSync(
|
||||||
|
path.resolve(OUTPUT_DIR, "iconMetadata.json"),
|
||||||
|
JSON.stringify({ version: package.version, parts })
|
||||||
|
);
|
||||||
|
|
||||||
|
done();
|
||||||
|
});
|
@@ -1,140 +0,0 @@
|
|||||||
const gulp = require("gulp");
|
|
||||||
const path = require("path");
|
|
||||||
const fs = require("fs");
|
|
||||||
const paths = require("../paths");
|
|
||||||
|
|
||||||
const ICON_PACKAGE_PATH = path.resolve(
|
|
||||||
__dirname,
|
|
||||||
"../../node_modules/@mdi/svg/"
|
|
||||||
);
|
|
||||||
const META_PATH = path.resolve(ICON_PACKAGE_PATH, "meta.json");
|
|
||||||
const ICON_PATH = path.resolve(ICON_PACKAGE_PATH, "svg");
|
|
||||||
const OUTPUT_DIR = path.resolve(__dirname, "../../build");
|
|
||||||
const MDI_OUTPUT_PATH = path.resolve(OUTPUT_DIR, "mdi.html");
|
|
||||||
const HASS_OUTPUT_PATH = path.resolve(OUTPUT_DIR, "hass-icons.html");
|
|
||||||
|
|
||||||
const BUILT_IN_PANEL_ICONS = [
|
|
||||||
"calendar", // Calendar
|
|
||||||
"settings", // Config
|
|
||||||
"home-assistant", // Hass.io
|
|
||||||
"poll-box", // History panel
|
|
||||||
"format-list-bulleted-type", // Logbook
|
|
||||||
"mailbox", // Mailbox
|
|
||||||
"tooltip-account", // Map
|
|
||||||
"cart", // Shopping List
|
|
||||||
"hammer", // developer-tools
|
|
||||||
];
|
|
||||||
|
|
||||||
// Given an icon name, load the SVG file
|
|
||||||
function loadIcon(name) {
|
|
||||||
const iconPath = path.resolve(ICON_PATH, `${name}.svg`);
|
|
||||||
try {
|
|
||||||
return fs.readFileSync(iconPath, "utf-8");
|
|
||||||
} catch (err) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Given an SVG file, convert it to an iron-iconset-svg definition
|
|
||||||
function transformXMLtoPolymer(name, xml) {
|
|
||||||
const start = xml.indexOf("><path") + 1;
|
|
||||||
const end = xml.length - start - 6;
|
|
||||||
const pth = xml.substr(start, end);
|
|
||||||
return `<g id="${name}">${pth}</g>`;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Given an iconset name and icon names, generate a polymer iconset
|
|
||||||
function generateIconset(iconsetName, iconNames) {
|
|
||||||
const iconDefs = Array.from(iconNames)
|
|
||||||
.map((name) => {
|
|
||||||
const iconDef = loadIcon(name);
|
|
||||||
if (!iconDef) {
|
|
||||||
throw new Error(`Unknown icon referenced: ${name}`);
|
|
||||||
}
|
|
||||||
return transformXMLtoPolymer(name, iconDef);
|
|
||||||
})
|
|
||||||
.join("");
|
|
||||||
return `<ha-iconset-svg name="${iconsetName}" size="24"><svg><defs>${iconDefs}</defs></svg></ha-iconset-svg>`;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Helper function to map recursively over files in a folder and it's subfolders
|
|
||||||
function mapFiles(startPath, filter, mapFunc) {
|
|
||||||
const files = fs.readdirSync(startPath);
|
|
||||||
for (let i = 0; i < files.length; i++) {
|
|
||||||
const filename = path.join(startPath, files[i]);
|
|
||||||
const stat = fs.lstatSync(filename);
|
|
||||||
if (stat.isDirectory()) {
|
|
||||||
mapFiles(filename, filter, mapFunc);
|
|
||||||
} else if (filename.indexOf(filter) >= 0) {
|
|
||||||
mapFunc(filename);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find all icons used by the project.
|
|
||||||
function findIcons(searchPath, iconsetName) {
|
|
||||||
const iconRegex = new RegExp(`${iconsetName}:[\\w-]+`, "g");
|
|
||||||
const icons = new Set();
|
|
||||||
function processFile(filename) {
|
|
||||||
const content = fs.readFileSync(filename);
|
|
||||||
let match;
|
|
||||||
// eslint-disable-next-line
|
|
||||||
while ((match = iconRegex.exec(content))) {
|
|
||||||
// strip off "hass:" and add to set
|
|
||||||
icons.add(match[0].substr(iconsetName.length + 1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mapFiles(searchPath, ".js", processFile);
|
|
||||||
mapFiles(searchPath, ".ts", processFile);
|
|
||||||
return icons;
|
|
||||||
}
|
|
||||||
|
|
||||||
gulp.task("gen-icons-mdi", (done) => {
|
|
||||||
const meta = JSON.parse(
|
|
||||||
fs.readFileSync(path.resolve(ICON_PACKAGE_PATH, META_PATH), "UTF-8")
|
|
||||||
);
|
|
||||||
const iconNames = meta.map((iconInfo) => iconInfo.name);
|
|
||||||
if (!fs.existsSync(OUTPUT_DIR)) {
|
|
||||||
fs.mkdirSync(OUTPUT_DIR);
|
|
||||||
}
|
|
||||||
fs.writeFileSync(MDI_OUTPUT_PATH, generateIconset("mdi", iconNames));
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task("gen-icons-app", (done) => {
|
|
||||||
const iconNames = findIcons("./src", "hass");
|
|
||||||
BUILT_IN_PANEL_ICONS.forEach((name) => iconNames.add(name));
|
|
||||||
if (!fs.existsSync(OUTPUT_DIR)) {
|
|
||||||
fs.mkdirSync(OUTPUT_DIR);
|
|
||||||
}
|
|
||||||
fs.writeFileSync(HASS_OUTPUT_PATH, generateIconset("hass", iconNames));
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task("gen-icons-demo", (done) => {
|
|
||||||
const iconNames = findIcons(path.resolve(paths.demo_dir, "./src"), "hademo");
|
|
||||||
fs.writeFileSync(
|
|
||||||
path.resolve(paths.demo_dir, "hademo-icons.html"),
|
|
||||||
generateIconset("hademo", iconNames)
|
|
||||||
);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task("gen-icons-hassio", (done) => {
|
|
||||||
const iconNames = findIcons(
|
|
||||||
path.resolve(paths.hassio_dir, "./src"),
|
|
||||||
"hassio"
|
|
||||||
);
|
|
||||||
// Find hassio icons inside HA main repo.
|
|
||||||
for (const item of findIcons(
|
|
||||||
path.resolve(paths.polymer_dir, "./src"),
|
|
||||||
"hassio"
|
|
||||||
)) {
|
|
||||||
iconNames.add(item);
|
|
||||||
}
|
|
||||||
fs.writeFileSync(
|
|
||||||
path.resolve(paths.hassio_dir, "hassio-icons.html"),
|
|
||||||
generateIconset("hassio", iconNames)
|
|
||||||
);
|
|
||||||
done();
|
|
||||||
});
|
|
@@ -1,11 +1,12 @@
|
|||||||
const gulp = require("gulp");
|
const gulp = require("gulp");
|
||||||
|
|
||||||
const envVars = require("../env");
|
const env = require("../env");
|
||||||
|
|
||||||
require("./clean.js");
|
require("./clean.js");
|
||||||
require("./gen-icons.js");
|
require("./gen-icons-json.js");
|
||||||
require("./webpack.js");
|
require("./webpack.js");
|
||||||
require("./compress.js");
|
require("./compress.js");
|
||||||
|
require("./rollup.js");
|
||||||
|
|
||||||
gulp.task(
|
gulp.task(
|
||||||
"develop-hassio",
|
"develop-hassio",
|
||||||
@@ -14,8 +15,8 @@ gulp.task(
|
|||||||
process.env.NODE_ENV = "development";
|
process.env.NODE_ENV = "development";
|
||||||
},
|
},
|
||||||
"clean-hassio",
|
"clean-hassio",
|
||||||
gulp.parallel("gen-icons-hassio", "gen-icons-mdi"),
|
"gen-icons-json",
|
||||||
"webpack-watch-hassio"
|
env.useRollup() ? "rollup-watch-hassio" : "webpack-watch-hassio"
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -26,9 +27,9 @@ gulp.task(
|
|||||||
process.env.NODE_ENV = "production";
|
process.env.NODE_ENV = "production";
|
||||||
},
|
},
|
||||||
"clean-hassio",
|
"clean-hassio",
|
||||||
gulp.parallel("gen-icons-hassio", "gen-icons-mdi"),
|
"gen-icons-json",
|
||||||
"webpack-prod-hassio",
|
env.useRollup() ? "rollup-prod-hassio" : "webpack-prod-hassio",
|
||||||
...// Don't compress running tests
|
...// Don't compress running tests
|
||||||
(envVars.isTravis ? [] : ["compress-hassio"])
|
(env.isTest() ? [] : ["compress-hassio"])
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
155
build-scripts/gulp/rollup.js
Normal file
@@ -0,0 +1,155 @@
|
|||||||
|
// Tasks to run Rollup
|
||||||
|
const path = require("path");
|
||||||
|
const gulp = require("gulp");
|
||||||
|
const rollup = require("rollup");
|
||||||
|
const handler = require("serve-handler");
|
||||||
|
const http = require("http");
|
||||||
|
const log = require("fancy-log");
|
||||||
|
const rollupConfig = require("../rollup");
|
||||||
|
const paths = require("../paths");
|
||||||
|
const open = require("open");
|
||||||
|
|
||||||
|
const bothBuilds = (createConfigFunc, params) =>
|
||||||
|
gulp.series(
|
||||||
|
async function buildLatest() {
|
||||||
|
await buildRollup(
|
||||||
|
createConfigFunc({
|
||||||
|
...params,
|
||||||
|
latestBuild: true,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
},
|
||||||
|
async function buildES5() {
|
||||||
|
await buildRollup(
|
||||||
|
createConfigFunc({
|
||||||
|
...params,
|
||||||
|
latestBuild: false,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
function createServer(serveOptions) {
|
||||||
|
const server = http.createServer((request, response) => {
|
||||||
|
return handler(request, response, {
|
||||||
|
public: serveOptions.root,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
server.listen(
|
||||||
|
serveOptions.port,
|
||||||
|
serveOptions.networkAccess ? "0.0.0.0" : undefined,
|
||||||
|
() => {
|
||||||
|
log.info(`Available at http://localhost:${serveOptions.port}`);
|
||||||
|
open(`http://localhost:${serveOptions.port}`);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function watchRollup(createConfig, extraWatchSrc = [], serveOptions) {
|
||||||
|
const { inputOptions, outputOptions } = createConfig({
|
||||||
|
isProdBuild: false,
|
||||||
|
latestBuild: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
const watcher = rollup.watch({
|
||||||
|
...inputOptions,
|
||||||
|
output: [outputOptions],
|
||||||
|
watch: {
|
||||||
|
include: ["src/**"] + extraWatchSrc,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
let startedHttp = false;
|
||||||
|
|
||||||
|
watcher.on("event", (event) => {
|
||||||
|
if (event.code === "BUNDLE_END") {
|
||||||
|
log(`Build done @ ${new Date().toLocaleTimeString()}`);
|
||||||
|
} else if (event.code === "ERROR") {
|
||||||
|
log.error(event.error);
|
||||||
|
} else if (event.code === "END") {
|
||||||
|
if (startedHttp || !serveOptions) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
startedHttp = true;
|
||||||
|
createServer(serveOptions);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.watch(
|
||||||
|
path.join(paths.translations_src, "en.json"),
|
||||||
|
gulp.series("build-translations", "copy-translations-app")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function buildRollup(config) {
|
||||||
|
const bundle = await rollup.rollup(config.inputOptions);
|
||||||
|
await bundle.write(config.outputOptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
gulp.task("rollup-watch-app", () => {
|
||||||
|
watchRollup(rollupConfig.createAppConfig);
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task("rollup-watch-hassio", () => {
|
||||||
|
watchRollup(
|
||||||
|
// Force latestBuild = false for hassio config.
|
||||||
|
(conf) => rollupConfig.createHassioConfig({ ...conf, latestBuild: false }),
|
||||||
|
["hassio/src/**"]
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task("rollup-dev-server-demo", () => {
|
||||||
|
watchRollup(rollupConfig.createDemoConfig, ["demo/src/**"], {
|
||||||
|
root: paths.demo_output_root,
|
||||||
|
port: 8090,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task("rollup-dev-server-cast", () => {
|
||||||
|
watchRollup(rollupConfig.createCastConfig, ["cast/src/**"], {
|
||||||
|
root: paths.cast_output_root,
|
||||||
|
port: 8080,
|
||||||
|
networkAccess: true,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task("rollup-dev-server-gallery", () => {
|
||||||
|
watchRollup(rollupConfig.createGalleryConfig, ["gallery/src/**"], {
|
||||||
|
root: paths.gallery_output_root,
|
||||||
|
port: 8100,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task(
|
||||||
|
"rollup-prod-app",
|
||||||
|
bothBuilds(rollupConfig.createAppConfig, { isProdBuild: true })
|
||||||
|
);
|
||||||
|
|
||||||
|
gulp.task(
|
||||||
|
"rollup-prod-demo",
|
||||||
|
bothBuilds(rollupConfig.createDemoConfig, { isProdBuild: true })
|
||||||
|
);
|
||||||
|
|
||||||
|
gulp.task(
|
||||||
|
"rollup-prod-cast",
|
||||||
|
bothBuilds(rollupConfig.createCastConfig, { isProdBuild: true })
|
||||||
|
);
|
||||||
|
|
||||||
|
gulp.task("rollup-prod-hassio", () =>
|
||||||
|
buildRollup(
|
||||||
|
rollupConfig.createHassioConfig({
|
||||||
|
isProdBuild: true,
|
||||||
|
latestBuild: false,
|
||||||
|
})
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
gulp.task("rollup-prod-gallery", () =>
|
||||||
|
buildRollup(
|
||||||
|
rollupConfig.createGalleryConfig({
|
||||||
|
isProdBuild: true,
|
||||||
|
latestBuild: true,
|
||||||
|
})
|
||||||
|
)
|
||||||
|
);
|
@@ -5,18 +5,22 @@
|
|||||||
const gulp = require("gulp");
|
const gulp = require("gulp");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const fs = require("fs-extra");
|
const fs = require("fs-extra");
|
||||||
const config = require("../paths.js");
|
const workboxBuild = require("workbox-build");
|
||||||
|
const sourceMapUrl = require("source-map-url");
|
||||||
|
const paths = require("../paths.js");
|
||||||
|
|
||||||
const swPath = path.resolve(config.root, "service_worker.js");
|
const swDest = path.resolve(paths.app_output_root, "service_worker.js");
|
||||||
|
|
||||||
const writeSW = (content) => fs.outputFileSync(swPath, content.trim() + "\n");
|
const writeSW = (content) => fs.outputFileSync(swDest, content.trim() + "\n");
|
||||||
|
|
||||||
gulp.task("gen-service-worker-dev", (done) => {
|
gulp.task("gen-service-worker-app-dev", (done) => {
|
||||||
writeSW(
|
writeSW(
|
||||||
`
|
`
|
||||||
console.debug('Service worker disabled in development');
|
console.debug('Service worker disabled in development');
|
||||||
|
|
||||||
self.addEventListener('install', (event) => {
|
self.addEventListener('install', (event) => {
|
||||||
|
// This will activate the dev service worker,
|
||||||
|
// removing any prod service worker the dev might have running
|
||||||
self.skipWaiting();
|
self.skipWaiting();
|
||||||
});
|
});
|
||||||
`
|
`
|
||||||
@@ -24,10 +28,69 @@ self.addEventListener('install', (event) => {
|
|||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task("gen-service-worker-prod", (done) => {
|
gulp.task("gen-service-worker-app-prod", async () => {
|
||||||
fs.copySync(
|
// Read bundled source file
|
||||||
path.resolve(config.output, "service_worker.js"),
|
const bundleManifestLatest = require(path.resolve(
|
||||||
path.resolve(config.root, "service_worker.js")
|
paths.app_output_latest,
|
||||||
|
"manifest.json"
|
||||||
|
));
|
||||||
|
let serviceWorkerContent = fs.readFileSync(
|
||||||
|
paths.app_output_root + bundleManifestLatest["service_worker.js"],
|
||||||
|
"utf-8"
|
||||||
);
|
);
|
||||||
done();
|
|
||||||
|
// Delete old file from frontend_latest so manifest won't pick it up
|
||||||
|
fs.removeSync(
|
||||||
|
paths.app_output_root + bundleManifestLatest["service_worker.js"]
|
||||||
|
);
|
||||||
|
fs.removeSync(
|
||||||
|
paths.app_output_root + bundleManifestLatest["service_worker.js.map"]
|
||||||
|
);
|
||||||
|
|
||||||
|
// Remove ES5
|
||||||
|
const bundleManifestES5 = require(path.resolve(
|
||||||
|
paths.app_output_es5,
|
||||||
|
"manifest.json"
|
||||||
|
));
|
||||||
|
fs.removeSync(paths.app_output_root + bundleManifestES5["service_worker.js"]);
|
||||||
|
fs.removeSync(
|
||||||
|
paths.app_output_root + bundleManifestES5["service_worker.js.map"]
|
||||||
|
);
|
||||||
|
|
||||||
|
const workboxManifest = await workboxBuild.getManifest({
|
||||||
|
// Files that mach this pattern will be considered unique and skip revision check
|
||||||
|
// ignore JS files + translation files
|
||||||
|
dontCacheBustURLsMatching: /(frontend_latest\/.+|static\/translations\/.+)/,
|
||||||
|
|
||||||
|
globDirectory: paths.app_output_root,
|
||||||
|
globPatterns: [
|
||||||
|
"frontend_latest/*.js",
|
||||||
|
// Cache all English translations because we catch them as fallback
|
||||||
|
// Using pattern to match hash instead of * to avoid caching en-GB
|
||||||
|
// 'v' added as valid hash letter because in dev we hash with 'dev'
|
||||||
|
"static/translations/**/en-+([a-fv0-9]).json",
|
||||||
|
// Icon shown on splash screen
|
||||||
|
"static/icons/favicon-192x192.png",
|
||||||
|
"static/icons/favicon.ico",
|
||||||
|
// Common fonts
|
||||||
|
"static/fonts/roboto/Roboto-Light.woff2",
|
||||||
|
"static/fonts/roboto/Roboto-Medium.woff2",
|
||||||
|
"static/fonts/roboto/Roboto-Regular.woff2",
|
||||||
|
"static/fonts/roboto/Roboto-Bold.woff2",
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
for (const warning of workboxManifest.warnings) {
|
||||||
|
console.warn(warning);
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove source map and add WB manifest
|
||||||
|
serviceWorkerContent = sourceMapUrl.removeFrom(serviceWorkerContent);
|
||||||
|
serviceWorkerContent = serviceWorkerContent.replace(
|
||||||
|
"WB_MANIFEST",
|
||||||
|
JSON.stringify(workboxManifest.manifestEntries)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Write new file to root
|
||||||
|
fs.writeFileSync(swDest, serviceWorkerContent);
|
||||||
});
|
});
|
||||||
|
@@ -1,22 +1,33 @@
|
|||||||
|
const crypto = require("crypto");
|
||||||
const del = require("del");
|
const del = require("del");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
const source = require("vinyl-source-stream");
|
||||||
|
const vinylBuffer = require("vinyl-buffer");
|
||||||
const gulp = require("gulp");
|
const gulp = require("gulp");
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const foreach = require("gulp-foreach");
|
const foreach = require("gulp-foreach");
|
||||||
const hash = require("gulp-hash");
|
|
||||||
const hashFilename = require("gulp-hash-filename");
|
|
||||||
const merge = require("gulp-merge-json");
|
const merge = require("gulp-merge-json");
|
||||||
const minify = require("gulp-jsonminify");
|
const minify = require("gulp-jsonminify");
|
||||||
const rename = require("gulp-rename");
|
const rename = require("gulp-rename");
|
||||||
const transform = require("gulp-json-transform");
|
const transform = require("gulp-json-transform");
|
||||||
|
const { mapFiles } = require("../util");
|
||||||
|
const env = require("../env");
|
||||||
|
const paths = require("../paths");
|
||||||
|
|
||||||
const inDir = "translations";
|
const inFrontendDir = "translations/frontend";
|
||||||
|
const inBackendDir = "translations/backend";
|
||||||
const workDir = "build-translations";
|
const workDir = "build-translations";
|
||||||
const fullDir = workDir + "/full";
|
const fullDir = workDir + "/full";
|
||||||
const coreDir = workDir + "/core";
|
const coreDir = workDir + "/core";
|
||||||
const outDir = workDir + "/output";
|
const outDir = workDir + "/output";
|
||||||
|
let mergeBackend = false;
|
||||||
|
|
||||||
String.prototype.rsplit = function(sep, maxsplit) {
|
gulp.task("translations-enable-merge-backend", (done) => {
|
||||||
|
mergeBackend = true;
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
String.prototype.rsplit = function (sep, maxsplit) {
|
||||||
var split = this.split(sep);
|
var split = this.split(sep);
|
||||||
return maxsplit
|
return maxsplit
|
||||||
? [split.slice(0, -maxsplit).join(sep)].concat(split.slice(-maxsplit))
|
? [split.slice(0, -maxsplit).join(sep)].concat(split.slice(-maxsplit))
|
||||||
@@ -39,11 +50,9 @@ const TRANSLATION_FRAGMENTS = [
|
|||||||
"developer-tools",
|
"developer-tools",
|
||||||
];
|
];
|
||||||
|
|
||||||
const tasks = [];
|
|
||||||
|
|
||||||
function recursiveFlatten(prefix, data) {
|
function recursiveFlatten(prefix, data) {
|
||||||
let output = {};
|
let output = {};
|
||||||
Object.keys(data).forEach(function(key) {
|
Object.keys(data).forEach(function (key) {
|
||||||
if (typeof data[key] === "object") {
|
if (typeof data[key] === "object") {
|
||||||
output = {
|
output = {
|
||||||
...output,
|
...output,
|
||||||
@@ -105,7 +114,12 @@ function lokaliseTransform(data, original, file) {
|
|||||||
output[key] = lokaliseTransform(value, original, file);
|
output[key] = lokaliseTransform(value, original, file);
|
||||||
} else {
|
} else {
|
||||||
output[key] = value.replace(re_key_reference, (match, key) => {
|
output[key] = value.replace(re_key_reference, (match, key) => {
|
||||||
const replace = key.split("::").reduce((tr, k) => tr[k], original);
|
const replace = key.split("::").reduce((tr, k) => {
|
||||||
|
if (!tr) {
|
||||||
|
throw Error(`Invalid key placeholder ${key} in ${file.path}`);
|
||||||
|
}
|
||||||
|
return tr[k];
|
||||||
|
}, original);
|
||||||
if (typeof replace !== "string") {
|
if (typeof replace !== "string") {
|
||||||
throw Error(`Invalid key placeholder ${key} in ${file.path}`);
|
throw Error(`Invalid key placeholder ${key} in ${file.path}`);
|
||||||
}
|
}
|
||||||
@@ -116,11 +130,9 @@ function lokaliseTransform(data, original, file) {
|
|||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
let taskName = "clean-translations";
|
gulp.task("clean-translations", function () {
|
||||||
gulp.task(taskName, function() {
|
return del([workDir]);
|
||||||
return del([`${outDir}/**/*.json`]);
|
|
||||||
});
|
});
|
||||||
tasks.push(taskName);
|
|
||||||
|
|
||||||
gulp.task("ensure-translations-build-dir", (done) => {
|
gulp.task("ensure-translations-build-dir", (done) => {
|
||||||
if (!fs.existsSync(workDir)) {
|
if (!fs.existsSync(workDir)) {
|
||||||
@@ -129,31 +141,25 @@ gulp.task("ensure-translations-build-dir", (done) => {
|
|||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
taskName = "create-test-metadata";
|
gulp.task("create-test-metadata", function (cb) {
|
||||||
gulp.task(
|
fs.writeFile(
|
||||||
taskName,
|
workDir + "/testMetadata.json",
|
||||||
gulp.series("ensure-translations-build-dir", function writeTestMetaData(cb) {
|
JSON.stringify({
|
||||||
fs.writeFile(
|
test: {
|
||||||
workDir + "/testMetadata.json",
|
nativeName: "Test",
|
||||||
JSON.stringify({
|
},
|
||||||
test: {
|
}),
|
||||||
nativeName: "Test",
|
cb
|
||||||
},
|
);
|
||||||
}),
|
});
|
||||||
cb
|
|
||||||
);
|
|
||||||
})
|
|
||||||
);
|
|
||||||
tasks.push(taskName);
|
|
||||||
|
|
||||||
taskName = "create-test-translation";
|
|
||||||
gulp.task(
|
gulp.task(
|
||||||
taskName,
|
"create-test-translation",
|
||||||
gulp.series("create-test-metadata", function() {
|
gulp.series("create-test-metadata", function createTestTranslation() {
|
||||||
return gulp
|
return gulp
|
||||||
.src("src/translations/en.json")
|
.src(path.join(paths.translations_src, "en.json"))
|
||||||
.pipe(
|
.pipe(
|
||||||
transform(function(data, file) {
|
transform(function (data, file) {
|
||||||
return recursiveEmpty(data);
|
return recursiveEmpty(data);
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
@@ -161,7 +167,6 @@ gulp.task(
|
|||||||
.pipe(gulp.dest(workDir));
|
.pipe(gulp.dest(workDir));
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
tasks.push(taskName);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
@@ -172,235 +177,231 @@ tasks.push(taskName);
|
|||||||
* project is buildable immediately after merging new translation keys, since
|
* project is buildable immediately after merging new translation keys, since
|
||||||
* the Lokalise update to translations/en.json will not happen immediately.
|
* the Lokalise update to translations/en.json will not happen immediately.
|
||||||
*/
|
*/
|
||||||
taskName = "build-master-translation";
|
gulp.task("build-master-translation", function () {
|
||||||
gulp.task(
|
const src = [path.join(paths.translations_src, "en.json")];
|
||||||
taskName,
|
|
||||||
gulp.series("clean-translations", function() {
|
|
||||||
return gulp
|
|
||||||
.src("src/translations/en.json")
|
|
||||||
.pipe(
|
|
||||||
transform(function(data, file) {
|
|
||||||
return lokaliseTransform(data, data, file);
|
|
||||||
})
|
|
||||||
)
|
|
||||||
.pipe(rename("translationMaster.json"))
|
|
||||||
.pipe(gulp.dest(workDir));
|
|
||||||
})
|
|
||||||
);
|
|
||||||
tasks.push(taskName);
|
|
||||||
|
|
||||||
taskName = "build-merged-translations";
|
if (mergeBackend) {
|
||||||
gulp.task(
|
src.push(path.join(inBackendDir, "en.json"));
|
||||||
taskName,
|
}
|
||||||
gulp.series("build-master-translation", function() {
|
|
||||||
return gulp
|
return gulp
|
||||||
.src([inDir + "/*.json", workDir + "/test.json"], { allowEmpty: true })
|
.src(src)
|
||||||
.pipe(
|
.pipe(
|
||||||
transform(function(data, file) {
|
transform(function (data, file) {
|
||||||
return lokaliseTransform(data, data, file);
|
return lokaliseTransform(data, data, file);
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
.pipe(
|
.pipe(
|
||||||
foreach(function(stream, file) {
|
merge({
|
||||||
// For each language generate a merged json file. It begins with the master
|
fileName: "translationMaster.json",
|
||||||
// translation as a failsafe for untranslated strings, and merges all parent
|
})
|
||||||
// tags into one file for each specific subtag
|
)
|
||||||
//
|
.pipe(gulp.dest(workDir));
|
||||||
// TODO: This is a naive interpretation of BCP47 that should be improved.
|
});
|
||||||
// Will be OK for now as long as we don't have anything more complicated
|
|
||||||
// than a base translation + region.
|
gulp.task("build-merged-translations", function () {
|
||||||
const tr = path.basename(file.history[0], ".json");
|
return gulp
|
||||||
const subtags = tr.split("-");
|
.src([inFrontendDir + "/*.json", workDir + "/test.json"], {
|
||||||
const src = [workDir + "/translationMaster.json"];
|
allowEmpty: true,
|
||||||
for (let i = 1; i <= subtags.length; i++) {
|
})
|
||||||
const lang = subtags.slice(0, i).join("-");
|
.pipe(
|
||||||
if (lang === "test") {
|
transform(function (data, file) {
|
||||||
src.push(workDir + "/test.json");
|
return lokaliseTransform(data, data, file);
|
||||||
} else if (lang !== "en") {
|
})
|
||||||
src.push(inDir + "/" + lang + ".json");
|
)
|
||||||
|
.pipe(
|
||||||
|
foreach(function (stream, file) {
|
||||||
|
// For each language generate a merged json file. It begins with the master
|
||||||
|
// translation as a failsafe for untranslated strings, and merges all parent
|
||||||
|
// tags into one file for each specific subtag
|
||||||
|
//
|
||||||
|
// TODO: This is a naive interpretation of BCP47 that should be improved.
|
||||||
|
// Will be OK for now as long as we don't have anything more complicated
|
||||||
|
// than a base translation + region.
|
||||||
|
const tr = path.basename(file.history[0], ".json");
|
||||||
|
const subtags = tr.split("-");
|
||||||
|
const src = [workDir + "/translationMaster.json"];
|
||||||
|
for (let i = 1; i <= subtags.length; i++) {
|
||||||
|
const lang = subtags.slice(0, i).join("-");
|
||||||
|
if (lang === "test") {
|
||||||
|
src.push(workDir + "/test.json");
|
||||||
|
} else if (lang !== "en") {
|
||||||
|
src.push(inFrontendDir + "/" + lang + ".json");
|
||||||
|
if (mergeBackend) {
|
||||||
|
src.push(inBackendDir + "/" + lang + ".json");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return gulp
|
}
|
||||||
.src(src, { allowEmpty: true })
|
return gulp
|
||||||
.pipe(transform((data) => emptyFilter(data)))
|
.src(src, { allowEmpty: true })
|
||||||
.pipe(
|
.pipe(transform((data) => emptyFilter(data)))
|
||||||
merge({
|
.pipe(
|
||||||
fileName: tr + ".json",
|
merge({
|
||||||
})
|
fileName: tr + ".json",
|
||||||
)
|
})
|
||||||
.pipe(gulp.dest(fullDir));
|
)
|
||||||
})
|
.pipe(gulp.dest(fullDir));
|
||||||
);
|
})
|
||||||
})
|
);
|
||||||
);
|
});
|
||||||
tasks.push(taskName);
|
|
||||||
|
var taskName;
|
||||||
|
|
||||||
const splitTasks = [];
|
const splitTasks = [];
|
||||||
TRANSLATION_FRAGMENTS.forEach((fragment) => {
|
TRANSLATION_FRAGMENTS.forEach((fragment) => {
|
||||||
taskName = "build-translation-fragment-" + fragment;
|
taskName = "build-translation-fragment-" + fragment;
|
||||||
gulp.task(
|
gulp.task(taskName, function () {
|
||||||
taskName,
|
// Return only the translations for this fragment.
|
||||||
gulp.series("build-merged-translations", function() {
|
return gulp
|
||||||
// Return only the translations for this fragment.
|
.src(fullDir + "/*.json")
|
||||||
return gulp
|
.pipe(
|
||||||
.src(fullDir + "/*.json")
|
transform((data) => ({
|
||||||
.pipe(
|
ui: {
|
||||||
transform((data) => ({
|
panel: {
|
||||||
ui: {
|
[fragment]: data.ui.panel[fragment],
|
||||||
panel: {
|
|
||||||
[fragment]: data.ui.panel[fragment],
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}))
|
},
|
||||||
)
|
}))
|
||||||
.pipe(gulp.dest(workDir + "/" + fragment));
|
)
|
||||||
})
|
.pipe(gulp.dest(workDir + "/" + fragment));
|
||||||
);
|
});
|
||||||
tasks.push(taskName);
|
|
||||||
splitTasks.push(taskName);
|
splitTasks.push(taskName);
|
||||||
});
|
});
|
||||||
|
|
||||||
taskName = "build-translation-core";
|
taskName = "build-translation-core";
|
||||||
gulp.task(
|
gulp.task(taskName, function () {
|
||||||
taskName,
|
// Remove the fragment translations from the core translation.
|
||||||
gulp.series("build-merged-translations", function() {
|
return gulp
|
||||||
// Remove the fragment translations from the core translation.
|
.src(fullDir + "/*.json")
|
||||||
return gulp
|
.pipe(
|
||||||
.src(fullDir + "/*.json")
|
transform((data, file) => {
|
||||||
.pipe(
|
TRANSLATION_FRAGMENTS.forEach((fragment) => {
|
||||||
transform((data) => {
|
delete data.ui.panel[fragment];
|
||||||
TRANSLATION_FRAGMENTS.forEach((fragment) => {
|
});
|
||||||
delete data.ui.panel[fragment];
|
return data;
|
||||||
});
|
})
|
||||||
return data;
|
)
|
||||||
})
|
.pipe(gulp.dest(coreDir));
|
||||||
)
|
});
|
||||||
.pipe(gulp.dest(coreDir));
|
|
||||||
})
|
|
||||||
);
|
|
||||||
tasks.push(taskName);
|
|
||||||
splitTasks.push(taskName);
|
splitTasks.push(taskName);
|
||||||
|
|
||||||
taskName = "build-flattened-translations";
|
gulp.task("build-flattened-translations", function () {
|
||||||
gulp.task(
|
// Flatten the split versions of our translations, and move them into outDir
|
||||||
taskName,
|
return gulp
|
||||||
gulp.series(...splitTasks, function() {
|
.src(
|
||||||
// Flatten the split versions of our translations, and move them into outDir
|
TRANSLATION_FRAGMENTS.map(
|
||||||
return gulp
|
(fragment) => workDir + "/" + fragment + "/*.json"
|
||||||
.src(
|
).concat(coreDir + "/*.json"),
|
||||||
TRANSLATION_FRAGMENTS.map(
|
{ base: workDir }
|
||||||
(fragment) => workDir + "/" + fragment + "/*.json"
|
)
|
||||||
).concat(coreDir + "/*.json"),
|
.pipe(
|
||||||
{ base: workDir }
|
transform(function (data) {
|
||||||
)
|
// Polymer.AppLocalizeBehavior requires flattened json
|
||||||
.pipe(
|
return flatten(data);
|
||||||
transform(function(data) {
|
})
|
||||||
// Polymer.AppLocalizeBehavior requires flattened json
|
)
|
||||||
return flatten(data);
|
.pipe(minify())
|
||||||
})
|
.pipe(
|
||||||
)
|
rename((filePath) => {
|
||||||
.pipe(minify())
|
if (filePath.dirname === "core") {
|
||||||
.pipe(hashFilename())
|
filePath.dirname = "";
|
||||||
.pipe(
|
}
|
||||||
rename((filePath) => {
|
})
|
||||||
if (filePath.dirname === "core") {
|
)
|
||||||
filePath.dirname = "";
|
.pipe(gulp.dest(outDir));
|
||||||
}
|
});
|
||||||
})
|
|
||||||
)
|
|
||||||
.pipe(gulp.dest(outDir));
|
|
||||||
})
|
|
||||||
);
|
|
||||||
tasks.push(taskName);
|
|
||||||
|
|
||||||
taskName = "build-translation-fingerprints";
|
const fingerprints = {};
|
||||||
gulp.task(
|
|
||||||
taskName,
|
|
||||||
gulp.series("build-flattened-translations", function() {
|
|
||||||
return gulp
|
|
||||||
.src(outDir + "/**/*.json")
|
|
||||||
.pipe(
|
|
||||||
rename({
|
|
||||||
extname: "",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
.pipe(
|
|
||||||
hash({
|
|
||||||
algorithm: "md5",
|
|
||||||
hashLength: 32,
|
|
||||||
template: "<%= name %>.json",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
.pipe(hash.manifest("translationFingerprints.json"))
|
|
||||||
.pipe(
|
|
||||||
transform(function(data) {
|
|
||||||
// After generating fingerprints of our translation files, consolidate
|
|
||||||
// all translation fragment fingerprints under the translation name key
|
|
||||||
const newData = {};
|
|
||||||
Object.entries(data).forEach(([key, value]) => {
|
|
||||||
const [path, _md5] = key.rsplit("-", 1);
|
|
||||||
// let translation = key;
|
|
||||||
let translation = path;
|
|
||||||
const parts = translation.split("/");
|
|
||||||
if (parts.length === 2) {
|
|
||||||
translation = parts[1];
|
|
||||||
}
|
|
||||||
if (!(translation in newData)) {
|
|
||||||
newData[translation] = {
|
|
||||||
fingerprints: {},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
newData[translation].fingerprints[path] = value;
|
|
||||||
});
|
|
||||||
return newData;
|
|
||||||
})
|
|
||||||
)
|
|
||||||
.pipe(gulp.dest(workDir));
|
|
||||||
})
|
|
||||||
);
|
|
||||||
tasks.push(taskName);
|
|
||||||
|
|
||||||
taskName = "build-translations";
|
|
||||||
gulp.task(
|
gulp.task(
|
||||||
taskName,
|
"build-translation-fingerprints",
|
||||||
gulp.series("build-translation-fingerprints", function() {
|
function fingerprintTranslationFiles() {
|
||||||
return gulp
|
// Fingerprint full file of each language
|
||||||
.src(
|
const files = fs.readdirSync(fullDir);
|
||||||
[
|
|
||||||
"src/translations/translationMetadata.json",
|
|
||||||
workDir + "/testMetadata.json",
|
|
||||||
workDir + "/translationFingerprints.json",
|
|
||||||
],
|
|
||||||
{ allowEmpty: true }
|
|
||||||
)
|
|
||||||
.pipe(merge({}))
|
|
||||||
.pipe(
|
|
||||||
transform(function(data) {
|
|
||||||
const newData = {};
|
|
||||||
Object.entries(data).forEach(([key, value]) => {
|
|
||||||
// Filter out translations without native name.
|
|
||||||
if (data[key].nativeName) {
|
|
||||||
newData[key] = data[key];
|
|
||||||
} else {
|
|
||||||
console.warn(
|
|
||||||
`Skipping language ${key}. Native name was not translated.`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (data[key]) newData[key] = value;
|
|
||||||
});
|
|
||||||
return newData;
|
|
||||||
})
|
|
||||||
)
|
|
||||||
.pipe(
|
|
||||||
transform((data) => ({
|
|
||||||
fragments: TRANSLATION_FRAGMENTS,
|
|
||||||
translations: data,
|
|
||||||
}))
|
|
||||||
)
|
|
||||||
.pipe(rename("translationMetadata.json"))
|
|
||||||
.pipe(gulp.dest(workDir));
|
|
||||||
})
|
|
||||||
);
|
|
||||||
tasks.push(taskName);
|
|
||||||
|
|
||||||
module.exports = tasks;
|
for (let i = 0; i < files.length; i++) {
|
||||||
|
fingerprints[files[i].split(".")[0]] = {
|
||||||
|
// In dev we create fake hashes
|
||||||
|
hash: env.isProdBuild()
|
||||||
|
? crypto
|
||||||
|
.createHash("md5")
|
||||||
|
.update(fs.readFileSync(path.join(fullDir, files[i]), "utf-8"))
|
||||||
|
.digest("hex")
|
||||||
|
: "dev",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
mapFiles(outDir, ".json", (filename) => {
|
||||||
|
const parsed = path.parse(filename);
|
||||||
|
|
||||||
|
// nl.json -> nl-<hash>.json
|
||||||
|
if (!(parsed.name in fingerprints)) {
|
||||||
|
throw new Error(`Unable to find hash for ${filename}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
fs.renameSync(
|
||||||
|
filename,
|
||||||
|
`${parsed.dir}/${parsed.name}-${fingerprints[parsed.name].hash}${
|
||||||
|
parsed.ext
|
||||||
|
}`
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
const stream = source("translationFingerprints.json");
|
||||||
|
stream.write(JSON.stringify(fingerprints));
|
||||||
|
process.nextTick(() => stream.end());
|
||||||
|
return stream.pipe(vinylBuffer()).pipe(gulp.dest(workDir));
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
gulp.task(
|
||||||
|
"build-translations",
|
||||||
|
gulp.series(
|
||||||
|
"clean-translations",
|
||||||
|
"ensure-translations-build-dir",
|
||||||
|
env.isProdBuild() ? (done) => done() : "create-test-translation",
|
||||||
|
"build-master-translation",
|
||||||
|
"build-merged-translations",
|
||||||
|
gulp.parallel(...splitTasks),
|
||||||
|
"build-flattened-translations",
|
||||||
|
"build-translation-fingerprints",
|
||||||
|
function writeMetadata() {
|
||||||
|
return gulp
|
||||||
|
.src(
|
||||||
|
[
|
||||||
|
path.join(paths.translations_src, "translationMetadata.json"),
|
||||||
|
workDir + "/testMetadata.json",
|
||||||
|
workDir + "/translationFingerprints.json",
|
||||||
|
],
|
||||||
|
{ allowEmpty: true }
|
||||||
|
)
|
||||||
|
.pipe(merge({}))
|
||||||
|
.pipe(
|
||||||
|
transform(function (data) {
|
||||||
|
const newData = {};
|
||||||
|
Object.entries(data).forEach(([key, value]) => {
|
||||||
|
// Filter out translations without native name.
|
||||||
|
if (data[key].nativeName) {
|
||||||
|
newData[key] = data[key];
|
||||||
|
} else {
|
||||||
|
console.warn(
|
||||||
|
`Skipping language ${key}. Native name was not translated.`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (data[key]) newData[key] = value;
|
||||||
|
});
|
||||||
|
return newData;
|
||||||
|
})
|
||||||
|
)
|
||||||
|
.pipe(
|
||||||
|
transform((data) => ({
|
||||||
|
fragments: TRANSLATION_FRAGMENTS,
|
||||||
|
translations: data,
|
||||||
|
}))
|
||||||
|
)
|
||||||
|
.pipe(rename("translationMetadata.json"))
|
||||||
|
.pipe(gulp.dest(workDir));
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
@@ -3,6 +3,7 @@ const gulp = require("gulp");
|
|||||||
const webpack = require("webpack");
|
const webpack = require("webpack");
|
||||||
const WebpackDevServer = require("webpack-dev-server");
|
const WebpackDevServer = require("webpack-dev-server");
|
||||||
const log = require("fancy-log");
|
const log = require("fancy-log");
|
||||||
|
const path = require("path");
|
||||||
const paths = require("../paths");
|
const paths = require("../paths");
|
||||||
const {
|
const {
|
||||||
createAppConfig,
|
createAppConfig,
|
||||||
@@ -27,7 +28,7 @@ const runDevServer = ({
|
|||||||
open: true,
|
open: true,
|
||||||
watchContentBase: true,
|
watchContentBase: true,
|
||||||
contentBase,
|
contentBase,
|
||||||
}).listen(port, listenHost, function(err) {
|
}).listen(port, listenHost, function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
@@ -37,9 +38,9 @@ const runDevServer = ({
|
|||||||
|
|
||||||
const handler = (done) => (err, stats) => {
|
const handler = (done) => (err, stats) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.log(err.stack || err);
|
log.error(err.stack || err);
|
||||||
if (err.details) {
|
if (err.details) {
|
||||||
console.log(err.details);
|
log.error(err.details);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -47,7 +48,7 @@ const handler = (done) => (err, stats) => {
|
|||||||
log(`Build done @ ${new Date().toLocaleTimeString()}`);
|
log(`Build done @ ${new Date().toLocaleTimeString()}`);
|
||||||
|
|
||||||
if (stats.hasErrors() || stats.hasWarnings()) {
|
if (stats.hasErrors() || stats.hasWarnings()) {
|
||||||
console.log(stats.toString("minimal"));
|
log.warn(stats.toString("minimal"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (done) {
|
if (done) {
|
||||||
@@ -57,10 +58,14 @@ const handler = (done) => (err, stats) => {
|
|||||||
|
|
||||||
gulp.task("webpack-watch-app", () => {
|
gulp.task("webpack-watch-app", () => {
|
||||||
// we are not calling done, so this command will run forever
|
// we are not calling done, so this command will run forever
|
||||||
webpack(bothBuilds(createAppConfig, { isProdBuild: false })).watch(
|
webpack(createAppConfig({ isProdBuild: false, latestBuild: true })).watch(
|
||||||
{},
|
{ ignored: /build-translations/ },
|
||||||
handler()
|
handler()
|
||||||
);
|
);
|
||||||
|
gulp.watch(
|
||||||
|
path.join(paths.translations_src, "en.json"),
|
||||||
|
gulp.series("build-translations", "copy-translations-app")
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task(
|
gulp.task(
|
||||||
@@ -77,7 +82,7 @@ gulp.task(
|
|||||||
gulp.task("webpack-dev-server-demo", () => {
|
gulp.task("webpack-dev-server-demo", () => {
|
||||||
runDevServer({
|
runDevServer({
|
||||||
compiler: webpack(bothBuilds(createDemoConfig, { isProdBuild: false })),
|
compiler: webpack(bothBuilds(createDemoConfig, { isProdBuild: false })),
|
||||||
contentBase: paths.demo_root,
|
contentBase: paths.demo_output_root,
|
||||||
port: 8090,
|
port: 8090,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -98,7 +103,7 @@ gulp.task(
|
|||||||
gulp.task("webpack-dev-server-cast", () => {
|
gulp.task("webpack-dev-server-cast", () => {
|
||||||
runDevServer({
|
runDevServer({
|
||||||
compiler: webpack(bothBuilds(createCastConfig, { isProdBuild: false })),
|
compiler: webpack(bothBuilds(createCastConfig, { isProdBuild: false })),
|
||||||
contentBase: paths.cast_root,
|
contentBase: paths.cast_output_root,
|
||||||
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",
|
||||||
@@ -145,10 +150,9 @@ gulp.task(
|
|||||||
|
|
||||||
gulp.task("webpack-dev-server-gallery", () => {
|
gulp.task("webpack-dev-server-gallery", () => {
|
||||||
runDevServer({
|
runDevServer({
|
||||||
compiler: webpack(
|
// We don't use the es5 build, but the dev server will fuck up the publicPath if we don't
|
||||||
createGalleryConfig({ latestBuild: true, isProdBuild: false })
|
compiler: webpack(bothBuilds(createGalleryConfig, { isProdBuild: false })),
|
||||||
),
|
contentBase: paths.gallery_output_root,
|
||||||
contentBase: paths.gallery_root,
|
|
||||||
port: 8100,
|
port: 8100,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -4,29 +4,37 @@ module.exports = {
|
|||||||
polymer_dir: path.resolve(__dirname, ".."),
|
polymer_dir: path.resolve(__dirname, ".."),
|
||||||
|
|
||||||
build_dir: path.resolve(__dirname, "../build"),
|
build_dir: path.resolve(__dirname, "../build"),
|
||||||
root: path.resolve(__dirname, "../hass_frontend"),
|
app_output_root: path.resolve(__dirname, "../hass_frontend"),
|
||||||
static: path.resolve(__dirname, "../hass_frontend/static"),
|
app_output_static: path.resolve(__dirname, "../hass_frontend/static"),
|
||||||
output: path.resolve(__dirname, "../hass_frontend/frontend_latest"),
|
app_output_latest: path.resolve(
|
||||||
output_es5: path.resolve(__dirname, "../hass_frontend/frontend_es5"),
|
__dirname,
|
||||||
|
"../hass_frontend/frontend_latest"
|
||||||
|
),
|
||||||
|
app_output_es5: path.resolve(__dirname, "../hass_frontend/frontend_es5"),
|
||||||
|
|
||||||
demo_dir: path.resolve(__dirname, "../demo"),
|
demo_dir: path.resolve(__dirname, "../demo"),
|
||||||
demo_root: path.resolve(__dirname, "../demo/dist"),
|
demo_output_root: path.resolve(__dirname, "../demo/dist"),
|
||||||
demo_static: path.resolve(__dirname, "../demo/dist/static"),
|
demo_output_static: path.resolve(__dirname, "../demo/dist/static"),
|
||||||
demo_output: path.resolve(__dirname, "../demo/dist/frontend_latest"),
|
demo_output_latest: path.resolve(__dirname, "../demo/dist/frontend_latest"),
|
||||||
demo_output_es5: path.resolve(__dirname, "../demo/dist/frontend_es5"),
|
demo_output_es5: path.resolve(__dirname, "../demo/dist/frontend_es5"),
|
||||||
|
|
||||||
cast_dir: path.resolve(__dirname, "../cast"),
|
cast_dir: path.resolve(__dirname, "../cast"),
|
||||||
cast_root: path.resolve(__dirname, "../cast/dist"),
|
cast_output_root: path.resolve(__dirname, "../cast/dist"),
|
||||||
cast_static: path.resolve(__dirname, "../cast/dist/static"),
|
cast_output_static: path.resolve(__dirname, "../cast/dist/static"),
|
||||||
cast_output: path.resolve(__dirname, "../cast/dist/frontend_latest"),
|
cast_output_latest: path.resolve(__dirname, "../cast/dist/frontend_latest"),
|
||||||
cast_output_es5: path.resolve(__dirname, "../cast/dist/frontend_es5"),
|
cast_output_es5: path.resolve(__dirname, "../cast/dist/frontend_es5"),
|
||||||
|
|
||||||
gallery_dir: path.resolve(__dirname, "../gallery"),
|
gallery_dir: path.resolve(__dirname, "../gallery"),
|
||||||
gallery_root: path.resolve(__dirname, "../gallery/dist"),
|
gallery_output_root: path.resolve(__dirname, "../gallery/dist"),
|
||||||
gallery_output: path.resolve(__dirname, "../gallery/dist/frontend_latest"),
|
gallery_output_latest: path.resolve(
|
||||||
gallery_static: path.resolve(__dirname, "../gallery/dist/static"),
|
__dirname,
|
||||||
|
"../gallery/dist/frontend_latest"
|
||||||
|
),
|
||||||
|
gallery_output_static: path.resolve(__dirname, "../gallery/dist/static"),
|
||||||
|
|
||||||
hassio_dir: path.resolve(__dirname, "../hassio"),
|
hassio_dir: path.resolve(__dirname, "../hassio"),
|
||||||
hassio_root: path.resolve(__dirname, "../hassio/build"),
|
hassio_output_root: path.resolve(__dirname, "../hassio/build"),
|
||||||
hassio_publicPath: "/api/hassio/app/",
|
hassio_publicPath: "/api/hassio/app/",
|
||||||
|
|
||||||
|
translations_src: path.resolve(__dirname, "../src/translations"),
|
||||||
};
|
};
|
||||||
|
14
build-scripts/rollup-plugins/dont-hash-plugin.js
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
module.exports = function (opts = {}) {
|
||||||
|
const dontHash = opts.dontHash || new Set();
|
||||||
|
|
||||||
|
return {
|
||||||
|
name: "dont-hash",
|
||||||
|
renderChunk(_code, chunk, _options) {
|
||||||
|
if (!chunk.isEntry || !dontHash.has(chunk.name)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
chunk.fileName = `${chunk.name}.js`;
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
52
build-scripts/rollup-plugins/ignore-plugin.js
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
const path = require("path");
|
||||||
|
|
||||||
|
module.exports = function (userOptions = {}) {
|
||||||
|
// Files need to be absolute paths.
|
||||||
|
// This only works if the file has no exports
|
||||||
|
// and only is imported for its side effects
|
||||||
|
const files = userOptions.files || [];
|
||||||
|
|
||||||
|
if (files.length === 0) {
|
||||||
|
return {
|
||||||
|
name: "ignore",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
name: "ignore",
|
||||||
|
resolveId(importee, importer) {
|
||||||
|
// Only use ignore to intercept imports that we don't control
|
||||||
|
// inside node_module dependencies.
|
||||||
|
if (
|
||||||
|
importee.endsWith("commonjsHelpers.js") ||
|
||||||
|
importee.endsWith("rollupPluginBabelHelpers.js") ||
|
||||||
|
importee.endsWith("?commonjs-proxy") ||
|
||||||
|
!importer ||
|
||||||
|
!importer.includes("/node_modules/")
|
||||||
|
) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
let fullPath;
|
||||||
|
try {
|
||||||
|
fullPath = importee.startsWith(".")
|
||||||
|
? path.resolve(importee, importer)
|
||||||
|
: require.resolve(importee);
|
||||||
|
} catch (err) {
|
||||||
|
console.error("Error in ignore plugin", { importee, importer }, err);
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
|
||||||
|
return files.some((toIgnorePath) => fullPath.startsWith(toIgnorePath))
|
||||||
|
? fullPath
|
||||||
|
: null;
|
||||||
|
},
|
||||||
|
|
||||||
|
load(id) {
|
||||||
|
return files.some((toIgnorePath) => id.startsWith(toIgnorePath))
|
||||||
|
? {
|
||||||
|
code: "",
|
||||||
|
}
|
||||||
|
: null;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
34
build-scripts/rollup-plugins/manifest-plugin.js
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
const url = require("url");
|
||||||
|
|
||||||
|
const defaultOptions = {
|
||||||
|
publicPath: "",
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = function (userOptions = {}) {
|
||||||
|
const options = { ...defaultOptions, ...userOptions };
|
||||||
|
|
||||||
|
return {
|
||||||
|
name: "manifest",
|
||||||
|
generateBundle(outputOptions, bundle) {
|
||||||
|
const manifest = {};
|
||||||
|
|
||||||
|
for (const chunk of Object.values(bundle)) {
|
||||||
|
if (!chunk.isEntry) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// Add js extension to mimic Webpack manifest.
|
||||||
|
manifest[`${chunk.name}.js`] = url.resolve(
|
||||||
|
options.publicPath,
|
||||||
|
chunk.fileName
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.emitFile({
|
||||||
|
type: "asset",
|
||||||
|
source: JSON.stringify(manifest, undefined, 2),
|
||||||
|
name: "manifest.json",
|
||||||
|
fileName: "manifest.json",
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
149
build-scripts/rollup-plugins/worker-plugin.js
Normal file
@@ -0,0 +1,149 @@
|
|||||||
|
// Worker plugin
|
||||||
|
// Each worker will include all of its dependencies
|
||||||
|
// instead of relying on an importer.
|
||||||
|
|
||||||
|
// Forked from v.1.4.1
|
||||||
|
// https://github.com/surma/rollup-plugin-off-main-thread
|
||||||
|
/**
|
||||||
|
* Copyright 2018 Google Inc. All Rights Reserved.
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const rollup = require("rollup");
|
||||||
|
const path = require("path");
|
||||||
|
const MagicString = require("magic-string");
|
||||||
|
|
||||||
|
const defaultOpts = {
|
||||||
|
// A RegExp to find `new Workers()` calls. The second capture group _must_
|
||||||
|
// capture the provided file name without the quotes.
|
||||||
|
workerRegexp: /new Worker\((["'])(.+?)\1(,[^)]+)?\)/g,
|
||||||
|
plugins: ["node-resolve", "commonjs", "babel", "terser", "ignore"],
|
||||||
|
};
|
||||||
|
|
||||||
|
async function getBundledWorker(workerPath, rollupOptions) {
|
||||||
|
const bundle = await rollup.rollup({
|
||||||
|
...rollupOptions,
|
||||||
|
input: {
|
||||||
|
worker: workerPath,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const { output } = await bundle.generate({
|
||||||
|
// Generates cleanest output, we shouldn't have any imports/exports
|
||||||
|
// that would be incompatible with ES5.
|
||||||
|
format: "es",
|
||||||
|
// We should not export anything. This will fail build if we are.
|
||||||
|
exports: "none",
|
||||||
|
});
|
||||||
|
|
||||||
|
let code;
|
||||||
|
|
||||||
|
for (const chunkOrAsset of output) {
|
||||||
|
if (chunkOrAsset.name === "worker") {
|
||||||
|
code = chunkOrAsset.code;
|
||||||
|
} else if (chunkOrAsset.type !== "asset") {
|
||||||
|
throw new Error("Unexpected extra output");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = function (opts = {}) {
|
||||||
|
opts = { ...defaultOpts, ...opts };
|
||||||
|
|
||||||
|
let rollupOptions;
|
||||||
|
let refIds;
|
||||||
|
|
||||||
|
return {
|
||||||
|
name: "hass-worker",
|
||||||
|
|
||||||
|
async buildStart(options) {
|
||||||
|
refIds = {};
|
||||||
|
rollupOptions = {
|
||||||
|
plugins: options.plugins.filter((plugin) =>
|
||||||
|
opts.plugins.includes(plugin.name)
|
||||||
|
),
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
async transform(code, id) {
|
||||||
|
// Copy the regexp as they are stateful and this hook is async.
|
||||||
|
const workerRegexp = new RegExp(
|
||||||
|
opts.workerRegexp.source,
|
||||||
|
opts.workerRegexp.flags
|
||||||
|
);
|
||||||
|
if (!workerRegexp.test(code)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const ms = new MagicString(code);
|
||||||
|
// Reset the regexp
|
||||||
|
workerRegexp.lastIndex = 0;
|
||||||
|
while (true) {
|
||||||
|
const match = workerRegexp.exec(code);
|
||||||
|
if (!match) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
const workerFile = match[2];
|
||||||
|
let optionsObject = {};
|
||||||
|
// Parse the optional options object
|
||||||
|
if (match[3] && match[3].length > 0) {
|
||||||
|
// FIXME: ooooof!
|
||||||
|
optionsObject = new Function(`return ${match[3].slice(1)};`)();
|
||||||
|
}
|
||||||
|
delete optionsObject.type;
|
||||||
|
|
||||||
|
if (!new RegExp("^.*/").test(workerFile)) {
|
||||||
|
this.warn(
|
||||||
|
`Paths passed to the Worker constructor must be relative or absolute, i.e. start with /, ./ or ../ (just like dynamic import!). Ignoring "${workerFile}".`
|
||||||
|
);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find worker file and store it as a chunk with ID prefixed for our loader
|
||||||
|
const resolvedWorkerFile = (await this.resolve(workerFile, id)).id;
|
||||||
|
let chunkRefId;
|
||||||
|
if (resolvedWorkerFile in refIds) {
|
||||||
|
chunkRefId = refIds[resolvedWorkerFile];
|
||||||
|
} else {
|
||||||
|
this.addWatchFile(resolvedWorkerFile);
|
||||||
|
const source = await getBundledWorker(
|
||||||
|
resolvedWorkerFile,
|
||||||
|
rollupOptions
|
||||||
|
);
|
||||||
|
chunkRefId = refIds[resolvedWorkerFile] = this.emitFile({
|
||||||
|
name: path.basename(resolvedWorkerFile),
|
||||||
|
source,
|
||||||
|
type: "asset",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const workerParametersStartIndex = match.index + "new Worker(".length;
|
||||||
|
const workerParametersEndIndex =
|
||||||
|
match.index + match[0].length - ")".length;
|
||||||
|
|
||||||
|
ms.overwrite(
|
||||||
|
workerParametersStartIndex,
|
||||||
|
workerParametersEndIndex,
|
||||||
|
`import.meta.ROLLUP_FILE_URL_${chunkRefId}, ${JSON.stringify(
|
||||||
|
optionsObject
|
||||||
|
)}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
code: ms.toString(),
|
||||||
|
map: ms.generateMap({ hires: true }),
|
||||||
|
};
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
151
build-scripts/rollup.js
Normal file
@@ -0,0 +1,151 @@
|
|||||||
|
const path = require("path");
|
||||||
|
|
||||||
|
const commonjs = require("@rollup/plugin-commonjs");
|
||||||
|
const resolve = require("@rollup/plugin-node-resolve");
|
||||||
|
const json = require("@rollup/plugin-json");
|
||||||
|
const babel = require("rollup-plugin-babel");
|
||||||
|
const replace = require("@rollup/plugin-replace");
|
||||||
|
const visualizer = require("rollup-plugin-visualizer");
|
||||||
|
const { string } = require("rollup-plugin-string");
|
||||||
|
const { terser } = require("rollup-plugin-terser");
|
||||||
|
const manifest = require("./rollup-plugins/manifest-plugin");
|
||||||
|
const worker = require("./rollup-plugins/worker-plugin");
|
||||||
|
const dontHashPlugin = require("./rollup-plugins/dont-hash-plugin");
|
||||||
|
const ignore = require("./rollup-plugins/ignore-plugin");
|
||||||
|
|
||||||
|
const bundle = require("./bundle");
|
||||||
|
const paths = require("./paths");
|
||||||
|
|
||||||
|
const extensions = [".js", ".ts"];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {Object} arg
|
||||||
|
* @param { import("rollup").InputOption } arg.input
|
||||||
|
*/
|
||||||
|
const createRollupConfig = ({
|
||||||
|
entry,
|
||||||
|
outputPath,
|
||||||
|
defineOverlay,
|
||||||
|
isProdBuild,
|
||||||
|
latestBuild,
|
||||||
|
isStatsBuild,
|
||||||
|
publicPath,
|
||||||
|
dontHash,
|
||||||
|
}) => {
|
||||||
|
return {
|
||||||
|
/**
|
||||||
|
* @type { import("rollup").InputOptions }
|
||||||
|
*/
|
||||||
|
inputOptions: {
|
||||||
|
input: entry,
|
||||||
|
// Some entry points contain no JavaScript. This setting silences a warning about that.
|
||||||
|
// https://rollupjs.org/guide/en/#preserveentrysignatures
|
||||||
|
preserveEntrySignatures: false,
|
||||||
|
plugins: [
|
||||||
|
ignore({
|
||||||
|
files: bundle.emptyPackages({ latestBuild }),
|
||||||
|
}),
|
||||||
|
resolve({
|
||||||
|
extensions,
|
||||||
|
preferBuiltins: false,
|
||||||
|
browser: true,
|
||||||
|
rootDir: paths.polymer_dir,
|
||||||
|
}),
|
||||||
|
commonjs({
|
||||||
|
namedExports: {
|
||||||
|
"js-yaml": ["safeDump", "safeLoad"],
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
json(),
|
||||||
|
babel({
|
||||||
|
...bundle.babelOptions({ latestBuild }),
|
||||||
|
extensions,
|
||||||
|
exclude: bundle.babelExclude(),
|
||||||
|
}),
|
||||||
|
string({
|
||||||
|
// Import certain extensions as strings
|
||||||
|
include: [path.join(paths.polymer_dir, "node_modules/**/*.css")],
|
||||||
|
}),
|
||||||
|
replace(
|
||||||
|
bundle.definedVars({ isProdBuild, latestBuild, defineOverlay })
|
||||||
|
),
|
||||||
|
manifest({
|
||||||
|
publicPath,
|
||||||
|
}),
|
||||||
|
worker(),
|
||||||
|
dontHashPlugin({ dontHash }),
|
||||||
|
isProdBuild && terser(bundle.terserOptions(latestBuild)),
|
||||||
|
isStatsBuild &&
|
||||||
|
visualizer({
|
||||||
|
// https://github.com/btd/rollup-plugin-visualizer#options
|
||||||
|
open: true,
|
||||||
|
sourcemap: true,
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* @type { import("rollup").OutputOptions }
|
||||||
|
*/
|
||||||
|
outputOptions: {
|
||||||
|
// https://rollupjs.org/guide/en/#outputdir
|
||||||
|
dir: outputPath,
|
||||||
|
// https://rollupjs.org/guide/en/#outputformat
|
||||||
|
format: latestBuild ? "es" : "systemjs",
|
||||||
|
// https://rollupjs.org/guide/en/#outputexternallivebindings
|
||||||
|
externalLiveBindings: false,
|
||||||
|
// https://rollupjs.org/guide/en/#outputentryfilenames
|
||||||
|
// https://rollupjs.org/guide/en/#outputchunkfilenames
|
||||||
|
// https://rollupjs.org/guide/en/#outputassetfilenames
|
||||||
|
entryFileNames:
|
||||||
|
isProdBuild && !isStatsBuild ? "[name]-[hash].js" : "[name].js",
|
||||||
|
chunkFileNames:
|
||||||
|
isProdBuild && !isStatsBuild ? "c.[hash].js" : "[name].js",
|
||||||
|
assetFileNames:
|
||||||
|
isProdBuild && !isStatsBuild ? "a.[hash].js" : "[name].js",
|
||||||
|
// https://rollupjs.org/guide/en/#outputsourcemap
|
||||||
|
sourcemap: isProdBuild ? true : "inline",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
const createAppConfig = ({ isProdBuild, latestBuild, isStatsBuild }) => {
|
||||||
|
return createRollupConfig(
|
||||||
|
bundle.config.app({
|
||||||
|
isProdBuild,
|
||||||
|
latestBuild,
|
||||||
|
isStatsBuild,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const createDemoConfig = ({ isProdBuild, latestBuild, isStatsBuild }) => {
|
||||||
|
return createRollupConfig(
|
||||||
|
bundle.config.demo({
|
||||||
|
isProdBuild,
|
||||||
|
latestBuild,
|
||||||
|
isStatsBuild,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const createCastConfig = ({ isProdBuild, latestBuild }) => {
|
||||||
|
return createRollupConfig(bundle.config.cast({ isProdBuild, latestBuild }));
|
||||||
|
};
|
||||||
|
|
||||||
|
const createHassioConfig = ({ isProdBuild, latestBuild }) => {
|
||||||
|
return createRollupConfig(bundle.config.hassio({ isProdBuild, latestBuild }));
|
||||||
|
};
|
||||||
|
|
||||||
|
const createGalleryConfig = ({ isProdBuild, latestBuild }) => {
|
||||||
|
return createRollupConfig(
|
||||||
|
bundle.config.gallery({ isProdBuild, latestBuild })
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
createAppConfig,
|
||||||
|
createDemoConfig,
|
||||||
|
createCastConfig,
|
||||||
|
createHassioConfig,
|
||||||
|
createGalleryConfig,
|
||||||
|
};
|
16
build-scripts/util.js
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
const path = require("path");
|
||||||
|
const fs = require("fs");
|
||||||
|
|
||||||
|
// Helper function to map recursively over files in a folder and it's subfolders
|
||||||
|
module.exports.mapFiles = function mapFiles(startPath, filter, mapFunc) {
|
||||||
|
const files = fs.readdirSync(startPath);
|
||||||
|
for (let i = 0; i < files.length; i++) {
|
||||||
|
const filename = path.join(startPath, files[i]);
|
||||||
|
const stat = fs.lstatSync(filename);
|
||||||
|
if (stat.isDirectory()) {
|
||||||
|
mapFiles(filename, filter, mapFunc);
|
||||||
|
} else if (filename.indexOf(filter) >= 0) {
|
||||||
|
mapFunc(filename);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
@@ -1,48 +1,46 @@
|
|||||||
const webpack = require("webpack");
|
const webpack = require("webpack");
|
||||||
const fs = require("fs");
|
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const TerserPlugin = require("terser-webpack-plugin");
|
const TerserPlugin = require("terser-webpack-plugin");
|
||||||
const WorkboxPlugin = require("workbox-webpack-plugin");
|
|
||||||
const ManifestPlugin = require("webpack-manifest-plugin");
|
const ManifestPlugin = require("webpack-manifest-plugin");
|
||||||
|
const WorkerPlugin = require("worker-plugin");
|
||||||
const paths = require("./paths.js");
|
const paths = require("./paths.js");
|
||||||
const { babelLoaderConfig } = require("./babel.js");
|
const bundle = require("./bundle");
|
||||||
|
|
||||||
let version = fs
|
|
||||||
.readFileSync(path.resolve(paths.polymer_dir, "setup.py"), "utf8")
|
|
||||||
.match(/\d{8}\.\d+/);
|
|
||||||
if (!version) {
|
|
||||||
throw Error("Version not found");
|
|
||||||
}
|
|
||||||
version = version[0];
|
|
||||||
|
|
||||||
const createWebpackConfig = ({
|
const createWebpackConfig = ({
|
||||||
entry,
|
entry,
|
||||||
outputRoot,
|
outputPath,
|
||||||
|
publicPath,
|
||||||
defineOverlay,
|
defineOverlay,
|
||||||
isProdBuild,
|
isProdBuild,
|
||||||
latestBuild,
|
latestBuild,
|
||||||
isStatsBuild,
|
isStatsBuild,
|
||||||
|
dontHash,
|
||||||
}) => {
|
}) => {
|
||||||
|
if (!dontHash) {
|
||||||
|
dontHash = new Set();
|
||||||
|
}
|
||||||
|
const ignorePackages = bundle.ignorePackages({ latestBuild });
|
||||||
return {
|
return {
|
||||||
mode: isProdBuild ? "production" : "development",
|
mode: isProdBuild ? "production" : "development",
|
||||||
devtool: isProdBuild ? "source-map" : "inline-cheap-module-source-map",
|
devtool: isProdBuild
|
||||||
|
? "cheap-module-source-map"
|
||||||
|
: "eval-cheap-module-source-map",
|
||||||
entry,
|
entry,
|
||||||
|
node: false,
|
||||||
module: {
|
module: {
|
||||||
rules: [
|
rules: [
|
||||||
babelLoaderConfig({ latestBuild }),
|
{
|
||||||
|
test: /\.js$|\.ts$/,
|
||||||
|
exclude: bundle.babelExclude(),
|
||||||
|
use: {
|
||||||
|
loader: "babel-loader",
|
||||||
|
options: bundle.babelOptions({ latestBuild }),
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
test: /\.css$/,
|
test: /\.css$/,
|
||||||
use: "raw-loader",
|
use: "raw-loader",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
test: /\.(html)$/,
|
|
||||||
use: {
|
|
||||||
loader: "html-loader",
|
|
||||||
options: {
|
|
||||||
exportAsEs6Default: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
optimization: {
|
optimization: {
|
||||||
@@ -52,59 +50,55 @@ const createWebpackConfig = ({
|
|||||||
parallel: true,
|
parallel: true,
|
||||||
extractComments: true,
|
extractComments: true,
|
||||||
sourceMap: true,
|
sourceMap: true,
|
||||||
terserOptions: {
|
terserOptions: bundle.terserOptions(latestBuild),
|
||||||
safari10: true,
|
|
||||||
ecma: latestBuild ? undefined : 5,
|
|
||||||
},
|
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
new ManifestPlugin(),
|
new WorkerPlugin(),
|
||||||
new webpack.DefinePlugin({
|
new ManifestPlugin({
|
||||||
__DEV__: !isProdBuild,
|
// Only include the JS of entrypoints
|
||||||
__BUILD__: JSON.stringify(latestBuild ? "latest" : "es5"),
|
filter: (file) => file.isInitial && !file.name.endsWith(".map"),
|
||||||
__VERSION__: JSON.stringify(version),
|
}),
|
||||||
__DEMO__: false,
|
new webpack.DefinePlugin(
|
||||||
__STATIC_PATH__: "/static/",
|
bundle.definedVars({ isProdBuild, latestBuild, defineOverlay })
|
||||||
"process.env.NODE_ENV": JSON.stringify(
|
),
|
||||||
isProdBuild ? "production" : "development"
|
new webpack.IgnorePlugin({
|
||||||
),
|
checkResource(resource, context) {
|
||||||
...defineOverlay,
|
// Only use ignore to intercept imports that we don't control
|
||||||
|
// inside node_module dependencies.
|
||||||
|
if (
|
||||||
|
!context.includes("/node_modules/") ||
|
||||||
|
// calling define.amd will call require("!!webpack amd options")
|
||||||
|
resource.startsWith("!!webpack")
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
let fullPath;
|
||||||
|
try {
|
||||||
|
fullPath = resource.startsWith(".")
|
||||||
|
? path.resolve(context, resource)
|
||||||
|
: require.resolve(resource);
|
||||||
|
} catch (err) {
|
||||||
|
console.error("Error in ignore plugin", resource, context);
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ignorePackages.some((toIgnorePath) =>
|
||||||
|
fullPath.startsWith(toIgnorePath)
|
||||||
|
);
|
||||||
|
},
|
||||||
}),
|
}),
|
||||||
// Ignore moment.js locales
|
|
||||||
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
|
|
||||||
// Color.js is bloated, it contains all color definitions for all material color sets.
|
|
||||||
new webpack.NormalModuleReplacementPlugin(
|
new webpack.NormalModuleReplacementPlugin(
|
||||||
/@polymer\/paper-styles\/color\.js$/,
|
new RegExp(bundle.emptyPackages({ latestBuild }).join("|")),
|
||||||
path.resolve(paths.polymer_dir, "src/util/empty.js")
|
path.resolve(paths.polymer_dir, "src/util/empty.js")
|
||||||
),
|
),
|
||||||
// Ignore roboto pointing at CDN. We use local font-roboto-local.
|
],
|
||||||
new webpack.NormalModuleReplacementPlugin(
|
|
||||||
/@polymer\/font-roboto\/roboto\.js$/,
|
|
||||||
path.resolve(paths.polymer_dir, "src/util/empty.js")
|
|
||||||
),
|
|
||||||
// Ignore mwc icons pointing at CDN.
|
|
||||||
new webpack.NormalModuleReplacementPlugin(
|
|
||||||
/@material\/mwc-icon\/mwc-icon-font\.js$/,
|
|
||||||
path.resolve(paths.polymer_dir, "src/util/empty.js")
|
|
||||||
),
|
|
||||||
].filter(Boolean),
|
|
||||||
resolve: {
|
resolve: {
|
||||||
extensions: [".ts", ".js", ".json", ".tsx"],
|
extensions: [".ts", ".js", ".json"],
|
||||||
alias: {
|
|
||||||
react: "preact-compat",
|
|
||||||
"react-dom": "preact-compat",
|
|
||||||
// Not necessary unless you consume a module using `createClass`
|
|
||||||
"create-react-class": "preact-compat/lib/create-react-class",
|
|
||||||
// Not necessary unless you consume a module requiring `react-dom-factories`
|
|
||||||
"react-dom-factories": "preact-compat/lib/react-dom-factories",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
output: {
|
output: {
|
||||||
filename: ({ chunk }) => {
|
filename: ({ chunk }) => {
|
||||||
const dontHash = new Set();
|
|
||||||
|
|
||||||
if (!isProdBuild || dontHash.has(chunk.name)) {
|
if (!isProdBuild || dontHash.has(chunk.name)) {
|
||||||
return `${chunk.name}.js`;
|
return `${chunk.name}.js`;
|
||||||
}
|
}
|
||||||
@@ -114,141 +108,40 @@ const createWebpackConfig = ({
|
|||||||
isProdBuild && !isStatsBuild
|
isProdBuild && !isStatsBuild
|
||||||
? "chunk.[chunkhash].js"
|
? "chunk.[chunkhash].js"
|
||||||
: "[name].chunk.js",
|
: "[name].chunk.js",
|
||||||
path: path.resolve(
|
path: outputPath,
|
||||||
outputRoot,
|
publicPath,
|
||||||
latestBuild ? "frontend_latest" : "frontend_es5"
|
// To silence warning in worker plugin
|
||||||
),
|
|
||||||
publicPath: latestBuild ? "/frontend_latest/" : "/frontend_es5/",
|
|
||||||
// For workerize loader
|
|
||||||
globalObject: "self",
|
globalObject: "self",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const createAppConfig = ({ isProdBuild, latestBuild, isStatsBuild }) => {
|
const createAppConfig = ({ isProdBuild, latestBuild, isStatsBuild }) => {
|
||||||
const config = createWebpackConfig({
|
return createWebpackConfig(
|
||||||
entry: {
|
bundle.config.app({ isProdBuild, latestBuild, isStatsBuild })
|
||||||
app: "./src/entrypoints/app.ts",
|
);
|
||||||
authorize: "./src/entrypoints/authorize.ts",
|
|
||||||
onboarding: "./src/entrypoints/onboarding.ts",
|
|
||||||
core: "./src/entrypoints/core.ts",
|
|
||||||
compatibility: "./src/entrypoints/compatibility.ts",
|
|
||||||
"custom-panel": "./src/entrypoints/custom-panel.ts",
|
|
||||||
"hass-icons": "./src/entrypoints/hass-icons.ts",
|
|
||||||
},
|
|
||||||
outputRoot: paths.root,
|
|
||||||
isProdBuild,
|
|
||||||
latestBuild,
|
|
||||||
isStatsBuild,
|
|
||||||
});
|
|
||||||
|
|
||||||
if (latestBuild) {
|
|
||||||
// Create an object mapping browser urls to their paths during build
|
|
||||||
const translationMetadata = require("../build-translations/translationMetadata.json");
|
|
||||||
const workBoxTranslationsTemplatedURLs = {};
|
|
||||||
const englishFP = translationMetadata.translations.en.fingerprints;
|
|
||||||
Object.keys(englishFP).forEach((key) => {
|
|
||||||
workBoxTranslationsTemplatedURLs[
|
|
||||||
`/static/translations/${englishFP[key]}`
|
|
||||||
] = `build-translations/output/${key}.json`;
|
|
||||||
});
|
|
||||||
|
|
||||||
config.plugins.push(
|
|
||||||
new WorkboxPlugin.InjectManifest({
|
|
||||||
swSrc: "./src/entrypoints/service-worker-hass.js",
|
|
||||||
swDest: "service_worker.js",
|
|
||||||
importWorkboxFrom: "local",
|
|
||||||
include: [/\.js$/],
|
|
||||||
templatedURLs: {
|
|
||||||
...workBoxTranslationsTemplatedURLs,
|
|
||||||
"/static/icons/favicon-192x192.png":
|
|
||||||
"public/icons/favicon-192x192.png",
|
|
||||||
"/static/fonts/roboto/Roboto-Light.woff2":
|
|
||||||
"node_modules/roboto-fontface/fonts/roboto/Roboto-Light.woff2",
|
|
||||||
"/static/fonts/roboto/Roboto-Medium.woff2":
|
|
||||||
"node_modules/roboto-fontface/fonts/roboto/Roboto-Medium.woff2",
|
|
||||||
"/static/fonts/roboto/Roboto-Regular.woff2":
|
|
||||||
"node_modules/roboto-fontface/fonts/roboto/Roboto-Regular.woff2",
|
|
||||||
"/static/fonts/roboto/Roboto-Bold.woff2":
|
|
||||||
"node_modules/roboto-fontface/fonts/roboto/Roboto-Bold.woff2",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return config;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const createDemoConfig = ({ isProdBuild, latestBuild, isStatsBuild }) => {
|
const createDemoConfig = ({ isProdBuild, latestBuild, isStatsBuild }) => {
|
||||||
return createWebpackConfig({
|
return createWebpackConfig(
|
||||||
entry: {
|
bundle.config.demo({ isProdBuild, latestBuild, isStatsBuild })
|
||||||
main: path.resolve(paths.demo_dir, "src/entrypoint.ts"),
|
);
|
||||||
compatibility: path.resolve(
|
|
||||||
paths.polymer_dir,
|
|
||||||
"src/entrypoints/compatibility.ts"
|
|
||||||
),
|
|
||||||
},
|
|
||||||
outputRoot: paths.demo_root,
|
|
||||||
defineOverlay: {
|
|
||||||
__VERSION__: JSON.stringify(`DEMO-${version}`),
|
|
||||||
__DEMO__: true,
|
|
||||||
},
|
|
||||||
isProdBuild,
|
|
||||||
latestBuild,
|
|
||||||
isStatsBuild,
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const createCastConfig = ({ isProdBuild, latestBuild }) => {
|
const createCastConfig = ({ isProdBuild, latestBuild }) => {
|
||||||
const entry = {
|
return createWebpackConfig(bundle.config.cast({ isProdBuild, latestBuild }));
|
||||||
launcher: path.resolve(paths.cast_dir, "src/launcher/entrypoint.ts"),
|
|
||||||
};
|
|
||||||
|
|
||||||
if (latestBuild) {
|
|
||||||
entry.receiver = path.resolve(paths.cast_dir, "src/receiver/entrypoint.ts");
|
|
||||||
}
|
|
||||||
|
|
||||||
return createWebpackConfig({
|
|
||||||
entry,
|
|
||||||
outputRoot: paths.cast_root,
|
|
||||||
isProdBuild,
|
|
||||||
latestBuild,
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const createHassioConfig = ({ isProdBuild, latestBuild }) => {
|
const createHassioConfig = ({ isProdBuild, latestBuild }) => {
|
||||||
if (latestBuild) {
|
return createWebpackConfig(
|
||||||
throw new Error("Hass.io does not support latest build!");
|
bundle.config.hassio({ isProdBuild, latestBuild })
|
||||||
}
|
);
|
||||||
const config = createWebpackConfig({
|
|
||||||
entry: {
|
|
||||||
entrypoint: path.resolve(paths.hassio_dir, "src/entrypoint.js"),
|
|
||||||
},
|
|
||||||
outputRoot: "",
|
|
||||||
isProdBuild,
|
|
||||||
latestBuild,
|
|
||||||
});
|
|
||||||
|
|
||||||
config.output.path = paths.hassio_root;
|
|
||||||
config.output.publicPath = paths.hassio_publicPath;
|
|
||||||
|
|
||||||
return config;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const createGalleryConfig = ({ isProdBuild, latestBuild }) => {
|
const createGalleryConfig = ({ isProdBuild, latestBuild }) => {
|
||||||
if (!latestBuild) {
|
return createWebpackConfig(
|
||||||
throw new Error("Gallery only supports latest build!");
|
bundle.config.gallery({ isProdBuild, latestBuild })
|
||||||
}
|
);
|
||||||
const config = createWebpackConfig({
|
|
||||||
entry: {
|
|
||||||
entrypoint: path.resolve(paths.gallery_dir, "src/entrypoint.js"),
|
|
||||||
},
|
|
||||||
outputRoot: paths.gallery_root,
|
|
||||||
isProdBuild,
|
|
||||||
latestBuild,
|
|
||||||
});
|
|
||||||
|
|
||||||
return config;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
10
cast/rollup.config.js
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
const rollup = require("../build-scripts/rollup.js");
|
||||||
|
const env = require("../build-scripts/env.js");
|
||||||
|
|
||||||
|
const config = rollup.createCastConfig({
|
||||||
|
isProdBuild: env.isProdBuild(),
|
||||||
|
latestBuild: true,
|
||||||
|
isStatsBuild: env.isStatsBuild(),
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = { ...config.inputOptions, output: config.outputOptions };
|
@@ -46,7 +46,13 @@
|
|||||||
// // Safari 10.1 supports type=module but ignores nomodule, so we add this check.
|
// // Safari 10.1 supports type=module but ignores nomodule, so we add this check.
|
||||||
if (!isS101) {
|
if (!isS101) {
|
||||||
_ls("/static/polyfills/custom-elements-es5-adapter.js");
|
_ls("/static/polyfills/custom-elements-es5-adapter.js");
|
||||||
_ls("<%= es5LauncherJS %>");
|
<% if (useRollup) { %>
|
||||||
|
_ls("/static/js/s.min.js").onload = function() {
|
||||||
|
System.import("<%= es5LauncherJS %>");
|
||||||
|
};
|
||||||
|
<% } else { %>
|
||||||
|
_ls("<%= es5LauncherJS %>");
|
||||||
|
<% } %>
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
|
@@ -37,7 +37,13 @@
|
|||||||
// // Safari 10.1 supports type=module but ignores nomodule, so we add this check.
|
// // Safari 10.1 supports type=module but ignores nomodule, so we add this check.
|
||||||
if (!isS101) {
|
if (!isS101) {
|
||||||
_ls("/static/polyfills/custom-elements-es5-adapter.js");
|
_ls("/static/polyfills/custom-elements-es5-adapter.js");
|
||||||
_ls("<%= es5LauncherJS %>");
|
<% if (useRollup) { %>
|
||||||
|
_ls("/static/js/s.min.js").onload = function() {
|
||||||
|
System.import("<%= es5LauncherJS %>");
|
||||||
|
};
|
||||||
|
<% } else { %>
|
||||||
|
_ls("<%= es5LauncherJS %>");
|
||||||
|
<% } %>
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
|
@@ -1,5 +1,3 @@
|
|||||||
import "../../../src/resources/ha-style";
|
import "../../../src/resources/ha-style";
|
||||||
import "../../../src/resources/roboto";
|
import "../../../src/resources/roboto";
|
||||||
import "../../../src/components/ha-iconset-svg";
|
|
||||||
import "../../../src/resources/hass-icons";
|
|
||||||
import "./layout/hc-connect";
|
import "./layout/hc-connect";
|
||||||
|
@@ -1,49 +1,53 @@
|
|||||||
|
import "@polymer/paper-item/paper-icon-item";
|
||||||
|
import "@polymer/paper-listbox/paper-listbox";
|
||||||
|
import { Auth, Connection } from "home-assistant-js-websocket";
|
||||||
import {
|
import {
|
||||||
|
css,
|
||||||
|
CSSResult,
|
||||||
customElement,
|
customElement,
|
||||||
|
html,
|
||||||
LitElement,
|
LitElement,
|
||||||
property,
|
property,
|
||||||
TemplateResult,
|
TemplateResult,
|
||||||
html,
|
|
||||||
CSSResult,
|
|
||||||
css,
|
|
||||||
} from "lit-element";
|
} from "lit-element";
|
||||||
import { Connection, Auth } from "home-assistant-js-websocket";
|
|
||||||
import "@polymer/iron-icon";
|
|
||||||
import "@polymer/paper-listbox/paper-listbox";
|
|
||||||
import "@polymer/paper-item/paper-icon-item";
|
|
||||||
import "../../../../src/components/ha-icon";
|
|
||||||
import {
|
|
||||||
enableWrite,
|
|
||||||
askWrite,
|
|
||||||
saveTokens,
|
|
||||||
} from "../../../../src/common/auth/token_storage";
|
|
||||||
import {
|
|
||||||
ensureConnectedCastSession,
|
|
||||||
castSendShowLovelaceView,
|
|
||||||
} from "../../../../src/cast/receiver_messages";
|
|
||||||
import "../../../../src/layouts/loading-screen";
|
|
||||||
import { CastManager } from "../../../../src/cast/cast_manager";
|
import { CastManager } from "../../../../src/cast/cast_manager";
|
||||||
import {
|
import {
|
||||||
LovelaceConfig,
|
castSendShowLovelaceView,
|
||||||
getLovelaceCollection,
|
ensureConnectedCastSession,
|
||||||
} from "../../../../src/data/lovelace";
|
} from "../../../../src/cast/receiver_messages";
|
||||||
import "./hc-layout";
|
import {
|
||||||
import { generateDefaultViewConfig } from "../../../../src/panels/lovelace/common/generate-lovelace-config";
|
askWrite,
|
||||||
|
enableWrite,
|
||||||
|
saveTokens,
|
||||||
|
} from "../../../../src/common/auth/token_storage";
|
||||||
|
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 {
|
||||||
|
getLegacyLovelaceCollection,
|
||||||
|
getLovelaceCollection,
|
||||||
|
LovelaceConfig,
|
||||||
|
} from "../../../../src/data/lovelace";
|
||||||
|
import "../../../../src/layouts/loading-screen";
|
||||||
|
import { generateDefaultViewConfig } from "../../../../src/panels/lovelace/common/generate-lovelace-config";
|
||||||
|
import "./hc-layout";
|
||||||
|
import "@material/mwc-button/mwc-button";
|
||||||
|
|
||||||
@customElement("hc-cast")
|
@customElement("hc-cast")
|
||||||
class HcCast extends LitElement {
|
class HcCast extends LitElement {
|
||||||
@property() public auth!: Auth;
|
@property() public auth!: Auth;
|
||||||
|
|
||||||
@property() public connection!: Connection;
|
@property() public connection!: Connection;
|
||||||
|
|
||||||
@property() public castManager!: CastManager;
|
@property() public castManager!: CastManager;
|
||||||
|
|
||||||
@property() private askWrite = false;
|
@property() private askWrite = false;
|
||||||
|
|
||||||
@property() private lovelaceConfig?: LovelaceConfig | null;
|
@property() private lovelaceConfig?: LovelaceConfig | null;
|
||||||
|
|
||||||
protected render(): TemplateResult | void {
|
protected render(): TemplateResult {
|
||||||
if (this.lovelaceConfig === undefined) {
|
if (this.lovelaceConfig === undefined) {
|
||||||
return html`
|
return html` <loading-screen></loading-screen>> `;
|
||||||
<loading-screen></loading-screen>>
|
|
||||||
`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const error =
|
const error =
|
||||||
@@ -73,14 +77,12 @@ class HcCast extends LitElement {
|
|||||||
`
|
`
|
||||||
: ""}
|
: ""}
|
||||||
${error
|
${error
|
||||||
? html`
|
? html` <div class="card-content">${error}</div> `
|
||||||
<div class="card-content">${error}</div>
|
|
||||||
`
|
|
||||||
: !this.castManager.status
|
: !this.castManager.status
|
||||||
? html`
|
? html`
|
||||||
<p class="center-item">
|
<p class="center-item">
|
||||||
<mwc-button raised @click=${this._handleLaunch}>
|
<mwc-button raised @click=${this._handleLaunch}>
|
||||||
<iron-icon icon="hass:cast"></iron-icon>
|
<ha-icon icon="hass:cast"></ha-icon>
|
||||||
Start Casting
|
Start Casting
|
||||||
</mwc-button>
|
</mwc-button>
|
||||||
</p>
|
</p>
|
||||||
@@ -118,7 +120,7 @@ class HcCast extends LitElement {
|
|||||||
${this.castManager.status
|
${this.castManager.status
|
||||||
? html`
|
? html`
|
||||||
<mwc-button @click=${this._handleLaunch}>
|
<mwc-button @click=${this._handleLaunch}>
|
||||||
<iron-icon icon="hass:cast-connected"></iron-icon>
|
<ha-icon icon="hass:cast-connected"></ha-icon>
|
||||||
Manage
|
Manage
|
||||||
</mwc-button>
|
</mwc-button>
|
||||||
`
|
`
|
||||||
@@ -133,7 +135,9 @@ class HcCast extends LitElement {
|
|||||||
protected firstUpdated(changedProps) {
|
protected firstUpdated(changedProps) {
|
||||||
super.firstUpdated(changedProps);
|
super.firstUpdated(changedProps);
|
||||||
|
|
||||||
const llColl = getLovelaceCollection(this.connection);
|
const llColl = atLeastVersion(this.connection.haVersion, 0, 107)
|
||||||
|
? getLovelaceCollection(this.connection)
|
||||||
|
: getLegacyLovelaceCollection(this.connection);
|
||||||
// We first do a single refresh because we need to check if there is LL
|
// We first do a single refresh because we need to check if there is LL
|
||||||
// configuration.
|
// configuration.
|
||||||
llColl.refresh().then(
|
llColl.refresh().then(
|
||||||
@@ -238,7 +242,7 @@ class HcCast extends LitElement {
|
|||||||
color: var(--secondary-text-color);
|
color: var(--secondary-text-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
mwc-button iron-icon {
|
mwc-button ha-icon {
|
||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
height: 18px;
|
height: 18px;
|
||||||
}
|
}
|
||||||
|
@@ -1,35 +1,35 @@
|
|||||||
import {
|
|
||||||
LitElement,
|
|
||||||
customElement,
|
|
||||||
property,
|
|
||||||
TemplateResult,
|
|
||||||
html,
|
|
||||||
CSSResult,
|
|
||||||
css,
|
|
||||||
} from "lit-element";
|
|
||||||
import {
|
|
||||||
getAuth,
|
|
||||||
createConnection,
|
|
||||||
Auth,
|
|
||||||
getAuthOptions,
|
|
||||||
ERR_HASS_HOST_REQUIRED,
|
|
||||||
ERR_INVALID_HTTPS_TO_HTTP,
|
|
||||||
Connection,
|
|
||||||
ERR_CANNOT_CONNECT,
|
|
||||||
ERR_INVALID_AUTH,
|
|
||||||
} from "home-assistant-js-websocket";
|
|
||||||
import "@polymer/iron-icon";
|
|
||||||
import "@material/mwc-button";
|
import "@material/mwc-button";
|
||||||
import "@polymer/paper-input/paper-input";
|
import "@polymer/paper-input/paper-input";
|
||||||
|
import {
|
||||||
|
Auth,
|
||||||
|
Connection,
|
||||||
|
createConnection,
|
||||||
|
ERR_CANNOT_CONNECT,
|
||||||
|
ERR_HASS_HOST_REQUIRED,
|
||||||
|
ERR_INVALID_AUTH,
|
||||||
|
ERR_INVALID_HTTPS_TO_HTTP,
|
||||||
|
getAuth,
|
||||||
|
getAuthOptions,
|
||||||
|
} from "home-assistant-js-websocket";
|
||||||
|
import {
|
||||||
|
css,
|
||||||
|
CSSResult,
|
||||||
|
customElement,
|
||||||
|
html,
|
||||||
|
LitElement,
|
||||||
|
property,
|
||||||
|
TemplateResult,
|
||||||
|
} from "lit-element";
|
||||||
|
import { CastManager, getCastManager } from "../../../../src/cast/cast_manager";
|
||||||
|
import { castSendShowDemo } from "../../../../src/cast/receiver_messages";
|
||||||
import {
|
import {
|
||||||
loadTokens,
|
loadTokens,
|
||||||
saveTokens,
|
saveTokens,
|
||||||
} from "../../../../src/common/auth/token_storage";
|
} from "../../../../src/common/auth/token_storage";
|
||||||
|
import "../../../../src/components/ha-icon";
|
||||||
import "../../../../src/layouts/loading-screen";
|
import "../../../../src/layouts/loading-screen";
|
||||||
import { CastManager, getCastManager } from "../../../../src/cast/cast_manager";
|
|
||||||
import "./hc-layout";
|
|
||||||
import { castSendShowDemo } from "../../../../src/cast/receiver_messages";
|
|
||||||
import { registerServiceWorker } from "../../../../src/util/register-service-worker";
|
import { registerServiceWorker } from "../../../../src/util/register-service-worker";
|
||||||
|
import "./hc-layout";
|
||||||
|
|
||||||
const seeFAQ = (qid) => html`
|
const seeFAQ = (qid) => html`
|
||||||
See <a href="./faq.html${qid ? `#${qid}` : ""}">the FAQ</a> for more
|
See <a href="./faq.html${qid ? `#${qid}` : ""}">the FAQ</a> for more
|
||||||
@@ -61,16 +61,22 @@ const INTRO = html`
|
|||||||
@customElement("hc-connect")
|
@customElement("hc-connect")
|
||||||
export class HcConnect extends LitElement {
|
export class HcConnect extends LitElement {
|
||||||
@property() private loading = false;
|
@property() private loading = false;
|
||||||
|
|
||||||
// If we had stored credentials but we cannot connect,
|
// If we had stored credentials but we cannot connect,
|
||||||
// show a screen asking retry or logout.
|
// show a screen asking retry or logout.
|
||||||
@property() private cannotConnect = false;
|
@property() private cannotConnect = false;
|
||||||
|
|
||||||
@property() private error?: string | TemplateResult;
|
@property() private error?: string | TemplateResult;
|
||||||
|
|
||||||
@property() private auth?: Auth;
|
@property() private auth?: Auth;
|
||||||
|
|
||||||
@property() private connection?: Connection;
|
@property() private connection?: Connection;
|
||||||
|
|
||||||
@property() private castManager?: CastManager | null;
|
@property() private castManager?: CastManager | null;
|
||||||
|
|
||||||
private openDemo = false;
|
private openDemo = false;
|
||||||
|
|
||||||
protected render(): TemplateResult | void {
|
protected render(): TemplateResult {
|
||||||
if (this.cannotConnect) {
|
if (this.cannotConnect) {
|
||||||
const tokens = loadTokens();
|
const tokens = loadTokens();
|
||||||
return html`
|
return html`
|
||||||
@@ -92,9 +98,7 @@ export class HcConnect extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.castManager === undefined || this.loading) {
|
if (this.castManager === undefined || this.loading) {
|
||||||
return html`
|
return html` <loading-screen></loading-screen> `;
|
||||||
<loading-screen></loading-screen>
|
|
||||||
`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.castManager === null) {
|
if (this.castManager === null) {
|
||||||
@@ -127,20 +131,16 @@ export class HcConnect extends LitElement {
|
|||||||
@keydown=${this._handleInputKeyDown}
|
@keydown=${this._handleInputKeyDown}
|
||||||
></paper-input>
|
></paper-input>
|
||||||
</p>
|
</p>
|
||||||
${this.error
|
${this.error ? html` <p class="error">${this.error}</p> ` : ""}
|
||||||
? html`
|
|
||||||
<p class="error">${this.error}</p>
|
|
||||||
`
|
|
||||||
: ""}
|
|
||||||
</div>
|
</div>
|
||||||
<div class="card-actions">
|
<div class="card-actions">
|
||||||
<mwc-button @click=${this._handleDemo}>
|
<mwc-button @click=${this._handleDemo}>
|
||||||
Show Demo
|
Show Demo
|
||||||
<iron-icon
|
<ha-icon
|
||||||
.icon=${this.castManager.castState === "CONNECTED"
|
.icon=${this.castManager.castState === "CONNECTED"
|
||||||
? "hass:cast-connected"
|
? "hass:cast-connected"
|
||||||
: "hass:cast"}
|
: "hass:cast"}
|
||||||
></iron-icon>
|
></ha-icon>
|
||||||
</mwc-button>
|
</mwc-button>
|
||||||
<div class="spacer"></div>
|
<div class="spacer"></div>
|
||||||
<mwc-button @click=${this._handleConnect}>Authorize</mwc-button>
|
<mwc-button @click=${this._handleConnect}>Authorize</mwc-button>
|
||||||
@@ -184,7 +184,7 @@ export class HcConnect extends LitElement {
|
|||||||
this.castManager = null;
|
this.castManager = null;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
registerServiceWorker(false);
|
registerServiceWorker(this, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _handleDemo() {
|
private async _handleDemo() {
|
||||||
@@ -211,7 +211,8 @@ export class HcConnect extends LitElement {
|
|||||||
if (value === "") {
|
if (value === "") {
|
||||||
this.error = "Please enter a Home Assistant URL.";
|
this.error = "Please enter a Home Assistant URL.";
|
||||||
return;
|
return;
|
||||||
} else if (value.indexOf("://") === -1) {
|
}
|
||||||
|
if (value.indexOf("://") === -1) {
|
||||||
this.error =
|
this.error =
|
||||||
"Please enter your full URL, including the protocol part (https://).";
|
"Please enter your full URL, including the protocol part (https://).";
|
||||||
return;
|
return;
|
||||||
@@ -315,7 +316,7 @@ export class HcConnect extends LitElement {
|
|||||||
color: darkred;
|
color: darkred;
|
||||||
}
|
}
|
||||||
|
|
||||||
mwc-button iron-icon {
|
mwc-button ha-icon {
|
||||||
margin-left: 8px;
|
margin-left: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,28 +1,31 @@
|
|||||||
import {
|
|
||||||
customElement,
|
|
||||||
LitElement,
|
|
||||||
TemplateResult,
|
|
||||||
html,
|
|
||||||
CSSResult,
|
|
||||||
css,
|
|
||||||
property,
|
|
||||||
} from "lit-element";
|
|
||||||
import {
|
import {
|
||||||
Auth,
|
Auth,
|
||||||
Connection,
|
Connection,
|
||||||
HassUser,
|
|
||||||
getUser,
|
getUser,
|
||||||
|
HassUser,
|
||||||
} from "home-assistant-js-websocket";
|
} from "home-assistant-js-websocket";
|
||||||
|
import {
|
||||||
|
css,
|
||||||
|
CSSResult,
|
||||||
|
customElement,
|
||||||
|
html,
|
||||||
|
LitElement,
|
||||||
|
property,
|
||||||
|
TemplateResult,
|
||||||
|
} from "lit-element";
|
||||||
import "../../../../src/components/ha-card";
|
import "../../../../src/components/ha-card";
|
||||||
|
|
||||||
@customElement("hc-layout")
|
@customElement("hc-layout")
|
||||||
class HcLayout extends LitElement {
|
class HcLayout extends LitElement {
|
||||||
@property() public subtitle?: string | undefined;
|
@property() public subtitle?: string | undefined;
|
||||||
|
|
||||||
@property() public auth?: Auth;
|
@property() public auth?: Auth;
|
||||||
|
|
||||||
@property() public connection?: Connection;
|
@property() public connection?: Connection;
|
||||||
|
|
||||||
@property() public user?: HassUser;
|
@property() public user?: HassUser;
|
||||||
|
|
||||||
protected render(): TemplateResult | void {
|
protected render(): TemplateResult {
|
||||||
return html`
|
return html`
|
||||||
<ha-card>
|
<ha-card>
|
||||||
<div class="layout">
|
<div class="layout">
|
||||||
@@ -37,11 +40,7 @@ class HcLayout extends LitElement {
|
|||||||
this.auth.data.hassUrl.indexOf("//") + 2
|
this.auth.data.hassUrl.indexOf("//") + 2
|
||||||
)}</a
|
)}</a
|
||||||
>
|
>
|
||||||
${this.user
|
${this.user ? html` – ${this.user.name} ` : ""}
|
||||||
? html`
|
|
||||||
– ${this.user.name}
|
|
||||||
`
|
|
||||||
: ""}
|
|
||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
: ""}
|
: ""}
|
||||||
@@ -50,13 +49,12 @@ class HcLayout extends LitElement {
|
|||||||
</div>
|
</div>
|
||||||
</ha-card>
|
</ha-card>
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
<a href="./faq.html">Frequently Asked Questions</a> – Found a bug? Let
|
<a href="./faq.html">Frequently Asked Questions</a> – Found a bug?
|
||||||
@balloob know
|
<a
|
||||||
<!-- <a
|
|
||||||
href="https://github.com/home-assistant/home-assistant-polymer/issues"
|
href="https://github.com/home-assistant/home-assistant-polymer/issues"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
>Let us know!</a
|
>Let us know!</a
|
||||||
> -->
|
>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
@@ -1 +1,2 @@
|
|||||||
|
/* eslint-disable no-undef */
|
||||||
export const castContext = cast.framework.CastReceiverContext.getInstance();
|
export const castContext = cast.framework.CastReceiverContext.getInstance();
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { Entity, convertEntities } from "../../../../src/fake_data/entity";
|
import { convertEntities, Entity } from "../../../../src/fake_data/entity";
|
||||||
|
|
||||||
export const castDemoEntities: () => Entity[] = () =>
|
export const castDemoEntities: () => Entity[] = () =>
|
||||||
convertEntities({
|
convertEntities({
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import {
|
import {
|
||||||
LovelaceConfig,
|
|
||||||
LovelaceCardConfig,
|
LovelaceCardConfig,
|
||||||
|
LovelaceConfig,
|
||||||
} from "../../../../src/data/lovelace";
|
} from "../../../../src/data/lovelace";
|
||||||
import { castContext } from "../cast_context";
|
import { castContext } from "../cast_context";
|
||||||
|
|
||||||
|
@@ -1,9 +1,10 @@
|
|||||||
|
/* eslint-disable no-undef */
|
||||||
|
import { CAST_NS } from "../../../src/cast/const";
|
||||||
|
import { HassMessage } from "../../../src/cast/receiver_messages";
|
||||||
import "../../../src/resources/custom-card-support";
|
import "../../../src/resources/custom-card-support";
|
||||||
import { castContext } from "./cast_context";
|
import { castContext } from "./cast_context";
|
||||||
import { ReceivedMessage } from "./types";
|
|
||||||
import { HassMessage } from "../../../src/cast/receiver_messages";
|
|
||||||
import { HcMain } from "./layout/hc-main";
|
import { HcMain } from "./layout/hc-main";
|
||||||
import { CAST_NS } from "../../../src/cast/const";
|
import { ReceivedMessage } from "./types";
|
||||||
|
|
||||||
const controller = new HcMain();
|
const controller = new HcMain();
|
||||||
document.body.append(controller);
|
document.body.append(controller);
|
||||||
|
@@ -1,22 +1,23 @@
|
|||||||
import { HassElement } from "../../../../src/state/hass-element";
|
import { customElement, html, property, TemplateResult } from "lit-element";
|
||||||
import "./hc-lovelace";
|
import { mockHistory } from "../../../../demo/src/stubs/history";
|
||||||
import { customElement, TemplateResult, html, property } from "lit-element";
|
import { LovelaceConfig } from "../../../../src/data/lovelace";
|
||||||
import {
|
import {
|
||||||
MockHomeAssistant,
|
MockHomeAssistant,
|
||||||
provideHass,
|
provideHass,
|
||||||
} from "../../../../src/fake_data/provide_hass";
|
} from "../../../../src/fake_data/provide_hass";
|
||||||
|
import { HassElement } from "../../../../src/state/hass-element";
|
||||||
import { HomeAssistant } from "../../../../src/types";
|
import { HomeAssistant } from "../../../../src/types";
|
||||||
import { LovelaceConfig } from "../../../../src/data/lovelace";
|
|
||||||
import { castDemoEntities } from "../demo/cast-demo-entities";
|
import { castDemoEntities } from "../demo/cast-demo-entities";
|
||||||
import { castDemoLovelace } from "../demo/cast-demo-lovelace";
|
import { castDemoLovelace } from "../demo/cast-demo-lovelace";
|
||||||
import { mockHistory } from "../../../../demo/src/stubs/history";
|
import "./hc-lovelace";
|
||||||
|
|
||||||
@customElement("hc-demo")
|
@customElement("hc-demo")
|
||||||
class HcDemo extends HassElement {
|
class HcDemo extends HassElement {
|
||||||
@property() public lovelacePath!: string;
|
@property() public lovelacePath!: string;
|
||||||
|
|
||||||
@property() private _lovelaceConfig?: LovelaceConfig;
|
@property() private _lovelaceConfig?: LovelaceConfig;
|
||||||
|
|
||||||
protected render(): TemplateResult | void {
|
protected render(): TemplateResult {
|
||||||
if (!this._lovelaceConfig) {
|
if (!this._lovelaceConfig) {
|
||||||
return html``;
|
return html``;
|
||||||
}
|
}
|
||||||
@@ -28,6 +29,7 @@ class HcDemo extends HassElement {
|
|||||||
></hc-lovelace>
|
></hc-lovelace>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected firstUpdated(changedProps) {
|
protected firstUpdated(changedProps) {
|
||||||
super.firstUpdated(changedProps);
|
super.firstUpdated(changedProps);
|
||||||
this._initialize();
|
this._initialize();
|
||||||
|
@@ -1,20 +1,21 @@
|
|||||||
import {
|
import {
|
||||||
LitElement,
|
|
||||||
TemplateResult,
|
|
||||||
html,
|
|
||||||
customElement,
|
|
||||||
CSSResult,
|
|
||||||
css,
|
css,
|
||||||
|
CSSResult,
|
||||||
|
customElement,
|
||||||
|
html,
|
||||||
|
LitElement,
|
||||||
property,
|
property,
|
||||||
|
TemplateResult,
|
||||||
} from "lit-element";
|
} from "lit-element";
|
||||||
import { HomeAssistant } from "../../../../src/types";
|
import { HomeAssistant } from "../../../../src/types";
|
||||||
|
|
||||||
@customElement("hc-launch-screen")
|
@customElement("hc-launch-screen")
|
||||||
class HcLaunchScreen extends LitElement {
|
class HcLaunchScreen extends LitElement {
|
||||||
@property() public hass?: HomeAssistant;
|
@property() public hass?: HomeAssistant;
|
||||||
|
|
||||||
@property() public error?: string;
|
@property() public error?: string;
|
||||||
|
|
||||||
protected render(): TemplateResult | void {
|
protected render(): TemplateResult {
|
||||||
return html`
|
return html`
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<img
|
<img
|
||||||
@@ -22,11 +23,7 @@ class HcLaunchScreen extends LitElement {
|
|||||||
/>
|
/>
|
||||||
<div class="status">
|
<div class="status">
|
||||||
${this.hass ? "Connected" : "Not Connected"}
|
${this.hass ? "Connected" : "Not Connected"}
|
||||||
${this.error
|
${this.error ? html` <p>Error: ${this.error}</p> ` : ""}
|
||||||
? html`
|
|
||||||
<p>Error: ${this.error}</p>
|
|
||||||
`
|
|
||||||
: ""}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
@@ -1,17 +1,17 @@
|
|||||||
import {
|
import {
|
||||||
LitElement,
|
|
||||||
TemplateResult,
|
|
||||||
html,
|
|
||||||
customElement,
|
|
||||||
CSSResult,
|
|
||||||
css,
|
css,
|
||||||
|
CSSResult,
|
||||||
|
customElement,
|
||||||
|
html,
|
||||||
|
LitElement,
|
||||||
property,
|
property,
|
||||||
|
TemplateResult,
|
||||||
} from "lit-element";
|
} from "lit-element";
|
||||||
import { LovelaceConfig } from "../../../../src/data/lovelace";
|
import { LovelaceConfig } from "../../../../src/data/lovelace";
|
||||||
import "../../../../src/panels/lovelace/views/hui-view";
|
|
||||||
import "../../../../src/panels/lovelace/views/hui-panel-view";
|
|
||||||
import { HomeAssistant } from "../../../../src/types";
|
|
||||||
import { Lovelace } from "../../../../src/panels/lovelace/types";
|
import { Lovelace } from "../../../../src/panels/lovelace/types";
|
||||||
|
import "../../../../src/panels/lovelace/views/hui-panel-view";
|
||||||
|
import "../../../../src/panels/lovelace/views/hui-view";
|
||||||
|
import { HomeAssistant } from "../../../../src/types";
|
||||||
import "./hc-launch-screen";
|
import "./hc-launch-screen";
|
||||||
|
|
||||||
@customElement("hc-lovelace")
|
@customElement("hc-lovelace")
|
||||||
@@ -22,7 +22,7 @@ class HcLovelace extends LitElement {
|
|||||||
|
|
||||||
@property() public viewPath?: string | number;
|
@property() public viewPath?: string | number;
|
||||||
|
|
||||||
protected render(): TemplateResult | void {
|
protected render(): TemplateResult {
|
||||||
const index = this._viewIndex;
|
const index = this._viewIndex;
|
||||||
if (index === undefined) {
|
if (index === undefined) {
|
||||||
return html`
|
return html`
|
||||||
@@ -39,12 +39,14 @@ class HcLovelace extends LitElement {
|
|||||||
mode: "storage",
|
mode: "storage",
|
||||||
language: "en",
|
language: "en",
|
||||||
saveConfig: async () => undefined,
|
saveConfig: async () => undefined,
|
||||||
|
deleteConfig: async () => undefined,
|
||||||
setEditMode: () => undefined,
|
setEditMode: () => undefined,
|
||||||
};
|
};
|
||||||
return this.lovelaceConfig.views[index].panel
|
return this.lovelaceConfig.views[index].panel
|
||||||
? html`
|
? html`
|
||||||
<hui-panel-view
|
<hui-panel-view
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
|
.lovelace=${lovelace}
|
||||||
.config=${this.lovelaceConfig.views[index]}
|
.config=${this.lovelaceConfig.views[index]}
|
||||||
></hui-panel-view>
|
></hui-panel-view>
|
||||||
`
|
`
|
||||||
|
@@ -1,27 +1,33 @@
|
|||||||
import {
|
import {
|
||||||
getAuth,
|
|
||||||
createConnection,
|
createConnection,
|
||||||
|
getAuth,
|
||||||
UnsubscribeFunc,
|
UnsubscribeFunc,
|
||||||
} from "home-assistant-js-websocket";
|
} from "home-assistant-js-websocket";
|
||||||
import { customElement, TemplateResult, html, property } from "lit-element";
|
import { customElement, html, property, TemplateResult } from "lit-element";
|
||||||
import { HassElement } from "../../../../src/state/hass-element";
|
|
||||||
import {
|
|
||||||
HassMessage,
|
|
||||||
ConnectMessage,
|
|
||||||
ShowLovelaceViewMessage,
|
|
||||||
GetStatusMessage,
|
|
||||||
ShowDemoMessage,
|
|
||||||
} from "../../../../src/cast/receiver_messages";
|
|
||||||
import {
|
|
||||||
LovelaceConfig,
|
|
||||||
getLovelaceCollection,
|
|
||||||
} from "../../../../src/data/lovelace";
|
|
||||||
import "./hc-launch-screen";
|
|
||||||
import { castContext } from "../cast_context";
|
|
||||||
import { CAST_NS } from "../../../../src/cast/const";
|
import { CAST_NS } from "../../../../src/cast/const";
|
||||||
|
import {
|
||||||
|
ConnectMessage,
|
||||||
|
GetStatusMessage,
|
||||||
|
HassMessage,
|
||||||
|
ShowDemoMessage,
|
||||||
|
ShowLovelaceViewMessage,
|
||||||
|
} from "../../../../src/cast/receiver_messages";
|
||||||
import { ReceiverStatusMessage } from "../../../../src/cast/sender_messages";
|
import { ReceiverStatusMessage } from "../../../../src/cast/sender_messages";
|
||||||
import { loadLovelaceResources } from "../../../../src/panels/lovelace/common/load-resources";
|
import { atLeastVersion } from "../../../../src/common/config/version";
|
||||||
import { isNavigationClick } from "../../../../src/common/dom/is-navigation-click";
|
import { isNavigationClick } from "../../../../src/common/dom/is-navigation-click";
|
||||||
|
import {
|
||||||
|
fetchResources,
|
||||||
|
getLegacyLovelaceCollection,
|
||||||
|
getLovelaceCollection,
|
||||||
|
LegacyLovelaceConfig,
|
||||||
|
LovelaceConfig,
|
||||||
|
} from "../../../../src/data/lovelace";
|
||||||
|
import { loadLovelaceResources } from "../../../../src/panels/lovelace/common/load-resources";
|
||||||
|
import { HassElement } from "../../../../src/state/hass-element";
|
||||||
|
import { castContext } from "../cast_context";
|
||||||
|
import "./hc-launch-screen";
|
||||||
|
|
||||||
|
let resourcesLoaded = false;
|
||||||
|
|
||||||
@customElement("hc-main")
|
@customElement("hc-main")
|
||||||
export class HcMain extends HassElement {
|
export class HcMain extends HassElement {
|
||||||
@@ -35,6 +41,8 @@ export class HcMain extends HassElement {
|
|||||||
|
|
||||||
private _unsubLovelace?: UnsubscribeFunc;
|
private _unsubLovelace?: UnsubscribeFunc;
|
||||||
|
|
||||||
|
private _urlPath?: string | null;
|
||||||
|
|
||||||
public processIncomingMessage(msg: HassMessage) {
|
public processIncomingMessage(msg: HassMessage) {
|
||||||
if (msg.type === "connect") {
|
if (msg.type === "connect") {
|
||||||
this._handleConnectMessage(msg);
|
this._handleConnectMessage(msg);
|
||||||
@@ -45,16 +53,14 @@ export class HcMain extends HassElement {
|
|||||||
} else if (msg.type === "show_demo") {
|
} else if (msg.type === "show_demo") {
|
||||||
this._handleShowDemo(msg);
|
this._handleShowDemo(msg);
|
||||||
} else {
|
} else {
|
||||||
// tslint:disable-next-line: no-console
|
// eslint-disable-next-line no-console
|
||||||
console.warn("unknown msg type", msg);
|
console.warn("unknown msg type", msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult | void {
|
protected render(): TemplateResult {
|
||||||
if (this._showDemo) {
|
if (this._showDemo) {
|
||||||
return html`
|
return html` <hc-demo .lovelacePath=${this._lovelacePath}></hc-demo> `;
|
||||||
<hc-demo .lovelacePath=${this._lovelacePath}></hc-demo>
|
|
||||||
`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
@@ -76,6 +82,7 @@ export class HcMain extends HassElement {
|
|||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.lovelaceConfig=${this._lovelaceConfig}
|
.lovelaceConfig=${this._lovelaceConfig}
|
||||||
.viewPath=${this._lovelacePath}
|
.viewPath=${this._lovelacePath}
|
||||||
|
@config-refresh=${this._generateLovelaceConfig}
|
||||||
></hc-lovelace>
|
></hc-lovelace>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
@@ -84,15 +91,17 @@ export class HcMain extends HassElement {
|
|||||||
super.firstUpdated(changedProps);
|
super.firstUpdated(changedProps);
|
||||||
import("../second-load");
|
import("../second-load");
|
||||||
window.addEventListener("location-changed", () => {
|
window.addEventListener("location-changed", () => {
|
||||||
if (location.pathname.startsWith("/lovelace/")) {
|
const panelPath = `/${this._urlPath || "lovelace"}/`;
|
||||||
this._lovelacePath = location.pathname.substr(10);
|
if (location.pathname.startsWith(panelPath)) {
|
||||||
|
this._lovelacePath = location.pathname.substr(panelPath.length);
|
||||||
this._sendStatus();
|
this._sendStatus();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
document.body.addEventListener("click", (ev) => {
|
document.body.addEventListener("click", (ev) => {
|
||||||
|
const panelPath = `/${this._urlPath || "lovelace"}/`;
|
||||||
const href = isNavigationClick(ev);
|
const href = isNavigationClick(ev);
|
||||||
if (href && href.startsWith("/lovelace/")) {
|
if (href && href.startsWith(panelPath)) {
|
||||||
this._lovelacePath = href.substr(10);
|
this._lovelacePath = href.substr(panelPath.length);
|
||||||
this._sendStatus();
|
this._sendStatus();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -108,6 +117,7 @@ export class HcMain extends HassElement {
|
|||||||
if (this.hass) {
|
if (this.hass) {
|
||||||
status.hassUrl = this.hass.auth.data.hassUrl;
|
status.hassUrl = this.hass.auth.data.hassUrl;
|
||||||
status.lovelacePath = this._lovelacePath!;
|
status.lovelacePath = this._lovelacePath!;
|
||||||
|
status.urlPath = this._urlPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (senderId) {
|
if (senderId) {
|
||||||
@@ -163,8 +173,17 @@ export class HcMain extends HassElement {
|
|||||||
this._error = "Cannot show Lovelace because we're not connected.";
|
this._error = "Cannot show Lovelace because we're not connected.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!this._unsubLovelace) {
|
if (msg.urlPath === "lovelace") {
|
||||||
const llColl = getLovelaceCollection(this.hass!.connection);
|
msg.urlPath = null;
|
||||||
|
}
|
||||||
|
if (!this._unsubLovelace || this._urlPath !== msg.urlPath) {
|
||||||
|
this._urlPath = msg.urlPath;
|
||||||
|
if (this._unsubLovelace) {
|
||||||
|
this._unsubLovelace();
|
||||||
|
}
|
||||||
|
const llColl = atLeastVersion(this.hass.connection.haVersion, 0, 107)
|
||||||
|
? getLovelaceCollection(this.hass!.connection, msg.urlPath)
|
||||||
|
: getLegacyLovelaceCollection(this.hass!.connection);
|
||||||
// We first do a single refresh because we need to check if there is LL
|
// We first do a single refresh because we need to check if there is LL
|
||||||
// configuration.
|
// configuration.
|
||||||
try {
|
try {
|
||||||
@@ -175,12 +194,16 @@ export class HcMain extends HassElement {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
// Generate a Lovelace config.
|
// Generate a Lovelace config.
|
||||||
this._unsubLovelace = () => undefined;
|
this._unsubLovelace = () => undefined;
|
||||||
const { generateLovelaceConfigFromHass } = await import(
|
await this._generateLovelaceConfig();
|
||||||
"../../../../src/panels/lovelace/common/generate-lovelace-config"
|
}
|
||||||
);
|
}
|
||||||
this._handleNewLovelaceConfig(
|
if (!resourcesLoaded) {
|
||||||
await generateLovelaceConfigFromHass(this.hass!)
|
resourcesLoaded = true;
|
||||||
);
|
const resources = atLeastVersion(this.hass.connection.haVersion, 0, 107)
|
||||||
|
? await fetchResources(this.hass!.connection)
|
||||||
|
: (this._lovelaceConfig as LegacyLovelaceConfig).resources;
|
||||||
|
if (resources) {
|
||||||
|
loadLovelaceResources(resources, this.hass!.auth.data.hassUrl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this._showDemo = false;
|
this._showDemo = false;
|
||||||
@@ -191,15 +214,18 @@ export class HcMain extends HassElement {
|
|||||||
this._sendStatus();
|
this._sendStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async _generateLovelaceConfig() {
|
||||||
|
const { generateLovelaceConfigFromHass } = await import(
|
||||||
|
"../../../../src/panels/lovelace/common/generate-lovelace-config"
|
||||||
|
);
|
||||||
|
this._handleNewLovelaceConfig(
|
||||||
|
await generateLovelaceConfigFromHass(this.hass!)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
private _handleNewLovelaceConfig(lovelaceConfig: LovelaceConfig) {
|
private _handleNewLovelaceConfig(lovelaceConfig: LovelaceConfig) {
|
||||||
castContext.setApplicationState(lovelaceConfig.title!);
|
castContext.setApplicationState(lovelaceConfig.title!);
|
||||||
this._lovelaceConfig = lovelaceConfig;
|
this._lovelaceConfig = lovelaceConfig;
|
||||||
if (lovelaceConfig.resources) {
|
|
||||||
loadLovelaceResources(
|
|
||||||
lovelaceConfig.resources,
|
|
||||||
this.hass!.auth.data.hassUrl
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private _handleShowDemo(_msg: ShowDemoMessage) {
|
private _handleShowDemo(_msg: ShowDemoMessage) {
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
import "web-animations-js/web-animations-next-lite.min";
|
import "web-animations-js/web-animations-next-lite.min";
|
||||||
import "../../../src/resources/hass-icons";
|
|
||||||
import "../../../src/resources/roboto";
|
import "../../../src/resources/roboto";
|
||||||
import "../../../src/components/ha-iconset-svg";
|
import "../../../src/resources/ha-style";
|
||||||
import "./layout/hc-lovelace";
|
import "./layout/hc-lovelace";
|
||||||
|
@@ -6,6 +6,6 @@ const { isProdBuild } = require("../build-scripts/env.js");
|
|||||||
const latestBuild = true;
|
const latestBuild = true;
|
||||||
|
|
||||||
module.exports = createCastConfig({
|
module.exports = createCastConfig({
|
||||||
isProdBuild,
|
isProdBuild: isProdBuild(),
|
||||||
latestBuild,
|
latestBuild,
|
||||||
});
|
});
|
||||||
|
Before Width: | Height: | Size: 81 KiB |
Before Width: | Height: | Size: 60 KiB |
Before Width: | Height: | Size: 63 KiB |
Before Width: | Height: | Size: 76 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 8.4 KiB |
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 9.9 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 9.5 KiB After Width: | Height: | Size: 8.5 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 9.9 KiB |
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 805 B After Width: | Height: | Size: 803 B |
BIN
demo/public/assets/arsaboo/images/camera.backyard.jpg
Normal file
After Width: | Height: | Size: 75 KiB |
BIN
demo/public/assets/arsaboo/images/camera.driveway.jpg
Normal file
After Width: | Height: | Size: 56 KiB |
BIN
demo/public/assets/arsaboo/images/camera.patio.jpg
Normal file
After Width: | Height: | Size: 58 KiB |
BIN
demo/public/assets/arsaboo/images/camera.porch.jpg
Normal file
After Width: | Height: | Size: 71 KiB |
BIN
demo/public/assets/arsaboo/images/media_player_family_room.jpg
Normal file
After Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 232 KiB After Width: | Height: | Size: 160 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 8.2 KiB |
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 73 KiB After Width: | Height: | Size: 62 KiB |
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 56 KiB |
Before Width: | Height: | Size: 87 KiB After Width: | Height: | Size: 83 KiB |
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 62 KiB |