@ihk-gfi/lux-components-update 16.3.0 → 16.4.1
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/add-lux-components/index.js +10 -7
- package/collection.json +10 -0
- package/package.json +1 -1
- package/update-dependencies/index.js +5 -6
- package/update-en-messages/index.js +1 -2
- package/updates/16.0.0/index.js +4 -4
- package/updates/16.0.1/index.js +1 -2
- package/updates/16.1.0/index.js +1 -2
- package/updates/16.2.0/index.js +1 -2
- package/updates/16.3.0/index.js +1 -2
- package/updates/16.4.0/index.d.ts +2 -0
- package/updates/16.4.0/index.js +19 -0
- package/updates/16.4.0/schema.json +23 -0
- package/updates/16.4.1/index.d.ts +2 -0
- package/updates/16.4.1/index.js +18 -0
- package/updates/16.4.1/schema.json +23 -0
- package/utility/dependencies.js +7 -7
- package/utility/files.js +8 -9
- package/utility/json.js +13 -13
- package/utility/typescript.js +34 -41
- package/utility/util.js +12 -12
- package/utility/validation.js +3 -4
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.addLuxComponents = addLuxComponents;
|
|
4
|
+
exports.check = check;
|
|
5
|
+
exports.updatePackageJson = updatePackageJson;
|
|
6
|
+
exports.updateIndexHtml = updateIndexHtml;
|
|
7
|
+
exports.copyAppFiles = copyAppFiles;
|
|
8
|
+
exports.updateApp = updateApp;
|
|
4
9
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
10
|
const chalk = require("chalk");
|
|
6
11
|
const jsonc_parser_1 = require("jsonc-parser");
|
|
@@ -10,6 +15,8 @@ const index_3 = require("../updates/16.0.1/index");
|
|
|
10
15
|
const index_4 = require("../updates/16.1.0/index");
|
|
11
16
|
const index_5 = require("../updates/16.2.0/index");
|
|
12
17
|
const index_6 = require("../updates/16.3.0/index");
|
|
18
|
+
const index_7 = require("../updates/16.4.0/index");
|
|
19
|
+
const index_8 = require("../updates/16.4.1/index");
|
|
13
20
|
const files_1 = require("../utility/files");
|
|
14
21
|
const json_1 = require("../utility/json");
|
|
15
22
|
const logging_1 = require("../utility/logging");
|
|
@@ -83,11 +90,12 @@ function addLuxComponents(options) {
|
|
|
83
90
|
(0, index_4.update160100)(options, false),
|
|
84
91
|
(0, index_5.update160200)(options, false),
|
|
85
92
|
(0, index_6.update160300)(options, false),
|
|
93
|
+
(0, index_7.update160400)(options, false),
|
|
94
|
+
(0, index_8.update160401)(options, false),
|
|
86
95
|
(0, util_1.finish)(true, `Die LUX-Components ${index_2.updateMajorVersion} wurden erfolgreich eingerichtet.`, `${chalk.yellowBright('Fertig!')}`)
|
|
87
96
|
]);
|
|
88
97
|
};
|
|
89
98
|
}
|
|
90
|
-
exports.addLuxComponents = addLuxComponents;
|
|
91
99
|
/**
|
|
92
100
|
* Prüft ob die Versionen des Projekts mit den erforderlichen Versionen dieses Updates übereinstimmen.
|
|
93
101
|
*/
|
|
@@ -100,7 +108,6 @@ function check() {
|
|
|
100
108
|
});
|
|
101
109
|
};
|
|
102
110
|
}
|
|
103
|
-
exports.check = check;
|
|
104
111
|
function updatePackageJson(_options) {
|
|
105
112
|
return (0, schematics_1.chain)([
|
|
106
113
|
(0, util_1.messageInfoRule)(`package.json wird aktualisiert...`),
|
|
@@ -146,7 +153,6 @@ function updatePackageJson(_options) {
|
|
|
146
153
|
(0, util_1.messageSuccessRule)(`package.json wurde aktualisiert.`)
|
|
147
154
|
]);
|
|
148
155
|
}
|
|
149
|
-
exports.updatePackageJson = updatePackageJson;
|
|
150
156
|
function updateIndexHtml(options) {
|
|
151
157
|
return (0, schematics_1.chain)([
|
|
152
158
|
(0, util_1.messageInfoRule)(`index.html wird aktualisiert...`),
|
|
@@ -161,7 +167,6 @@ function updateIndexHtml(options) {
|
|
|
161
167
|
(0, util_1.messageSuccessRule)(`index.html wurde aktualisiert.`)
|
|
162
168
|
]);
|
|
163
169
|
}
|
|
164
|
-
exports.updateIndexHtml = updateIndexHtml;
|
|
165
170
|
function copyAppFiles(options) {
|
|
166
171
|
return (0, schematics_1.chain)([
|
|
167
172
|
(0, util_1.messageInfoRule)(`App-Dateien werden angelegt...`),
|
|
@@ -174,7 +179,6 @@ function copyAppFiles(options) {
|
|
|
174
179
|
(0, util_1.messageSuccessRule)(`App-Dateien wurden angelegt.`)
|
|
175
180
|
]);
|
|
176
181
|
}
|
|
177
|
-
exports.copyAppFiles = copyAppFiles;
|
|
178
182
|
function updateApp(options) {
|
|
179
183
|
return (0, schematics_1.chain)([
|
|
180
184
|
(0, util_1.messageInfoRule)(`App-Dateien wird angepasst...`),
|
|
@@ -230,4 +234,3 @@ function updateApp(options) {
|
|
|
230
234
|
(0, util_1.messageSuccessRule)(`App wurde angepasst.`)
|
|
231
235
|
]);
|
|
232
236
|
}
|
|
233
|
-
exports.updateApp = updateApp;
|
package/collection.json
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "../node_modules/@angular-devkit/schematics/collection-schema.json",
|
|
3
3
|
"schematics": {
|
|
4
|
+
"update-16.4.1": {
|
|
5
|
+
"description": "Aktualisiert das LUX-Componentsprojekt auf die Version 16.4.1",
|
|
6
|
+
"factory": "./updates/16.4.1/index#update160401",
|
|
7
|
+
"schema": "./updates/16.4.1/schema.json"
|
|
8
|
+
},
|
|
9
|
+
"update-16.4.0": {
|
|
10
|
+
"description": "Aktualisiert das LUX-Componentsprojekt auf die Version 16.4.0",
|
|
11
|
+
"factory": "./updates/16.4.0/index#update160400",
|
|
12
|
+
"schema": "./updates/16.4.0/schema.json"
|
|
13
|
+
},
|
|
4
14
|
"update-16.3.0": {
|
|
5
15
|
"description": "Aktualisiert das LUX-Componentsprojekt auf die Version 16.3.0",
|
|
6
16
|
"factory": "./updates/16.3.0/index#update160300",
|
package/package.json
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.updateDependencies = updateDependencies;
|
|
4
|
+
exports.updateDep = updateDep;
|
|
5
|
+
exports.deleteDep = deleteDep;
|
|
6
|
+
exports.updateDevDep = updateDevDep;
|
|
7
|
+
exports.deleteDevDep = deleteDevDep;
|
|
4
8
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
9
|
const dependencies_1 = require("../utility/dependencies");
|
|
6
10
|
const json_1 = require("../utility/json");
|
|
@@ -71,20 +75,15 @@ function updateDependencies() {
|
|
|
71
75
|
(0, util_1.messageSuccessRule)(`Abhängigkeiten in der Datei "package.json" wurden aktualisiert.`)
|
|
72
76
|
]);
|
|
73
77
|
}
|
|
74
|
-
exports.updateDependencies = updateDependencies;
|
|
75
78
|
function updateDep(name, version, onlyUpdate) {
|
|
76
79
|
return (0, json_1.updateJsonValue)('/package.json', [dependencies_1.NodeDependencyType.Default, name], version, onlyUpdate);
|
|
77
80
|
}
|
|
78
|
-
exports.updateDep = updateDep;
|
|
79
81
|
function deleteDep(name) {
|
|
80
82
|
return (0, json_1.updateJsonValue)('/package.json', [dependencies_1.NodeDependencyType.Default, name], void 0, true);
|
|
81
83
|
}
|
|
82
|
-
exports.deleteDep = deleteDep;
|
|
83
84
|
function updateDevDep(name, version, onlyUpdate) {
|
|
84
85
|
return (0, json_1.updateJsonValue)('/package.json', [dependencies_1.NodeDependencyType.Dev, name], version, onlyUpdate);
|
|
85
86
|
}
|
|
86
|
-
exports.updateDevDep = updateDevDep;
|
|
87
87
|
function deleteDevDep(name) {
|
|
88
88
|
return (0, json_1.updateJsonValue)('/package.json', [dependencies_1.NodeDependencyType.Dev, name], void 0, true);
|
|
89
89
|
}
|
|
90
|
-
exports.deleteDevDep = deleteDevDep;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateEnMessages =
|
|
3
|
+
exports.updateEnMessages = updateEnMessages;
|
|
4
4
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
5
|
const cheerio_1 = require("cheerio");
|
|
6
6
|
const logging_1 = require("../utility/logging");
|
|
@@ -13,7 +13,6 @@ function updateEnMessages() {
|
|
|
13
13
|
(0, util_1.messageInfoRule)(`Die englischen Übersetzungen im Projekt wurden aktualisiert.`)
|
|
14
14
|
]);
|
|
15
15
|
}
|
|
16
|
-
exports.updateEnMessages = updateEnMessages;
|
|
17
16
|
function updateEnMessagesIntern() {
|
|
18
17
|
return (tree, _context) => {
|
|
19
18
|
const filePathLCEn = '/node_modules/@ihk-gfi/lux-components/src/locale/messages.en.xlf';
|
package/updates/16.0.0/index.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.i18nEn = exports.i18nDe = exports.
|
|
3
|
+
exports.i18nEn = exports.i18nDe = exports.updateNodeMinVersion = exports.updateMinVersion = exports.updateMajorVersion = void 0;
|
|
4
|
+
exports.update160000 = update160000;
|
|
5
|
+
exports.updateProject = updateProject;
|
|
6
|
+
exports.updateI18NFiles = updateI18NFiles;
|
|
4
7
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
8
|
const chalk = require("chalk");
|
|
6
9
|
const index_1 = require("../../update-dependencies/index");
|
|
@@ -19,7 +22,6 @@ function update160000(options) {
|
|
|
19
22
|
]);
|
|
20
23
|
};
|
|
21
24
|
}
|
|
22
|
-
exports.update160000 = update160000;
|
|
23
25
|
function updateProject(_options) {
|
|
24
26
|
return (_tree, _context) => {
|
|
25
27
|
return (0, schematics_1.chain)([
|
|
@@ -30,7 +32,6 @@ function updateProject(_options) {
|
|
|
30
32
|
]);
|
|
31
33
|
};
|
|
32
34
|
}
|
|
33
|
-
exports.updateProject = updateProject;
|
|
34
35
|
function check(_options) {
|
|
35
36
|
return (tree, _context) => {
|
|
36
37
|
(0, logging_1.logInfoWithDescriptor)(`Vorbedingungen werden geprüft...`);
|
|
@@ -48,7 +49,6 @@ function updateI18NFiles() {
|
|
|
48
49
|
(0, util_1.messageInfoRule)(`I18n-Dateien wurden angepasst.`);
|
|
49
50
|
};
|
|
50
51
|
}
|
|
51
|
-
exports.updateI18NFiles = updateI18NFiles;
|
|
52
52
|
exports.i18nDe = `<trans-unit id="luxc.dialog.btn.close.arialabel" datatype="html">
|
|
53
53
|
<source>Dialog schließen</source>
|
|
54
54
|
<context-group purpose="location">
|
package/updates/16.0.1/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.update160001 =
|
|
3
|
+
exports.update160001 = update160001;
|
|
4
4
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
5
|
const chalk = require("chalk");
|
|
6
6
|
const index_1 = require("../../update-dependencies/index");
|
|
@@ -16,4 +16,3 @@ function update160001(_options, runNpmInstall = true) {
|
|
|
16
16
|
]);
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
|
-
exports.update160001 = update160001;
|
package/updates/16.1.0/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.update160100 =
|
|
3
|
+
exports.update160100 = update160100;
|
|
4
4
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
5
|
const chalk = require("chalk");
|
|
6
6
|
const index_1 = require("../../update-dependencies/index");
|
|
@@ -17,4 +17,3 @@ function update160100(_options, runNpmInstall = true) {
|
|
|
17
17
|
]);
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
|
-
exports.update160100 = update160100;
|
package/updates/16.2.0/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.update160200 =
|
|
3
|
+
exports.update160200 = update160200;
|
|
4
4
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
5
|
const chalk = require("chalk");
|
|
6
6
|
const index_1 = require("../../update-dependencies/index");
|
|
@@ -19,4 +19,3 @@ function update160200(_options, runNpmInstall = true) {
|
|
|
19
19
|
]);
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
exports.update160200 = update160200;
|
package/updates/16.3.0/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.update160300 =
|
|
3
|
+
exports.update160300 = update160300;
|
|
4
4
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
5
|
const chalk = require("chalk");
|
|
6
6
|
const index_1 = require("../../update-dependencies/index");
|
|
@@ -17,4 +17,3 @@ function update160300(_options, runNpmInstall = true) {
|
|
|
17
17
|
]);
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
|
-
exports.update160300 = update160300;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.update160400 = update160400;
|
|
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 update160400(_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 16.4.0 aktualisiert...`),
|
|
12
|
+
(0, util_1.messageInfoRule)(`Die Datei "package.json" wird angepasst...`),
|
|
13
|
+
(0, index_1.updateDep)('@ihk-gfi/lux-components', '16.4.0', false),
|
|
14
|
+
(0, index_1.updateDep)('@ihk-gfi/lux-components-theme', '16.2.0', false),
|
|
15
|
+
(0, util_1.messageSuccessRule)(`Die LUX-Components wurden auf die Version 16.4.0 aktualisiert.`),
|
|
16
|
+
(0, util_1.finish)(runNpmInstall, `${chalk.yellowBright('Fertig!')}`)
|
|
17
|
+
]);
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "luxupdate160400Schema",
|
|
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,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.update160401 = update160401;
|
|
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 update160401(_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 16.4.1 aktualisiert...`),
|
|
12
|
+
(0, util_1.messageInfoRule)(`Die Datei "package.json" wird angepasst...`),
|
|
13
|
+
(0, index_1.updateDep)('@ihk-gfi/lux-components', '16.4.1', false),
|
|
14
|
+
(0, util_1.messageSuccessRule)(`Die LUX-Components wurden auf die Version 16.4.1 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": "luxupdate160401Schema",
|
|
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
|
+
}
|
package/utility/dependencies.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.NodeDependencyType = void 0;
|
|
4
|
+
exports.hasPackageJsonDependency = hasPackageJsonDependency;
|
|
5
|
+
exports.getPackageJsonDependency = getPackageJsonDependency;
|
|
6
|
+
exports.updateDependency = updateDependency;
|
|
7
|
+
exports.updateDependencyDev = updateDependencyDev;
|
|
8
|
+
exports.updatePackageJsonDependency = updatePackageJsonDependency;
|
|
9
|
+
exports.deletePackageJsonDependency = deletePackageJsonDependency;
|
|
4
10
|
const chalk = require("chalk");
|
|
5
11
|
const jsonc_parser_1 = require("jsonc-parser");
|
|
6
12
|
const files_1 = require("./files");
|
|
@@ -33,7 +39,6 @@ function hasPackageJsonDependency(tree, name) {
|
|
|
33
39
|
});
|
|
34
40
|
return dependency;
|
|
35
41
|
}
|
|
36
|
-
exports.hasPackageJsonDependency = hasPackageJsonDependency;
|
|
37
42
|
/**
|
|
38
43
|
* Versucht eine Dependency aus der package.json auslesen und gibt diese zurück.
|
|
39
44
|
* @param tree
|
|
@@ -59,7 +64,6 @@ function getPackageJsonDependency(tree, name) {
|
|
|
59
64
|
throw (0, logging_1.formattedSchematicsException)(`Dependency ${name} nicht in der package.json gefunden.`);
|
|
60
65
|
}
|
|
61
66
|
}
|
|
62
|
-
exports.getPackageJsonDependency = getPackageJsonDependency;
|
|
63
67
|
/**
|
|
64
68
|
* Aktualisiert eine Dependency in der package.json bzw. fügt diese hinzu, falls sie noch nicht vorhanden ist.
|
|
65
69
|
* @param tree
|
|
@@ -69,7 +73,6 @@ exports.getPackageJsonDependency = getPackageJsonDependency;
|
|
|
69
73
|
function updateDependency(tree, name, version) {
|
|
70
74
|
updatePackageJsonDependency(tree, { type: NodeDependencyType.Default, name: name, version: version });
|
|
71
75
|
}
|
|
72
|
-
exports.updateDependency = updateDependency;
|
|
73
76
|
/**
|
|
74
77
|
* Aktualisiert eine Dependency in der package.json bzw. fügt diese hinzu, falls sie noch nicht vorhanden ist.
|
|
75
78
|
* @param tree
|
|
@@ -79,7 +82,6 @@ exports.updateDependency = updateDependency;
|
|
|
79
82
|
function updateDependencyDev(tree, name, version) {
|
|
80
83
|
updatePackageJsonDependency(tree, { type: NodeDependencyType.Dev, name: name, version: version });
|
|
81
84
|
}
|
|
82
|
-
exports.updateDependencyDev = updateDependencyDev;
|
|
83
85
|
/**
|
|
84
86
|
* Aktualisiert eine Dependency in der package.json bzw. fügt diese hinzu, falls sie noch nicht vorhanden ist.
|
|
85
87
|
* @param tree
|
|
@@ -108,11 +110,9 @@ function updatePackageJsonDependency(tree, dependency) {
|
|
|
108
110
|
}
|
|
109
111
|
}
|
|
110
112
|
}
|
|
111
|
-
exports.updatePackageJsonDependency = updatePackageJsonDependency;
|
|
112
113
|
function deletePackageJsonDependency(tree, context, dependency) {
|
|
113
114
|
const changed = (0, files_1.deleteLineFromFile)(tree, context, '/package.json', dependency.name, false);
|
|
114
115
|
if (changed) {
|
|
115
116
|
(0, logging_1.logInfo)(`Dependency ` + chalk.yellowBright(`${dependency.name}`) + ` wurde aus dem Abschnitt ${dependency.type} gelöscht.`);
|
|
116
117
|
}
|
|
117
118
|
}
|
|
118
|
-
exports.deletePackageJsonDependency = deletePackageJsonDependency;
|
package/utility/files.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.deleteLineFromFile = deleteLineFromFile;
|
|
4
|
+
exports.writeLinesToFile = writeLinesToFile;
|
|
5
|
+
exports.iterateFilesAndModifyContent = iterateFilesAndModifyContent;
|
|
6
|
+
exports.moveFilesToDirectory = moveFilesToDirectory;
|
|
7
|
+
exports.deleteFilesInDirectory = deleteFilesInDirectory;
|
|
8
|
+
exports.searchInComponentAndModifyModule = searchInComponentAndModifyModule;
|
|
9
|
+
exports.findModule = findModule;
|
|
10
|
+
exports.deleteFile = deleteFile;
|
|
4
11
|
const core_1 = require("@angular-devkit/core");
|
|
5
12
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
6
13
|
const logging_1 = require("./logging");
|
|
@@ -69,7 +76,6 @@ function deleteLineFromFile(tree, _context, filePath, searchString, withLog = tr
|
|
|
69
76
|
}
|
|
70
77
|
return changed;
|
|
71
78
|
}
|
|
72
|
-
exports.deleteLineFromFile = deleteLineFromFile;
|
|
73
79
|
/**
|
|
74
80
|
* Schreibt die übergebenen Zeilen in die Datei.
|
|
75
81
|
* Wenn die Datei existiert, wird der neue Inhalt am Ende der Datei angehangen.
|
|
@@ -96,7 +102,6 @@ function writeLinesToFile(tree, _context, filePath, ...lines) {
|
|
|
96
102
|
(0, logging_1.logInfo)(`Erstelle die Datei "${filePath}" und füge Inhalt hinzu.`);
|
|
97
103
|
}
|
|
98
104
|
}
|
|
99
|
-
exports.writeLinesToFile = writeLinesToFile;
|
|
100
105
|
/**
|
|
101
106
|
* Iteriert über alle Dateien vom Root-Pfad aus.
|
|
102
107
|
* Über die filePathEndings lassen sich Einschränkungen bzgl. des Datei-Typs festlegen (z.B. .html).
|
|
@@ -137,7 +142,6 @@ function iterateFilesAndModifyContent(tree, rootPath = '', callback, ...filePath
|
|
|
137
142
|
callback(filePath, content.toString());
|
|
138
143
|
});
|
|
139
144
|
}
|
|
140
|
-
exports.iterateFilesAndModifyContent = iterateFilesAndModifyContent;
|
|
141
145
|
/**
|
|
142
146
|
* Diese Methode ersetzt die angegebene Dateien. Sollten diese nicht existieren, werden sie neu angelegt.
|
|
143
147
|
*
|
|
@@ -177,7 +181,6 @@ function moveFilesToDirectory(options, sourcePath, targetPath) {
|
|
|
177
181
|
return (0, schematics_1.mergeWith)(templateSource, schematics_1.MergeStrategy.Overwrite);
|
|
178
182
|
};
|
|
179
183
|
}
|
|
180
|
-
exports.moveFilesToDirectory = moveFilesToDirectory;
|
|
181
184
|
/**
|
|
182
185
|
* Diese Methode löscht die Dateien in dem angegebenen Ordner.
|
|
183
186
|
*
|
|
@@ -206,7 +209,6 @@ function deleteFilesInDirectory(options, path, exclude) {
|
|
|
206
209
|
return tree;
|
|
207
210
|
};
|
|
208
211
|
}
|
|
209
|
-
exports.deleteFilesInDirectory = deleteFilesInDirectory;
|
|
210
212
|
function searchInComponentAndModifyModule(tree, rootPath, searchStrings, callback, ...filePathEndings) {
|
|
211
213
|
tree.getDir(rootPath).visit((filePath) => {
|
|
212
214
|
// Ignoriere folende Odner
|
|
@@ -254,7 +256,6 @@ function searchInComponentAndModifyModule(tree, rootPath, searchStrings, callbac
|
|
|
254
256
|
}
|
|
255
257
|
});
|
|
256
258
|
}
|
|
257
|
-
exports.searchInComponentAndModifyModule = searchInComponentAndModifyModule;
|
|
258
259
|
/**
|
|
259
260
|
* Function to find the "closest" module to a generated file's path.
|
|
260
261
|
*
|
|
@@ -283,7 +284,6 @@ function findModule(host, generateDir, moduleExt = '.module.ts', routingModuleEx
|
|
|
283
284
|
: 'Could not find an NgModule. Use the skip-import option to skip importing in NgModule.';
|
|
284
285
|
throw new Error(errorMsg);
|
|
285
286
|
}
|
|
286
|
-
exports.findModule = findModule;
|
|
287
287
|
/**
|
|
288
288
|
* Löscht die Datei aus dem gegebenen Pfad.
|
|
289
289
|
* @param options
|
|
@@ -306,4 +306,3 @@ function deleteFile(options, targetPath) {
|
|
|
306
306
|
return tree;
|
|
307
307
|
};
|
|
308
308
|
}
|
|
309
|
-
exports.deleteFile = deleteFile;
|
package/utility/json.js
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.jsonFormattingOptions = void 0;
|
|
4
|
+
exports.readJson = readJson;
|
|
5
|
+
exports.readJsonAsString = readJsonAsString;
|
|
6
|
+
exports.appendScript = appendScript;
|
|
7
|
+
exports.updateJsonValue = updateJsonValue;
|
|
8
|
+
exports.deleteJsonValue = deleteJsonValue;
|
|
9
|
+
exports.updateJsonArray = updateJsonArray;
|
|
10
|
+
exports.deleteJsonArray = deleteJsonArray;
|
|
11
|
+
exports.findObjectIndexInArray = findObjectIndexInArray;
|
|
12
|
+
exports.findObjectPropertyInArray = findObjectPropertyInArray;
|
|
13
|
+
exports.findStringInArray = findStringInArray;
|
|
14
|
+
exports.findStringIndexInArray = findStringIndexInArray;
|
|
15
|
+
exports.removeJsonNode = removeJsonNode;
|
|
4
16
|
const jsonc_parser_1 = require("jsonc-parser");
|
|
5
17
|
const logging_1 = require("./logging");
|
|
6
18
|
exports.jsonFormattingOptions = {
|
|
@@ -23,7 +35,6 @@ function readJson(tree, filePath) {
|
|
|
23
35
|
let result = (0, jsonc_parser_1.parseTree)(content);
|
|
24
36
|
return result;
|
|
25
37
|
}
|
|
26
|
-
exports.readJson = readJson;
|
|
27
38
|
/**
|
|
28
39
|
* Liest die Json-Datei aus und wirft Fehlermeldungen, sollte die Json-Datei nicht gefunden oder
|
|
29
40
|
* in einem falschen Format sein.
|
|
@@ -37,7 +48,6 @@ function readJsonAsString(tree, filePath) {
|
|
|
37
48
|
}
|
|
38
49
|
return buffer.toString();
|
|
39
50
|
}
|
|
40
|
-
exports.readJsonAsString = readJsonAsString;
|
|
41
51
|
/**
|
|
42
52
|
* Diese Methode fügt dem Skript den Teil am Index hinzu.
|
|
43
53
|
* Beispiel 1:
|
|
@@ -66,7 +76,6 @@ function appendScript(script, part, index) {
|
|
|
66
76
|
}
|
|
67
77
|
return newSkript;
|
|
68
78
|
}
|
|
69
|
-
exports.appendScript = appendScript;
|
|
70
79
|
function updateJsonValue(filePath, jsonPath, value, onlyUpdate = false) {
|
|
71
80
|
return (tree, _context) => {
|
|
72
81
|
const found = (0, jsonc_parser_1.findNodeAtLocation)(readJson(tree, filePath), jsonPath);
|
|
@@ -88,11 +97,9 @@ function updateJsonValue(filePath, jsonPath, value, onlyUpdate = false) {
|
|
|
88
97
|
}
|
|
89
98
|
};
|
|
90
99
|
}
|
|
91
|
-
exports.updateJsonValue = updateJsonValue;
|
|
92
100
|
function deleteJsonValue(filePath, jsonPath) {
|
|
93
101
|
return updateJsonValue(filePath, jsonPath, void 0, true);
|
|
94
102
|
}
|
|
95
|
-
exports.deleteJsonValue = deleteJsonValue;
|
|
96
103
|
function updateJsonArray(filePath, jsonPath, value, onlyUpdate = false, findFn, message) {
|
|
97
104
|
return (tree, _context) => {
|
|
98
105
|
// Gibt es bereits eine passende Stelle?
|
|
@@ -137,11 +144,9 @@ function updateJsonArray(filePath, jsonPath, value, onlyUpdate = false, findFn,
|
|
|
137
144
|
}
|
|
138
145
|
};
|
|
139
146
|
}
|
|
140
|
-
exports.updateJsonArray = updateJsonArray;
|
|
141
147
|
function deleteJsonArray(filePath, jsonPath, findFn) {
|
|
142
148
|
return updateJsonArray(filePath, jsonPath, void 0, true, findFn, `${filePath}: Wert aus dem Array an der Stelle "${jsonPath.join('.')}" gelöscht.`);
|
|
143
149
|
}
|
|
144
|
-
exports.deleteJsonArray = deleteJsonArray;
|
|
145
150
|
/**
|
|
146
151
|
* Diese Methode liefert den Index im Array des Objekts mit der übergebenen Property zurück.
|
|
147
152
|
*
|
|
@@ -192,7 +197,6 @@ function findObjectIndexInArray(arrayNode, propertyName, propertyValue) {
|
|
|
192
197
|
}
|
|
193
198
|
return arrayIndex;
|
|
194
199
|
}
|
|
195
|
-
exports.findObjectIndexInArray = findObjectIndexInArray;
|
|
196
200
|
function findObjectPropertyInArray(node, propertyName, propertyValue) {
|
|
197
201
|
var _a;
|
|
198
202
|
let found = false;
|
|
@@ -212,7 +216,6 @@ function findObjectPropertyInArray(node, propertyName, propertyValue) {
|
|
|
212
216
|
}
|
|
213
217
|
return found;
|
|
214
218
|
}
|
|
215
|
-
exports.findObjectPropertyInArray = findObjectPropertyInArray;
|
|
216
219
|
function findStringInArray(arrayNode, value) {
|
|
217
220
|
let found = false;
|
|
218
221
|
if (arrayNode.type === 'string' && arrayNode.value === value) {
|
|
@@ -220,7 +223,6 @@ function findStringInArray(arrayNode, value) {
|
|
|
220
223
|
}
|
|
221
224
|
return found;
|
|
222
225
|
}
|
|
223
|
-
exports.findStringInArray = findStringInArray;
|
|
224
226
|
/**
|
|
225
227
|
* Diese Methode liefert den Index im Array des Werts zurück.
|
|
226
228
|
*
|
|
@@ -253,7 +255,6 @@ function findStringIndexInArray(arrayNode, value) {
|
|
|
253
255
|
}
|
|
254
256
|
return arrayIndex;
|
|
255
257
|
}
|
|
256
|
-
exports.findStringIndexInArray = findStringIndexInArray;
|
|
257
258
|
function removeJsonNode(tree, filePath, jsonPath, message = `Den Abschnitt "${JSON.stringify(jsonPath)}" gelöscht.`) {
|
|
258
259
|
const contentAsNode = readJson(tree, filePath);
|
|
259
260
|
const testAssetsNode = (0, jsonc_parser_1.findNodeAtLocation)(contentAsNode, jsonPath);
|
|
@@ -266,7 +267,6 @@ function removeJsonNode(tree, filePath, jsonPath, message = `Den Abschnitt "${JS
|
|
|
266
267
|
}
|
|
267
268
|
}
|
|
268
269
|
}
|
|
269
|
-
exports.removeJsonNode = removeJsonNode;
|
|
270
270
|
function getLogValue(value) {
|
|
271
271
|
let logValue = JSON.stringify(value);
|
|
272
272
|
return logValue && logValue.startsWith('"') && logValue.endsWith('"') ? logValue : `"${logValue}"`;
|
package/utility/typescript.js
CHANGED
|
@@ -1,6 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getSourceNodes = getSourceNodes;
|
|
4
|
+
exports.addInterface = addInterface;
|
|
5
|
+
exports.removeInterface = removeInterface;
|
|
6
|
+
exports.addImport = addImport;
|
|
7
|
+
exports.removeImport = removeImport;
|
|
8
|
+
exports.removeProvider = removeProvider;
|
|
9
|
+
exports.getSiblings = getSiblings;
|
|
10
|
+
exports.getPrevSibling = getPrevSibling;
|
|
11
|
+
exports.getNextSibling = getNextSibling;
|
|
12
|
+
exports.getNextSiblings = getNextSiblings;
|
|
13
|
+
exports.showTree = showTree;
|
|
14
|
+
exports.findChild = findChild;
|
|
15
|
+
exports.getSyntaxListOfClass = getSyntaxListOfClass;
|
|
16
|
+
exports.getConstructor = getConstructor;
|
|
17
|
+
exports.getMethod = getMethod;
|
|
18
|
+
exports.addParameter = addParameter;
|
|
19
|
+
exports.addMethod = addMethod;
|
|
20
|
+
exports.addConstructorParameter = addConstructorParameter;
|
|
21
|
+
exports.addClassProperty = addClassProperty;
|
|
22
|
+
exports.addConstructorContent = addConstructorContent;
|
|
4
23
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
24
|
const ts = require("typescript");
|
|
6
25
|
const logging_1 = require("./logging");
|
|
@@ -18,7 +37,6 @@ function getSourceNodes(sourceFile) {
|
|
|
18
37
|
}
|
|
19
38
|
return result;
|
|
20
39
|
}
|
|
21
|
-
exports.getSourceNodes = getSourceNodes;
|
|
22
40
|
function addInterface(tree, filePath, interfaceName, logMessage = true) {
|
|
23
41
|
const content = tree.read(filePath).toString();
|
|
24
42
|
const fileName = filePath.substring(filePath.lastIndexOf('/') + 1, filePath.length);
|
|
@@ -68,7 +86,6 @@ function addInterface(tree, filePath, interfaceName, logMessage = true) {
|
|
|
68
86
|
}
|
|
69
87
|
}
|
|
70
88
|
}
|
|
71
|
-
exports.addInterface = addInterface;
|
|
72
89
|
function removeInterface(tree, filePath, interfaceName, logMessage = true) {
|
|
73
90
|
const content = tree.read(filePath).toString();
|
|
74
91
|
const fileName = filePath.substring(filePath.lastIndexOf('/') + 1, filePath.length);
|
|
@@ -82,21 +99,16 @@ function removeInterface(tree, filePath, interfaceName, logMessage = true) {
|
|
|
82
99
|
const heritageClauseNodes = syntaxListNode.getChildren().filter((n) => n.kind === ts.SyntaxKind.HeritageClause);
|
|
83
100
|
if (heritageClauseNodes) {
|
|
84
101
|
heritageClauseNodes.forEach((heritageClauseNode) => {
|
|
85
|
-
const wordNode = heritageClauseNode
|
|
86
|
-
.getChildren()
|
|
87
|
-
.find((n) => n.kind === ts.SyntaxKind.FirstFutureReservedWord);
|
|
102
|
+
const wordNode = heritageClauseNode.getChildren().find((n) => n.kind === ts.SyntaxKind.FirstFutureReservedWord);
|
|
88
103
|
if (wordNode && wordNode.getText() === 'implements') {
|
|
89
|
-
const interfaceSyntaxNode = heritageClauseNode
|
|
90
|
-
.getChildren()
|
|
91
|
-
.find((n) => n.kind === ts.SyntaxKind.SyntaxList);
|
|
104
|
+
const interfaceSyntaxNode = heritageClauseNode.getChildren().find((n) => n.kind === ts.SyntaxKind.SyntaxList);
|
|
92
105
|
if (interfaceSyntaxNode) {
|
|
93
106
|
const interfaceChildren = interfaceSyntaxNode.getChildren();
|
|
94
107
|
if (interfaceChildren) {
|
|
95
108
|
if (interfaceChildren.length === 1) {
|
|
96
109
|
if (interfaceChildren[0].getText() === interfaceName) {
|
|
97
110
|
const updateRecorder = tree.beginUpdate(filePath);
|
|
98
|
-
updateRecorder.remove(heritageClauseNode.pos, heritageClauseNode.getChildren()[heritageClauseNode.getChildren().length - 1].end -
|
|
99
|
-
heritageClauseNode.pos);
|
|
111
|
+
updateRecorder.remove(heritageClauseNode.pos, heritageClauseNode.getChildren()[heritageClauseNode.getChildren().length - 1].end - heritageClauseNode.pos);
|
|
100
112
|
tree.commitUpdate(updateRecorder);
|
|
101
113
|
if (logMessage) {
|
|
102
114
|
(0, logging_1.logInfo)(`Interface ${interfaceName} entfernt.`);
|
|
@@ -136,7 +148,6 @@ function removeInterface(tree, filePath, interfaceName, logMessage = true) {
|
|
|
136
148
|
}
|
|
137
149
|
}
|
|
138
150
|
}
|
|
139
|
-
exports.removeInterface = removeInterface;
|
|
140
151
|
function addImport(tree, filePath, packageName, importName, logMessage = true) {
|
|
141
152
|
const content = tree.read(filePath).toString();
|
|
142
153
|
const fileName = filePath.substring(filePath.lastIndexOf('/') + 1, filePath.length);
|
|
@@ -148,8 +159,7 @@ function addImport(tree, filePath, packageName, importName, logMessage = true) {
|
|
|
148
159
|
importNodes.forEach((node) => {
|
|
149
160
|
const importDeclarationChildren = node.getChildren();
|
|
150
161
|
if (importDeclarationChildren) {
|
|
151
|
-
const importNameNode = importDeclarationChildren.find((n) => n.kind === ts.SyntaxKind.StringLiteral &&
|
|
152
|
-
(n.getText() === `'${packageName}'` || n.getText() === `"${packageName}"`));
|
|
162
|
+
const importNameNode = importDeclarationChildren.find((n) => n.kind === ts.SyntaxKind.StringLiteral && (n.getText() === `'${packageName}'` || n.getText() === `"${packageName}"`));
|
|
153
163
|
if (importNameNode) {
|
|
154
164
|
importNode = node;
|
|
155
165
|
}
|
|
@@ -194,7 +204,6 @@ function addImport(tree, filePath, packageName, importName, logMessage = true) {
|
|
|
194
204
|
}
|
|
195
205
|
}
|
|
196
206
|
}
|
|
197
|
-
exports.addImport = addImport;
|
|
198
207
|
function removeImport(tree, filePath, packageName, importName, logMessage = true) {
|
|
199
208
|
const content = tree.read(filePath).toString();
|
|
200
209
|
const fileName = filePath.substring(filePath.lastIndexOf('/') + 1, filePath.length);
|
|
@@ -272,7 +281,6 @@ function removeImport(tree, filePath, packageName, importName, logMessage = true
|
|
|
272
281
|
});
|
|
273
282
|
}
|
|
274
283
|
}
|
|
275
|
-
exports.removeImport = removeImport;
|
|
276
284
|
function removeProvider(tree, filePath, providerName, logMessage = true) {
|
|
277
285
|
const content = tree.read(filePath).toString();
|
|
278
286
|
const fileName = filePath.substring(filePath.lastIndexOf('/') + 1, filePath.length);
|
|
@@ -316,7 +324,6 @@ function removeProvider(tree, filePath, providerName, logMessage = true) {
|
|
|
316
324
|
}
|
|
317
325
|
}
|
|
318
326
|
}
|
|
319
|
-
exports.removeProvider = removeProvider;
|
|
320
327
|
function getSiblings(node, childKind) {
|
|
321
328
|
let result = [];
|
|
322
329
|
if (node && node.parent.getChildren()) {
|
|
@@ -325,15 +332,14 @@ function getSiblings(node, childKind) {
|
|
|
325
332
|
if (!childNode) {
|
|
326
333
|
throw new schematics_1.SchematicsException(`Es konnte kein Knoten vom Typ ${childKind} gefunden werden.`);
|
|
327
334
|
}
|
|
328
|
-
result = childNode.getChildren();
|
|
335
|
+
result = [...childNode.getChildren()];
|
|
329
336
|
}
|
|
330
337
|
else {
|
|
331
|
-
result = node.parent.getChildren();
|
|
338
|
+
result = [...node.parent.getChildren()];
|
|
332
339
|
}
|
|
333
340
|
}
|
|
334
341
|
return result;
|
|
335
342
|
}
|
|
336
|
-
exports.getSiblings = getSiblings;
|
|
337
343
|
function getPrevSibling(node, childKind) {
|
|
338
344
|
let result = null;
|
|
339
345
|
if (node) {
|
|
@@ -347,7 +353,6 @@ function getPrevSibling(node, childKind) {
|
|
|
347
353
|
}
|
|
348
354
|
return result;
|
|
349
355
|
}
|
|
350
|
-
exports.getPrevSibling = getPrevSibling;
|
|
351
356
|
function getNextSibling(node, childKind) {
|
|
352
357
|
let result = null;
|
|
353
358
|
if (node) {
|
|
@@ -361,7 +366,6 @@ function getNextSibling(node, childKind) {
|
|
|
361
366
|
}
|
|
362
367
|
return result;
|
|
363
368
|
}
|
|
364
|
-
exports.getNextSibling = getNextSibling;
|
|
365
369
|
function getNextSiblings(node) {
|
|
366
370
|
let result = [];
|
|
367
371
|
if (node) {
|
|
@@ -375,7 +379,6 @@ function getNextSiblings(node) {
|
|
|
375
379
|
}
|
|
376
380
|
return result;
|
|
377
381
|
}
|
|
378
|
-
exports.getNextSiblings = getNextSiblings;
|
|
379
382
|
function showTree(node, indent = ' ') {
|
|
380
383
|
console.log(indent + ts.SyntaxKind[node.kind]);
|
|
381
384
|
if (node.getChildCount() === 0) {
|
|
@@ -385,7 +388,6 @@ function showTree(node, indent = ' ') {
|
|
|
385
388
|
showTree(child, indent + ' ');
|
|
386
389
|
}
|
|
387
390
|
}
|
|
388
|
-
exports.showTree = showTree;
|
|
389
391
|
function findChild(node, kind, text) {
|
|
390
392
|
if (node.kind === kind && (!text || node.getText() === text)) {
|
|
391
393
|
return node;
|
|
@@ -400,7 +402,6 @@ function findChild(node, kind, text) {
|
|
|
400
402
|
}
|
|
401
403
|
return undefined;
|
|
402
404
|
}
|
|
403
|
-
exports.findChild = findChild;
|
|
404
405
|
function getSyntaxListOfClass(tree, filePath) {
|
|
405
406
|
const content = tree.read(filePath).toString();
|
|
406
407
|
const fileName = filePath.substring(filePath.lastIndexOf('/') + 1, filePath.length);
|
|
@@ -410,7 +411,7 @@ function getSyntaxListOfClass(tree, filePath) {
|
|
|
410
411
|
if (!classNode) {
|
|
411
412
|
throw new schematics_1.SchematicsException(`Die Klasse in der Datei ${fileName} hat kein ClassKeyword.`);
|
|
412
413
|
}
|
|
413
|
-
const firstPunctuationNode = getNextSiblings(classNode).find(n => n.kind === ts.SyntaxKind.FirstPunctuation);
|
|
414
|
+
const firstPunctuationNode = getNextSiblings(classNode).find((n) => n.kind === ts.SyntaxKind.FirstPunctuation);
|
|
414
415
|
if (!firstPunctuationNode) {
|
|
415
416
|
throw new schematics_1.SchematicsException(`Die Klasse in der Datei ${fileName} hat keine FirstPunctuation.`);
|
|
416
417
|
}
|
|
@@ -420,15 +421,12 @@ function getSyntaxListOfClass(tree, filePath) {
|
|
|
420
421
|
}
|
|
421
422
|
return syntaxListNode;
|
|
422
423
|
}
|
|
423
|
-
exports.getSyntaxListOfClass = getSyntaxListOfClass;
|
|
424
424
|
function getConstructor(tree, filePath) {
|
|
425
425
|
return findChild(getSyntaxListOfClass(tree, filePath), ts.SyntaxKind.Constructor);
|
|
426
426
|
}
|
|
427
|
-
exports.getConstructor = getConstructor;
|
|
428
427
|
function getMethod(tree, filePath, methodeName) {
|
|
429
428
|
return findChild(getSyntaxListOfClass(tree, filePath), ts.SyntaxKind.MethodDeclaration, methodeName);
|
|
430
429
|
}
|
|
431
|
-
exports.getMethod = getMethod;
|
|
432
430
|
function addParameter(tree, filePath, syntaxListNode, service) {
|
|
433
431
|
const parameterNodes = syntaxListNode.getChildren();
|
|
434
432
|
const updateRecorder = tree.beginUpdate(filePath);
|
|
@@ -442,10 +440,9 @@ function addParameter(tree, filePath, syntaxListNode, service) {
|
|
|
442
440
|
}
|
|
443
441
|
tree.commitUpdate(updateRecorder);
|
|
444
442
|
}
|
|
445
|
-
exports.addParameter = addParameter;
|
|
446
443
|
function addMethod(tree, filePath, _syntaxListNode, method) {
|
|
447
444
|
const syntaxList = getSyntaxListOfClass(tree, filePath);
|
|
448
|
-
const methodNodes = syntaxList.getChildren().filter(n => n.kind === ts.SyntaxKind.MethodDeclaration);
|
|
445
|
+
const methodNodes = syntaxList.getChildren().filter((n) => n.kind === ts.SyntaxKind.MethodDeclaration);
|
|
449
446
|
let startNode = syntaxList;
|
|
450
447
|
if (methodNodes && methodNodes.length > 0) {
|
|
451
448
|
startNode = methodNodes[methodNodes.length - 1];
|
|
@@ -454,7 +451,6 @@ function addMethod(tree, filePath, _syntaxListNode, method) {
|
|
|
454
451
|
updateRecorder.insertLeft(startNode.end, '\n' + method);
|
|
455
452
|
tree.commitUpdate(updateRecorder);
|
|
456
453
|
}
|
|
457
|
-
exports.addMethod = addMethod;
|
|
458
454
|
function addConstructorParameter(tree, filePath, service) {
|
|
459
455
|
const constructorNode = getConstructor(tree, filePath);
|
|
460
456
|
if (constructorNode) {
|
|
@@ -469,35 +465,33 @@ function addConstructorParameter(tree, filePath, service) {
|
|
|
469
465
|
(0, logging_1.logInfo)(`constructor(${service}) {} hinzugefügt.`);
|
|
470
466
|
}
|
|
471
467
|
}
|
|
472
|
-
exports.addConstructorParameter = addConstructorParameter;
|
|
473
468
|
function addClassProperty(tree, filePath, property) {
|
|
474
469
|
const syntaxListNode = getSyntaxListOfClass(tree, filePath);
|
|
475
470
|
if (!syntaxListNode) {
|
|
476
471
|
throw new schematics_1.SchematicsException(`Die Klasse in der Datei ${filePath} hat keine Syntaxlist.`);
|
|
477
472
|
}
|
|
478
|
-
const startNode = syntaxListNode.getChildren() && syntaxListNode.getChildren().length > 0
|
|
479
|
-
? syntaxListNode.getChildren()[0]
|
|
480
|
-
: syntaxListNode;
|
|
473
|
+
const startNode = syntaxListNode.getChildren() && syntaxListNode.getChildren().length > 0 ? syntaxListNode.getChildren()[0] : syntaxListNode;
|
|
481
474
|
const updateRecorder = tree.beginUpdate(filePath);
|
|
482
475
|
updateRecorder.insertLeft(startNode.pos, '\n\n ' + property + '\n');
|
|
483
476
|
tree.commitUpdate(updateRecorder);
|
|
484
477
|
(0, logging_1.logInfo)(`Die Property "${property}" wurde hinzugefügt.`);
|
|
485
478
|
}
|
|
486
|
-
exports.addClassProperty = addClassProperty;
|
|
487
479
|
function addConstructorContent(tree, filePath, content, append) {
|
|
488
480
|
const constructorNode = getConstructor(tree, filePath);
|
|
489
481
|
if (constructorNode) {
|
|
490
|
-
const blockNode = constructorNode.getChildren().find(n => n.kind === ts.SyntaxKind.Block);
|
|
482
|
+
const blockNode = constructorNode.getChildren().find((n) => n.kind === ts.SyntaxKind.Block);
|
|
491
483
|
if (!blockNode) {
|
|
492
484
|
throw new schematics_1.SchematicsException(`Der Konstruktor in der Klasse ${filePath} hat keinen Block.`);
|
|
493
485
|
}
|
|
494
|
-
const firstPunctuationNode = blockNode.getChildren().find(n => n.kind === ts.SyntaxKind.FirstPunctuation);
|
|
486
|
+
const firstPunctuationNode = blockNode.getChildren().find((n) => n.kind === ts.SyntaxKind.FirstPunctuation);
|
|
495
487
|
if (!firstPunctuationNode) {
|
|
496
488
|
throw new schematics_1.SchematicsException(`Der Konstruktor in der Klasse ${filePath} hat keine FirstPunctuation.`);
|
|
497
489
|
}
|
|
498
490
|
const syntaxListNode = getNextSibling(firstPunctuationNode);
|
|
499
491
|
if (syntaxListNode && syntaxListNode.getChildren().length > 0) {
|
|
500
|
-
const start = append
|
|
492
|
+
const start = append
|
|
493
|
+
? syntaxListNode.getChildren()[syntaxListNode.getChildren().length - 1].end
|
|
494
|
+
: syntaxListNode.getChildren()[0].pos;
|
|
501
495
|
const updateRecorder = tree.beginUpdate(filePath);
|
|
502
496
|
updateRecorder.insertLeft(start, '\n ' + content);
|
|
503
497
|
tree.commitUpdate(updateRecorder);
|
|
@@ -517,4 +511,3 @@ function addConstructorContent(tree, filePath, content, append) {
|
|
|
517
511
|
(0, logging_1.logInfo)(`Konstruktor mit Inhalt hinzugefügt.`);
|
|
518
512
|
}
|
|
519
513
|
}
|
|
520
|
-
exports.addConstructorContent = addConstructorContent;
|
package/utility/util.js
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.runInstallAndLogToDos = exports.waitForTreeCallback = exports.UtilConfig = void 0;
|
|
4
|
+
exports.escapeRegExp = escapeRegExp;
|
|
5
|
+
exports.replaceFirst = replaceFirst;
|
|
6
|
+
exports.replaceAll = replaceAll;
|
|
7
|
+
exports.updateI18nFile = updateI18nFile;
|
|
8
|
+
exports.applyRuleIfFileExists = applyRuleIfFileExists;
|
|
9
|
+
exports.applyRuleIf = applyRuleIf;
|
|
10
|
+
exports.messageDebugRule = messageDebugRule;
|
|
11
|
+
exports.messageInfoRule = messageInfoRule;
|
|
12
|
+
exports.messageInfoInternRule = messageInfoInternRule;
|
|
13
|
+
exports.messageSuccessRule = messageSuccessRule;
|
|
14
|
+
exports.finish = finish;
|
|
4
15
|
const tasks_1 = require("@angular-devkit/schematics/tasks");
|
|
5
16
|
const rxjs_1 = require("rxjs");
|
|
6
17
|
const operators_1 = require("rxjs/operators");
|
|
@@ -17,15 +28,12 @@ exports.UtilConfig = {
|
|
|
17
28
|
function escapeRegExp(str) {
|
|
18
29
|
return str.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, '\\$1');
|
|
19
30
|
}
|
|
20
|
-
exports.escapeRegExp = escapeRegExp;
|
|
21
31
|
function replaceFirst(str, find, replace) {
|
|
22
32
|
return str.replace(new RegExp(escapeRegExp(find), 'm'), replace);
|
|
23
33
|
}
|
|
24
|
-
exports.replaceFirst = replaceFirst;
|
|
25
34
|
function replaceAll(str, find, replace) {
|
|
26
35
|
return str.replace(new RegExp(escapeRegExp(find), 'gm'), replace);
|
|
27
36
|
}
|
|
28
|
-
exports.replaceAll = replaceAll;
|
|
29
37
|
/**
|
|
30
38
|
* Wartet die übergebene Zeitspanne und ruft dann den Callback auf.
|
|
31
39
|
* Gibt anschließend den Tree über ein Observable zurück.
|
|
@@ -96,7 +104,6 @@ function updateI18nFile(tree, language, insertTransUnitId, translations) {
|
|
|
96
104
|
}
|
|
97
105
|
}
|
|
98
106
|
}
|
|
99
|
-
exports.updateI18nFile = updateI18nFile;
|
|
100
107
|
function applyRuleIfFileExists(rule, path) {
|
|
101
108
|
return (tree, _context) => {
|
|
102
109
|
if (tree.exists(path)) {
|
|
@@ -107,7 +114,6 @@ function applyRuleIfFileExists(rule, path) {
|
|
|
107
114
|
}
|
|
108
115
|
};
|
|
109
116
|
}
|
|
110
|
-
exports.applyRuleIfFileExists = applyRuleIfFileExists;
|
|
111
117
|
function applyRuleIf(minVersion, rule) {
|
|
112
118
|
return (tree, _context) => {
|
|
113
119
|
let version = (0, dependencies_1.getPackageJsonDependency)(tree, '@ihk-gfi/lux-components').version;
|
|
@@ -119,7 +125,6 @@ function applyRuleIf(minVersion, rule) {
|
|
|
119
125
|
}
|
|
120
126
|
};
|
|
121
127
|
}
|
|
122
|
-
exports.applyRuleIf = applyRuleIf;
|
|
123
128
|
function messageDebugRule(message, options) {
|
|
124
129
|
return (_tree, _context) => {
|
|
125
130
|
if (options && options.verbose) {
|
|
@@ -127,29 +132,24 @@ function messageDebugRule(message, options) {
|
|
|
127
132
|
}
|
|
128
133
|
};
|
|
129
134
|
}
|
|
130
|
-
exports.messageDebugRule = messageDebugRule;
|
|
131
135
|
function messageInfoRule(message) {
|
|
132
136
|
return (_tree, _context) => {
|
|
133
137
|
(0, logging_1.logInfoWithDescriptor)(message);
|
|
134
138
|
};
|
|
135
139
|
}
|
|
136
|
-
exports.messageInfoRule = messageInfoRule;
|
|
137
140
|
function messageInfoInternRule(message) {
|
|
138
141
|
return (_tree, _context) => {
|
|
139
142
|
(0, logging_1.logInfo)(message);
|
|
140
143
|
};
|
|
141
144
|
}
|
|
142
|
-
exports.messageInfoInternRule = messageInfoInternRule;
|
|
143
145
|
function messageSuccessRule(message) {
|
|
144
146
|
return (_tree, _context) => {
|
|
145
147
|
(0, logging_1.logSuccess)(message);
|
|
146
148
|
};
|
|
147
149
|
}
|
|
148
|
-
exports.messageSuccessRule = messageSuccessRule;
|
|
149
150
|
function finish(runNpmInstall, ...messages) {
|
|
150
151
|
return (tree, context) => {
|
|
151
152
|
(0, exports.runInstallAndLogToDos)(context, messages, runNpmInstall);
|
|
152
153
|
return tree;
|
|
153
154
|
};
|
|
154
155
|
}
|
|
155
|
-
exports.finish = finish;
|
package/utility/validation.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.validateNodeVersion = validateNodeVersion;
|
|
4
|
+
exports.validateAngularVersion = validateAngularVersion;
|
|
5
|
+
exports.validateLuxComponentsVersion = validateLuxComponentsVersion;
|
|
4
6
|
const chalk = require("chalk");
|
|
5
7
|
const semver = require("semver");
|
|
6
8
|
const dependencies_1 = require("./dependencies");
|
|
@@ -14,7 +16,6 @@ function validateNodeVersion(_context, minimumVersion) {
|
|
|
14
16
|
}
|
|
15
17
|
(0, logging_1.logInfo)(`Nodeversion ${process.versions.node} -> ok`);
|
|
16
18
|
}
|
|
17
|
-
exports.validateNodeVersion = validateNodeVersion;
|
|
18
19
|
/**
|
|
19
20
|
* Prüft die Angular Version der aufrufenden Applikation und wirft eine SchematicsException, wenn
|
|
20
21
|
* die Version nicht der erforderlichen entspricht.
|
|
@@ -29,7 +30,6 @@ function validateAngularVersion(tree, angularVersion) {
|
|
|
29
30
|
}
|
|
30
31
|
(0, logging_1.logInfo)(`Angularversion ${currentVersion} -> ok`);
|
|
31
32
|
}
|
|
32
|
-
exports.validateAngularVersion = validateAngularVersion;
|
|
33
33
|
function validateLuxComponentsVersion(tree, versionRange) {
|
|
34
34
|
const version = (0, dependencies_1.getPackageJsonDependency)(tree, '@ihk-gfi/lux-components').version.replace(/([\^~])/g, '');
|
|
35
35
|
if (!semver.satisfies(version, versionRange)) {
|
|
@@ -39,4 +39,3 @@ function validateLuxComponentsVersion(tree, versionRange) {
|
|
|
39
39
|
}
|
|
40
40
|
(0, logging_1.logInfo)(`LUX-Componentsversion ${version} -> ok`);
|
|
41
41
|
}
|
|
42
|
-
exports.validateLuxComponentsVersion = validateLuxComponentsVersion;
|