@ihk-gfi/lux-components-update 11.13.0 → 13.0.1

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 (230) 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 -78
  10. package/src/add-lux-components/index.js.map +1 -1
  11. package/src/add-lux-components/index.ts +141 -66
  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 -88
  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 +296 -0
  30. package/src/updates/update130000/index.js.map +1 -0
  31. package/src/updates/update130000/index.ts +346 -0
  32. package/src/{migrate-to-eslint → updates/update130000}/index_spec.d.ts +0 -0
  33. package/src/updates/update130000/index_spec.js +574 -0
  34. package/src/updates/update130000/index_spec.js.map +1 -0
  35. package/src/updates/update130000/index_spec.ts +665 -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
@@ -1,1139 +0,0 @@
1
- import { callRule, SchematicContext } from '@angular-devkit/schematics';
2
- import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing';
3
- import * as path from 'path';
4
- import { of as observableOf } from 'rxjs';
5
- import { getPackageJsonDependency, NodeDependencyType, updatePackageJsonDependency } from '../utility/dependencies';
6
- import { appOptions, workspaceOptions } from '../utility/test';
7
- import { UtilConfig } from '../utility/util';
8
- import {
9
- addNg2PdfViewer,
10
- addThemeAssets,
11
- clearStylesScss,
12
- deleteOldThemeDir,
13
- i18nCopyMessages,
14
- i18nUpdateAngularJson,
15
- i18nUpdateAppModule,
16
- i18nUpdatePackageJson,
17
- removeThemeAssets,
18
- update,
19
- updateAppComponent,
20
- updateAppModule,
21
- updateBrowserList,
22
- updateMajorVersion,
23
- updateTsConfigJson
24
- } from './index';
25
-
26
- const collectionPath = path.join(__dirname, '../collection.json');
27
-
28
- describe('update', () => {
29
- let appTree: UnitTestTree;
30
- let runner: SchematicTestRunner;
31
- let context: SchematicContext;
32
-
33
- const testOptions: any = {};
34
-
35
- beforeEach(async () => {
36
- runner = new SchematicTestRunner('schematics', collectionPath);
37
-
38
- appTree = await runner.runExternalSchematicAsync('@schematics/angular', 'workspace', workspaceOptions).toPromise();
39
- appTree = await runner
40
- .runExternalSchematicAsync('@schematics/angular', 'application', appOptions, appTree)
41
- .toPromise();
42
-
43
- UtilConfig.defaultWaitMS = 0;
44
-
45
- const collection = runner.engine.createCollection(collectionPath);
46
- const schematic = runner.engine.createSchematic('update', collection);
47
- context = runner.engine.createContext(schematic);
48
-
49
- testOptions.project = appOptions.name;
50
- testOptions.path = workspaceOptions.newProjectRoot + '/' + appOptions.name;
51
- testOptions.verbose = true;
52
- });
53
-
54
- describe('[Rule] addNg2PdfViewer', () => {
55
- it('Sollte Ng2PdfViewer hinzufügen', (done) => {
56
- appTree.overwrite(
57
- '/angular.json',
58
- `
59
- {
60
- "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
61
- "version": 1,
62
- "newProjectRoot": "projects",
63
- "projects": {
64
- "bar": {
65
- "root": "",
66
- "sourceRoot": "src",
67
- "projectType": "application",
68
- "i18n": {
69
- "sourceLocale": {
70
- "code": "de",
71
- "baseHref": "/"
72
- },
73
- "locales": {
74
- "en": "src/locale/messages.en.xlf"
75
- }
76
- },
77
- "architect": {
78
- "build": {
79
- "builder": "ngx-build-plus:browser",
80
- "options": {
81
- "outputPath": "dist",
82
- "allowedCommonJsDependencies": [
83
- "hammerjs"
84
- ]
85
- }
86
- }
87
- }
88
- },
89
- },
90
- "defaultProject": "lux-components",
91
- "schematics": {
92
- "@schematics/angular:component": {
93
- "prefix": "lux",
94
- "style": "scss"
95
- },
96
- "@schematics/angular:directive": {
97
- "prefix": "lux"
98
- }
99
- }
100
- }
101
-
102
- `
103
- );
104
-
105
- callRule(addNg2PdfViewer(testOptions), observableOf(appTree), context).subscribe(
106
- (success) => {
107
- const content = success.read('/angular.json')?.toString();
108
-
109
- expect(content).toContain(
110
- '"allowedCommonJsDependencies": [\n "ng2-pdf-viewer",\n "hammerjs"\n ]'
111
- );
112
-
113
- done();
114
- },
115
- (reason) => expect(reason).toBeUndefined()
116
- );
117
- });
118
-
119
- it('Sollte Ng2PdfViewer nicht hinzufügen', (done) => {
120
- appTree.overwrite(
121
- '/angular.json',
122
- `
123
- {
124
- "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
125
- "version": 1,
126
- "newProjectRoot": "projects",
127
- "projects": {
128
- "bar": {
129
- "root": "",
130
- "sourceRoot": "src",
131
- "projectType": "application",
132
- "i18n": {
133
- "sourceLocale": {
134
- "code": "de",
135
- "baseHref": "/"
136
- },
137
- "locales": {
138
- "en": "src/locale/messages.en.xlf"
139
- }
140
- },
141
- "architect": {
142
- "build": {
143
- "builder": "ngx-build-plus:browser",
144
- "options": {
145
- "outputPath": "dist",
146
- "allowedCommonJsDependencies": [
147
- "hammerjs",
148
- "ng2-pdf-viewer"
149
- ]
150
- }
151
- }
152
- }
153
- },
154
- },
155
- "defaultProject": "lux-components",
156
- "schematics": {
157
- "@schematics/angular:component": {
158
- "prefix": "lux",
159
- "style": "scss"
160
- },
161
- "@schematics/angular:directive": {
162
- "prefix": "lux"
163
- }
164
- }
165
- }
166
-
167
- `
168
- );
169
-
170
- callRule(addNg2PdfViewer(testOptions), observableOf(appTree), context).subscribe(
171
- (success) => {
172
- const content = success.read('/angular.json')?.toString();
173
-
174
- expect(content).toContain(
175
- '"allowedCommonJsDependencies": [\n "hammerjs",\n "ng2-pdf-viewer"\n ]'
176
- );
177
-
178
- done();
179
- },
180
- (reason) => expect(reason).toBeUndefined()
181
- );
182
- });
183
- });
184
-
185
- describe('[Rule] update', () => {
186
- it('Sollte einen Fehler werfen, wenn Version < n - 1', () => {
187
- updatePackageJsonDependency(
188
- appTree,
189
- { type: NodeDependencyType.Default, version: '1.9.3', name: '@ihk-gfi/lux-components' }
190
- );
191
- Object.defineProperty(process.versions, 'node', {
192
- get: () => '12.16.3'
193
- });
194
-
195
- callRule(update(testOptions), observableOf(appTree), context).subscribe(
196
- (success) => {},
197
- (reason) => expect(reason.toString()).toContain('wird nicht unterstützt.')
198
- );
199
- });
200
-
201
- it('Sollte LUX-Components 10 einrichten', (done) => {
202
- appTree.overwrite(
203
- '/package.json',
204
- `
205
- {
206
- "name": "Lorem ipsum",
207
- "version": "0.0.32",
208
- "scripts": {
209
- "build": "tsc -p tsconfig.json",
210
- "test": "npm run build && jasmine src/**/*_spec.js"
211
- },
212
- "keywords": [
213
- "schematics",
214
- "lux-components"
215
- ],
216
- "dependencies": {
217
- "@ihk-gfi/lux-components": "10.8.2"
218
- }
219
- }
220
- `
221
- );
222
-
223
- callRule(update(testOptions), observableOf(appTree), context).subscribe(
224
- () => {
225
- expect(getPackageJsonDependency(appTree, '@ihk-gfi/lux-components').version).toEqual('' + updateMajorVersion + '.0.0');
226
- done();
227
- },
228
- (reason) => expect(reason).toBeUndefined()
229
- );
230
- });
231
- });
232
-
233
- describe('[Rule] updateBrowserList', () => {
234
- it('Sollte die alten IE-Versionen (9 und 10) entfernt haben', (done) => {
235
- appTree.create(
236
- '/.browserslistrc',
237
- `
238
- # This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
239
- # For additional information regarding the format and rule options, please see:
240
- # https://github.com/browserslist/browserslist#queries
241
-
242
- # You can see what browsers were selected by your queries by running:
243
- # npx browserslist
244
-
245
- > 0.5%
246
- last 2 versions
247
- Firefox ESR
248
- not dead
249
- IE 9-11 # For IE 9-11 support, remove 'not'.
250
-
251
- `
252
- );
253
-
254
- callRule(updateBrowserList(testOptions), observableOf(appTree), context).subscribe(
255
- (success) => {
256
- const browserListContent = success.read('/.browserslistrc');
257
- expect(browserListContent).toBeDefined();
258
- const content = browserListContent?.toString();
259
- expect(content).toContain('not IE 9-10');
260
- expect(content).toContain('IE 11');
261
- done();
262
- },
263
- (reason) => expect(reason).toBeNull()
264
- );
265
- });
266
- });
267
-
268
- describe('[Rule] deleteOldThemeDir', () => {
269
- it('Sollte das alte Theming-Verzeichnis löschen.', (done) => {
270
- const oldThemePath = testOptions.path + '/src/theming/';
271
- appTree.create(oldThemePath + '_luxcommon.scss', `---`);
272
- appTree.create(oldThemePath + '_luxfocus.scss', `---`);
273
- appTree.create(oldThemePath + '_luxpalette.scss', `---`);
274
- appTree.create(oldThemePath + '_luxstyles.scss', `---`);
275
- appTree.create(oldThemePath + 'luxtheme.scss', `---`);
276
- expect(appTree.exists(oldThemePath + '_luxcommon.scss')).toBeTrue();
277
- expect(appTree.exists(oldThemePath + '_luxfocus.scss')).toBeTrue();
278
- expect(appTree.exists(oldThemePath + '_luxpalette.scss')).toBeTrue();
279
- expect(appTree.exists(oldThemePath + '_luxstyles.scss')).toBeTrue();
280
- expect(appTree.exists(oldThemePath + 'luxtheme.scss')).toBeTrue();
281
-
282
- callRule(deleteOldThemeDir(testOptions), observableOf(appTree), context).subscribe(
283
- (success) => {
284
- expect(appTree.exists(oldThemePath + '_luxcommon.scss')).toBeFalse();
285
- expect(appTree.exists(oldThemePath + '_luxfocus.scss')).toBeFalse();
286
- expect(appTree.exists(oldThemePath + '_luxpalette.scss')).toBeFalse();
287
- expect(appTree.exists(oldThemePath + '_luxstyles.scss')).toBeFalse();
288
- expect(appTree.exists(oldThemePath + 'luxtheme.scss')).toBeFalse();
289
- done();
290
- },
291
- (reason) => expect(reason).toBeNull()
292
- );
293
- });
294
- });
295
-
296
- describe('[Rule] clearStylesScss', () => {
297
- it('Sollte die alten Styles aus der styles.scss entfernen.', (done) => {
298
- appTree.overwrite(
299
- testOptions.path + '/src/styles.scss',
300
- `
301
- /* You can add global styles to this file, and also import other style files */
302
- /* Themenamen: deeppurple-amber.css, indigo-pink.css, pink-bluegrey.css und purple-green.css */
303
- $fa-font-path: '~@fortawesome/fontawesome-free/webfonts';
304
- @import '~@fortawesome/fontawesome-free/scss/fontawesome';
305
- @import '~@fortawesome/fontawesome-free/scss/regular';
306
- @import '~@fortawesome/fontawesome-free/scss/solid';
307
- @import '~@fortawesome/fontawesome-free/scss/brands';
308
- @import '~material-design-icons-iconfont/dist/material-design-icons.css';
309
- @import '../node_modules/@angular/material/theming';
310
- @import './theming/luxtheme';
311
-
312
- @include mat-core();
313
-
314
- @include angular-material-theme($lux-theme);
315
-
316
- `
317
- );
318
-
319
- callRule(clearStylesScss(testOptions), observableOf(appTree), context).subscribe(
320
- (success) => {
321
- const content = success.read(testOptions.path + '/src/styles.scss')?.toString();
322
- expect(content).not.toContain('$fa-font-path: \'~@fortawesome/fontawesome-free/webfonts\';');
323
- expect(content).not.toContain('@import \'~@fortawesome/fontawesome-free/scss/fontawesome\';');
324
- expect(content).not.toContain('@import \'~@fortawesome/fontawesome-free/scss/regular\';');
325
- expect(content).not.toContain('@import \'~@fortawesome/fontawesome-free/scss/solid\';');
326
- expect(content).not.toContain('@import \'~@fortawesome/fontawesome-free/scss/brands\';');
327
- expect(content).not.toContain('@import \'~material-design-icons-iconfont/dist/material-design-icons.css\';');
328
- expect(content).not.toContain('@import \'../node_modules/@angular/material/theming\';');
329
- expect(content).not.toContain('@import \'./theming/luxtheme\';');
330
- expect(content).not.toContain('@include mat-core();');
331
- expect(content).not.toContain('@include angular-material-theme($lux-theme);');
332
- done();
333
- },
334
- (reason) => expect(reason).toBeNull()
335
- );
336
- });
337
- });
338
-
339
- describe('[Rule] addThemeAssets', () => {
340
- it('Sollte das Theme in das Assets-Array eintragen', (done) => {
341
- appTree.overwrite(
342
- '/angular.json',
343
- `
344
- {
345
- "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
346
- "version": 1,
347
- "newProjectRoot": "projects",
348
- "projects": {
349
- "bar": {
350
- "projectType": "application",
351
- "schematics": {
352
- "@schematics/angular:component": {
353
- "style": "scss"
354
- }
355
- },
356
- "root": "projects/bar",
357
- "sourceRoot": "projects/bar/src",
358
- "prefix": "app",
359
- "architect": {
360
- "build": {
361
- "builder": "@angular-devkit/build-angular:browser",
362
- "options": {
363
- "assets": [
364
- "projects/bar/src/favicon.ico",
365
- "projects/bar/src/assets"
366
- ],
367
- "styles": [
368
- "projects/bar/src/styles.scss"
369
- ],
370
- "scripts": []
371
- }
372
- },
373
- "test": {
374
- "builder": "@angular-devkit/build-angular:karma",
375
- "options": {
376
- "main": "projects/bar/src/test.ts",
377
- "polyfills": "projects/bar/src/polyfills.ts",
378
- "tsConfig": "projects/bar/tsconfig.spec.json",
379
- "karmaConfig": "projects/bar/karma.conf.js",
380
- "assets": [
381
- "projects/bar/src/favicon.ico",
382
- "projects/bar/src/assets"
383
- ],
384
- "styles": [
385
- "projects/bar/src/styles.scss"
386
- ],
387
- "scripts": []
388
- }
389
- }
390
- }
391
- }
392
- },
393
- "defaultProject": "bar"
394
- }
395
- `
396
- );
397
-
398
- callRule(addThemeAssets(testOptions), observableOf(appTree), context).subscribe(
399
- (success) => {
400
- const content = success.read('/angular.json')?.toString();
401
- expect(content).toContain(`
402
- "options": {
403
- "assets": [
404
- {
405
- "glob": "*.css",
406
- "input": "./node_modules/@ihk-gfi/lux-components-theme/prebuilt-themes",
407
- "output": "./assets/themes"
408
- },
409
- "projects/bar/src/favicon.ico",
410
- "projects/bar/src/assets"
411
- ],
412
- `);
413
-
414
- expect(content).toContain(`
415
- "karmaConfig": "projects/bar/karma.conf.js",
416
- "assets": [
417
- {
418
- "glob": "*.css",
419
- "input": "./node_modules/@ihk-gfi/lux-components-theme/prebuilt-themes",
420
- "output": "./assets/themes"
421
- },
422
- "projects/bar/src/favicon.ico",
423
- "projects/bar/src/assets"
424
- ],
425
- `);
426
- done();
427
- },
428
- (reason) => expect(reason).toBeUndefined()
429
- );
430
- });
431
- });
432
-
433
- describe('[Rule] removeThemeAssets', () => {
434
- it('Sollte das Theme aus dem Assets-Array austragen', (done) => {
435
- appTree.overwrite(
436
- '/angular.json',
437
- `
438
- {
439
- "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
440
- "version": 1,
441
- "newProjectRoot": "projects",
442
- "projects": {
443
- "bar": {
444
- "projectType": "application",
445
- "schematics": {
446
- "@schematics/angular:component": {
447
- "style": "scss"
448
- }
449
- },
450
- "root": "projects/bar",
451
- "sourceRoot": "projects/bar/src",
452
- "prefix": "app",
453
- "architect": {
454
- "build": {
455
- "builder": "@angular-devkit/build-angular:browser",
456
- "options": {
457
- "styles": [
458
- "projects/bar/src/styles.scss",
459
- "src/theming/luxtheme.scss"
460
- ],
461
- "scripts": []
462
- }
463
- },
464
- "test": {
465
- "builder": "@angular-devkit/build-angular:karma",
466
- "options": {
467
- "main": "projects/bar/src/test.ts",
468
- "polyfills": "projects/bar/src/polyfills.ts",
469
- "tsConfig": "projects/bar/tsconfig.spec.json",
470
- "karmaConfig": "projects/bar/karma.conf.js",
471
- "styles": [
472
- "src/theming/luxtheme.scss",
473
- "projects/bar/src/styles.scss"
474
- ],
475
- "scripts": []
476
- }
477
- }
478
- }
479
- }
480
- },
481
- "defaultProject": "bar"
482
- }
483
- `
484
- );
485
-
486
- callRule(removeThemeAssets(testOptions), observableOf(appTree), context).subscribe(
487
- (success) => {
488
- const content = success.read('/angular.json')?.toString();
489
- expect(content).toContain(`
490
- "options": {
491
- "styles": [
492
- "projects/bar/src/styles.scss"
493
- ],
494
- `);
495
-
496
- expect(content).toContain(`
497
- "karmaConfig": "projects/bar/karma.conf.js",
498
- "styles": [
499
- "projects/bar/src/styles.scss"
500
- ],
501
- `);
502
- done();
503
- },
504
- (reason) => expect(reason).toBeUndefined()
505
- );
506
- });
507
- });
508
-
509
- describe('[Rule] updateAppComponent', () => {
510
- it('Sollte die app.component.ts (mit Constructor) anpassen', (done) => {
511
- appTree.overwrite(
512
- testOptions.path + '/src/app/app.component.ts',
513
- `
514
- import { Component, OnInit } from '@angular/core';
515
- import { Router } from '@angular/router';
516
-
517
- @Component({
518
- selector: 'app-root',
519
- templateUrl: './app.component.html',
520
- styleUrls: ['./app.component.scss']
521
- })
522
- export class AppComponent implements OnInit {
523
- constructor(public router: Router) {}
524
-
525
- ngOnInit(): void {}
526
- }
527
- `
528
- );
529
-
530
- callRule(updateAppComponent(testOptions), observableOf(appTree), context).subscribe(
531
- (success) => {
532
- const content = success.read(testOptions.path + '/src/app/app.component.ts')?.toString();
533
- expect(content).toContain('import { LuxThemeService } from \'@ihk-gfi/lux-components\';');
534
- expect(content).toContain('constructor(public router: Router, private themeService: LuxThemeService)');
535
- expect(content).toContain('themeService.loadTheme();');
536
- done();
537
- },
538
- (reason) => expect(reason).toBeUndefined()
539
- );
540
- });
541
-
542
- it('Sollte die app.component.ts (leerer Constructor) anpassen', (done) => {
543
- appTree.overwrite(
544
- testOptions.path + '/src/app/app.component.ts',
545
- `
546
- import { Component, OnInit } from '@angular/core';
547
- import { Router } from '@angular/router';
548
-
549
- @Component({
550
- selector: 'app-root',
551
- templateUrl: './app.component.html',
552
- styleUrls: ['./app.component.scss']
553
- })
554
- export class AppComponent implements OnInit {
555
- constructor() {
556
- console.log('Test');
557
- }
558
-
559
- ngOnInit(): void {}
560
- }
561
- `
562
- );
563
-
564
- callRule(updateAppComponent(testOptions), observableOf(appTree), context).subscribe(
565
- (success) => {
566
- const content = success.read(testOptions.path + '/src/app/app.component.ts')?.toString();
567
- expect(content).toContain('import { LuxThemeService } from \'@ihk-gfi/lux-components\';');
568
- expect(content).toContain('constructor(private themeService: LuxThemeService)');
569
- expect(content).toContain('themeService.loadTheme();');
570
- done();
571
- },
572
- (reason) => expect(reason).toBeUndefined()
573
- );
574
- });
575
-
576
- it('Sollte die app.component.ts (ohne Constructor) anpassen', (done) => {
577
- appTree.overwrite(
578
- testOptions.path + '/src/app/app.component.ts',
579
- `
580
- import { Component, OnInit } from '@angular/core';
581
- import { Router } from '@angular/router';
582
-
583
- @Component({
584
- selector: 'app-root',
585
- templateUrl: './app.component.html',
586
- styleUrls: ['./app.component.scss']
587
- })
588
- export class AppComponent implements OnInit {
589
-
590
- ngOnInit(): void {}
591
- }
592
- `
593
- );
594
-
595
- callRule(updateAppComponent(testOptions), observableOf(appTree), context).subscribe(
596
- (success) => {
597
- const content = success.read(testOptions.path + '/src/app/app.component.ts')?.toString();
598
- expect(content).toContain('import { LuxThemeService } from \'@ihk-gfi/lux-components\';');
599
- expect(content).toContain('constructor(private themeService: LuxThemeService)');
600
- expect(content).toContain('themeService.loadTheme();');
601
- done();
602
- },
603
- (reason) => expect(reason).toBeUndefined()
604
- );
605
- });
606
- });
607
-
608
- describe('[Rule] updateAppModule', () => {
609
- it('Sollte die Root-Services aus den Providern entfernen', (done) => {
610
- appTree.overwrite(
611
- testOptions.path + '/src/app/app.module.ts',
612
- `
613
- import { BrowserModule } from '@angular/platform-browser';
614
- import { FlexLayoutModule } from '@angular/flex-layout';
615
- import {
616
- LuxActionModule,
617
- LuxAppFooterButtonService,
618
- LuxAppFooterLinkService,
619
- LuxCommonModule,
620
- LuxComponentsConfigModule,
621
- LuxComponentsConfigParameters,
622
- LuxConsoleService,
623
- LuxDirectivesModule,
624
- LuxErrorModule,
625
- LuxErrorService,
626
- LuxFormModule,
627
- LuxIconModule,
628
- LuxLayoutModule,
629
- LuxMasterDetailMobileHelperService,
630
- LuxPipesModule,
631
- LuxPopupsModule,
632
- LuxSnackbarService,
633
- LuxStepperHelperService
634
- } from '@ihk-gfi/lux-components';
635
- import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
636
-
637
- const luxComponentsConfig: LuxComponentsConfigParameters = {
638
- generateLuxTagIds: true,
639
- labelConfiguration: {
640
- allUppercase: true,
641
- notAppliedTo: ['lux-side-nav-item', 'lux-menu-item', 'lux-link']
642
- },
643
- lookupServiceUrl: '/lookup/'
644
- };
645
-
646
- @NgModule({
647
- declarations: [AppComponent, HomeComponent, ErrorComponent, ProfilComponent],
648
- imports: [
649
- BrowserModule,
650
- BrowserAnimationsModule,
651
- AppRoutingModule,
652
- LuxDirectivesModule,
653
- LuxIconModule,
654
- LuxLayoutModule,
655
- LuxActionModule,
656
- LuxFormModule,
657
- LuxCommonModule,
658
- LuxPipesModule,
659
- LuxPopupsModule,
660
- LuxErrorModule,
661
- FlexLayoutModule,
662
- LuxComponentsConfigModule.forRoot(luxComponentsConfig)
663
- ],
664
- providers: [
665
- LuxAppFooterButtonService,
666
- LuxAppFooterLinkService,
667
- LuxSnackbarService,
668
- LuxErrorService,
669
- LuxMasterDetailMobileHelperService,
670
- LuxStepperHelperService,
671
- LuxConsoleService
672
- ],
673
- bootstrap: [AppComponent]
674
- })
675
- export class AppModule {}
676
- `
677
- );
678
-
679
- callRule(updateAppModule(testOptions), observableOf(appTree), context).subscribe(
680
- (success) => {
681
- const content = success.read(testOptions.path + '/src/app/app.module.ts')?.toString();
682
-
683
- expect(content).not.toContain('LuxAppFooterButtonService,');
684
- expect(content).not.toContain('LuxAppFooterLinkService,');
685
- expect(content).not.toContain('LuxSnackbarService,');
686
- expect(content).not.toContain('LuxErrorService,');
687
- expect(content).not.toContain('LuxMasterDetailMobileHelperService,');
688
- expect(content).not.toContain('LuxStepperHelperService,');
689
- expect(content).not.toContain('LuxConsoleService,');
690
- expect(content).toContain('LuxIconModule,');
691
-
692
- expect(content).toContain('LuxCommonModule,');
693
-
694
- expect(content).not.toContain('displayBindingDebugHint');
695
- expect(content).toContain(`
696
- const luxComponentsConfig: LuxComponentsConfigParameters = {
697
- generateLuxTagIds: environment.generateLuxTagIds
698
- };`);
699
- done();
700
- },
701
- (reason) => expect(reason).toBeUndefined()
702
- );
703
- });
704
- });
705
-
706
- describe('[Rule] i18nUpdateAppModule', () => {
707
- it('Sollte die Datei "app.module.ts" (i18n) angepasst haben', (done) => {
708
- appTree.overwrite(
709
- testOptions.path + '/src/app/app.module.ts',
710
- `
711
- import '@angular/common/locales/global/de';
712
- import { Configuration, ConfigurationParameters } from './../../src-gen/bsclient/configuration';
713
- import { SDApiModule } from '@ihk-gfi/lux-stammdaten';
714
- import { BSApiModule } from './../../src-gen/bsclient/api.module';
715
- import {registerLocaleData, DatePipe} from '@angular/common';
716
- import {HTTP_INTERCEPTORS, HttpClientModule} from '@angular/common/http';
717
- import {LOCALE_ID, NgModule, ErrorHandler} from '@angular/core';
718
- import {FlexLayoutModule} from '@angular/flex-layout';
719
- import {FormsModule, ReactiveFormsModule} from '@angular/forms';
720
- import {BrowserModule} from '@angular/platform-browser';
721
-
722
- import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
723
- import {
724
- LuxFilePreviewModule,
725
- LuxFilePreviewComponent
726
- } from '@ihk-gfi/lux-components';
727
-
728
- import { TimeoutComponent } from './components/basic/timeout/timeout.component';
729
- import {UnauthorizedComponent} from './components/basic/unauthorized/unauthorized.component';
730
- import {SharedService} from './services/shared.service';
731
-
732
- @NgModule({
733
- declarations : [
734
- AppComponent,
735
- DatenschutzComponent,
736
- ImpressumComponent,
737
- MaintenanceComponent,
738
- ErrorComponent,
739
- WelcomeComponent,
740
- UnauthorizedComponent,
741
- TimeoutComponent,
742
- ByeComponent
743
- ],
744
- imports : [
745
- HttpClientModule,
746
- BrowserModule,
747
- FormsModule,
748
- ReactiveFormsModule,
749
- AppRoutingModule,
750
- BrowserAnimationsModule,
751
- LuxDirectivesModule,
752
- LuxIconModule,
753
- LuxLayoutModule,
754
- LuxActionModule,
755
- LuxFormModule,
756
- LuxCommonModule,
757
- LuxPipesModule,
758
- LuxPopupsModule,
759
- LuxErrorModule,
760
- FlexLayoutModule,
761
- LuxFilePreviewModule,
762
- FeedbackModule,
763
- HomeModule,
764
- ConfigurationModule,
765
- SDApiModule.forRoot(apiSDConfigFactory),
766
- BSApiModule.forRoot(apiConfigFactory),
767
- LuxComponentsConfigModule.forRoot(luxComponentsConfig)
768
- ],
769
- entryComponents: [
770
- LuxSnackbarComponent,
771
- LuxFilePreviewComponent
772
- ],
773
- providers : [
774
- LuxConsoleService,
775
- {
776
- provide : HTTP_INTERCEPTORS,
777
- useClass: CSRFInterceptor,
778
- multi : true
779
- },
780
- {
781
- provide : HTTP_INTERCEPTORS,
782
- useClass: CorrelationInterceptor,
783
- multi : true
784
- },
785
- {
786
- provide : HTTP_INTERCEPTORS,
787
- useClass: UnauthorizedInterceptor,
788
- multi : true
789
- },
790
- {provide: LOCALE_ID, useValue: (document[ 'locale' ] ? document[ 'locale' ] : 'de-DE')},
791
- { provide: Window, useValue: window },
792
- ],
793
- bootstrap : [
794
- AppComponent
795
- ]
796
- })
797
- export class AppModule {
798
- }
799
- `
800
- );
801
-
802
- callRule(i18nUpdateAppModule(testOptions), observableOf(appTree), context).subscribe(
803
- (success) => {
804
- const content = success.read(testOptions.path + '/src/app/app.module.ts')?.toString();
805
-
806
- expect(content).not.toContain('import \'@angular/common/locales/global/de\';');
807
- expect(content).not.toContain('{provide: LOCALE_ID, useValue: (document[ \'locale\' ] ? document[ \'locale\' ] : \'de-DE\')},');
808
- expect(content).not.toContain('import {LOCALE_ID');
809
- expect(content).toContain('import { NgModule, ErrorHandler} from \'@angular/core\';');
810
- expect(content).not.toContain('import {registerLocaleData');
811
- expect(content).toContain('import { DatePipe} from \'@angular/common\';');
812
-
813
- done();
814
- },
815
- (reason) => expect(reason).toBeUndefined()
816
- );
817
- });
818
- });
819
-
820
- describe('[Rule] i18nCopyMessages', () => {
821
- it('Sollte die I18N-Dateien kopieren', (done) => {
822
-
823
- callRule(i18nCopyMessages(testOptions), observableOf(appTree), context).subscribe(
824
- (success) => {
825
- expect(success.exists(testOptions.path + '/src/locale/messages.xlf')).toBeTrue();
826
- expect(success.exists(testOptions.path + '/src/locale/messages.en.xlf')).toBeTrue();
827
- expect(success.exists(testOptions.path + '/move-de-files.js')).toBeTrue();
828
- done();
829
- },
830
- (reason) => expect(reason).toBeUndefined()
831
- );
832
- });
833
- });
834
-
835
- describe('[Rule] i18nUpdateAngularJson', () => {
836
- it('Sollte die Datei "angular.json" (i18n) angepasst haben', (done) => {
837
- appTree.overwrite('/angular.json',
838
- `
839
- {
840
- "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
841
- "version": 1,
842
- "newProjectRoot": "projects",
843
- "projects": {
844
- "bar": {
845
- "root": "",
846
- "sourceRoot": "src",
847
- "projectType": "application",
848
- "architect": {
849
- "build": {
850
- "builder": "@angular-devkit/build-angular:browser",
851
- "options": {
852
- "outputPath": "dist",
853
- "index": "src/index.html",
854
- "main": "src/main.ts",
855
- "tsConfig": "src/tsconfig.app.json",
856
- "polyfills": "src/polyfills.ts",
857
- "assets": [
858
- "src/assets",
859
- \t\t\t { "glob": "**/*", "input": "./node_modules/pdfjs-dist/cmaps/", "output": "./assets/cmaps" }
860
- ],
861
- "styles": [
862
- "src/styles.scss",
863
- "src/theming/luxtheme.scss"
864
- ],
865
- "scripts": [],
866
- "allowedCommonJsDependencies": ["hammerjs", "ng2-pdf-viewer"]
867
- },
868
- "configurations": {
869
- "production": {
870
- "budgets": [
871
- {
872
- "type": "anyComponentStyle",
873
- "maximumWarning": "6kb"
874
- }
875
- ],
876
- "optimization": true,
877
- "outputHashing": "all",
878
- "sourceMap": false,
879
- "namedChunks": false,
880
- "aot": true,
881
- "extractLicenses": true,
882
- "vendorChunk": false,
883
- "buildOptimizer": true,
884
- "fileReplacements": [
885
- {
886
- "replace": "src/environments/environment.ts",
887
- "with": "src/environments/environment.prod.ts"
888
- }
889
- ]
890
- },
891
- "es5": {
892
- "budgets": [
893
- {
894
- "type": "anyComponentStyle",
895
- "maximumWarning": "6kb"
896
- }
897
- ],
898
- "tsConfig": "src/tsconfig.app.ie.json"
899
- }
900
- }
901
- },
902
- "serve": {
903
- "builder": "@angular-devkit/build-angular:dev-server",
904
- "options": {
905
- "browserTarget": "lux-bp:build"
906
- },
907
- "configurations": {
908
- "production": {
909
- "browserTarget": "lux-bp:build:production"
910
- },
911
- "es5": {
912
- "browserTarget": "lux-bp:build:es5"
913
- }
914
- }
915
- },
916
- "extract-i18n": {
917
- "builder": "@angular-devkit/build-angular:extract-i18n",
918
- "options": {
919
- "browserTarget": "lux-bp:build"
920
- }
921
- },
922
- "test": {
923
- "builder": "@angular-devkit/build-angular:karma",
924
- "options": {
925
- "main": "src/test.ts",
926
- "karmaConfig": "./karma.conf.js",
927
- "polyfills": "src/polyfills.ts",
928
- "tsConfig": "src/tsconfig.spec.json",
929
- "scripts": [],
930
- "styles": [
931
- "src/styles.scss",
932
- "src/theming/luxtheme.scss"
933
- ],
934
- "assets": [
935
- "src/assets",
936
- \t\t\t { "glob": "**/*", "input": "./node_modules/pdfjs-dist/cmaps/", "output": "./assets/cmaps" }
937
- ]
938
- }
939
- },
940
- "app-lint": {
941
- "builder": "@angular-devkit/build-angular:tslint",
942
- "options": {
943
- "tsConfig": [
944
- "src/tsconfig.app.json"
945
- ],
946
- "tslintConfig": "./tslint.json"
947
- }
948
- \t\t},
949
- "spec-lint": {
950
- "builder": "@angular-devkit/build-angular:tslint",
951
- "options": {
952
- "tsConfig": [
953
- "src/tsconfig.spec.json"
954
- ],
955
- "tslintConfig": "./tslint.spec.json"
956
- }
957
- \t\t}
958
- }
959
- },
960
- "lux-bp-e2e": {
961
- "root": "e2e",
962
- "sourceRoot": "e2e",
963
- "projectType": "application",
964
- "architect": {
965
- "e2e": {
966
- "builder": "@angular-devkit/build-angular:protractor",
967
- "options": {
968
- "protractorConfig": "./protractor.conf.js",
969
- "devServerTarget": "lux-bp:serve"
970
- }
971
- },
972
- "lint": {
973
- "builder": "@angular-devkit/build-angular:tslint",
974
- "options": {
975
- "tsConfig": [
976
- "e2e/tsconfig.e2e.json"
977
- ],
978
- "exclude": [
979
- "**/node_modules/**"
980
- ]
981
- }
982
- }
983
- }
984
- }
985
- },
986
- "defaultProject": "lux-bp",
987
- "schematics": {
988
- "@schematics/angular:component": {
989
- "prefix": "bp",
990
- "style": "scss"
991
- },
992
- "@schematics/angular:directive": {
993
- "prefix": "bp"
994
- }
995
- }
996
- }
997
-
998
- `
999
- );
1000
-
1001
- callRule(i18nUpdateAngularJson(testOptions), observableOf(appTree), context).subscribe(
1002
- (success) => {
1003
- const content = success.read('angular.json')?.toString();
1004
-
1005
- expect(content).toContain('"i18n": {\n' +
1006
- ' "sourceLocale": {\n' +
1007
- ' "code": "de",\n' +
1008
- ' "baseHref": "/"\n' +
1009
- ' }');
1010
- expect(content).toContain(`"localize": [
1011
- "de"
1012
- ]`);
1013
- expect(content).toContain('"i18nMissingTranslation": "error"');
1014
- expect(content).toContain(`"en": {
1015
- "localize": [
1016
- "en"
1017
- ],
1018
- "aot": true,
1019
- "outputPath": "dist/en",
1020
- "i18nMissingTranslation": "error"
1021
- }
1022
- `);
1023
- expect(content).toContain(`"en": {
1024
- "browserTarget": "bar:build:en"
1025
- }
1026
- `);
1027
-
1028
- done();
1029
- },
1030
- (reason) => expect(reason).toBeUndefined()
1031
- );
1032
- });
1033
- });
1034
-
1035
- describe('[Rule] i18nUpdatePackageJson', () => {
1036
- it('Sollte die Datei "package.json" (i18n) angepasst haben', (done) => {
1037
- appTree.overwrite('/package.json',
1038
- `
1039
- {
1040
- "name": "BP",
1041
- "version": "0.0.1",
1042
- "license": "MIT",
1043
- "scripts": {
1044
- "ng": "ng",
1045
- "start": "ng serve --public-host=http://localhost:4200",
1046
- "start_en": "ng serve --public-host=http://localhost:4200 --configuration en",
1047
- "build": "node --max_old_space_size=4024 ./node_modules/@angular/cli/bin/ng build --source-map",
1048
- "build-aot": "node --max_old_space_size=4024 ./node_modules/@angular/cli/bin/ng build --aot",
1049
- "buildzentral": "node --max_old_space_size=4024 ./node_modules/@angular/cli/bin/ng build --prod",
1050
- "start-ie": "ng serve --configuration es5 --public-host=http://localhost:4200",
1051
- "test": "ng test",
1052
- "test_no_sm": "ng test --no-sourceMap",
1053
- "test_single_run": "ng test --watch=false --code-coverage=true --browsers=ChromeHeadless",
1054
- "test_coverage": "ng test --watch=false --code-coverage=true",
1055
- "lint": "ng run lux-bp:app-lint --format=stylish && ng run lux-bp:spec-lint --format=stylish",
1056
- "e2e": "ng e2e",
1057
- "compodoc": "./node_modules/.bin/compodoc -p tsconfig.json",
1058
- "docStart": "compodoc src -s --port 8888",
1059
- "security": "npm audit --registry=https://registry.npmjs.org --audit-level high",
1060
- "smoketest": "npm run test_single_run && npm run build-aot && npm run lint --bailOnLintError true",
1061
- "generate_bsclient": "openapi-generator generate -i http://localhost:8081/business-service/openapi/v3/api-docs -g typescript-angular -o src-gen/bsclient --additional-properties apiModulePrefix=BS",
1062
- "generate_bsclient_zentral": "openapi-generator generate -i ../business-service/target/swagger.json -g typescript-angular -o src-gen/bsclient --additional-properties apiModulePrefix=BS"
1063
- }
1064
- }
1065
-
1066
- `
1067
- );
1068
-
1069
- callRule(i18nUpdatePackageJson(testOptions), observableOf(appTree), context).subscribe(
1070
- (success) => {
1071
- const content = success.read('package.json')?.toString();
1072
-
1073
- expect(content).toContain('"xi18n": "ng extract-i18n --output-path src/locale --ivy"');
1074
- expect(content).toContain('"build-aot": "node --max_old_space_size=4024 ./node_modules/@angular/cli/bin/ng build --aot && npm run move-de-files"');
1075
- expect(content).toContain('"buildzentral": "node --max_old_space_size=4024 ./node_modules/@angular/cli/bin/ng build --prod && npm run move-de-files"');
1076
- expect(content).toContain('"start_en": "ng serve --public-host=http://localhost:4200 --configuration en"');
1077
-
1078
- done();
1079
- },
1080
- (reason) => expect(reason).toBeUndefined()
1081
- );
1082
- });
1083
- });
1084
-
1085
- describe('[Rule] updateTsConfigJson', () => {
1086
- it('Sollte die tsconfig.json anpassen', (done) => {
1087
- appTree.overwrite( '/tsconfig.json',
1088
- `
1089
- {
1090
- "compileOnSave": false,
1091
- "compilerOptions": {
1092
- "downlevelIteration": true,
1093
- "outDir": "./dist/out-tsc",
1094
- "sourceMap": true,
1095
- "declaration": false,
1096
- "moduleResolution": "node",
1097
- "emitDecoratorMetadata": true,
1098
- "experimentalDecorators": true,
1099
- "target": "es2015",
1100
- "typeRoots": [
1101
- "node_modules/@types"
1102
- ],
1103
- "lib": [
1104
- "es2017",
1105
- "dom"
1106
- ],
1107
- "module": "esnext",
1108
- "baseUrl": "./"
1109
- },
1110
- "angularCompilerOptions": {
1111
- "fullTemplateTypeCheck": true,
1112
- "preserveWhiteSpace": false,
1113
- "strictInjectionParameters": true,
1114
- "enableIvy": true
1115
- }
1116
- }
1117
- `
1118
- );
1119
-
1120
- callRule(updateTsConfigJson(testOptions), observableOf(appTree), context).subscribe(
1121
- (success) => {
1122
- const content = success.read('/tsconfig.json')?.toString();
1123
-
1124
- expect(content).toContain('"strict": false');
1125
- expect(content).toContain('"noImplicitReturns": true');
1126
- expect(content).toContain('"noFallthroughCasesInSwitch": true');
1127
- expect(content).toContain('"forceConsistentCasingInFileNames": true');
1128
- expect(content).toContain('"lib": [\n "es2018",\n "dom"\n ]');
1129
- expect(content).toContain('"module": "es2020"');
1130
- expect(content).toContain('"strictInputAccessModifiers": true');
1131
- expect(content).toContain('"strictTemplates": false');
1132
-
1133
- done();
1134
- },
1135
- (reason) => expect(reason).toBeUndefined()
1136
- );
1137
- });
1138
- });
1139
- });