@ihk-gfi/lux-components-update 15.0.0 → 15.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 +1 -1
- package/package.json +6 -6
- package/update-dependencies/index.js +2 -1
- package/updates/15.0.0/index.js +4 -0
- package/utility/json.d.ts +2 -1
- package/utility/json.js +17 -4
- package/utility/util.d.ts +1 -0
- package/utility/util.js +12 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ Dieses Projekt enthält alle Updateskripte (umgesetzt mit Angular Schematics) f
|
|
|
5
5
|
Updateskripte:
|
|
6
6
|
|
|
7
7
|
- `update` (aktualisiert das Projekt auf die Version 15.0.0)
|
|
8
|
-
- `update-
|
|
8
|
+
- `update-15.x.x` (aktualisiert das Projekt auf die Version 15.x.x)
|
|
9
9
|
- `add-lux-components` (fügt die LUX-Components zu einem Angular-Projekt hinzu)
|
|
10
10
|
|
|
11
11
|
## Voraussetzungen
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ihk-gfi/lux-components-update",
|
|
3
|
-
"version": "15.0.
|
|
3
|
+
"version": "15.0.2",
|
|
4
4
|
"description": "Schematics für die Aktualisierung von LUX-Applikationen",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "npm run clean && tsc -p tsconfig.json",
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
},
|
|
31
31
|
"schematics": "./collection.json",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@angular-devkit/core": "15.2.
|
|
34
|
-
"@angular-devkit/schematics": "15.2.
|
|
35
|
-
"@angular-devkit/schematics-cli": "15.2.
|
|
36
|
-
"@angular/cli": "15.2.
|
|
33
|
+
"@angular-devkit/core": "15.2.9",
|
|
34
|
+
"@angular-devkit/schematics": "15.2.9",
|
|
35
|
+
"@angular-devkit/schematics-cli": "15.2.9",
|
|
36
|
+
"@angular/cli": "15.2.9",
|
|
37
37
|
"@types/jasmine": "4.3.1",
|
|
38
38
|
"@types/node": "16.11.7",
|
|
39
39
|
"@types/semver": "7.3.13",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"jasmine": "4.6.0",
|
|
45
45
|
"jsdom": "20.0.1",
|
|
46
46
|
"jsonc-parser": "3.0.0",
|
|
47
|
-
"semver": "7.
|
|
47
|
+
"semver": "7.5.2",
|
|
48
48
|
"typescript": "4.9.5"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
@@ -37,6 +37,7 @@ function updateDependencies() {
|
|
|
37
37
|
updateDep('ng2-pdf-viewer', '8.0.1', addOrUpdate),
|
|
38
38
|
updateDep('pdfjs-dist', '2.13.216', addOrUpdate),
|
|
39
39
|
updateDep('ngx-cookie-service', '15.0.0', addOrUpdate),
|
|
40
|
+
updateDep('ngx-build-plus', '15.0.0', addOrUpdate),
|
|
40
41
|
updateDevDep('@ihk-gfi/lux-components-update', '15.0.0', addOrUpdate),
|
|
41
42
|
updateDevDep('@angular-eslint/builder', '15.2.1', updateIfExists),
|
|
42
43
|
updateDevDep('@angular-eslint/eslint-plugin', '15.2.1', updateIfExists),
|
|
@@ -45,7 +46,7 @@ function updateDependencies() {
|
|
|
45
46
|
updateDevDep('@angular-eslint/template-parser', '15.2.1', updateIfExists),
|
|
46
47
|
updateDevDep('@typescript-eslint/eslint-plugin', '5.62.0', updateIfExists),
|
|
47
48
|
updateDevDep('@typescript-eslint/parser', '5.62.0', updateIfExists),
|
|
48
|
-
updateDevDep('eslint', '8.
|
|
49
|
+
updateDevDep('eslint', '8.46.0', updateIfExists),
|
|
49
50
|
updateDevDep('eslint-plugin-import', '2.26.0', updateIfExists),
|
|
50
51
|
updateDevDep('eslint-plugin-jsdoc', '39.2.9', updateIfExists),
|
|
51
52
|
updateDevDep('eslint-plugin-prefer-arrow', '1.2.3', updateIfExists),
|
package/updates/15.0.0/index.js
CHANGED
|
@@ -69,6 +69,7 @@ function removeMaAndFaIcons(options) {
|
|
|
69
69
|
}
|
|
70
70
|
exports.removeMaAndFaIcons = removeMaAndFaIcons;
|
|
71
71
|
function updateProjectStructure(options) {
|
|
72
|
+
var _a, _b, _c, _d, _e, _f;
|
|
72
73
|
return (0, schematics_1.chain)([
|
|
73
74
|
(0, util_1.messageInfoRule)(`Projektstruktur wird angepasst...`),
|
|
74
75
|
copyAppFiles(options),
|
|
@@ -77,6 +78,9 @@ function updateProjectStructure(options) {
|
|
|
77
78
|
(0, json_1.updateJsonValue)('/angular.json', ['projects', options.project, 'architect', 'build', 'options', 'polyfills'], ['zone.js'], false),
|
|
78
79
|
(0, json_1.updateJsonValue)('/angular.json', ['projects', options.project, 'architect', 'test', 'options', 'polyfills'], ['zone.js', 'zone.js/testing', 'src/test.ts'], false),
|
|
79
80
|
(0, json_1.deleteJsonValue)('/angular.json', ['projects', options.project, 'architect', 'test', 'options', 'main']),
|
|
81
|
+
(0, util_1.applyRuleIfFileExists)((0, json_1.deleteJsonArray)(((_a = options.path) !== null && _a !== void 0 ? _a : '.') + '/src/tsconfig.app.json', ['files'], (node) => (0, json_1.findStringInArray)(node, 'polyfills.ts')), ((_b = options.path) !== null && _b !== void 0 ? _b : '.') + '/src/tsconfig.app.json'),
|
|
82
|
+
(0, util_1.applyRuleIfFileExists)((0, json_1.deleteJsonArray)(((_c = options.path) !== null && _c !== void 0 ? _c : '.') + '/src/tsconfig.spec.json', ['files'], (node) => (0, json_1.findStringInArray)(node, 'polyfills.ts')), ((_d = options.path) !== null && _d !== void 0 ? _d : '.') + '/src/tsconfig.spec.json'),
|
|
83
|
+
(0, util_1.applyRuleIfFileExists)((0, json_1.deleteJsonArray)(((_e = options.path) !== null && _e !== void 0 ? _e : '.') + '/src/tsconfig.spec.json', ['compilerOptions', 'types'], (node) => (0, json_1.findStringInArray)(node, 'node')), ((_f = options.path) !== null && _f !== void 0 ? _f : '.') + '/src/tsconfig.spec.json'),
|
|
80
84
|
(0, util_1.messageSuccessRule)(`Projektstruktur wurde angepasst.`)
|
|
81
85
|
]);
|
|
82
86
|
}
|
package/utility/json.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ export declare function readJsonAsString(tree: Tree, filePath: string): string;
|
|
|
34
34
|
export declare function appendScript(script: string, part: string, index?: number): string;
|
|
35
35
|
export declare function updateJsonValue(filePath: string, jsonPath: string[], value: any, onlyUpdate?: boolean): Rule;
|
|
36
36
|
export declare function deleteJsonValue(filePath: string, jsonPath: string[]): Rule;
|
|
37
|
-
export declare function updateJsonArray(filePath: string, jsonPath: string[], value: any, onlyUpdate?: boolean, findFn?: (value: Node) => boolean): Rule;
|
|
37
|
+
export declare function updateJsonArray(filePath: string, jsonPath: string[], value: any, onlyUpdate?: boolean, findFn?: (value: Node) => boolean, message?: string): Rule;
|
|
38
38
|
export declare function deleteJsonArray(filePath: string, jsonPath: string[], findFn?: (value: Node) => boolean): Rule;
|
|
39
39
|
/**
|
|
40
40
|
* Diese Methode liefert den Index im Array des Objekts mit der übergebenen Property zurück.
|
|
@@ -58,6 +58,7 @@ export declare function deleteJsonArray(filePath: string, jsonPath: string[], fi
|
|
|
58
58
|
*/
|
|
59
59
|
export declare function findObjectIndexInArray(arrayNode: Node, propertyName: string, propertyValue: string): number;
|
|
60
60
|
export declare function findObjectPropertyInArray(node: Node, propertyName: string, propertyValue: string): boolean;
|
|
61
|
+
export declare function findStringInArray(arrayNode: Node, value: string): boolean;
|
|
61
62
|
/**
|
|
62
63
|
* Diese Methode liefert den Index im Array des Werts zurück.
|
|
63
64
|
*
|
package/utility/json.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.removeJsonNode = exports.findStringIndexInArray = exports.findObjectPropertyInArray = exports.findObjectIndexInArray = exports.deleteJsonArray = exports.updateJsonArray = exports.deleteJsonValue = exports.updateJsonValue = exports.appendScript = exports.readJsonAsString = exports.readJson = exports.jsonFormattingOptions = void 0;
|
|
3
|
+
exports.removeJsonNode = exports.findStringIndexInArray = exports.findStringInArray = exports.findObjectPropertyInArray = exports.findObjectIndexInArray = exports.deleteJsonArray = exports.updateJsonArray = exports.deleteJsonValue = exports.updateJsonValue = exports.appendScript = exports.readJsonAsString = exports.readJson = exports.jsonFormattingOptions = void 0;
|
|
4
4
|
const jsonc_parser_1 = require("jsonc-parser");
|
|
5
5
|
const logging_1 = require("./logging");
|
|
6
6
|
exports.jsonFormattingOptions = {
|
|
@@ -93,7 +93,7 @@ function deleteJsonValue(filePath, jsonPath) {
|
|
|
93
93
|
return updateJsonValue(filePath, jsonPath, void 0, true);
|
|
94
94
|
}
|
|
95
95
|
exports.deleteJsonValue = deleteJsonValue;
|
|
96
|
-
function updateJsonArray(filePath, jsonPath, value, onlyUpdate = false, findFn) {
|
|
96
|
+
function updateJsonArray(filePath, jsonPath, value, onlyUpdate = false, findFn, message) {
|
|
97
97
|
return (tree, _context) => {
|
|
98
98
|
// Gibt es bereits eine passende Stelle?
|
|
99
99
|
let foundIndex = -1;
|
|
@@ -127,14 +127,19 @@ function updateJsonArray(filePath, jsonPath, value, onlyUpdate = false, findFn)
|
|
|
127
127
|
});
|
|
128
128
|
if (edits) {
|
|
129
129
|
tree.overwrite(filePath, (0, jsonc_parser_1.applyEdits)(jsonFile, edits));
|
|
130
|
-
|
|
130
|
+
if (message) {
|
|
131
|
+
(0, logging_1.logInfo)(message);
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
(0, logging_1.logInfo)(`"${JSON.stringify(value)}" an der Stelle "${jsonPath.join('.')}" hinzugefügt.`);
|
|
135
|
+
}
|
|
131
136
|
}
|
|
132
137
|
}
|
|
133
138
|
};
|
|
134
139
|
}
|
|
135
140
|
exports.updateJsonArray = updateJsonArray;
|
|
136
141
|
function deleteJsonArray(filePath, jsonPath, findFn) {
|
|
137
|
-
return updateJsonArray(filePath, jsonPath, void 0, true, findFn);
|
|
142
|
+
return updateJsonArray(filePath, jsonPath, void 0, true, findFn, `${filePath}: Wert aus dem Array an der Stelle "${jsonPath.join('.')}" gelöscht.`);
|
|
138
143
|
}
|
|
139
144
|
exports.deleteJsonArray = deleteJsonArray;
|
|
140
145
|
/**
|
|
@@ -208,6 +213,14 @@ function findObjectPropertyInArray(node, propertyName, propertyValue) {
|
|
|
208
213
|
return found;
|
|
209
214
|
}
|
|
210
215
|
exports.findObjectPropertyInArray = findObjectPropertyInArray;
|
|
216
|
+
function findStringInArray(arrayNode, value) {
|
|
217
|
+
let found = false;
|
|
218
|
+
if (arrayNode.type === 'string' && arrayNode.value === value) {
|
|
219
|
+
found = true;
|
|
220
|
+
}
|
|
221
|
+
return found;
|
|
222
|
+
}
|
|
223
|
+
exports.findStringInArray = findStringInArray;
|
|
211
224
|
/**
|
|
212
225
|
* Diese Methode liefert den Index im Array des Werts zurück.
|
|
213
226
|
*
|
package/utility/util.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ export declare const waitForTreeCallback: (_tree: Tree, callback: Function, wait
|
|
|
26
26
|
*/
|
|
27
27
|
export declare const runInstallAndLogToDos: (context: SchematicContext, messages: string[], runNpmInstall: boolean) => void;
|
|
28
28
|
export declare function updateI18nFile(tree: Tree, language: string, insertTransUnitId: string, translations: string): void;
|
|
29
|
+
export declare function applyRuleIfFileExists(rule: Rule, path: string): Rule;
|
|
29
30
|
export declare function applyRuleIf(minVersion: string, rule: Rule): Rule;
|
|
30
31
|
export declare function messageDebugRule(message: any, options: any): Rule;
|
|
31
32
|
export declare function messageInfoRule(message: any): Rule;
|
package/utility/util.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.finish = exports.messageSuccessRule = exports.messageInfoInternRule = exports.messageInfoRule = exports.messageDebugRule = exports.applyRuleIf = exports.updateI18nFile = exports.runInstallAndLogToDos = exports.waitForTreeCallback = exports.replaceAll = exports.replaceFirst = exports.escapeRegExp = exports.UtilConfig = void 0;
|
|
3
|
+
exports.finish = exports.messageSuccessRule = exports.messageInfoInternRule = exports.messageInfoRule = exports.messageDebugRule = exports.applyRuleIf = exports.applyRuleIfFileExists = exports.updateI18nFile = exports.runInstallAndLogToDos = exports.waitForTreeCallback = exports.replaceAll = exports.replaceFirst = exports.escapeRegExp = exports.UtilConfig = void 0;
|
|
4
4
|
const tasks_1 = require("@angular-devkit/schematics/tasks");
|
|
5
5
|
const rxjs_1 = require("rxjs");
|
|
6
6
|
const operators_1 = require("rxjs/operators");
|
|
@@ -97,6 +97,17 @@ function updateI18nFile(tree, language, insertTransUnitId, translations) {
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
exports.updateI18nFile = updateI18nFile;
|
|
100
|
+
function applyRuleIfFileExists(rule, path) {
|
|
101
|
+
return (tree, _context) => {
|
|
102
|
+
if (tree.exists(path)) {
|
|
103
|
+
return rule;
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
return tree;
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
exports.applyRuleIfFileExists = applyRuleIfFileExists;
|
|
100
111
|
function applyRuleIf(minVersion, rule) {
|
|
101
112
|
return (tree, _context) => {
|
|
102
113
|
let version = (0, dependencies_1.getPackageJsonDependency)(tree, '@ihk-gfi/lux-components').version;
|