@ihk-gfi/lux-components-update 19.0.1 → 19.2.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.
package/collection.json CHANGED
@@ -6,6 +6,16 @@
6
6
  "factory": "./src/update-standalone-imports/index#updateStandAloneImports",
7
7
  "schema": "./src/update-standalone-imports/schema.json"
8
8
  },
9
+ "update-19.2.0": {
10
+ "description": "Aktualisiert das LUX-Componentsprojekt auf die Version 19.2.0",
11
+ "factory": "./src/updates/19.2.0/index#update190200",
12
+ "schema": "./src/updates/19.2.0/schema.json"
13
+ },
14
+ "update-19.1.0": {
15
+ "description": "Aktualisiert das LUX-Componentsprojekt auf die Version 19.1.0",
16
+ "factory": "./src/updates/19.1.0/index#update190100",
17
+ "schema": "./src/updates/19.1.0/schema.json"
18
+ },
9
19
  "update-19.0.0": {
10
20
  "description": "Aktualisiert das LUX-Componentsprojekt auf die Version 19.0.0",
11
21
  "factory": "./src/updates/19.0.0/index#update190000",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ihk-gfi/lux-components-update",
3
- "version": "19.0.1",
3
+ "version": "19.2.0",
4
4
  "description": "Schematics für die Aktualisierung von LUX-Applikationen",
5
5
  "scripts": {
6
6
  "build": "npm run clean && tsc -p tsconfig.json",
@@ -159,13 +159,10 @@ function updateTsConfigAppJson(options) {
159
159
  function updateTsConfigSpecJson(options) {
160
160
  return (_tree, _context) => {
161
161
  const filePath = (options.path ?? '') + '/src/tsconfig.spec.json';
162
- const testPath = ['files'];
163
- const testFn = (node) => (0, json_1.findStringInArray)(node, 'test.ts');
164
162
  const i18nPath = ['compilerOptions', 'types'];
165
163
  const i18nValue = '@angular/localize';
166
164
  return (0, schematics_1.chain)([
167
165
  (0, util_1.messageInfoRule)(`tsconfig.spec.json wird angepasst...`),
168
- (0, json_1.deleteJsonArray)(filePath, testPath, testFn),
169
166
  (0, json_1.updateJsonArray)(filePath, i18nPath, i18nValue),
170
167
  (0, util_1.messageSuccessRule)(`tsconfig.spec.json wurde angepasst.`)
171
168
  ]);
@@ -186,7 +183,7 @@ function updateTestTs(options) {
186
183
  const filePath = (options.path ?? '') + '/src/main.ts';
187
184
  return (0, schematics_1.chain)([
188
185
  (0, util_1.messageInfoRule)(`test.ts wird angepasst...`),
189
- (0, files_1.replaceRule)(options, 'I18N wird angepasst...', 'I18N wurde angepasst.', filePath, new replace_item_1.ReplaceItem("import '@angular/localize/init';", '/// <reference types="@angular/localize" />')),
186
+ (0, files_1.replaceRule)(options, 'I18N wird angepasst...', 'I18N wurde angepasst.', filePath, new replace_item_1.ReplaceItem("import '@angular/localize/init';", '/// <reference types="@angular/localize" />'), new replace_item_1.ReplaceItem('import "@angular/localize/init";', '/// <reference types="@angular/localize" />')),
190
187
  (0, util_1.messageSuccessRule)(`test.ts wurde angepasst.`)
191
188
  ]);
192
189
  };
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.update190100 = update190100;
4
+ const schematics_1 = require("@angular-devkit/schematics");
5
+ const chalk = require("chalk");
6
+ const index_1 = require("../../update-dependencies/index");
7
+ const util_1 = require("../../utility/util");
8
+ function update190100(_options, runNpmInstall = true) {
9
+ return (_tree, _context) => {
10
+ return (0, schematics_1.chain)([
11
+ (0, util_1.messageInfoRule)(`Die LUX-Components werden auf die Version 19.1.0 aktualisiert...`),
12
+ (0, util_1.messageInfoRule)(`Die Datei "package.json" wird angepasst...`),
13
+ (0, index_1.updateDep)('@ihk-gfi/lux-components', '19.1.0', false),
14
+ (0, util_1.messageSuccessRule)(`Die LUX-Components wurden auf die Version 19.1.0 aktualisiert.`),
15
+ (0, util_1.finish)(runNpmInstall, `${chalk.yellowBright('Fertig!')}`)
16
+ ]);
17
+ };
18
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "luxupdate190100Schema",
4
+ "title": "Aktualisiert das LUX-Componentsprojekt",
5
+ "type": "object",
6
+ "description": "Aktualisiert das LUX-Componentsprojekt",
7
+ "properties": {
8
+ "project": {
9
+ "type": "string",
10
+ "description": "Der Projektname",
11
+ "$default": {
12
+ "$source": "projectName"
13
+ }
14
+ },
15
+ "verbose": {
16
+ "type": "boolean",
17
+ "description": "Generiert mehr Logausgaben",
18
+ "default": false
19
+ }
20
+ },
21
+ "required": [],
22
+ "additionalProperties": false
23
+ }
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.update190200 = update190200;
4
+ exports.addCdkScrollable = addCdkScrollable;
5
+ const schematics_1 = require("@angular-devkit/schematics");
6
+ const chalk = require("chalk");
7
+ const index_1 = require("../../update-dependencies/index");
8
+ const files_1 = require("../../utility/files");
9
+ const logging_1 = require("../../utility/logging");
10
+ const replace_item_1 = require("../../utility/replace-item");
11
+ const typescript_1 = require("../../utility/typescript");
12
+ const util_1 = require("../../utility/util");
13
+ function update190200(options, runNpmInstall = true) {
14
+ return (_tree, _context) => {
15
+ return (0, schematics_1.chain)([
16
+ (0, util_1.messageInfoRule)(`Die LUX-Components werden auf die Version 19.2.0 aktualisiert...`),
17
+ (0, util_1.messageInfoRule)(`Die Datei "package.json" wird angepasst...`),
18
+ (0, index_1.updateDep)('@ihk-gfi/lux-components', '19.2.0', false),
19
+ addCdkScrollable(options),
20
+ (0, util_1.messageSuccessRule)(`Die LUX-Components wurden auf die Version 19.2.0 aktualisiert.`),
21
+ (0, util_1.finish)(runNpmInstall, `${chalk.yellowBright('Fertig!')}`)
22
+ ]);
23
+ };
24
+ }
25
+ function addCdkScrollable(options) {
26
+ return (tree, _context) => {
27
+ let returnRule = (0, schematics_1.chain)([]);
28
+ const appHtmlPath = (options.path ?? '') + '/src/app/app.component.html';
29
+ const appTsPath = (options.path ?? '') + '/src/app/app.component.ts';
30
+ const appModuleTsPath = (options.path ?? '') + '/src/app/app.module.ts';
31
+ if (tree.exists(appHtmlPath)) {
32
+ const buffer = tree.read(appHtmlPath)?.toString();
33
+ if (buffer) {
34
+ if (buffer.includes('<lux-app-content') && !buffer.includes('cdkScrollable')) {
35
+ returnRule = (0, schematics_1.chain)([
36
+ (0, util_1.messageInfoRule)(`Die Directive cdkScrollable wird ergänzt...`),
37
+ (0, files_1.replaceRule)(options, `app.component.html wird angepasst...`, `app.component.html wurde angepasst.`, appHtmlPath, new replace_item_1.ReplaceItem('<lux-app-content', '<lux-app-content cdkScrollable', true)),
38
+ (0, util_1.applyRuleIfFileExists)((tree, _context) => {
39
+ (0, typescript_1.addImport)(tree, appModuleTsPath, '@angular/cdk/scrolling', 'CdkScrollable', false);
40
+ (0, typescript_1.addComponentImport)(tree, appModuleTsPath, 'CdkScrollable', false);
41
+ }, appModuleTsPath),
42
+ (0, util_1.applyRuleIfFileNotExists)((tree, _context) => {
43
+ (0, typescript_1.addImport)(tree, appTsPath, '@angular/cdk/scrolling', 'CdkScrollable', false);
44
+ (0, typescript_1.addComponentImport)(tree, appTsPath, 'CdkScrollable', false);
45
+ }, appModuleTsPath),
46
+ (0, util_1.messageSuccessRule)(`Die Directive cdkScrollable wurde ergänzt.`)
47
+ ]);
48
+ }
49
+ else {
50
+ if (!buffer.includes('<lux-app-content')) {
51
+ (0, logging_1.logWarn)(`Die Datei ${appHtmlPath} enthält nicht den Tag lux-app-content.`);
52
+ }
53
+ if (!buffer.includes('cdkScrollable')) {
54
+ (0, logging_1.logWarn)(`Die Directive cdkScrollable muss manuell dem Content-Container hinzugefügt werden!!!`);
55
+ }
56
+ }
57
+ }
58
+ }
59
+ return returnRule;
60
+ };
61
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "luxupdate190200Schema",
4
+ "title": "Aktualisiert das LUX-Componentsprojekt",
5
+ "type": "object",
6
+ "description": "Aktualisiert das LUX-Componentsprojekt",
7
+ "properties": {
8
+ "project": {
9
+ "type": "string",
10
+ "description": "Der Projektname",
11
+ "$default": {
12
+ "$source": "projectName"
13
+ }
14
+ },
15
+ "verbose": {
16
+ "type": "boolean",
17
+ "description": "Generiert mehr Logausgaben",
18
+ "default": false
19
+ }
20
+ },
21
+ "required": [],
22
+ "additionalProperties": false
23
+ }
@@ -7,6 +7,7 @@ exports.replaceString = replaceString;
7
7
  exports.replaceFirst = replaceFirst;
8
8
  exports.replaceAll = replaceAll;
9
9
  exports.applyRuleIfFileExists = applyRuleIfFileExists;
10
+ exports.applyRuleIfFileNotExists = applyRuleIfFileNotExists;
10
11
  exports.applyRuleIf = applyRuleIf;
11
12
  exports.messageDebugRule = messageDebugRule;
12
13
  exports.messageInfoRule = messageInfoRule;
@@ -100,6 +101,16 @@ function applyRuleIfFileExists(rule, path) {
100
101
  }
101
102
  };
102
103
  }
104
+ function applyRuleIfFileNotExists(rule, path) {
105
+ return (tree, _context) => {
106
+ if (!tree.exists(path)) {
107
+ return rule;
108
+ }
109
+ else {
110
+ return tree;
111
+ }
112
+ };
113
+ }
103
114
  function applyRuleIf(minVersion, rule) {
104
115
  return (tree, _context) => {
105
116
  let version = (0, dependencies_1.getPackageJsonDependency)(tree, '@ihk-gfi/lux-components').version;