@ihk-gfi/lux-components-update 11.14.0 → 13.0.2

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.
Files changed (239) hide show
  1. package/README.md +2 -4
  2. package/package.json +14 -17
  3. package/src/add-lux-components/files/app/app.component.html +1 -1
  4. package/src/add-lux-components/files/app/app.component.ts +4 -1
  5. package/src/add-lux-components/files/locale/messages.en.xlf +489 -235
  6. package/src/add-lux-components/files/locale/messages.xlf +451 -218
  7. package/src/add-lux-components/files/scripts/.browserslistrc +10 -7
  8. package/src/add-lux-components/files/src/index.html +31 -0
  9. package/src/add-lux-components/index.js +151 -84
  10. package/src/add-lux-components/index.js.map +1 -1
  11. package/src/add-lux-components/index.ts +141 -72
  12. package/src/add-lux-components/index_spec.js +4 -4
  13. package/src/add-lux-components/index_spec.js.map +1 -1
  14. package/src/add-lux-components/index_spec.ts +1 -1
  15. package/src/add-lux-components/schema.json +1 -1
  16. package/src/collection.json +8 -93
  17. package/src/update-dependencies/index.d.ts +1 -1
  18. package/src/update-dependencies/index.js +82 -65
  19. package/src/update-dependencies/index.js.map +1 -1
  20. package/src/update-dependencies/index.ts +112 -95
  21. package/src/update-dependencies/schema.json +1 -1
  22. package/src/update-en-messages/index.d.ts +2 -0
  23. package/src/update-en-messages/index.js +75 -0
  24. package/src/update-en-messages/index.js.map +1 -0
  25. package/src/update-en-messages/index.ts +78 -0
  26. package/src/{update110100 → update-en-messages}/schema.json +3 -3
  27. package/src/updates/update130000/files/root/.browserslistrc +20 -0
  28. package/src/updates/update130000/index.d.ts +27 -0
  29. package/src/updates/update130000/index.js +306 -0
  30. package/src/updates/update130000/index.js.map +1 -0
  31. package/src/updates/update130000/index.ts +358 -0
  32. package/src/{migrate-to-eslint → updates/update130000}/index_spec.d.ts +0 -0
  33. package/src/updates/update130000/index_spec.js +582 -0
  34. package/src/updates/update130000/index_spec.js.map +1 -0
  35. package/src/updates/update130000/index_spec.ts +673 -0
  36. package/src/{update → updates/update130000}/schema.json +1 -1
  37. package/src/utility/dependencies.js +16 -14
  38. package/src/utility/dependencies.js.map +1 -1
  39. package/src/utility/dependencies.ts +6 -4
  40. package/src/utility/files.d.ts +5 -1
  41. package/src/utility/files.js +27 -16
  42. package/src/utility/files.js.map +1 -1
  43. package/src/utility/files.ts +16 -3
  44. package/src/utility/html.js +88 -25
  45. package/src/utility/html.js.map +1 -1
  46. package/src/utility/html.ts +105 -29
  47. package/src/{migrate-to-webcomponent/index_spec.d.ts → utility/html_spec.d.ts} +0 -0
  48. package/src/utility/html_spec.js +560 -0
  49. package/src/utility/html_spec.js.map +1 -0
  50. package/src/utility/html_spec.ts +575 -0
  51. package/src/utility/json.d.ts +46 -1
  52. package/src/utility/json.js +174 -4
  53. package/src/utility/json.js.map +1 -1
  54. package/src/utility/json.ts +198 -3
  55. package/src/{update/index_spec.d.ts → utility/json_spec.d.ts} +0 -0
  56. package/src/utility/json_spec.js +326 -0
  57. package/src/utility/json_spec.js.map +1 -0
  58. package/src/utility/json_spec.ts +376 -0
  59. package/src/utility/typescript.js +16 -16
  60. package/src/utility/typescript.js.map +1 -1
  61. package/src/utility/typescript_spec.js +36 -36
  62. package/src/utility/typescript_spec.js.map +1 -1
  63. package/src/utility/util.d.ts +2 -2
  64. package/src/utility/util.js +16 -14
  65. package/src/utility/util.js.map +1 -1
  66. package/src/utility/util.ts +7 -5
  67. package/src/utility/validation.js +11 -11
  68. package/src/utility/validation.js.map +1 -1
  69. package/src/migrate-to-eslint/files/.eslintrc.json +0 -68
  70. package/src/migrate-to-eslint/files/.prettierrc +0 -25
  71. package/src/migrate-to-eslint/index.d.ts +0 -6
  72. package/src/migrate-to-eslint/index.js +0 -149
  73. package/src/migrate-to-eslint/index.js.map +0 -1
  74. package/src/migrate-to-eslint/index.ts +0 -181
  75. package/src/migrate-to-eslint/index_spec.js +0 -129
  76. package/src/migrate-to-eslint/index_spec.js.map +0 -1
  77. package/src/migrate-to-eslint/index_spec.ts +0 -152
  78. package/src/migrate-to-eslint/schema.json +0 -23
  79. package/src/migrate-to-webcomponent/index.d.ts +0 -10
  80. package/src/migrate-to-webcomponent/index.js +0 -278
  81. package/src/migrate-to-webcomponent/index.js.map +0 -1
  82. package/src/migrate-to-webcomponent/index.ts +0 -331
  83. package/src/migrate-to-webcomponent/index_spec.js +0 -580
  84. package/src/migrate-to-webcomponent/index_spec.js.map +0 -1
  85. package/src/migrate-to-webcomponent/index_spec.ts +0 -703
  86. package/src/migrate-to-webcomponent/schema.json +0 -23
  87. package/src/update/files/locale/messages.en.xlf +0 -940
  88. package/src/update/files/locale/messages.xlf +0 -815
  89. package/src/update/files/scripts/move-de-files.js +0 -15
  90. package/src/update/index.d.ts +0 -23
  91. package/src/update/index.js +0 -635
  92. package/src/update/index.js.map +0 -1
  93. package/src/update/index.ts +0 -712
  94. package/src/update/index_spec.js +0 -984
  95. package/src/update/index_spec.js.map +0 -1
  96. package/src/update/index_spec.ts +0 -1139
  97. package/src/update110001/index.d.ts +0 -2
  98. package/src/update110001/index.js +0 -42
  99. package/src/update110001/index.js.map +0 -1
  100. package/src/update110001/index.ts +0 -40
  101. package/src/update110001/index_spec.d.ts +0 -1
  102. package/src/update110001/index_spec.js +0 -67
  103. package/src/update110001/index_spec.js.map +0 -1
  104. package/src/update110001/index_spec.ts +0 -72
  105. package/src/update110001/schema.json +0 -23
  106. package/src/update110100/index.d.ts +0 -2
  107. package/src/update110100/index.js +0 -27
  108. package/src/update110100/index.js.map +0 -1
  109. package/src/update110100/index.ts +0 -24
  110. package/src/update110100/index_spec.d.ts +0 -1
  111. package/src/update110100/index_spec.js +0 -69
  112. package/src/update110100/index_spec.js.map +0 -1
  113. package/src/update110100/index_spec.ts +0 -73
  114. package/src/update110101/index.d.ts +0 -2
  115. package/src/update110101/index.js +0 -24
  116. package/src/update110101/index.js.map +0 -1
  117. package/src/update110101/index.ts +0 -21
  118. package/src/update110101/index_spec.d.ts +0 -1
  119. package/src/update110101/index_spec.js +0 -65
  120. package/src/update110101/index_spec.js.map +0 -1
  121. package/src/update110101/index_spec.ts +0 -69
  122. package/src/update110101/schema.json +0 -23
  123. package/src/update110200/index.d.ts +0 -2
  124. package/src/update110200/index.js +0 -24
  125. package/src/update110200/index.js.map +0 -1
  126. package/src/update110200/index.ts +0 -21
  127. package/src/update110200/index_spec.d.ts +0 -1
  128. package/src/update110200/index_spec.js +0 -65
  129. package/src/update110200/index_spec.js.map +0 -1
  130. package/src/update110200/index_spec.ts +0 -69
  131. package/src/update110200/schema.json +0 -23
  132. package/src/update110300/index.d.ts +0 -2
  133. package/src/update110300/index.js +0 -133
  134. package/src/update110300/index.js.map +0 -1
  135. package/src/update110300/index.ts +0 -148
  136. package/src/update110300/index_spec.d.ts +0 -1
  137. package/src/update110300/index_spec.js +0 -121
  138. package/src/update110300/index_spec.js.map +0 -1
  139. package/src/update110300/index_spec.ts +0 -139
  140. package/src/update110300/schema.json +0 -23
  141. package/src/update110400/index.d.ts +0 -2
  142. package/src/update110400/index.js +0 -28
  143. package/src/update110400/index.js.map +0 -1
  144. package/src/update110400/index.ts +0 -28
  145. package/src/update110400/index_spec.d.ts +0 -1
  146. package/src/update110400/index_spec.js +0 -66
  147. package/src/update110400/index_spec.js.map +0 -1
  148. package/src/update110400/index_spec.ts +0 -70
  149. package/src/update110400/schema.json +0 -23
  150. package/src/update110500/index.d.ts +0 -2
  151. package/src/update110500/index.js +0 -28
  152. package/src/update110500/index.js.map +0 -1
  153. package/src/update110500/index.ts +0 -28
  154. package/src/update110500/index_spec.d.ts +0 -1
  155. package/src/update110500/index_spec.js +0 -66
  156. package/src/update110500/index_spec.js.map +0 -1
  157. package/src/update110500/index_spec.ts +0 -70
  158. package/src/update110500/schema.json +0 -23
  159. package/src/update110600/index.d.ts +0 -2
  160. package/src/update110600/index.js +0 -28
  161. package/src/update110600/index.js.map +0 -1
  162. package/src/update110600/index.ts +0 -28
  163. package/src/update110600/index_spec.d.ts +0 -1
  164. package/src/update110600/index_spec.js +0 -66
  165. package/src/update110600/index_spec.js.map +0 -1
  166. package/src/update110600/index_spec.ts +0 -70
  167. package/src/update110600/schema.json +0 -23
  168. package/src/update110700/index.d.ts +0 -2
  169. package/src/update110700/index.js +0 -45
  170. package/src/update110700/index.js.map +0 -1
  171. package/src/update110700/index.ts +0 -47
  172. package/src/update110700/index_spec.d.ts +0 -1
  173. package/src/update110700/index_spec.js +0 -108
  174. package/src/update110700/index_spec.js.map +0 -1
  175. package/src/update110700/index_spec.ts +0 -122
  176. package/src/update110700/schema.json +0 -23
  177. package/src/update110800/index.d.ts +0 -2
  178. package/src/update110800/index.js +0 -32
  179. package/src/update110800/index.js.map +0 -1
  180. package/src/update110800/index.ts +0 -33
  181. package/src/update110800/index_spec.d.ts +0 -1
  182. package/src/update110800/index_spec.js +0 -70
  183. package/src/update110800/index_spec.js.map +0 -1
  184. package/src/update110800/index_spec.ts +0 -75
  185. package/src/update110800/schema.json +0 -23
  186. package/src/update110900/index.d.ts +0 -4
  187. package/src/update110900/index.js +0 -111
  188. package/src/update110900/index.js.map +0 -1
  189. package/src/update110900/index.ts +0 -123
  190. package/src/update110900/index_spec.d.ts +0 -1
  191. package/src/update110900/index_spec.js +0 -311
  192. package/src/update110900/index_spec.js.map +0 -1
  193. package/src/update110900/index_spec.ts +0 -341
  194. package/src/update110900/schema.json +0 -23
  195. package/src/update111000/index.d.ts +0 -2
  196. package/src/update111000/index.js +0 -27
  197. package/src/update111000/index.js.map +0 -1
  198. package/src/update111000/index.ts +0 -27
  199. package/src/update111000/index_spec.d.ts +0 -1
  200. package/src/update111000/index_spec.js +0 -65
  201. package/src/update111000/index_spec.js.map +0 -1
  202. package/src/update111000/index_spec.ts +0 -70
  203. package/src/update111000/schema.json +0 -23
  204. package/src/update111100/index.d.ts +0 -2
  205. package/src/update111100/index.js +0 -389
  206. package/src/update111100/index.js.map +0 -1
  207. package/src/update111100/index.ts +0 -405
  208. package/src/update111100/index_spec.d.ts +0 -1
  209. package/src/update111100/index_spec.js +0 -66
  210. package/src/update111100/index_spec.js.map +0 -1
  211. package/src/update111100/index_spec.ts +0 -70
  212. package/src/update111100/schema.json +0 -23
  213. package/src/update111200/index.d.ts +0 -2
  214. package/src/update111200/index.js +0 -59
  215. package/src/update111200/index.js.map +0 -1
  216. package/src/update111200/index.ts +0 -75
  217. package/src/update111200/index_spec.d.ts +0 -1
  218. package/src/update111200/index_spec.js +0 -67
  219. package/src/update111200/index_spec.js.map +0 -1
  220. package/src/update111200/index_spec.ts +0 -71
  221. package/src/update111200/schema.json +0 -23
  222. package/src/update111300/index.d.ts +0 -2
  223. package/src/update111300/index.js +0 -27
  224. package/src/update111300/index.js.map +0 -1
  225. package/src/update111300/index.ts +0 -27
  226. package/src/update111300/index_spec.d.ts +0 -1
  227. package/src/update111300/index_spec.js +0 -65
  228. package/src/update111300/index_spec.js.map +0 -1
  229. package/src/update111300/index_spec.ts +0 -69
  230. package/src/update111300/schema.json +0 -23
  231. package/src/update111400/index.d.ts +0 -2
  232. package/src/update111400/index.js +0 -27
  233. package/src/update111400/index.js.map +0 -1
  234. package/src/update111400/index.ts +0 -27
  235. package/src/update111400/index_spec.d.ts +0 -1
  236. package/src/update111400/index_spec.js +0 -65
  237. package/src/update111400/index_spec.js.map +0 -1
  238. package/src/update111400/index_spec.ts +0 -69
  239. package/src/update111400/schema.json +0 -23
@@ -0,0 +1,358 @@
1
+ import { chain, Rule, SchematicContext, Tree } from '@angular-devkit/schematics';
2
+ import * as chalk from 'chalk';
3
+ import { applyEdits, findNodeAtLocation, modify } from 'jsonc-parser';
4
+ import { updateDependencies } from '../../update-dependencies/index';
5
+ import { deleteFile, iterateFilesAndModifyContent, moveFilesToDirectory } from '../../utility/files';
6
+ import { removeAttribute } from '../../utility/html';
7
+ import {
8
+ findObjectIndexInArray, findObjectPropertyInArray,
9
+ jsonFormattingOptions,
10
+ readJson,
11
+ readJsonAsString,
12
+ removeJsonNode,
13
+ updateJsonArray,
14
+ updateJsonValue
15
+ } from '../../utility/json';
16
+ import { logInfo, logInfoWithDescriptor, logSuccess } from '../../utility/logging';
17
+ import { applyRuleIf, finish, messageInfoRule, messageSuccessRule, replaceAll } from '../../utility/util';
18
+ import { validateLuxComponentsVersion, validateNodeVersion } from '../../utility/validation';
19
+
20
+ export const updateMajorVersion = '13';
21
+ export const updateMinVersion = '11.14.0';
22
+ export const updateNodeMinVersion = '16.0.0';
23
+
24
+ export function update(options: any): Rule {
25
+ return (tree: Tree, _context: SchematicContext) => {
26
+ return chain([
27
+ check(options),
28
+ applyRuleIf(updateMinVersion, updateProject(options)),
29
+ finish(
30
+ false,
31
+ `${ chalk.yellowBright(
32
+ 'Wichtig!!!'
33
+ ) } Hinweise im Update Guide beachten -> https://github.com/IHK-GfI/lux-components/wiki/update-guide-${ updateMajorVersion }`
34
+ )
35
+ ]);
36
+ };
37
+ }
38
+
39
+ export function updateProject(options: any): Rule {
40
+ return (tree: Tree, _context: SchematicContext) => {
41
+ return chain([
42
+ messageInfoRule(`LUX-Components ${ updateMajorVersion } werden aktualisiert...`),
43
+ updateAngularJson(options),
44
+ updatePackageJson(options),
45
+ updateTsConfigJson(options),
46
+ updateIndexHtml(options),
47
+ removeLuxSelectedFilesAlwaysUseArray(options),
48
+ fixEmptyStyles(options),
49
+ removeDatepickerDefaultLocale(options),
50
+ copyFiles(options),
51
+ fixKarmaConf(options),
52
+ deleteWebpackConfig(options),
53
+ updateDependencies(),
54
+ messageSuccessRule(`LUX-Components ${ updateMajorVersion } wurden aktualisiert.`)
55
+ ]);
56
+ };
57
+ }
58
+
59
+ export function check(options: any): Rule {
60
+ return (tree: Tree, _context: SchematicContext) => {
61
+ logInfoWithDescriptor(`Vorbedingungen werden geprüft...`);
62
+
63
+ validateNodeVersion(_context, updateNodeMinVersion);
64
+ validateLuxComponentsVersion(tree, `${ updateMinVersion } || ^${ updateMajorVersion }.0.0`);
65
+
66
+ logSuccess(`Vorbedingungen wurden geprüft.`);
67
+
68
+ return tree;
69
+ };
70
+ }
71
+
72
+ export function deleteWebpackConfig(options: any): Rule {
73
+ return chain([
74
+ messageInfoRule(`Datei 'webpack.config.js' wird gelöscht...`),
75
+ deleteFile(options, '/webpack.config.js'),
76
+ messageSuccessRule(`Datei 'webpack.config.js' wurde gelöscht.`),
77
+ messageInfoRule(`Verweis auf die 'webpack.config.js' wird aus der Datei 'angular.json' gelöscht...`),
78
+ (tree: Tree, _context: SchematicContext) => {
79
+ removeJsonNode(tree, '/angular.json', ['projects', options.project, 'architect', 'build', 'options', 'extraWebpackConfig']);
80
+ },
81
+ messageSuccessRule(`Verweis auf die 'webpack.config.js' wurde aus der Datei 'angular.json' gelöscht.`),
82
+ ]);
83
+ }
84
+
85
+ export function copyFiles(options: any): Rule {
86
+ return chain([
87
+ messageInfoRule(`Dateien werden kopiert...`),
88
+ moveFilesToDirectory(options, 'files/root', '/'),
89
+ messageSuccessRule(`Dateien wurden kopiert.`)
90
+ ]);
91
+ }
92
+
93
+ export function updateAngularJson(options: any): Rule {
94
+ return (tree: Tree, _context: SchematicContext) => {
95
+ const jsonPathAllowedCommonJS = ['projects', options.project, 'architect', 'build', 'options', 'allowedCommonJsDependencies'];
96
+ const jsonPathOptimization = ['projects', options.project, 'architect', 'build', 'configurations', 'production', 'optimization'];
97
+ const jsonValueOptimization = {
98
+ 'scripts': true,
99
+ 'styles' : {
100
+ 'minify' : true,
101
+ 'inlineCritical': false
102
+ },
103
+ 'fonts' : true
104
+ };
105
+
106
+ const jsonPathDevelopmentBuild = ['projects', options.project, 'architect', 'build', 'configurations', 'development'];
107
+ const jsonValueDevelopmentBuild = {
108
+ 'buildOptimizer' : false,
109
+ 'optimization' : false,
110
+ 'vendorChunk' : true,
111
+ 'extractLicenses': false,
112
+ 'sourceMap' : true,
113
+ 'namedChunks' : true
114
+ };
115
+ const jsonPathDevelopmentServe = ['projects', options.project, 'architect', 'serve', 'configurations', 'development'];
116
+ const jsonValueDevelopmentServe = {
117
+ 'browserTarget': options.project + ':build:development'
118
+ };
119
+ const jsonPathDevelopmentServeDefault = ['projects', options.project, 'architect', 'serve', 'defaultConfiguration'];
120
+
121
+ const findGlobFn = (node) => findObjectPropertyInArray(node, 'glob', 'material-design-icons.css');
122
+ const jsonPathGlob = ['projects', options.project, 'architect', 'build', 'options', 'assets'];
123
+ const jsonValueGlob = {
124
+ "glob": "material-design-icons.css*",
125
+ "input": "./node_modules/material-design-icons-iconfont/dist",
126
+ "output": "./assets/icons/material-icons"
127
+ };
128
+
129
+ return chain([
130
+ messageInfoRule(`Datei "angular.json" wird aktualisiert...`),
131
+ updateBuildThemeAssets(options),
132
+ updateTestThemeAssets(options),
133
+ removeThemeAssets(options),
134
+ updateJsonArray(options, '/angular.json', jsonPathGlob, jsonValueGlob, true, findGlobFn),
135
+ updateJsonValue(options, '/angular.json', jsonPathDevelopmentBuild, jsonValueDevelopmentBuild),
136
+ updateJsonValue(options, '/angular.json', jsonPathDevelopmentServe, jsonValueDevelopmentServe),
137
+ updateJsonValue(options, '/angular.json', jsonPathDevelopmentServeDefault, 'development'),
138
+ updateJsonArray(options, '/angular.json', jsonPathAllowedCommonJS, 'hammerjs'),
139
+ updateJsonArray(options, '/angular.json', jsonPathAllowedCommonJS, 'ng2-pdf-viewer'),
140
+ updateJsonArray(options, '/angular.json', jsonPathAllowedCommonJS, 'pdfjs-dist'),
141
+ updateJsonValue(options, '/angular.json', jsonPathOptimization, jsonValueOptimization),
142
+ messageSuccessRule(`Datei "angular.json" wurde aktualisiert.`)
143
+ ]);
144
+ };
145
+ }
146
+
147
+ export function updateTsConfigJson(options: any): Rule {
148
+ return (tree: Tree, _context: SchematicContext) => {
149
+ return chain([
150
+ messageInfoRule(`Datei "tsconfig.json" wird aktualisiert...`),
151
+ updateJsonValue(options, '/tsconfig.json', ['compilerOptions', 'allowSyntheticDefaultImports'], true),
152
+ messageSuccessRule(`Datei "tsconfig.json" wurde aktualisiert.`)
153
+ ]);
154
+ };
155
+ }
156
+
157
+ export function updateIndexHtml(options: any): Rule {
158
+ return (tree: Tree, _context: SchematicContext) => {
159
+ return chain([
160
+ messageInfoRule(`Datei "index.html" wird aktualisiert...`),
161
+ (tree: Tree, _context: SchematicContext) => {
162
+ const filePath = '/src/index.html';
163
+ const buffer = tree.read(filePath);
164
+ if (buffer) {
165
+ const content = buffer.toString();
166
+ let modifiedContent = content;
167
+ modifiedContent = replaceAll(modifiedContent, 'rel="stylesheet"', 'rel="stylesheet preload" as="style" type="text/css"');
168
+
169
+ if (content !== modifiedContent) {
170
+ logInfo(`Den Wert "preload" ergänzt.`);
171
+ tree.overwrite(filePath, modifiedContent);
172
+ }
173
+ }
174
+ },
175
+ messageSuccessRule(`Datei "index.html" wurde aktualisiert.`)
176
+ ]);
177
+ };
178
+ }
179
+
180
+ export function updatePackageJson(options: any): Rule {
181
+ return (tree: Tree, _context: SchematicContext) => {
182
+ return chain([
183
+ messageInfoRule(`Datei "package.json" wird aktualisiert...`),
184
+ (tree: Tree, _context: SchematicContext) => {
185
+ const filePath = '/package.json';
186
+ const content = readJsonAsString(tree, filePath);
187
+
188
+ let modifiedContent = content;
189
+ modifiedContent = modifiedContent.replace(' --ivy', '');
190
+ modifiedContent = modifiedContent.replace(' --plugin @ihk-gfi/lux-components/ie11-lazy-modules-plugin.js', '');
191
+ modifiedContent = modifiedContent.replace(' npm run lint --bailOnLintError true', ' npm run lint');
192
+
193
+ if (content !== modifiedContent) {
194
+ logInfo(`Das Flag "--ivy" wurde aus dem Script "xi18n" entfernt.`);
195
+ tree.overwrite(filePath, modifiedContent);
196
+ }
197
+ },
198
+ (tree: Tree, _context: SchematicContext) => {
199
+ removeJsonNode(tree, '/package.json', ['scripts', 'start-ie']);
200
+ },
201
+ messageSuccessRule(`Datei "package.json" wurde aktualisiert.`)
202
+ ]);
203
+ };
204
+ }
205
+
206
+ export function updateBuildThemeAssets(options: any): Rule {
207
+ return (tree: Tree, context: SchematicContext) => {
208
+ updateThemeAssetsIntern(tree, ['projects', options.project, 'architect', 'build', 'options', 'assets'], 'build');
209
+ };
210
+ }
211
+
212
+ export function updateTestThemeAssets(options: any): Rule {
213
+ return (tree: Tree, context: SchematicContext) => {
214
+ updateThemeAssetsIntern(tree, ['projects', options.project, 'architect', 'test', 'options', 'assets'], 'test');
215
+ };
216
+ }
217
+
218
+ function updateThemeAssetsIntern(tree: Tree, jsonPath: string[], label: string) {
219
+ const filePath = '/angular.json';
220
+ const contentAsNode = readJson(tree, filePath);
221
+ const buildAssetsNode = findNodeAtLocation(contentAsNode, jsonPath);
222
+ if (buildAssetsNode) {
223
+ const arrayIndex = findObjectIndexInArray(buildAssetsNode, 'glob', '*.css');
224
+ if (arrayIndex >= 0) {
225
+ const angularJson = readJsonAsString(tree, filePath);
226
+ const edits = modify(
227
+ angularJson,
228
+ [...jsonPath, arrayIndex],
229
+ {
230
+ glob : '*(*min.css|*min.css.map)',
231
+ input : './node_modules/@ihk-gfi/lux-components-theme/prebuilt-themes',
232
+ output: './assets/themes'
233
+ },
234
+ { formattingOptions: jsonFormattingOptions, isArrayInsertion: false }
235
+ );
236
+ if (edits) {
237
+ tree.overwrite(filePath, applyEdits(angularJson, edits));
238
+ logInfo(`Den Abschnitt "${ JSON.stringify(jsonPath) }" aktualisiert.`);
239
+ }
240
+ }
241
+ }
242
+ }
243
+
244
+ export function removeThemeAssets(options: any): Rule {
245
+ return (tree: Tree, context: SchematicContext) => {
246
+ const filePath = '/angular.json';
247
+ const jsonPath = ['projects', options.project, 'architect', 'build', 'configurations', 'es5'];
248
+
249
+ removeJsonNode(tree, filePath, jsonPath);
250
+ };
251
+ }
252
+
253
+ export function removeLuxSelectedFilesAlwaysUseArray(options: any): Rule {
254
+ return chain([
255
+ messageInfoRule(`Das Attribut "luxSelectedFilesAlwaysUseArray" wird entfernt...`),
256
+ (tree: Tree, context: SchematicContext) => {
257
+ iterateFilesAndModifyContent(
258
+ tree,
259
+ options.path,
260
+ (filePath: string, content: string) => {
261
+ let result = removeAttribute(content, 'lux-file-list', 'luxSelectedFilesAlwaysUseArray');
262
+
263
+ if (content !== result.content) {
264
+ logInfo(filePath + ' wurde angepasst.');
265
+ tree.overwrite(filePath, result.content);
266
+ }
267
+ },
268
+ '.component.html'
269
+ );
270
+ },
271
+ messageSuccessRule(`Das Attribut "luxSelectedFilesAlwaysUseArray" wird entfernt.`)
272
+ ]);
273
+ }
274
+
275
+ /**
276
+ * Wenn eine Komponente einen leeren Style im styles-Array (styles: ['']) angegeben hat, führt dies zu dem folgenden Fehler:
277
+ * Error: PostCSS received undefined instead of CSS string
278
+ * Diese Methode repariert diesen Fehler, in dem der Leerstring entfernt wird.
279
+ *
280
+ * @param options
281
+ */
282
+ export function fixEmptyStyles(options: any): Rule {
283
+ return chain([
284
+ messageInfoRule(`Die leeren Styles im @Component-Teil (styles: [''] => styles: []) werden korrigiert...`),
285
+ (tree: Tree, context: SchematicContext) => {
286
+ iterateFilesAndModifyContent(
287
+ tree,
288
+ options.path,
289
+ (filePath: string, content: string) => {
290
+ const modifiedContent = content.replace(/styles\s?:\s*\[('{2}|"{2})\]/g, 'styles: []');
291
+
292
+ if (modifiedContent !== content) {
293
+ logInfo(filePath + ' wurde angepasst.');
294
+ tree.overwrite(filePath, modifiedContent);
295
+ }
296
+ },
297
+ '.component.ts'
298
+ );
299
+ },
300
+ messageSuccessRule(`Die leeren Styles wurden korrigiert.`)
301
+ ]);
302
+ }
303
+
304
+ export function removeDatepickerDefaultLocale(options: any): Rule {
305
+ return chain([
306
+ messageInfoRule(`Die explizit gesetzte Defaultlocale "de-DE" wird bei allen Datepickern entfernt...`),
307
+ (tree: Tree, context: SchematicContext) => {
308
+ iterateFilesAndModifyContent(
309
+ tree,
310
+ options.path,
311
+ (filePath: string, content: string) => {
312
+ const modifiedContent = content.replace(/\sluxLocale="de-DE"/g, '');
313
+
314
+ if (modifiedContent !== content) {
315
+ logInfo(filePath + ' wurde angepasst.');
316
+ tree.overwrite(filePath, modifiedContent);
317
+ }
318
+ },
319
+ '.component.html'
320
+ );
321
+ },
322
+ messageSuccessRule(`Die explizit gesetzte Defaultlocale "de-DE" wurde bei allen Datepickern entfernt.`)
323
+ ]);
324
+ }
325
+
326
+ export function fixKarmaConf(options: any): Rule {
327
+ return chain([
328
+ messageInfoRule(`Datei "karma.conf.js" wird aktualisiert...`),
329
+ (tree: Tree, context: SchematicContext) => {
330
+ iterateFilesAndModifyContent(
331
+ tree,
332
+ options.path,
333
+ (filePath: string, content: string) => {
334
+ let modifiedContent = content.replace(/require\('karma-coverage-istanbul-reporter'\),/g, 'require(\'karma-coverage\'),');
335
+ modifiedContent = modifiedContent.replace(/coverageIstanbulReporter\:.*\{(.|\n)*\},/gim, karmaCoverageReporter)
336
+ modifiedContent = modifiedContent.replace(/reporters\:(.*)],/gim, karmaReporters)
337
+
338
+ if (modifiedContent !== content) {
339
+ logInfo(filePath + ' wurde angepasst.');
340
+ tree.overwrite(filePath, modifiedContent);
341
+ }
342
+ },
343
+ 'karma.conf.js'
344
+ );
345
+ },
346
+ messageSuccessRule(`Datei "karma.conf.js" wurde aktualisiert.`)
347
+ ]);
348
+ }
349
+
350
+ const karmaCoverageReporter = `coverageReporter: {
351
+ dir: require('path').join(__dirname, 'coverage'),
352
+ reporters: [
353
+ {type: 'html', subdir: '.'},
354
+ {type: 'lcovonly', subdir: '.'}
355
+ ]
356
+ },`;
357
+
358
+ const karmaReporters = `reporters: ['progress', 'coverage'],`;