@ihk-gfi/lux-components-update 19.1.0 → 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,11 @@
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
+ },
9
14
  "update-19.1.0": {
10
15
  "description": "Aktualisiert das LUX-Componentsprojekt auf die Version 19.1.0",
11
16
  "factory": "./src/updates/19.1.0/index#update190100",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ihk-gfi/lux-components-update",
3
- "version": "19.1.0",
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",
@@ -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;