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