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