@atb-as/generate-assets 18.7.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.
@@ -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="black"/>
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="black"/>
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="black"/>
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="black"/>
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.7.0",
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,106 +0,0 @@
1
- # Changelog
2
-
3
- ## [18.7.0](https://github.com/AtB-AS/design-system/compare/generate-assets@v18.6.0...generate-assets@v18.7.0) (2026-01-19)
4
-
5
-
6
- ### Features
7
-
8
- * add Apple Pay icon ([#371](https://github.com/AtB-AS/design-system/issues/371)) ([3b6a438](https://github.com/AtB-AS/design-system/commit/3b6a4385f06cf934523407528a82e72942409d12))
9
- * add custom map illustration for AtB ([#368](https://github.com/AtB-AS/design-system/issues/368)) ([8ebb745](https://github.com/AtB-AS/design-system/commit/8ebb745d563027da0b29d43e147de3d3442fc2d8))
10
-
11
- ## [18.6.0](https://github.com/AtB-AS/design-system/compare/generate-assets@v18.5.1...generate-assets@v18.6.0) (2025-11-10)
12
-
13
-
14
- ### Features
15
-
16
- * added new flash icons ([#363](https://github.com/AtB-AS/design-system/issues/363)) ([95a626b](https://github.com/AtB-AS/design-system/commit/95a626b8a6dac3dec7e08107cf49efe82ef1c3ce))
17
-
18
- ## [18.5.1](https://github.com/AtB-AS/design-system/compare/generate-assets@v18.5.0...generate-assets@v18.5.1) (2025-10-22)
19
-
20
-
21
- ### Bug Fixes
22
-
23
- * EmptyIllustration ([#344](https://github.com/AtB-AS/design-system/issues/344)) ([064b5f2](https://github.com/AtB-AS/design-system/commit/064b5f2550ac952637c847d582027fb212021c6b))
24
-
25
- ## [18.5.0](https://github.com/AtB-AS/design-system/compare/generate-assets@v18.4.0...generate-assets@v18.5.0) (2025-09-18)
26
-
27
-
28
- ### Features
29
-
30
- * 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))
31
-
32
- ## [18.4.0](https://github.com/AtB-AS/design-system/compare/generate-assets@v18.3.1...generate-assets@v18.4.0) (2025-09-08)
33
-
34
-
35
- ### Features
36
-
37
- * 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))
38
-
39
- ## [18.3.1](https://github.com/AtB-AS/design-system/compare/generate-assets@v18.3.0...generate-assets@v18.3.1) (2025-08-04)
40
-
41
-
42
- ### Bug Fixes
43
-
44
- * 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))
45
-
46
- ## [18.3.0](https://github.com/AtB-AS/design-system/compare/generate-assets@v18.2.0...generate-assets@v18.3.0) (2025-07-31)
47
-
48
-
49
- ### Features
50
-
51
- * Added common ProfileCardLoggedIn ([d894bed](https://github.com/AtB-AS/design-system/commit/d894bed7e2f62bf6f38e0185cef96c4121006d79))
52
- * Added ProfileCard images to light common ([d8107d9](https://github.com/AtB-AS/design-system/commit/d8107d9a66af65c6fd52f098b7bae127e530d09d))
53
- * Added ProfileCardLoggedOut to common ([9d32b33](https://github.com/AtB-AS/design-system/commit/9d32b331286ab5dd5ee779a3dabe9bc97953825f))
54
-
55
- ## [18.2.0](https://github.com/AtB-AS/design-system/compare/generate-assets@v18.1.1...generate-assets@v18.2.0) (2025-07-31)
56
-
57
-
58
- ### Features
59
-
60
- * 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))
61
-
62
- ## [18.1.1](https://github.com/AtB-AS/design-system/compare/generate-assets@v18.1.0...generate-assets@v18.1.1) (2025-07-18)
63
-
64
-
65
- ### Bug Fixes
66
-
67
- * make privacy icon monochrome ([#326](https://github.com/AtB-AS/design-system/issues/326)) ([c2287e3](https://github.com/AtB-AS/design-system/commit/c2287e398a428022dba05f2399c4ab883ddcdc49))
68
-
69
- ## [18.1.0](https://github.com/AtB-AS/design-system/compare/generate-assets@v18.0.0...generate-assets@v18.1.0) (2025-07-11)
70
-
71
-
72
- ### Features
73
-
74
- * 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))
75
-
76
- ## [18.0.0](https://github.com/AtB-AS/design-system/compare/generate-assets@v17.5.2...generate-assets@v18.0.0) (2025-07-11)
77
-
78
-
79
- ### ⚠ BREAKING CHANGES
80
-
81
- * update transportation icons ([#321](https://github.com/AtB-AS/design-system/issues/321))
82
-
83
- ### Features
84
-
85
- * update transportation icons ([#321](https://github.com/AtB-AS/design-system/issues/321)) ([c086b69](https://github.com/AtB-AS/design-system/commit/c086b695f8ea06d5f5888b5084a6e354750ef95e))
86
-
87
- ## [17.5.2](https://github.com/AtB-AS/design-system/compare/generate-assets@v17.5.1...generate-assets@v17.5.2) (2025-07-09)
88
-
89
-
90
- ### Bug Fixes
91
-
92
- * 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))
93
-
94
- ## [17.5.1](https://github.com/AtB-AS/design-system/compare/generate-assets@v17.5.0...generate-assets@v17.5.1) (2025-07-09)
95
-
96
-
97
- ### Bug Fixes
98
-
99
- * 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))
100
-
101
- ## [17.5.0](https://github.com/AtB-AS/design-system/compare/generate-assets@v17.4.0...generate-assets@v17.5.0) (2025-07-09)
102
-
103
-
104
- ### Features
105
-
106
- * 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":"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"}
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,10 +0,0 @@
1
- let isDebug = false;
2
-
3
- export function setDebug(active: boolean) {
4
- isDebug = active;
5
- }
6
-
7
- export function log(...args: any[]) {
8
- if (!isDebug) return;
9
- return console.log(...args);
10
- }
@@ -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};
package/tsconfig.json DELETED
@@ -1,10 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.json",
3
- "compilerOptions": {
4
- "declaration": true,
5
- "outDir": "./lib",
6
- "noEmit": false
7
- },
8
- "exclude": ["node_modules", "lib"],
9
- "include": ["src/**/*.ts"]
10
- }