@atb-as/generate-assets 18.6.0 → 18.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/files/atb/colors/images/dark/Map.svg +15 -0
- package/files/atb/colors/images/light/Map.svg +15 -0
- package/files/common/colors/icons/ticketing/ApplePay.svg +9 -0
- package/files/common/mono/actions/Save.svg +3 -0
- package/files/common/mono/actions/SaveFill.svg +3 -0
- package/files/common/mono/transportation/BoatFill.svg +4 -4
- package/package.json +4 -1
- package/CHANGELOG.md +0 -98
- package/lib/tools/validate-files.d.ts +0 -1
- package/lib/tools/validate-files.js +0 -150
- package/lib/tools/validate-files.js.map +0 -1
- package/src/bin.ts +0 -121
- package/src/generate.ts +0 -197
- package/src/generateTs.ts +0 -189
- package/src/logger.ts +0 -10
- package/src/tools/validate-files.ts +0 -94
- package/src/utils.ts +0 -66
- package/tsconfig.json +0 -10
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<svg width="200" height="216" viewBox="0 0 200 216" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<g clip-path="url(#clip0_7767_31452)">
|
|
3
|
+
<path d="M146.999 46.056C155.857 45.1647 155.053 51.9792 156.757 58.3767C162.103 78.449 199.054 170.122 199.874 173.085C200.396 174.975 199.212 175.106 197.835 175.804C183.672 182.992 166.198 189.906 151.288 195.684C143.415 198.736 141.813 198.789 133.562 196.945C120.962 194.126 108.511 190.529 96.1188 186.94C92.0173 186.354 65.151 204.893 55.6258 211.9C49.3406 216.522 47.0012 216.822 43.9101 209.183C37.3774 193.029 7.33308 112.127 0.0602978 87.9421C-0.178004 87.2249 0.332969 86.6154 0.841652 86.1915C11.4621 78.3895 40.6724 56.1609 44.1644 55.0977C50.0349 53.3105 86.6165 60.1319 96.7352 60.7139C104.925 61.1859 140.266 46.7343 147.001 46.056H146.999Z" fill="#86B200"/>
|
|
4
|
+
<path d="M19.4487 101.495V100.795C19.4566 101.031 19.4685 101.266 19.4487 101.495Z" fill="#88BDC9"/>
|
|
5
|
+
<path d="M19.4487 101.495V100.795C19.4566 101.031 19.4685 101.266 19.4487 101.495Z" fill="#90BFCA"/>
|
|
6
|
+
<path d="M88.5961 175.229C87.9202 175.229 87.2901 174.798 87.0701 174.12C80.7757 154.742 74.9075 139.2 68.1137 121.203C67.023 118.311 65.9071 115.358 64.7637 112.317C61.5787 103.851 58.561 95.9111 55.6418 88.235C53.174 81.7482 50.6237 75.0413 47.9451 67.9381C47.6335 67.1086 48.0505 66.1829 48.88 65.8713C49.7094 65.5574 50.6351 65.9767 50.9468 66.8062C53.6254 73.9048 56.1757 80.6116 58.6412 87.0962C61.5627 94.7768 64.5804 102.716 67.7677 111.19C68.9111 114.231 70.0247 117.182 71.1153 120.071C77.923 138.104 83.8026 153.681 90.1222 173.13C90.3949 173.973 89.9343 174.878 89.0934 175.151C88.9284 175.204 88.7611 175.229 88.5984 175.229H88.5961Z" fill="#00151A"/>
|
|
7
|
+
<path d="M140.395 181.179C139.698 181.179 139.056 180.723 138.855 180.02C133.195 160.447 127.838 144.721 121.633 126.512C120.636 123.586 119.619 120.6 118.574 117.523C115.668 108.958 112.91 100.927 110.242 93.1588C107.988 86.594 105.657 79.8047 103.208 72.6167C102.922 71.7781 103.371 70.8661 104.209 70.582C105.048 70.2956 105.96 70.7447 106.244 71.5833C108.691 78.7668 111.022 85.5538 113.274 92.1185C115.941 99.8885 118.7 107.922 121.61 116.492C122.652 119.567 123.67 122.552 124.667 125.476C130.883 143.722 136.252 159.482 141.932 179.126C142.177 179.976 141.687 180.865 140.837 181.113C140.688 181.156 140.539 181.177 140.39 181.177L140.395 181.179Z" fill="#00151A"/>
|
|
8
|
+
<path d="M175.195 29.5782C176.649 15.067 165.72 1.7945 148.974 0.779168C134.309 -0.104802 122.41 10.3549 120.124 24.9841C116.78 46.3934 133.087 101.01 139.053 102.044C144.598 103.004 171.989 61.6562 175.2 29.5777L175.195 29.5782ZM143.988 40.5091C126.226 37.6767 132.226 13.0593 144.553 11.9415C168.812 9.73393 167.681 44.2898 143.988 40.5091Z" fill="#C2E8F0"/>
|
|
9
|
+
</g>
|
|
10
|
+
<defs>
|
|
11
|
+
<clipPath id="clip0_7767_31452">
|
|
12
|
+
<rect width="200" height="216" fill="white"/>
|
|
13
|
+
</clipPath>
|
|
14
|
+
</defs>
|
|
15
|
+
</svg>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<svg width="200" height="216" viewBox="0 0 200 216" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<g clip-path="url(#clip0_7767_31422)">
|
|
3
|
+
<path d="M146.999 46.056C155.857 45.1647 155.053 51.9792 156.757 58.3767C162.103 78.449 199.054 170.122 199.874 173.085C200.396 174.975 199.212 175.106 197.835 175.804C183.672 182.992 166.198 189.906 151.288 195.684C143.415 198.736 141.813 198.789 133.562 196.945C120.962 194.126 108.511 190.529 96.1188 186.94C92.0173 186.354 65.151 204.893 55.6258 211.9C49.3406 216.522 47.0012 216.822 43.9101 209.183C37.3774 193.029 7.33308 112.127 0.0602978 87.9421C-0.178004 87.2249 0.332969 86.6154 0.841652 86.1915C11.4621 78.3895 40.6724 56.1609 44.1644 55.0977C50.0349 53.3105 86.6165 60.1319 96.7352 60.7139C104.925 61.1859 140.266 46.7343 147.001 46.056H146.999Z" fill="#99D9E5"/>
|
|
4
|
+
<path d="M19.4487 101.495V100.795C19.4566 101.031 19.4685 101.266 19.4487 101.495Z" fill="#88BDC9"/>
|
|
5
|
+
<path d="M19.4487 101.495V100.795C19.4566 101.031 19.4685 101.266 19.4487 101.495Z" fill="#90BFCA"/>
|
|
6
|
+
<path d="M88.5961 175.229C87.9202 175.229 87.2901 174.798 87.0701 174.12C80.7757 154.742 74.9075 139.2 68.1137 121.203C67.023 118.311 65.9071 115.358 64.7637 112.317C61.5787 103.851 58.561 95.9111 55.6418 88.235C53.174 81.7482 50.6237 75.0413 47.9451 67.9381C47.6335 67.1086 48.0505 66.1829 48.88 65.8713C49.7094 65.5574 50.6351 65.9767 50.9468 66.8062C53.6254 73.9048 56.1757 80.6116 58.6412 87.0962C61.5627 94.7768 64.5804 102.716 67.7677 111.19C68.9111 114.231 70.0247 117.182 71.1153 120.071C77.923 138.104 83.8026 153.681 90.1222 173.13C90.3949 173.973 89.9343 174.878 89.0934 175.151C88.9284 175.204 88.7611 175.229 88.5984 175.229H88.5961Z" fill="#00151A"/>
|
|
7
|
+
<path d="M140.395 181.179C139.698 181.179 139.056 180.723 138.855 180.02C133.195 160.447 127.838 144.721 121.633 126.512C120.636 123.586 119.619 120.6 118.574 117.523C115.668 108.958 112.91 100.927 110.242 93.1588C107.988 86.594 105.657 79.8047 103.208 72.6167C102.922 71.7781 103.371 70.8661 104.209 70.582C105.048 70.2956 105.96 70.7447 106.244 71.5833C108.691 78.7668 111.022 85.5538 113.274 92.1185C115.941 99.8885 118.7 107.922 121.61 116.492C122.652 119.567 123.67 122.552 124.667 125.476C130.883 143.722 136.252 159.482 141.932 179.126C142.177 179.976 141.687 180.865 140.837 181.113C140.688 181.156 140.539 181.177 140.39 181.177L140.395 181.179Z" fill="#00151A"/>
|
|
8
|
+
<path d="M175.195 29.5782C176.649 15.067 165.72 1.7945 148.974 0.779168C134.309 -0.104802 122.41 10.3549 120.124 24.9841C116.78 46.3934 133.087 101.01 139.053 102.044C144.598 103.004 171.989 61.6562 175.2 29.5777L175.195 29.5782ZM143.988 40.5091C126.226 37.6767 132.226 13.0593 144.553 11.9415C168.812 9.73393 167.681 44.2898 143.988 40.5091Z" fill="#86B200"/>
|
|
9
|
+
</g>
|
|
10
|
+
<defs>
|
|
11
|
+
<clipPath id="clip0_7767_31422">
|
|
12
|
+
<rect width="200" height="216" fill="white"/>
|
|
13
|
+
</clipPath>
|
|
14
|
+
</defs>
|
|
15
|
+
</svg>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M34.7761 8H5.22397C5.10089 8 4.97759 8 4.85473 8.00075C4.75087 8.00152 4.64726 8.00272 4.54364 8.00566C4.31766 8.01203 4.08975 8.02591 3.8666 8.06768C3.63989 8.11016 3.42892 8.17947 3.2231 8.28859C3.02076 8.39575 2.83552 8.5359 2.67499 8.70314C2.51439 8.87038 2.37981 9.06296 2.27693 9.27389C2.17212 9.48822 2.10552 9.70798 2.065 9.94426C2.02468 10.1767 2.01126 10.414 2.00517 10.6491C2.00239 10.757 2.00119 10.8649 2.00052 10.9727C1.9998 11.101 2.00004 11.2291 2.00004 11.3575V28.6427C2.00004 28.7712 1.9998 28.8991 2.00052 29.0275C2.00119 29.1354 2.00239 29.2433 2.00517 29.3512C2.01126 29.5861 2.02468 29.8234 2.065 30.0557C2.10552 30.2921 2.17212 30.5118 2.27693 30.7261C2.37981 30.9371 2.51439 31.1299 2.67499 31.2969C2.83552 31.4644 3.02076 31.6045 3.2231 31.7114C3.42892 31.8208 3.63989 31.8902 3.8666 31.9326C4.08975 31.9741 4.31766 31.9882 4.54364 31.9946C4.64726 31.9971 4.75087 31.9985 4.85473 31.999C4.97759 32 5.10089 32 5.22397 32H34.7761C34.8989 32 35.0222 32 35.1451 31.999C35.2487 31.9985 35.3523 31.9971 35.4564 31.9946C35.6819 31.9882 35.9098 31.9741 36.1335 31.9326C36.3599 31.8902 36.5709 31.8208 36.7767 31.7114C36.9793 31.6045 37.164 31.4644 37.3248 31.2969C37.4852 31.1299 37.6198 30.9371 37.7229 30.7261C37.8279 30.5118 37.8945 30.2921 37.9348 30.0557C37.9751 29.8234 37.9882 29.5861 37.9943 29.3512C37.9972 29.2433 37.9986 29.1354 37.999 29.0275C38 28.8991 38 28.7712 38 28.6427V11.3575C38 11.2291 38 11.101 37.999 10.9727C37.9986 10.8649 37.9972 10.757 37.9943 10.6491C37.9882 10.414 37.9751 10.1767 37.9348 9.94426C37.8945 9.70798 37.8279 9.48822 37.7229 9.27389C37.6198 9.06296 37.4852 8.87038 37.3248 8.70314C37.164 8.5359 36.9793 8.39575 36.7767 8.28859C36.5709 8.17947 36.3599 8.11016 36.1335 8.06768C35.9098 8.02591 35.6819 8.01203 35.4564 8.00566C35.3523 8.00272 35.2487 8.00152 35.1451 8.00075C35.0222 8 34.8989 8 34.7761 8Z" fill="black"/>
|
|
3
|
+
<path d="M34.7761 8.79996L35.1396 8.80069C35.2381 8.80141 35.3366 8.80252 35.4356 8.80533C35.6079 8.81018 35.8094 8.81989 35.9972 8.85495C36.1605 8.88557 36.2974 8.93214 36.4288 9.00181C36.5586 9.07046 36.6774 9.16042 36.7812 9.26834C36.8854 9.37699 36.9719 9.50097 37.0387 9.63757C37.1052 9.77335 37.1496 9.91526 37.1789 10.0865C37.2125 10.28 37.2217 10.4904 37.2265 10.6709C37.2291 10.7728 37.2304 10.8747 37.2309 10.979C37.2318 11.1051 37.2318 11.2311 37.2318 11.3575V28.6427C37.2318 28.7691 37.2318 28.8949 37.2309 29.0238C37.2304 29.1256 37.2291 29.2275 37.2264 29.3295C37.2217 29.5098 37.2125 29.7201 37.1785 29.9158C37.1496 30.0847 37.1052 30.2267 37.0383 30.3631C36.9717 30.4994 36.8854 30.6232 36.7816 30.7312C36.6773 30.8399 36.5588 30.9296 36.4275 30.9989C36.2971 31.0682 36.1604 31.1147 35.9987 31.145C35.8071 31.1806 35.5971 31.1904 35.439 31.1949C35.3395 31.1972 35.2405 31.1986 35.1391 31.1991C35.0183 31.2001 34.897 31.2 34.7761 31.2H5.21916C5.09967 31.2 4.97994 31.2 4.85827 31.1991C4.75907 31.1986 4.66009 31.1972 4.56439 31.1949C4.40266 31.1904 4.19258 31.1806 4.00252 31.1453C3.83946 31.1147 3.70276 31.0682 3.57061 30.998C3.44058 30.9293 3.32219 30.8397 3.21777 30.7308C3.11416 30.6231 3.02805 30.4996 2.96148 30.3632C2.89484 30.2268 2.85025 30.0845 2.82093 29.9135C2.78704 29.7182 2.77774 29.5087 2.77308 29.3297C2.77043 29.2272 2.76932 29.1248 2.76869 29.0229L2.76821 28.7221V11.2781L2.76867 10.978C2.76932 10.8755 2.77043 10.773 2.77308 10.6707C2.77774 10.4915 2.78704 10.2819 2.82121 10.0849C2.85027 9.91554 2.89484 9.77316 2.96182 9.63616C3.02788 9.50074 3.11414 9.37713 3.2183 9.26868C3.32204 9.1606 3.44081 9.07075 3.57168 9.00145C3.70242 8.93212 3.83937 8.88557 4.00243 8.85502C4.1903 8.81987 4.39194 8.81018 4.56463 8.80531C4.66307 8.80252 4.76151 8.80141 4.85921 8.80071L5.22397 8.79996H34.7761Z" fill="white"/>
|
|
4
|
+
<path d="M11.8278 16.0722C12.136 15.6707 12.3452 15.1316 12.29 14.5808C11.8388 14.6041 11.2882 14.8908 10.9694 15.2926C10.6831 15.6366 10.4298 16.1983 10.4958 16.7261C11.0024 16.7718 11.5084 16.4624 11.8278 16.0722Z" fill="black"/>
|
|
5
|
+
<path d="M12.2843 16.8291C11.5487 16.7835 10.9232 17.2639 10.572 17.2639C10.2205 17.2639 9.68255 16.8521 9.10074 16.8632C8.34347 16.8748 7.64081 17.3207 7.25653 18.0298C6.46613 19.4485 7.04795 21.5528 7.81657 22.7082C8.18983 23.2798 8.63967 23.9092 9.23241 23.8866C9.79244 23.8637 10.012 23.509 10.6927 23.509C11.373 23.509 11.5707 23.8866 12.1635 23.8752C12.7783 23.8637 13.1626 23.3033 13.5359 22.7311C13.9641 22.0795 14.1394 21.4503 14.1504 21.4158C14.1394 21.4043 12.9649 20.9351 12.9541 19.5283C12.943 18.3503 13.8761 17.79 13.92 17.7553C13.3931 16.9436 12.5697 16.8521 12.2843 16.8291Z" fill="black"/>
|
|
6
|
+
<path d="M18.6892 15.2349C20.288 15.2349 21.4013 16.3826 21.4013 18.0535C21.4013 19.7303 20.2651 20.8839 18.6491 20.8839H16.879V23.8154H15.6V15.2349L18.6892 15.2349ZM16.879 19.766H18.3465C19.46 19.766 20.0937 19.1417 20.0937 18.0594C20.0937 16.9773 19.46 16.3588 18.3522 16.3588H16.879V19.766Z" fill="black"/>
|
|
7
|
+
<path d="M21.7355 22.0375C21.7355 20.9433 22.5406 20.2714 23.9683 20.1882L25.6126 20.0871V19.6055C25.6126 18.9098 25.1615 18.4936 24.4079 18.4936C23.694 18.4936 23.2486 18.8503 23.1402 19.4093H21.9754C22.0439 18.2794 22.9688 17.447 24.4535 17.447C25.9096 17.447 26.8403 18.2497 26.8403 19.5044V23.8154H25.6582V22.7867H25.6298C25.2816 23.4825 24.522 23.9224 23.7341 23.9224C22.5578 23.9224 21.7355 23.1613 21.7355 22.0375ZM25.6126 21.4726V20.9791L24.1337 21.0742C23.3971 21.1278 22.9803 21.4667 22.9803 22.0019C22.9803 22.5488 23.4142 22.9056 24.0766 22.9056C24.9388 22.9056 25.6126 22.2872 25.6126 21.4726Z" fill="black"/>
|
|
8
|
+
<path d="M27.9562 26.1167V25.076C28.0474 25.0998 28.2529 25.0998 28.3558 25.0998C28.9268 25.0998 29.2352 24.8501 29.4235 24.2079C29.4235 24.196 29.5321 23.8273 29.5321 23.8214L27.3623 17.5599H28.6983L30.2174 22.65H30.2401L31.7591 17.5599H33.061L30.811 24.1424C30.2974 25.6588 29.7035 26.1464 28.4587 26.1464C28.3558 26.1464 28.0474 26.1344 27.9562 26.1167Z" fill="black"/>
|
|
9
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M31.25 7.49984C31.25 6.34923 30.3173 5.4165 29.1667 5.4165H10.8333C9.68274 5.4165 8.75 6.34924 8.75 7.49984V33.7482L19.4124 28.063L19.5524 27.9995C19.888 27.8708 20.2659 27.8917 20.5876 28.063L31.25 33.7482V7.49984ZM33.75 35.8332C33.75 36.2722 33.5194 36.6799 33.1429 36.9058C32.7667 37.1312 32.2995 37.1428 31.9124 36.9367L20 30.5825L8.08757 36.9367C7.70046 37.1428 7.23327 37.1312 6.8571 36.9058C6.48059 36.6799 6.25 36.2722 6.25 35.8332V7.49984C6.25 4.96853 8.30203 2.9165 10.8333 2.9165H29.1667C31.698 2.9165 33.75 4.96854 33.75 7.49984V35.8332Z" fill="#000000"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M6.25 7.50008C6.25 4.96878 8.30203 2.91675 10.8333 2.91675H29.1667C31.698 2.91675 33.75 4.96878 33.75 7.50008V35.8334C33.75 36.2726 33.5197 36.6794 33.1432 36.9053C32.7667 37.1313 32.2992 37.1429 31.9118 36.9364L20 30.5834L8.08823 36.9364C7.70082 37.1429 7.23338 37.1313 6.85688 36.9053C6.48037 36.6794 6.25 36.2726 6.25 35.8334V7.50008Z" fill="#000000"/>
|
|
3
|
+
</svg>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path d="M35.2758 34.9835C35.2758 34.9835 35.3662 34.9135 35.4462 34.8335C36.0762 34.1635 37.1361 34.1335 37.8061 34.7635C38.4761 35.3935 38.5059 36.4435 37.8759 37.1235C37.3059 37.7335 36.606 38.1835 35.766 38.3135C34.936 38.4335 34.2059 38.2035 33.6459 37.9135C33.0959 37.6335 32.616 37.2435 32.226 36.9035C32.026 36.7335 31.7658 36.4935 31.5258 36.2735C31.3558 36.1235 31.2061 35.9835 31.0961 35.8835C30.3161 35.1835 29.946 35.0235 29.766 35.0135C29.766 35.0135 29.6663 35.0135 29.4863 35.1335C29.2663 35.2835 28.936 35.6035 28.516 36.2435H28.5058C28.0158 36.9835 27.4059 37.6035 26.6259 37.9235C25.7959 38.2735 24.9861 38.2035 24.3061 37.9735C23.6761 37.7635 23.126 37.3935 22.686 37.0735C22.376 36.8435 22.046 36.5635 21.746 36.3235C21.646 36.2335 21.5362 36.1535 21.4462 36.0735C20.5862 35.3735 20.1361 35.1335 19.8461 35.1135H19.8359C19.8359 35.1135 19.3458 35.0635 18.5058 36.3135C18.0558 37.0135 17.4559 37.6035 16.6459 37.8935C15.8259 38.1935 15.046 38.0835 14.416 37.8735C13.816 37.6635 13.2759 37.3335 12.8359 37.0235C12.5359 36.8235 12.2162 36.5835 11.9262 36.3635C11.7962 36.2635 11.6658 36.1635 11.5458 36.0735C10.6558 35.4235 10.1458 35.1635 9.79583 35.1435C9.69583 35.1435 9.25581 35.1135 8.52581 36.2335H8.51605C7.78605 37.3335 6.68601 38.3035 5.22601 38.3035C3.76601 38.3035 2.65622 37.3335 1.94622 36.2335C1.43622 35.4635 1.6562 34.4335 2.4262 33.9235C3.1962 33.4235 4.23626 33.6335 4.73626 34.4135C4.97626 34.7835 5.14601 34.9135 5.22601 34.9535C5.30601 34.9135 5.48626 34.7835 5.73626 34.4035C6.86626 32.6835 8.28579 31.7135 10.0058 31.8135C11.4658 31.9035 12.7158 32.7835 13.5258 33.3835C13.7058 33.5135 13.866 33.6335 14.016 33.7435C14.266 33.9335 14.4963 34.1035 14.7363 34.2635C15.1063 34.5135 15.346 34.6535 15.516 34.7035H15.5458C15.5458 34.7035 15.646 34.5935 15.726 34.4735C16.896 32.7035 18.3261 31.6535 20.0761 31.7735C21.5661 31.8835 22.7958 32.8635 23.5458 33.4735C23.6958 33.5935 23.8262 33.7035 23.9462 33.8035C24.2162 34.0235 24.446 34.2135 24.686 34.3935C25.026 34.6535 25.2459 34.7635 25.3759 34.8135C25.4359 34.7635 25.556 34.6535 25.726 34.4035C26.836 32.7135 28.196 31.5935 29.916 31.6735C31.416 31.7435 32.5959 32.7435 33.3159 33.3835C33.5459 33.5935 33.7161 33.7435 33.8661 33.8935C34.0361 34.0535 34.1959 34.1935 34.416 34.3835C34.746 34.6835 34.9962 34.8535 35.1762 34.9535C35.2262 34.9735 35.2558 34.9935 35.2758 35.0035V34.9835Z" fill="
|
|
3
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.32605 11.6635C8.32605 9.82349 9.82589 8.3335 11.6659 8.3335H20.266C22.156 8.3335 23.956 9.1335 25.226 10.5435L31.2362 17.2235C31.8462 17.9035 31.7958 18.9635 31.1058 19.5735C30.4258 20.1935 29.3757 20.1335 28.7557 19.4535L22.746 12.7735C22.116 12.0735 21.216 11.6735 20.266 11.6735H11.6659V18.3435C11.6659 19.2635 10.916 20.0135 9.99597 20.0135C9.07597 20.0135 8.32605 19.2635 8.32605 18.3435V11.6635Z" fill="
|
|
4
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.99597 3.32381C9.99597 2.40381 10.7459 1.65381 11.6659 1.65381H14.996C16.836 1.65381 18.326 3.14381 18.326 4.98381V9.98381C18.326 10.9038 17.5859 11.6538 16.6659 11.6538C15.7459 11.6538 14.996 10.9038 14.996 9.98381V4.98381H11.6659C10.7459 4.98381 9.99597 4.23381 9.99597 3.31381V3.32381Z" fill="
|
|
5
|
-
<path d="M3.32628 17.074C2.94628 17.074 2.5863 17.244 2.3463 17.544C2.1163 17.844 2.02631 18.234 2.11631 18.604L5.08604 31.254C6.39604 30.004 8.0761 29.184 10.1461 29.304C12.3961 29.444 14.236 30.794 15.026 31.364C16.336 30.044 18.066 29.114 20.256 29.264C22.446 29.414 24.1361 30.714 24.9361 31.364C26.1861 30.064 27.856 29.054 30.026 29.154C32.216 29.254 33.8661 30.524 34.6861 31.234C34.7561 31.154 34.8161 31.064 34.8761 30.984C35.9461 29.464 36.616 27.514 37.046 25.684C37.486 23.834 37.6963 21.994 37.8063 20.624C37.8563 19.934 37.8861 19.364 37.8961 18.964C37.9061 18.764 37.9061 18.444 37.9161 18.324C37.9161 17.624 37.3561 17.064 36.6661 17.064H3.32628V17.074Z" fill="
|
|
2
|
+
<path d="M35.2758 34.9835C35.2758 34.9835 35.3662 34.9135 35.4462 34.8335C36.0762 34.1635 37.1361 34.1335 37.8061 34.7635C38.4761 35.3935 38.5059 36.4435 37.8759 37.1235C37.3059 37.7335 36.606 38.1835 35.766 38.3135C34.936 38.4335 34.2059 38.2035 33.6459 37.9135C33.0959 37.6335 32.616 37.2435 32.226 36.9035C32.026 36.7335 31.7658 36.4935 31.5258 36.2735C31.3558 36.1235 31.2061 35.9835 31.0961 35.8835C30.3161 35.1835 29.946 35.0235 29.766 35.0135C29.766 35.0135 29.6663 35.0135 29.4863 35.1335C29.2663 35.2835 28.936 35.6035 28.516 36.2435H28.5058C28.0158 36.9835 27.4059 37.6035 26.6259 37.9235C25.7959 38.2735 24.9861 38.2035 24.3061 37.9735C23.6761 37.7635 23.126 37.3935 22.686 37.0735C22.376 36.8435 22.046 36.5635 21.746 36.3235C21.646 36.2335 21.5362 36.1535 21.4462 36.0735C20.5862 35.3735 20.1361 35.1335 19.8461 35.1135H19.8359C19.8359 35.1135 19.3458 35.0635 18.5058 36.3135C18.0558 37.0135 17.4559 37.6035 16.6459 37.8935C15.8259 38.1935 15.046 38.0835 14.416 37.8735C13.816 37.6635 13.2759 37.3335 12.8359 37.0235C12.5359 36.8235 12.2162 36.5835 11.9262 36.3635C11.7962 36.2635 11.6658 36.1635 11.5458 36.0735C10.6558 35.4235 10.1458 35.1635 9.79583 35.1435C9.69583 35.1435 9.25581 35.1135 8.52581 36.2335H8.51605C7.78605 37.3335 6.68601 38.3035 5.22601 38.3035C3.76601 38.3035 2.65622 37.3335 1.94622 36.2335C1.43622 35.4635 1.6562 34.4335 2.4262 33.9235C3.1962 33.4235 4.23626 33.6335 4.73626 34.4135C4.97626 34.7835 5.14601 34.9135 5.22601 34.9535C5.30601 34.9135 5.48626 34.7835 5.73626 34.4035C6.86626 32.6835 8.28579 31.7135 10.0058 31.8135C11.4658 31.9035 12.7158 32.7835 13.5258 33.3835C13.7058 33.5135 13.866 33.6335 14.016 33.7435C14.266 33.9335 14.4963 34.1035 14.7363 34.2635C15.1063 34.5135 15.346 34.6535 15.516 34.7035H15.5458C15.5458 34.7035 15.646 34.5935 15.726 34.4735C16.896 32.7035 18.3261 31.6535 20.0761 31.7735C21.5661 31.8835 22.7958 32.8635 23.5458 33.4735C23.6958 33.5935 23.8262 33.7035 23.9462 33.8035C24.2162 34.0235 24.446 34.2135 24.686 34.3935C25.026 34.6535 25.2459 34.7635 25.3759 34.8135C25.4359 34.7635 25.556 34.6535 25.726 34.4035C26.836 32.7135 28.196 31.5935 29.916 31.6735C31.416 31.7435 32.5959 32.7435 33.3159 33.3835C33.5459 33.5935 33.7161 33.7435 33.8661 33.8935C34.0361 34.0535 34.1959 34.1935 34.416 34.3835C34.746 34.6835 34.9962 34.8535 35.1762 34.9535C35.2262 34.9735 35.2558 34.9935 35.2758 35.0035V34.9835Z" fill="#000000"/>
|
|
3
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.32605 11.6635C8.32605 9.82349 9.82589 8.3335 11.6659 8.3335H20.266C22.156 8.3335 23.956 9.1335 25.226 10.5435L31.2362 17.2235C31.8462 17.9035 31.7958 18.9635 31.1058 19.5735C30.4258 20.1935 29.3757 20.1335 28.7557 19.4535L22.746 12.7735C22.116 12.0735 21.216 11.6735 20.266 11.6735H11.6659V18.3435C11.6659 19.2635 10.916 20.0135 9.99597 20.0135C9.07597 20.0135 8.32605 19.2635 8.32605 18.3435V11.6635Z" fill="#000000"/>
|
|
4
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.99597 3.32381C9.99597 2.40381 10.7459 1.65381 11.6659 1.65381H14.996C16.836 1.65381 18.326 3.14381 18.326 4.98381V9.98381C18.326 10.9038 17.5859 11.6538 16.6659 11.6538C15.7459 11.6538 14.996 10.9038 14.996 9.98381V4.98381H11.6659C10.7459 4.98381 9.99597 4.23381 9.99597 3.31381V3.32381Z" fill="#000000"/>
|
|
5
|
+
<path d="M3.32628 17.074C2.94628 17.074 2.5863 17.244 2.3463 17.544C2.1163 17.844 2.02631 18.234 2.11631 18.604L5.08604 31.254C6.39604 30.004 8.0761 29.184 10.1461 29.304C12.3961 29.444 14.236 30.794 15.026 31.364C16.336 30.044 18.066 29.114 20.256 29.264C22.446 29.414 24.1361 30.714 24.9361 31.364C26.1861 30.064 27.856 29.054 30.026 29.154C32.216 29.254 33.8661 30.524 34.6861 31.234C34.7561 31.154 34.8161 31.064 34.8761 30.984C35.9461 29.464 36.616 27.514 37.046 25.684C37.486 23.834 37.6963 21.994 37.8063 20.624C37.8563 19.934 37.8861 19.364 37.8961 18.964C37.9061 18.764 37.9061 18.444 37.9161 18.324C37.9161 17.624 37.3561 17.064 36.6661 17.064H3.32628V17.074Z" fill="#000000"/>
|
|
6
6
|
</svg>
|
package/package.json
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atb-as/generate-assets",
|
|
3
|
-
"version": "18.
|
|
3
|
+
"version": "18.9.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"description": "OOS Design System generate-assets",
|
|
7
|
+
"repository": {
|
|
8
|
+
"url": "https://github.com/AtB-AS/design-system"
|
|
9
|
+
},
|
|
7
10
|
"license": "EUPL-1.2",
|
|
8
11
|
"bin": {
|
|
9
12
|
"generate-assets": "./lib/bin.js"
|
package/CHANGELOG.md
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## [18.6.0](https://github.com/AtB-AS/design-system/compare/generate-assets@v18.5.1...generate-assets@v18.6.0) (2025-11-10)
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
### Features
|
|
7
|
-
|
|
8
|
-
* added new flash icons ([#363](https://github.com/AtB-AS/design-system/issues/363)) ([95a626b](https://github.com/AtB-AS/design-system/commit/95a626b8a6dac3dec7e08107cf49efe82ef1c3ce))
|
|
9
|
-
|
|
10
|
-
## [18.5.1](https://github.com/AtB-AS/design-system/compare/generate-assets@v18.5.0...generate-assets@v18.5.1) (2025-10-22)
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
### Bug Fixes
|
|
14
|
-
|
|
15
|
-
* EmptyIllustration ([#344](https://github.com/AtB-AS/design-system/issues/344)) ([064b5f2](https://github.com/AtB-AS/design-system/commit/064b5f2550ac952637c847d582027fb212021c6b))
|
|
16
|
-
|
|
17
|
-
## [18.5.0](https://github.com/AtB-AS/design-system/compare/generate-assets@v18.4.0...generate-assets@v18.5.0) (2025-09-18)
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
### Features
|
|
21
|
-
|
|
22
|
-
* Add baby on scooter illustration ([#340](https://github.com/AtB-AS/design-system/issues/340)) ([6708b4f](https://github.com/AtB-AS/design-system/commit/6708b4fb0bd80e091c59885cdb34ee25cdf1077b))
|
|
23
|
-
|
|
24
|
-
## [18.4.0](https://github.com/AtB-AS/design-system/compare/generate-assets@v18.3.1...generate-assets@v18.4.0) (2025-09-08)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
### Features
|
|
28
|
-
|
|
29
|
-
* Add new illustrations for Smart Park & Ride ([#335](https://github.com/AtB-AS/design-system/issues/335)) ([36c85be](https://github.com/AtB-AS/design-system/commit/36c85bec8c353d69523f1fb89fc60ca35c88c13f))
|
|
30
|
-
|
|
31
|
-
## [18.3.1](https://github.com/AtB-AS/design-system/compare/generate-assets@v18.3.0...generate-assets@v18.3.1) (2025-08-04)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
### Bug Fixes
|
|
35
|
-
|
|
36
|
-
* Swappet loggedIn and Out, and updated colors for other counties ([#332](https://github.com/AtB-AS/design-system/issues/332)) ([6c3930e](https://github.com/AtB-AS/design-system/commit/6c3930ef5861c1a7041cd5b2a707515bf40ce301))
|
|
37
|
-
|
|
38
|
-
## [18.3.0](https://github.com/AtB-AS/design-system/compare/generate-assets@v18.2.0...generate-assets@v18.3.0) (2025-07-31)
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
### Features
|
|
42
|
-
|
|
43
|
-
* Added common ProfileCardLoggedIn ([d894bed](https://github.com/AtB-AS/design-system/commit/d894bed7e2f62bf6f38e0185cef96c4121006d79))
|
|
44
|
-
* Added ProfileCard images to light common ([d8107d9](https://github.com/AtB-AS/design-system/commit/d8107d9a66af65c6fd52f098b7bae127e530d09d))
|
|
45
|
-
* Added ProfileCardLoggedOut to common ([9d32b33](https://github.com/AtB-AS/design-system/commit/9d32b331286ab5dd5ee779a3dabe9bc97953825f))
|
|
46
|
-
|
|
47
|
-
## [18.2.0](https://github.com/AtB-AS/design-system/compare/generate-assets@v18.1.1...generate-assets@v18.2.0) (2025-07-31)
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
### Features
|
|
51
|
-
|
|
52
|
-
* Added new illustrations for ProfileCard ([#329](https://github.com/AtB-AS/design-system/issues/329)) ([7d80a63](https://github.com/AtB-AS/design-system/commit/7d80a6396d7fb7031e14a08f1e50efeab8e41cea))
|
|
53
|
-
|
|
54
|
-
## [18.1.1](https://github.com/AtB-AS/design-system/compare/generate-assets@v18.1.0...generate-assets@v18.1.1) (2025-07-18)
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
### Bug Fixes
|
|
58
|
-
|
|
59
|
-
* make privacy icon monochrome ([#326](https://github.com/AtB-AS/design-system/issues/326)) ([c2287e3](https://github.com/AtB-AS/design-system/commit/c2287e398a428022dba05f2399c4ab883ddcdc49))
|
|
60
|
-
|
|
61
|
-
## [18.1.0](https://github.com/AtB-AS/design-system/compare/generate-assets@v18.0.0...generate-assets@v18.1.0) (2025-07-11)
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
### Features
|
|
65
|
-
|
|
66
|
-
* add outline variants of transport icons ([#323](https://github.com/AtB-AS/design-system/issues/323)) ([d8d0ec1](https://github.com/AtB-AS/design-system/commit/d8d0ec1e6c4fc16a22e3de972d8dd82870fa00c6))
|
|
67
|
-
|
|
68
|
-
## [18.0.0](https://github.com/AtB-AS/design-system/compare/generate-assets@v17.5.2...generate-assets@v18.0.0) (2025-07-11)
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
### ⚠ BREAKING CHANGES
|
|
72
|
-
|
|
73
|
-
* update transportation icons ([#321](https://github.com/AtB-AS/design-system/issues/321))
|
|
74
|
-
|
|
75
|
-
### Features
|
|
76
|
-
|
|
77
|
-
* update transportation icons ([#321](https://github.com/AtB-AS/design-system/issues/321)) ([c086b69](https://github.com/AtB-AS/design-system/commit/c086b695f8ea06d5f5888b5084a6e354750ef95e))
|
|
78
|
-
|
|
79
|
-
## [17.5.2](https://github.com/AtB-AS/design-system/compare/generate-assets@v17.5.1...generate-assets@v17.5.2) (2025-07-09)
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
### Bug Fixes
|
|
83
|
-
|
|
84
|
-
* lock `@atb-as/theme` to v14.0.1 ([#319](https://github.com/AtB-AS/design-system/issues/319)) ([99b12df](https://github.com/AtB-AS/design-system/commit/99b12df8eec9e908f94c0d4e787626ad33e04007))
|
|
85
|
-
|
|
86
|
-
## [17.5.1](https://github.com/AtB-AS/design-system/compare/generate-assets@v17.5.0...generate-assets@v17.5.1) (2025-07-09)
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
### Bug Fixes
|
|
90
|
-
|
|
91
|
-
* remove duplicate folder and fix release build ([#317](https://github.com/AtB-AS/design-system/issues/317)) ([69ef6ab](https://github.com/AtB-AS/design-system/commit/69ef6ab5db0925a06ffd77a039f5ddff1863c4e3))
|
|
92
|
-
|
|
93
|
-
## [17.5.0](https://github.com/AtB-AS/design-system/compare/generate-assets@v17.4.0...generate-assets@v17.5.0) (2025-07-09)
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
### Features
|
|
97
|
-
|
|
98
|
-
* Add contact illustration ([#315](https://github.com/AtB-AS/design-system/issues/315)) ([787e2ee](https://github.com/AtB-AS/design-system/commit/787e2ee3cb2a59b20400f830e07ecd24e82a0e14))
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
-
};
|
|
41
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
var theme_1 = require("@atb-as/theme");
|
|
43
|
-
var fs_1 = require("fs");
|
|
44
|
-
var path_1 = __importDefault(require("path"));
|
|
45
|
-
var generate_1 = require("../generate");
|
|
46
|
-
var utils_1 = require("../utils");
|
|
47
|
-
validateValidOrgs();
|
|
48
|
-
function fromOrgFiles(org) {
|
|
49
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
50
|
-
var fullPath, files;
|
|
51
|
-
return __generator(this, function (_a) {
|
|
52
|
-
switch (_a.label) {
|
|
53
|
-
case 0:
|
|
54
|
-
fullPath = path_1.default.join(__dirname, '..', '..', 'files', (0, utils_1.themeVariantAsString)(org), '**/*.*');
|
|
55
|
-
return [4 /*yield*/, (0, utils_1.fgNormalizedForUnix)(fullPath)];
|
|
56
|
-
case 1:
|
|
57
|
-
files = _a.sent();
|
|
58
|
-
return [2 /*return*/, { org: org, files: files.map(cleanFilenames) }];
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
function exists(fileToCheck) {
|
|
64
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
65
|
-
return __generator(this, function (_a) {
|
|
66
|
-
switch (_a.label) {
|
|
67
|
-
case 0: return [4 /*yield*/, fs_1.promises
|
|
68
|
-
.access(fileToCheck, fs_1.constants.F_OK)
|
|
69
|
-
.then(function () { return true; })
|
|
70
|
-
.catch(function () { return false; })];
|
|
71
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
function verifyThatMissingOrgFilesHasCommonReplacements(missingOrgFiles) {
|
|
77
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
78
|
-
var filesMissingFromBothOrgAndCommonFolder, _i, missingOrgFiles_1, missingOrgFile, fullPath, missingOrgFileExistsInCommon;
|
|
79
|
-
return __generator(this, function (_a) {
|
|
80
|
-
switch (_a.label) {
|
|
81
|
-
case 0:
|
|
82
|
-
filesMissingFromBothOrgAndCommonFolder = [];
|
|
83
|
-
_i = 0, missingOrgFiles_1 = missingOrgFiles;
|
|
84
|
-
_a.label = 1;
|
|
85
|
-
case 1:
|
|
86
|
-
if (!(_i < missingOrgFiles_1.length)) return [3 /*break*/, 4];
|
|
87
|
-
missingOrgFile = missingOrgFiles_1[_i];
|
|
88
|
-
fullPath = path_1.default.join(__dirname, '..', '..', 'files', 'common', missingOrgFile);
|
|
89
|
-
return [4 /*yield*/, exists(fullPath)];
|
|
90
|
-
case 2:
|
|
91
|
-
missingOrgFileExistsInCommon = _a.sent();
|
|
92
|
-
if (!missingOrgFileExistsInCommon)
|
|
93
|
-
filesMissingFromBothOrgAndCommonFolder.push(fullPath);
|
|
94
|
-
_a.label = 3;
|
|
95
|
-
case 3:
|
|
96
|
-
_i++;
|
|
97
|
-
return [3 /*break*/, 1];
|
|
98
|
-
case 4: return [2 /*return*/, filesMissingFromBothOrgAndCommonFolder];
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
function validateValidOrgs() {
|
|
104
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
105
|
-
var expectedFiles, extraOrgs, hasErrors, _i, extraOrgs_1, orgAssets, filesMissingInOrg, filesMissingBothInOrgAndCommon;
|
|
106
|
-
return __generator(this, function (_a) {
|
|
107
|
-
switch (_a.label) {
|
|
108
|
-
case 0: return [4 /*yield*/, fromOrgFiles(theme_1.ThemeVariant.AtB)];
|
|
109
|
-
case 1:
|
|
110
|
-
expectedFiles = _a.sent();
|
|
111
|
-
return [4 /*yield*/, Promise.all(generate_1.validOrgIds.filter(function (i) { return i != theme_1.ThemeVariant.AtB; }).map(fromOrgFiles))];
|
|
112
|
-
case 2:
|
|
113
|
-
extraOrgs = _a.sent();
|
|
114
|
-
hasErrors = false;
|
|
115
|
-
_i = 0, extraOrgs_1 = extraOrgs;
|
|
116
|
-
_a.label = 3;
|
|
117
|
-
case 3:
|
|
118
|
-
if (!(_i < extraOrgs_1.length)) return [3 /*break*/, 6];
|
|
119
|
-
orgAssets = extraOrgs_1[_i];
|
|
120
|
-
filesMissingInOrg = difference(expectedFiles.files, orgAssets.files);
|
|
121
|
-
if (!filesMissingInOrg.length)
|
|
122
|
-
return [3 /*break*/, 5];
|
|
123
|
-
console.log("".concat((0, utils_1.themeVariantAsString)(orgAssets.org), " seems to be missing some assets, checking if common files can be used for these files:\n").concat(filesMissingInOrg.join('\n')));
|
|
124
|
-
return [4 /*yield*/, verifyThatMissingOrgFilesHasCommonReplacements(filesMissingInOrg)];
|
|
125
|
-
case 4:
|
|
126
|
-
filesMissingBothInOrgAndCommon = _a.sent();
|
|
127
|
-
if (filesMissingBothInOrgAndCommon.length) {
|
|
128
|
-
hasErrors = true;
|
|
129
|
-
console.error("".concat((0, utils_1.themeVariantAsString)(orgAssets.org), " is missing some assets, that also does not have a common file:\n").concat(filesMissingBothInOrgAndCommon.join('\n')));
|
|
130
|
-
}
|
|
131
|
-
_a.label = 5;
|
|
132
|
-
case 5:
|
|
133
|
-
_i++;
|
|
134
|
-
return [3 /*break*/, 3];
|
|
135
|
-
case 6:
|
|
136
|
-
hasErrors
|
|
137
|
-
? process.exit(1)
|
|
138
|
-
: console.log('Asset validation completed successfully');
|
|
139
|
-
return [2 /*return*/];
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
function cleanFilenames(filename) {
|
|
145
|
-
return filename.split(/\/files\/(.*?)\//)[2];
|
|
146
|
-
}
|
|
147
|
-
function difference(correct, potential) {
|
|
148
|
-
return correct.filter(function (x) { return !potential.includes(x); });
|
|
149
|
-
}
|
|
150
|
-
//# sourceMappingURL=validate-files.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validate-files.js","sourceRoot":"","sources":["../../src/tools/validate-files.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAA2C;AAC3C,yBAAuC;AACvC,8CAAwB;AACxB,wCAAwC;AACxC,kCAAmE;AAEnE,iBAAiB,EAAE,CAAC;AAEpB,SAAe,YAAY,CAAC,GAAiB;;;;;;oBACrC,QAAQ,GAAG,cAAI,CAAC,IAAI,CACxB,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,IAAA,4BAAoB,EAAC,GAAG,CAAC,EACzB,QAAQ,CACT,CAAC;oBACY,qBAAM,IAAA,2BAAmB,EAAC,QAAQ,CAAC,EAAA;;oBAA3C,KAAK,GAAG,SAAmC;oBACjD,sBAAO,EAAC,GAAG,KAAA,EAAE,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,EAAC,EAAC;;;;CAChD;AAED,SAAe,MAAM,CAAC,WAAmB;;;;wBAChC,qBAAM,aAAQ;yBAClB,MAAM,CAAC,WAAW,EAAE,cAAS,CAAC,IAAI,CAAC;yBACnC,IAAI,CAAC,cAAM,OAAA,IAAI,EAAJ,CAAI,CAAC;yBAChB,KAAK,CAAC,cAAM,OAAA,KAAK,EAAL,CAAK,CAAC,EAAA;wBAHrB,sBAAO,SAGc,EAAC;;;;CACvB;AAED,SAAe,8CAA8C,CAC3D,eAAyB;;;;;;oBAErB,sCAAsC,GAAa,EAAE,CAAC;0BACd,EAAf,mCAAe;;;yBAAf,CAAA,6BAAe,CAAA;oBAAjC,cAAc;oBACjB,QAAQ,GAAG,cAAI,CAAC,IAAI,CACxB,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,cAAc,CACf,CAAC;oBACmC,qBAAM,MAAM,CAAC,QAAQ,CAAC,EAAA;;oBAArD,4BAA4B,GAAG,SAAsB;oBAC3D,IAAI,CAAC,4BAA4B;wBAC/B,sCAAsC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;;;oBAX7B,IAAe,CAAA;;wBAa5C,sBAAO,sCAAsC,EAAC;;;;CAC/C;AAED,SAAe,iBAAiB;;;;;wBACR,qBAAM,YAAY,CAAC,oBAAY,CAAC,GAAG,CAAC,EAAA;;oBAApD,aAAa,GAAG,SAAoC;oBACxC,qBAAM,OAAO,CAAC,GAAG,CACjC,sBAAW,CAAC,MAAM,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,IAAI,oBAAY,CAAC,GAAG,EAArB,CAAqB,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,CACnE,EAAA;;oBAFK,SAAS,GAAG,SAEjB;oBAEG,SAAS,GAAG,KAAK,CAAC;0BAES,EAAT,uBAAS;;;yBAAT,CAAA,uBAAS,CAAA;oBAAtB,SAAS;oBACV,iBAAiB,GAAG,UAAU,CAAC,aAAa,CAAC,KAAK,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;oBAC3E,IAAI,CAAC,iBAAiB,CAAC,MAAM;wBAAE,wBAAS;oBAExC,OAAO,CAAC,GAAG,CACT,UAAG,IAAA,4BAAoB,EACrB,SAAS,CAAC,GAAG,CACd,sGAA4F,iBAAiB,CAAC,IAAI,CACjH,IAAI,CACL,CAAE,CACJ,CAAC;oBAEA,qBAAM,8CAA8C,CAAC,iBAAiB,CAAC,EAAA;;oBADnE,8BAA8B,GAClC,SAAuE;oBAEzE,IAAI,8BAA8B,CAAC,MAAM,EAAE,CAAC;wBAC1C,SAAS,GAAG,IAAI,CAAC;wBACjB,OAAO,CAAC,KAAK,CACX,UAAG,IAAA,4BAAoB,EACrB,SAAS,CAAC,GAAG,CACd,8EAAoE,8BAA8B,CAAC,IAAI,CACtG,IAAI,CACL,CAAE,CACJ,CAAC;oBACJ,CAAC;;;oBAvBmB,IAAS,CAAA;;;oBA0B/B,SAAS;wBACP,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;wBACjB,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,yCAAyC,CAAC,CAAC;;;;;CAC5D;AAED,SAAS,cAAc,CAAC,QAAgB;IACtC,OAAO,QAAQ,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC;AAC/C,CAAC;AAED,SAAS,UAAU,CAAC,OAAiB,EAAE,SAAmB;IACxD,OAAO,OAAO,CAAC,MAAM,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAtB,CAAsB,CAAC,CAAC;AACvD,CAAC"}
|
package/src/bin.ts
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import {validOrgIds, generateAssets, searchGlob} from './generate';
|
|
4
|
-
import pathlib from 'path';
|
|
5
|
-
import {AssetType, stringAsThemeVariant, themeVariantAsString} from './utils';
|
|
6
|
-
import {setDebug} from './logger';
|
|
7
|
-
|
|
8
|
-
import {program, Argument} from 'commander';
|
|
9
|
-
import {generateTs} from './generateTs';
|
|
10
|
-
|
|
11
|
-
type InputOptions = {
|
|
12
|
-
debug: boolean;
|
|
13
|
-
generateMonoTheme: boolean;
|
|
14
|
-
glob?: string;
|
|
15
|
-
outDir: string;
|
|
16
|
-
generateTs: boolean;
|
|
17
|
-
tsOutDir: string | undefined;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
program
|
|
21
|
-
.name('npx @atb-as/generate-assets')
|
|
22
|
-
.addArgument(
|
|
23
|
-
new Argument('<type>', 'Type of assets to generate')
|
|
24
|
-
.choices(['colors', 'all', 'mono'])
|
|
25
|
-
.argRequired(),
|
|
26
|
-
)
|
|
27
|
-
.addArgument(
|
|
28
|
-
new Argument('<orgId>', 'Generate for specific organization')
|
|
29
|
-
.choices(validOrgIds.map(themeVariantAsString))
|
|
30
|
-
.argRequired(),
|
|
31
|
-
)
|
|
32
|
-
.requiredOption('-o, --out-dir <output>', 'Output directory')
|
|
33
|
-
.option(
|
|
34
|
-
'-ts-o, --ts-out-dir <output>',
|
|
35
|
-
'Output directory for generated typescript',
|
|
36
|
-
)
|
|
37
|
-
.option('-d, --debug', 'Log all files generated', false)
|
|
38
|
-
.option(
|
|
39
|
-
'-nm, --no-generate-mono-theme',
|
|
40
|
-
'Ignore generating themed mono-icons, but keep general mono icons.',
|
|
41
|
-
)
|
|
42
|
-
.option('-ts, --generate-ts', 'Generates typescript resolution file.', false)
|
|
43
|
-
.option(
|
|
44
|
-
'-g, --glob [glob]',
|
|
45
|
-
'Pass in custom glob for matching files.',
|
|
46
|
-
searchGlob,
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
program.showHelpAfterError();
|
|
50
|
-
program.showSuggestionAfterError();
|
|
51
|
-
|
|
52
|
-
program.parse();
|
|
53
|
-
|
|
54
|
-
const opts = program.opts<InputOptions>();
|
|
55
|
-
const assetType = program.args[0] as AssetType;
|
|
56
|
-
const orgId = program.args[1];
|
|
57
|
-
|
|
58
|
-
if (opts.debug) setDebug(true);
|
|
59
|
-
|
|
60
|
-
const main = async () => {
|
|
61
|
-
const outputFolder = pathlib.join(process.cwd(), opts.outDir);
|
|
62
|
-
|
|
63
|
-
try {
|
|
64
|
-
const potentialGlob = findPotentialGlobPattern(process.argv);
|
|
65
|
-
|
|
66
|
-
console.log(`Writing assets for ${orgId} to ${outputFolder}`);
|
|
67
|
-
const assets = await generateAssets(
|
|
68
|
-
assetType,
|
|
69
|
-
stringAsThemeVariant(orgId),
|
|
70
|
-
outputFolder,
|
|
71
|
-
{
|
|
72
|
-
patterns: potentialGlob,
|
|
73
|
-
generateMonoTheme: opts.generateMonoTheme,
|
|
74
|
-
},
|
|
75
|
-
);
|
|
76
|
-
if (opts.debug) {
|
|
77
|
-
console.log(`Written ${assets.length} assets for ${orgId}:\n`);
|
|
78
|
-
|
|
79
|
-
console.log();
|
|
80
|
-
assets.forEach((i) => console.log(i));
|
|
81
|
-
} else {
|
|
82
|
-
console.log(
|
|
83
|
-
`Successfully written ${assets.length} assets for ${orgId} to ${outputFolder}`,
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
if (opts.generateTs) {
|
|
88
|
-
const generatedTsFile = await generateTs(
|
|
89
|
-
assets,
|
|
90
|
-
assetType,
|
|
91
|
-
outputFolder,
|
|
92
|
-
opts.tsOutDir,
|
|
93
|
-
);
|
|
94
|
-
console.log(`Generated typescript file: ${generatedTsFile}`);
|
|
95
|
-
}
|
|
96
|
-
} catch (e) {
|
|
97
|
-
console.error((e as Error)?.message);
|
|
98
|
-
program.help({error: true});
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
main();
|
|
103
|
-
|
|
104
|
-
function findPotentialGlobPattern(args: string[]) {
|
|
105
|
-
for (let arg in args) {
|
|
106
|
-
if (!args[arg]?.startsWith('--glob') && !args[arg]?.startsWith('-g'))
|
|
107
|
-
continue;
|
|
108
|
-
|
|
109
|
-
// Is glob, check for valid next argument or if using =
|
|
110
|
-
if (args[arg].includes('=')) {
|
|
111
|
-
const [, glob] = args[arg].split('=');
|
|
112
|
-
return glob;
|
|
113
|
-
}
|
|
114
|
-
const potentialGlob = args[Number(arg) + 1];
|
|
115
|
-
if (!potentialGlob) {
|
|
116
|
-
throw new Error('Missing argument to --glob.');
|
|
117
|
-
}
|
|
118
|
-
return potentialGlob;
|
|
119
|
-
}
|
|
120
|
-
return undefined;
|
|
121
|
-
}
|
package/src/generate.ts
DELETED
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
import fs from 'fs/promises';
|
|
2
|
-
import {createReadStream, createWriteStream} from 'fs';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
|
|
5
|
-
import {createThemesFor, Mode, Themes, ThemeVariant} from '@atb-as/theme';
|
|
6
|
-
|
|
7
|
-
import micromatch from 'micromatch';
|
|
8
|
-
import {sed as updateFiles} from 'stream-editor';
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
fgNormalizedForUnix,
|
|
12
|
-
normalizeToUnix,
|
|
13
|
-
themeVariantAsString,
|
|
14
|
-
} from './utils';
|
|
15
|
-
import {log} from './logger';
|
|
16
|
-
|
|
17
|
-
export const validOrgIds = [
|
|
18
|
-
ThemeVariant.AtB,
|
|
19
|
-
ThemeVariant.Nfk,
|
|
20
|
-
ThemeVariant.FRAM,
|
|
21
|
-
ThemeVariant.Troms,
|
|
22
|
-
ThemeVariant.Innlandet,
|
|
23
|
-
ThemeVariant.VKT,
|
|
24
|
-
ThemeVariant.Farte,
|
|
25
|
-
];
|
|
26
|
-
export const searchGlob = '**/*.{svg,png,jpg,jpeg,ico}';
|
|
27
|
-
export const searchGlobSvg = '**/*.svg';
|
|
28
|
-
|
|
29
|
-
type AssetTypes = 'colors' | 'mono' | 'all';
|
|
30
|
-
|
|
31
|
-
type Options = {
|
|
32
|
-
generateMonoTheme?: boolean;
|
|
33
|
-
onlyOutputMono?: boolean;
|
|
34
|
-
patterns?: string | readonly string[];
|
|
35
|
-
};
|
|
36
|
-
const defaultOpts: Options = {
|
|
37
|
-
generateMonoTheme: true,
|
|
38
|
-
onlyOutputMono: false,
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export async function generateAssets(
|
|
42
|
-
assetType: AssetTypes,
|
|
43
|
-
orgId: ThemeVariant,
|
|
44
|
-
destinationDirectory: string,
|
|
45
|
-
opts: Options = defaultOpts,
|
|
46
|
-
) {
|
|
47
|
-
const assetDir = assetType == 'all' ? '{colors,mono}' : assetType;
|
|
48
|
-
const fromBase = (...p: string[]) => {
|
|
49
|
-
const fullPath = path.join(
|
|
50
|
-
__dirname,
|
|
51
|
-
'..',
|
|
52
|
-
'files',
|
|
53
|
-
...p,
|
|
54
|
-
assetDir,
|
|
55
|
-
searchGlob,
|
|
56
|
-
);
|
|
57
|
-
|
|
58
|
-
log('searching for files in', fullPath);
|
|
59
|
-
return fgNormalizedForUnix(fullPath);
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
if (!validOrgIds.includes(orgId))
|
|
63
|
-
throw new Error(`Invalid orgId provided, valid orgIds are ${validOrgIds}`);
|
|
64
|
-
|
|
65
|
-
// File paths are returned as UNIX type separators.
|
|
66
|
-
const commonFiles = await fromBase('common');
|
|
67
|
-
const orgFiles = await fromBase(themeVariantAsString(orgId));
|
|
68
|
-
|
|
69
|
-
log('Found common files:', commonFiles.length);
|
|
70
|
-
log('Found org files for', orgId, ':', orgFiles.length);
|
|
71
|
-
|
|
72
|
-
log('Merging files for ', assetType);
|
|
73
|
-
const allFilesToBeCopied = mergeFiles(assetType, commonFiles, orgFiles);
|
|
74
|
-
log('Found merged files:', allFilesToBeCopied.length);
|
|
75
|
-
|
|
76
|
-
const potentiallyFiltered = opts.patterns
|
|
77
|
-
? micromatch(allFilesToBeCopied, opts.patterns)
|
|
78
|
-
: allFilesToBeCopied;
|
|
79
|
-
|
|
80
|
-
let allFiles = potentiallyFiltered.map(async (absolutePath) => {
|
|
81
|
-
const relativePath = path.normalize(
|
|
82
|
-
getGeneralNameWithoutFullPath(assetType, absolutePath),
|
|
83
|
-
);
|
|
84
|
-
const destinationPath = path.join(destinationDirectory, relativePath);
|
|
85
|
-
|
|
86
|
-
await fs.mkdir(path.dirname(destinationPath), {recursive: true});
|
|
87
|
-
await fs.copyFile(path.normalize(absolutePath), destinationPath);
|
|
88
|
-
|
|
89
|
-
return destinationPath;
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
log('Total files before generated mono icons:', allFiles.length);
|
|
93
|
-
|
|
94
|
-
let created = await Promise.all(allFiles);
|
|
95
|
-
if (opts.generateMonoTheme && assetType !== 'colors') {
|
|
96
|
-
const allExtraMonoIcons = await generateMonoIconsInDestinationDirectory(
|
|
97
|
-
assetType,
|
|
98
|
-
orgId,
|
|
99
|
-
destinationDirectory,
|
|
100
|
-
);
|
|
101
|
-
created = created.concat(await Promise.all(allExtraMonoIcons));
|
|
102
|
-
}
|
|
103
|
-
log('Total files after generated mono icons:', created.length);
|
|
104
|
-
|
|
105
|
-
return created;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export async function generateMonoIconsInDestinationDirectory(
|
|
109
|
-
assetType: AssetTypes,
|
|
110
|
-
orgId: ThemeVariant,
|
|
111
|
-
destinationDirectory: string,
|
|
112
|
-
) {
|
|
113
|
-
const themes = createThemesFor(orgId);
|
|
114
|
-
|
|
115
|
-
// Assume mono-icons is created directly on destination root.
|
|
116
|
-
const base = path.join(
|
|
117
|
-
destinationDirectory,
|
|
118
|
-
assetType === 'all' ? 'mono' : '',
|
|
119
|
-
);
|
|
120
|
-
const folder = path.join(base, searchGlobSvg);
|
|
121
|
-
|
|
122
|
-
const darkBase = path.join(base, 'dark');
|
|
123
|
-
const lightBase = path.join(base, 'light');
|
|
124
|
-
|
|
125
|
-
await fs.mkdir(darkBase, {recursive: true});
|
|
126
|
-
await fs.mkdir(lightBase, {recursive: true});
|
|
127
|
-
|
|
128
|
-
let files: Promise<string>[] = [];
|
|
129
|
-
for (const entry of await fgNormalizedForUnix(folder, {
|
|
130
|
-
// Avoid trying to convert what we have from before.
|
|
131
|
-
ignore: [darkBase, lightBase],
|
|
132
|
-
})) {
|
|
133
|
-
files = files.concat([
|
|
134
|
-
rewriteAndSave('dark', themes, entry, base),
|
|
135
|
-
rewriteAndSave('light', themes, entry, base),
|
|
136
|
-
]);
|
|
137
|
-
}
|
|
138
|
-
return files;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
async function rewriteAndSave(
|
|
142
|
-
color: Mode,
|
|
143
|
-
themes: Themes,
|
|
144
|
-
absoluteFile: string,
|
|
145
|
-
monoIconsBase: string,
|
|
146
|
-
) {
|
|
147
|
-
const relativeFileName = path.relative(monoIconsBase, absoluteFile);
|
|
148
|
-
const filename = path.basename(relativeFileName);
|
|
149
|
-
const destinationDir = path.join(
|
|
150
|
-
monoIconsBase,
|
|
151
|
-
color,
|
|
152
|
-
path.dirname(relativeFileName),
|
|
153
|
-
);
|
|
154
|
-
|
|
155
|
-
await fs.mkdir(destinationDir, {recursive: true});
|
|
156
|
-
const destination = path.join(destinationDir, filename);
|
|
157
|
-
|
|
158
|
-
await updateFiles({
|
|
159
|
-
from: createReadStream(absoluteFile),
|
|
160
|
-
to: createWriteStream(destination),
|
|
161
|
-
match: /((fill|stroke)\=\"(?:[^"]+)\")/,
|
|
162
|
-
replacement: `$2="${themes[color].color.foreground.dynamic.primary}"`,
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
return destination;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
function mergeFiles(
|
|
169
|
-
assetType: AssetTypes,
|
|
170
|
-
commonFiles: string[],
|
|
171
|
-
orgFiles: string[],
|
|
172
|
-
) {
|
|
173
|
-
const relativeOrgFiles = orgFiles.map((f) =>
|
|
174
|
-
getGeneralNameWithoutFullPath(assetType, f),
|
|
175
|
-
);
|
|
176
|
-
const commonsWithoutOverrides = commonFiles.filter(function (filepath) {
|
|
177
|
-
return !relativeOrgFiles.includes(
|
|
178
|
-
getGeneralNameWithoutFullPath(assetType, filepath),
|
|
179
|
-
);
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
return commonsWithoutOverrides.concat(orgFiles);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
function getGeneralNameWithoutFullPath(
|
|
186
|
-
assetType: AssetTypes,
|
|
187
|
-
fullPath: string,
|
|
188
|
-
) {
|
|
189
|
-
const assetDir = assetType == 'all' ? '' : escapeRegex(`/${assetType}`);
|
|
190
|
-
const regexString = `^.*\/files\/[^\/]+${assetDir}`;
|
|
191
|
-
|
|
192
|
-
// Normalize to unix style instead if handling separator manually
|
|
193
|
-
return normalizeToUnix(fullPath).replace(new RegExp(regexString), '');
|
|
194
|
-
}
|
|
195
|
-
function escapeRegex(str: string) {
|
|
196
|
-
return str.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
|
|
197
|
-
}
|
package/src/generateTs.ts
DELETED
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
import fs from 'fs/promises';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import {AssetType, normalizeToUnix} from './utils';
|
|
4
|
-
|
|
5
|
-
type Data = Partial<{
|
|
6
|
-
mono: Record<string, MonoType>;
|
|
7
|
-
colorIcons: Record<string, ColorType>;
|
|
8
|
-
images: Record<string, ColorType>;
|
|
9
|
-
illustration: Record<string, ColorType>;
|
|
10
|
-
}>;
|
|
11
|
-
export async function generateTs(
|
|
12
|
-
allFiles: string[],
|
|
13
|
-
assetTypeInput: AssetType,
|
|
14
|
-
outputDir: string,
|
|
15
|
-
tsOutput: string = outputDir,
|
|
16
|
-
) {
|
|
17
|
-
const data = generateData(allFiles, assetTypeInput, outputDir);
|
|
18
|
-
const generatedContents = template(data);
|
|
19
|
-
|
|
20
|
-
await fs.mkdir(tsOutput, {recursive: true});
|
|
21
|
-
const destinationFile = path.join(tsOutput, 'generated-icons.ts');
|
|
22
|
-
await fs.writeFile(destinationFile, generatedContents);
|
|
23
|
-
|
|
24
|
-
return destinationFile;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function template(data: Data) {
|
|
28
|
-
return `// NB! NB! NB!
|
|
29
|
-
// AUTO GENERATED FILE. DON'T CHANGE
|
|
30
|
-
// NB! NB! NB!
|
|
31
|
-
export const icons = ${JSON.stringify(data, null, 2)};
|
|
32
|
-
export type Icons = typeof icons;
|
|
33
|
-
|
|
34
|
-
export type ColorType = {
|
|
35
|
-
relative: string;
|
|
36
|
-
absolute: string;
|
|
37
|
-
assetType: 'colors';
|
|
38
|
-
colorType: 'illustrations' | 'images';
|
|
39
|
-
darkable: boolean;
|
|
40
|
-
id: string;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export type MonoType = {
|
|
44
|
-
relative: string;
|
|
45
|
-
absolute: string;
|
|
46
|
-
assetType: 'mono';
|
|
47
|
-
id: string;
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
export type IconType = ColorType | MonoType;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
${data.mono ? `export type MonoIcons = keyof Icons['mono'];` : ''}
|
|
54
|
-
${data.images ? `export type Images = keyof Icons['images'];` : ''}
|
|
55
|
-
${data.colorIcons ? `export type ColorIcons = keyof Icons['colorIcons'];` : ''}
|
|
56
|
-
${
|
|
57
|
-
data.illustration
|
|
58
|
-
? `export type Illustrations = keyof Icons['illustration'];`
|
|
59
|
-
: ''
|
|
60
|
-
}
|
|
61
|
-
`;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function toUniqueObject<T extends IconType>(list: T[]) {
|
|
65
|
-
return pickBy(list, (i) => i.id);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function generateData(
|
|
69
|
-
allFiles: string[],
|
|
70
|
-
assetTypeInput: AssetType,
|
|
71
|
-
outputDir: string,
|
|
72
|
-
) {
|
|
73
|
-
const constructs = allFiles
|
|
74
|
-
.map((f) => toTypeCoonstruct(f, assetTypeInput, outputDir))
|
|
75
|
-
.filter(Boolean) as IconType[];
|
|
76
|
-
|
|
77
|
-
const groupedByMode = groupBy(constructs, (i) => i.assetType);
|
|
78
|
-
const mono = groupedByMode.mono as MonoType[];
|
|
79
|
-
const colors = groupedByMode.colors
|
|
80
|
-
? groupBy(groupedByMode.colors as ColorType[], (i) => i.colorType)
|
|
81
|
-
: undefined;
|
|
82
|
-
|
|
83
|
-
return {
|
|
84
|
-
mono: mono ? toUniqueObject(mono) : undefined,
|
|
85
|
-
images: colors?.images ? toUniqueObject(colors.images) : undefined,
|
|
86
|
-
colorIcons: colors?.icons ? toUniqueObject(colors.icons) : undefined,
|
|
87
|
-
illustration: colors?.illustrations
|
|
88
|
-
? toUniqueObject(colors.illustrations)
|
|
89
|
-
: undefined,
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
type ColorType = {
|
|
94
|
-
relative: string;
|
|
95
|
-
absolute: string;
|
|
96
|
-
assetType: 'colors';
|
|
97
|
-
colorType: 'illustrations' | 'images' | 'icons';
|
|
98
|
-
darkable: boolean;
|
|
99
|
-
id: string;
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
type MonoType = {
|
|
103
|
-
relative: string;
|
|
104
|
-
absolute: string;
|
|
105
|
-
assetType: 'mono';
|
|
106
|
-
id: string;
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
type IconType = ColorType | MonoType;
|
|
110
|
-
function toTypeCoonstruct(
|
|
111
|
-
absolute: string,
|
|
112
|
-
assetTypeInput: AssetType,
|
|
113
|
-
outputDir: string,
|
|
114
|
-
): IconType | undefined {
|
|
115
|
-
const relative = absolute.replace(outputDir, '');
|
|
116
|
-
|
|
117
|
-
let assetType =
|
|
118
|
-
assetTypeInput == 'all'
|
|
119
|
-
? relative.match(/^.?colors/)
|
|
120
|
-
? 'colors'
|
|
121
|
-
: 'mono'
|
|
122
|
-
: assetTypeInput;
|
|
123
|
-
|
|
124
|
-
// If is mono and has dark/light in the path, skip the asset.
|
|
125
|
-
if (assetType === 'mono' && relative.match(/(dark|light)/)) {
|
|
126
|
-
return undefined;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
if (assetType == 'colors') {
|
|
130
|
-
return {
|
|
131
|
-
relative,
|
|
132
|
-
absolute,
|
|
133
|
-
assetType: 'colors',
|
|
134
|
-
colorType: getColorType(relative),
|
|
135
|
-
darkable: isDarkable(relative),
|
|
136
|
-
id: toIDPath(relative),
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
return {
|
|
141
|
-
relative,
|
|
142
|
-
absolute,
|
|
143
|
-
assetType: 'mono',
|
|
144
|
-
id: toIDPath(relative),
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
const darkOrLight = /\/(?:dark|light)\//;
|
|
148
|
-
|
|
149
|
-
function toIDPath(relative: string) {
|
|
150
|
-
return normalizeToUnix(relative)
|
|
151
|
-
.replace(darkOrLight, '/')
|
|
152
|
-
.replace(
|
|
153
|
-
/^\/?(?:(?:mono|colors)\/)?(?:(?:illustrations|images|icons)\/)?(.*)\..{3}$/,
|
|
154
|
-
'$1',
|
|
155
|
-
);
|
|
156
|
-
}
|
|
157
|
-
function isDarkable(relative: string) {
|
|
158
|
-
return relative.match(darkOrLight) !== null;
|
|
159
|
-
}
|
|
160
|
-
function getColorType(relative: string): ColorType['colorType'] {
|
|
161
|
-
const colorType = normalizeToUnix(relative)
|
|
162
|
-
// Extract the color type
|
|
163
|
-
.match(/^\/?(?:(?:mono|colors)\/)?(illustrations|images|icons)\//)?.[1];
|
|
164
|
-
|
|
165
|
-
switch (colorType) {
|
|
166
|
-
case 'illustrations':
|
|
167
|
-
return 'illustrations';
|
|
168
|
-
case 'icons':
|
|
169
|
-
return 'icons';
|
|
170
|
-
default:
|
|
171
|
-
return 'images';
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
const groupBy = <T, K extends keyof any>(list: T[], getKey: (item: T) => K) =>
|
|
176
|
-
list.reduce((previous, currentItem) => {
|
|
177
|
-
const group = getKey(currentItem);
|
|
178
|
-
if (!previous[group]) previous[group] = [];
|
|
179
|
-
previous[group].push(currentItem);
|
|
180
|
-
return previous;
|
|
181
|
-
}, {} as Record<K, T[]>);
|
|
182
|
-
|
|
183
|
-
const pickBy = <T, K extends keyof any>(list: T[], getKey: (item: T) => K) =>
|
|
184
|
-
list.reduce((previous, currentItem) => {
|
|
185
|
-
const group = getKey(currentItem);
|
|
186
|
-
if (previous[group]) return previous;
|
|
187
|
-
previous[group] = currentItem;
|
|
188
|
-
return previous;
|
|
189
|
-
}, {} as Record<K, T>);
|
package/src/logger.ts
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import {ThemeVariant} from '@atb-as/theme';
|
|
2
|
-
import {constants, promises} from 'fs';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
import {validOrgIds} from '../generate';
|
|
5
|
-
import {fgNormalizedForUnix, themeVariantAsString} from '../utils';
|
|
6
|
-
|
|
7
|
-
validateValidOrgs();
|
|
8
|
-
|
|
9
|
-
async function fromOrgFiles(org: ThemeVariant) {
|
|
10
|
-
const fullPath = path.join(
|
|
11
|
-
__dirname,
|
|
12
|
-
'..',
|
|
13
|
-
'..',
|
|
14
|
-
'files',
|
|
15
|
-
themeVariantAsString(org),
|
|
16
|
-
'**/*.*',
|
|
17
|
-
);
|
|
18
|
-
const files = await fgNormalizedForUnix(fullPath);
|
|
19
|
-
return {org, files: files.map(cleanFilenames)};
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
async function exists(fileToCheck: string) {
|
|
23
|
-
return await promises
|
|
24
|
-
.access(fileToCheck, constants.F_OK)
|
|
25
|
-
.then(() => true)
|
|
26
|
-
.catch(() => false);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
async function verifyThatMissingOrgFilesHasCommonReplacements(
|
|
30
|
-
missingOrgFiles: string[],
|
|
31
|
-
) {
|
|
32
|
-
let filesMissingFromBothOrgAndCommonFolder = <string[]>[];
|
|
33
|
-
for (const missingOrgFile of missingOrgFiles) {
|
|
34
|
-
const fullPath = path.join(
|
|
35
|
-
__dirname,
|
|
36
|
-
'..',
|
|
37
|
-
'..',
|
|
38
|
-
'files',
|
|
39
|
-
'common',
|
|
40
|
-
missingOrgFile,
|
|
41
|
-
);
|
|
42
|
-
const missingOrgFileExistsInCommon = await exists(fullPath);
|
|
43
|
-
if (!missingOrgFileExistsInCommon)
|
|
44
|
-
filesMissingFromBothOrgAndCommonFolder.push(fullPath);
|
|
45
|
-
}
|
|
46
|
-
return filesMissingFromBothOrgAndCommonFolder;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
async function validateValidOrgs() {
|
|
50
|
-
const expectedFiles = await fromOrgFiles(ThemeVariant.AtB);
|
|
51
|
-
const extraOrgs = await Promise.all(
|
|
52
|
-
validOrgIds.filter((i) => i != ThemeVariant.AtB).map(fromOrgFiles),
|
|
53
|
-
);
|
|
54
|
-
|
|
55
|
-
let hasErrors = false;
|
|
56
|
-
|
|
57
|
-
for (let orgAssets of extraOrgs) {
|
|
58
|
-
const filesMissingInOrg = difference(expectedFiles.files, orgAssets.files);
|
|
59
|
-
if (!filesMissingInOrg.length) continue;
|
|
60
|
-
|
|
61
|
-
console.log(
|
|
62
|
-
`${themeVariantAsString(
|
|
63
|
-
orgAssets.org,
|
|
64
|
-
)} seems to be missing some assets, checking if common files can be used for these files:\n${filesMissingInOrg.join(
|
|
65
|
-
'\n',
|
|
66
|
-
)}`,
|
|
67
|
-
);
|
|
68
|
-
const filesMissingBothInOrgAndCommon =
|
|
69
|
-
await verifyThatMissingOrgFilesHasCommonReplacements(filesMissingInOrg);
|
|
70
|
-
|
|
71
|
-
if (filesMissingBothInOrgAndCommon.length) {
|
|
72
|
-
hasErrors = true;
|
|
73
|
-
console.error(
|
|
74
|
-
`${themeVariantAsString(
|
|
75
|
-
orgAssets.org,
|
|
76
|
-
)} is missing some assets, that also does not have a common file:\n${filesMissingBothInOrgAndCommon.join(
|
|
77
|
-
'\n',
|
|
78
|
-
)}`,
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
hasErrors
|
|
84
|
-
? process.exit(1)
|
|
85
|
-
: console.log('Asset validation completed successfully');
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
function cleanFilenames(filename: string) {
|
|
89
|
-
return filename.split(/\/files\/(.*?)\//)[2];
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function difference(correct: string[], potential: string[]) {
|
|
93
|
-
return correct.filter((x) => !potential.includes(x));
|
|
94
|
-
}
|
package/src/utils.ts
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import {ThemeVariant} from '@atb-as/theme';
|
|
2
|
-
|
|
3
|
-
export {ThemeVariant};
|
|
4
|
-
import fg from 'fast-glob';
|
|
5
|
-
import normalizeToUnix from 'normalize-path';
|
|
6
|
-
|
|
7
|
-
export type AssetType = 'colors' | 'all' | 'mono';
|
|
8
|
-
|
|
9
|
-
export function themeVariantAsString(org: ThemeVariant): string {
|
|
10
|
-
switch (org) {
|
|
11
|
-
case ThemeVariant.Nfk:
|
|
12
|
-
return 'nfk';
|
|
13
|
-
case ThemeVariant.AtB:
|
|
14
|
-
return 'atb';
|
|
15
|
-
case ThemeVariant.FRAM:
|
|
16
|
-
return 'fram';
|
|
17
|
-
case ThemeVariant.Troms:
|
|
18
|
-
return 'troms';
|
|
19
|
-
case ThemeVariant.Innlandet:
|
|
20
|
-
return 'innlandet';
|
|
21
|
-
case ThemeVariant.VKT:
|
|
22
|
-
return 'vkt';
|
|
23
|
-
case ThemeVariant.Farte:
|
|
24
|
-
return 'farte';
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export function stringAsThemeVariant(org: string): ThemeVariant {
|
|
29
|
-
switch (org) {
|
|
30
|
-
case 'nfk':
|
|
31
|
-
return ThemeVariant.Nfk;
|
|
32
|
-
case 'atb':
|
|
33
|
-
return ThemeVariant.AtB;
|
|
34
|
-
case 'fram':
|
|
35
|
-
return ThemeVariant.FRAM;
|
|
36
|
-
case 'troms':
|
|
37
|
-
return ThemeVariant.Troms;
|
|
38
|
-
case 'innlandet':
|
|
39
|
-
return ThemeVariant.Innlandet;
|
|
40
|
-
case 'vkt':
|
|
41
|
-
return ThemeVariant.VKT;
|
|
42
|
-
case 'farte':
|
|
43
|
-
return ThemeVariant.Farte;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
throw new Error('Invalid org');
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// Due to globs nature forward UNIX type slashes should be used. Normalize paths.
|
|
50
|
-
// All paths returned are also UNIX style. All node functions normalize self, no
|
|
51
|
-
// need to do it manually.
|
|
52
|
-
// (see https://github.com/mrmlnc/fast-glob#how-to-write-patterns-on-windows)
|
|
53
|
-
export function fgNormalizedForUnix(
|
|
54
|
-
path: string,
|
|
55
|
-
options?: {ignore: string[]},
|
|
56
|
-
) {
|
|
57
|
-
const opts =
|
|
58
|
-
options && options.ignore
|
|
59
|
-
? {
|
|
60
|
-
ignore: options.ignore.map((f) => normalizeToUnix(f)),
|
|
61
|
-
}
|
|
62
|
-
: options;
|
|
63
|
-
return fg(normalizeToUnix(path), opts);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export {normalizeToUnix};
|