@ihk-gfi/lux-components-update 11.3.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/LICENSE +198 -0
- package/README.md +55 -0
- package/package.json +54 -0
- package/src/add-lux-components/files/app/app-routing.module.ts +19 -0
- package/src/add-lux-components/files/app/app.component.html +27 -0
- package/src/add-lux-components/files/app/app.component.spec.ts +19 -0
- package/src/add-lux-components/files/app/app.component.ts +13 -0
- package/src/add-lux-components/files/app/app.module.ts +56 -0
- package/src/add-lux-components/files/app/error/error.component.html +10 -0
- package/src/add-lux-components/files/app/error/error.component.scss +3 -0
- package/src/add-lux-components/files/app/error/error.component.spec.ts +49 -0
- package/src/add-lux-components/files/app/error/error.component.ts +17 -0
- package/src/add-lux-components/files/app/home/home.component.html +7 -0
- package/src/add-lux-components/files/app/home/home.component.scss +0 -0
- package/src/add-lux-components/files/app/home/home.component.ts +13 -0
- package/src/add-lux-components/files/app/profil/profil.component.html +1 -0
- package/src/add-lux-components/files/app/profil/profil.component.scss +0 -0
- package/src/add-lux-components/files/app/profil/profil.component.spec.ts +24 -0
- package/src/add-lux-components/files/app/profil/profil.component.ts +11 -0
- package/src/add-lux-components/files/environments/environment.prod.ts +4 -0
- package/src/add-lux-components/files/environments/environment.ts +17 -0
- package/src/add-lux-components/files/locale/messages.en.xlf +948 -0
- package/src/add-lux-components/files/locale/messages.xlf +822 -0
- package/src/add-lux-components/files/scripts/.browserslistrc +17 -0
- package/src/add-lux-components/files/src/polyfills.ts +68 -0
- package/src/add-lux-components/index.d.ts +10 -0
- package/src/add-lux-components/index.js +143 -0
- package/src/add-lux-components/index.js.map +1 -0
- package/src/add-lux-components/index.ts +183 -0
- package/src/add-lux-components/index_spec.d.ts +1 -0
- package/src/add-lux-components/index_spec.js +51 -0
- package/src/add-lux-components/index_spec.js.map +1 -0
- package/src/add-lux-components/index_spec.ts +55 -0
- package/src/add-lux-components/schema.json +23 -0
- package/src/collection.json +55 -0
- package/src/migrate-to-eslint/files/.eslintrc.json +68 -0
- package/src/migrate-to-eslint/files/.prettierrc +25 -0
- package/src/migrate-to-eslint/index.d.ts +6 -0
- package/src/migrate-to-eslint/index.js +149 -0
- package/src/migrate-to-eslint/index.js.map +1 -0
- package/src/migrate-to-eslint/index.ts +181 -0
- package/src/migrate-to-eslint/index_spec.d.ts +1 -0
- package/src/migrate-to-eslint/index_spec.js +129 -0
- package/src/migrate-to-eslint/index_spec.js.map +1 -0
- package/src/migrate-to-eslint/index_spec.ts +152 -0
- package/src/migrate-to-eslint/schema.json +23 -0
- package/src/migrate-to-webcomponent/index.d.ts +10 -0
- package/src/migrate-to-webcomponent/index.js +278 -0
- package/src/migrate-to-webcomponent/index.js.map +1 -0
- package/src/migrate-to-webcomponent/index.ts +331 -0
- package/src/migrate-to-webcomponent/index_spec.d.ts +1 -0
- package/src/migrate-to-webcomponent/index_spec.js +580 -0
- package/src/migrate-to-webcomponent/index_spec.js.map +1 -0
- package/src/migrate-to-webcomponent/index_spec.ts +703 -0
- package/src/migrate-to-webcomponent/schema.json +23 -0
- package/src/update/files/locale/messages.en.xlf +940 -0
- package/src/update/files/locale/messages.xlf +815 -0
- package/src/update/files/scripts/move-de-files.js +15 -0
- package/src/update/index.d.ts +23 -0
- package/src/update/index.js +635 -0
- package/src/update/index.js.map +1 -0
- package/src/update/index.ts +712 -0
- package/src/update/index_spec.d.ts +1 -0
- package/src/update/index_spec.js +990 -0
- package/src/update/index_spec.js.map +1 -0
- package/src/update/index_spec.ts +1145 -0
- package/src/update/schema.json +23 -0
- package/src/update-dependencies/index.d.ts +5 -0
- package/src/update-dependencies/index.js +113 -0
- package/src/update-dependencies/index.js.map +1 -0
- package/src/update-dependencies/index.ts +114 -0
- package/src/update-dependencies/schema.json +23 -0
- package/src/update110001/index.d.ts +2 -0
- package/src/update110001/index.js +42 -0
- package/src/update110001/index.js.map +1 -0
- package/src/update110001/index.ts +40 -0
- package/src/update110001/index_spec.d.ts +1 -0
- package/src/update110001/index_spec.js +67 -0
- package/src/update110001/index_spec.js.map +1 -0
- package/src/update110001/index_spec.ts +72 -0
- package/src/update110001/schema.json +23 -0
- package/src/update110100/index.d.ts +2 -0
- package/src/update110100/index.js +27 -0
- package/src/update110100/index.js.map +1 -0
- package/src/update110100/index.ts +24 -0
- package/src/update110100/index_spec.d.ts +1 -0
- package/src/update110100/index_spec.js +69 -0
- package/src/update110100/index_spec.js.map +1 -0
- package/src/update110100/index_spec.ts +73 -0
- package/src/update110100/schema.json +23 -0
- package/src/update110101/index.d.ts +2 -0
- package/src/update110101/index.js +24 -0
- package/src/update110101/index.js.map +1 -0
- package/src/update110101/index.ts +21 -0
- package/src/update110101/index_spec.d.ts +1 -0
- package/src/update110101/index_spec.js +65 -0
- package/src/update110101/index_spec.js.map +1 -0
- package/src/update110101/index_spec.ts +69 -0
- package/src/update110101/schema.json +23 -0
- package/src/update110200/index.d.ts +2 -0
- package/src/update110200/index.js +24 -0
- package/src/update110200/index.js.map +1 -0
- package/src/update110200/index.ts +21 -0
- package/src/update110200/index_spec.d.ts +1 -0
- package/src/update110200/index_spec.js +65 -0
- package/src/update110200/index_spec.js.map +1 -0
- package/src/update110200/index_spec.ts +69 -0
- package/src/update110200/schema.json +23 -0
- package/src/update110300/index.d.ts +2 -0
- package/src/update110300/index.js +133 -0
- package/src/update110300/index.js.map +1 -0
- package/src/update110300/index.ts +148 -0
- package/src/update110300/index_spec.d.ts +1 -0
- package/src/update110300/index_spec.js +121 -0
- package/src/update110300/index_spec.js.map +1 -0
- package/src/update110300/index_spec.ts +139 -0
- package/src/update110300/schema.json +23 -0
- package/src/utility/dependencies.d.ts +39 -0
- package/src/utility/dependencies.js +96 -0
- package/src/utility/dependencies.js.map +1 -0
- package/src/utility/dependencies.ts +116 -0
- package/src/utility/files.d.ts +60 -0
- package/src/utility/files.js +299 -0
- package/src/utility/files.js.map +1 -0
- package/src/utility/files.ts +355 -0
- package/src/utility/html.d.ts +49 -0
- package/src/utility/html.js +183 -0
- package/src/utility/html.js.map +1 -0
- package/src/utility/html.ts +212 -0
- package/src/utility/json.d.ts +34 -0
- package/src/utility/json.js +70 -0
- package/src/utility/json.js.map +1 -0
- package/src/utility/json.ts +70 -0
- package/src/utility/logging.d.ts +32 -0
- package/src/utility/logging.js +82 -0
- package/src/utility/logging.js.map +1 -0
- package/src/utility/logging.ts +80 -0
- package/src/utility/test.d.ts +10 -0
- package/src/utility/test.js +24 -0
- package/src/utility/test.js.map +1 -0
- package/src/utility/test.ts +24 -0
- package/src/utility/typescript.d.ts +22 -0
- package/src/utility/typescript.js +521 -0
- package/src/utility/typescript.js.map +1 -0
- package/src/utility/typescript.ts +598 -0
- package/src/utility/typescript_spec.d.ts +1 -0
- package/src/utility/typescript_spec.js +1006 -0
- package/src/utility/typescript_spec.js.map +1 -0
- package/src/utility/typescript_spec.ts +1267 -0
- package/src/utility/util.d.ts +33 -0
- package/src/utility/util.js +139 -0
- package/src/utility/util.js.map +1 -0
- package/src/utility/util.ts +140 -0
- package/src/utility/validation.d.ts +11 -0
- package/src/utility/validation.js +44 -0
- package/src/utility/validation.js.map +1 -0
- package/src/utility/validation.ts +49 -0
- package/tsconfig.json +37 -0
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
const cheerio = require('cheerio');
|
|
2
|
+
|
|
3
|
+
const luxCherioParserOptions = { xmlMode: true, decodeEntities: false, selfClosingTags: false };
|
|
4
|
+
|
|
5
|
+
export class CheerioInfo {
|
|
6
|
+
content: string;
|
|
7
|
+
updated: boolean;
|
|
8
|
+
|
|
9
|
+
constructor(content: string) {
|
|
10
|
+
this.content = content;
|
|
11
|
+
this.updated = false;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Diese Methode fügt ein neues Attribut hinzu, das zum Selektor passt.
|
|
17
|
+
*
|
|
18
|
+
* @param content
|
|
19
|
+
* @param selector
|
|
20
|
+
* @param attrName
|
|
21
|
+
* @param attrValue
|
|
22
|
+
*/
|
|
23
|
+
export function addAttribute(content: string, selector: string, attrName: string, attrValue: string): CheerioInfo {
|
|
24
|
+
const $ = cheerio.load(content, luxCherioParserOptions);
|
|
25
|
+
|
|
26
|
+
const result = new CheerioInfo(content);
|
|
27
|
+
|
|
28
|
+
$(selector).each(function (i, elem) {
|
|
29
|
+
$(elem).attr(attrName, attrValue);
|
|
30
|
+
result.updated = true;
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
if (result.updated) {
|
|
34
|
+
result.content = $.xml();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return result;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Diese Methode fügt den Wert ans Ende des Attributwertes an, das zum Selektor passt.
|
|
42
|
+
*
|
|
43
|
+
* @param content
|
|
44
|
+
* @param selector
|
|
45
|
+
* @param attrName
|
|
46
|
+
* @param attrValue
|
|
47
|
+
*/
|
|
48
|
+
export function appendAttribute(content: string, selector: string, attrName: string, attrValue: string): CheerioInfo {
|
|
49
|
+
const $ = cheerio.load(content, luxCherioParserOptions);
|
|
50
|
+
|
|
51
|
+
const result = new CheerioInfo(content);
|
|
52
|
+
|
|
53
|
+
$(selector).each(function (i, elem) {
|
|
54
|
+
$(elem).attr(attrName, $(elem).attr(attrName) + attrValue);
|
|
55
|
+
result.updated = true;
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
if (result.updated) {
|
|
59
|
+
result.content = $.xml();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return result;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Diese Methode benennt ein Attribut um, die zum Selektor passen.
|
|
67
|
+
*
|
|
68
|
+
* @param content Der Inhalt eines HTML-Templates.
|
|
69
|
+
* @param selector Ein beliebiger Selektor (z.B. lux-list).
|
|
70
|
+
* @param attrNameOld Ein beliebiger Attributname (z.B. luxItem).
|
|
71
|
+
* @param attrNameNew Ein beliebiger neuer Attributname.
|
|
72
|
+
*/
|
|
73
|
+
export function renameAttribute( content: string, selector: string, attrNameOld: string, attrNameNew: string): CheerioInfo {
|
|
74
|
+
const $ = cheerio.load(content, luxCherioParserOptions);
|
|
75
|
+
|
|
76
|
+
const result = new CheerioInfo(content);
|
|
77
|
+
|
|
78
|
+
$(selector).each(function (i, elem) {
|
|
79
|
+
const attrNameNoBindingOld = attrNameOld;
|
|
80
|
+
const attrNameNoBindingNew = attrNameNew;
|
|
81
|
+
const attrValueNoBinding = $(elem).attr(attrNameNoBindingOld);
|
|
82
|
+
if (attrValueNoBinding) {
|
|
83
|
+
$(elem).removeAttr(attrNameNoBindingOld);
|
|
84
|
+
$(elem).attr(attrNameNoBindingNew, attrValueNoBinding);
|
|
85
|
+
result.updated = true;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const attrNameDataBindingOld = '[' + attrNameOld + ']';
|
|
89
|
+
const attrNameDataBindingNew = '[' + attrNameNew + ']';
|
|
90
|
+
const attrNameDataBindingValue = $(elem).attr(attrNameDataBindingOld);
|
|
91
|
+
if (attrNameDataBindingValue) {
|
|
92
|
+
$(elem).removeAttr(attrNameDataBindingOld);
|
|
93
|
+
$(elem).attr(attrNameDataBindingNew, attrNameDataBindingValue);
|
|
94
|
+
result.updated = true;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const attrNameTwoWayBindingOld = '[(' + attrNameOld + ')]';
|
|
98
|
+
const attrNameTwoWayBindingNew = '[(' + attrNameNew + ')]';
|
|
99
|
+
const attrValueTwoWayBinding = $(elem).attr(attrNameTwoWayBindingOld);
|
|
100
|
+
if (attrValueTwoWayBinding) {
|
|
101
|
+
$(elem).removeAttr(attrNameTwoWayBindingOld);
|
|
102
|
+
$(elem).attr(attrNameTwoWayBindingNew, attrValueTwoWayBinding);
|
|
103
|
+
result.updated = true;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const attrNameEventBindingOld = '(' + attrNameOld + ')';
|
|
107
|
+
const attrNameEventBindingNew = '(' + attrNameNew + ')';
|
|
108
|
+
const attrValueEventBinding = $(elem).attr(attrNameEventBindingOld);
|
|
109
|
+
if (attrValueEventBinding) {
|
|
110
|
+
$(elem).removeAttr(attrNameEventBindingOld);
|
|
111
|
+
$(elem).attr(attrNameEventBindingNew, attrValueEventBinding);
|
|
112
|
+
result.updated = true;
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
if (result.updated) {
|
|
117
|
+
result.content = $.xml();
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return result;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Diese Methode setzt den neuen Wert für das Attribut, die zum Selektor passen.
|
|
125
|
+
*
|
|
126
|
+
* @param content Der Inhalt eines HTML-Templates.
|
|
127
|
+
* @param selector Ein beliebiger Selektor (z.B. lux-list).
|
|
128
|
+
* @param attrName Ein beliebiger Attributname (z.B. luxItem).
|
|
129
|
+
* @param attrValue Ein beliebiger Wert.
|
|
130
|
+
*/
|
|
131
|
+
export function updateAttribute(content: string, selector: string, attrName: string, attrValue: string): CheerioInfo {
|
|
132
|
+
const $ = cheerio.load(content, luxCherioParserOptions);
|
|
133
|
+
|
|
134
|
+
const result = new CheerioInfo(content);
|
|
135
|
+
|
|
136
|
+
$(selector).each(function (i, elem) {
|
|
137
|
+
const attrNameNoBinding = attrName;
|
|
138
|
+
if ($(elem).attr(attrNameNoBinding)) {
|
|
139
|
+
$(elem).attr(attrNameNoBinding, attrValue);
|
|
140
|
+
result.updated = true;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const attrNameDataBinding = '[' + attrName + ']';
|
|
144
|
+
if ($(elem).attr(attrNameDataBinding)) {
|
|
145
|
+
$(elem).attr(attrNameDataBinding, attrValue);
|
|
146
|
+
result.updated = true;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
const attrNameTwoWayBinding = '[(' + attrName + ')]';
|
|
150
|
+
if ($(elem).attr(attrNameTwoWayBinding)) {
|
|
151
|
+
$(elem).attr(attrNameTwoWayBinding, attrValue);
|
|
152
|
+
result.updated = true;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const attrNameEventBinding = '(' + attrName + ')';
|
|
156
|
+
if ($(elem).attr(attrNameEventBinding)) {
|
|
157
|
+
$(elem).attr(attrNameEventBinding, attrValue);
|
|
158
|
+
result.updated = true;
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
if (result.updated) {
|
|
163
|
+
result.content = $.xml();
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return result;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Diese Methode entfernt das Attribut für alle Elemente, die zum Selektor passen.
|
|
171
|
+
*
|
|
172
|
+
* @param content Der Inhalt eines HTML-Templates.
|
|
173
|
+
* @param selector Ein beliebiger Selektor (z.B. lux-list).
|
|
174
|
+
* @param attrName Ein beliebiger Attributname (z.B. luxListItem).
|
|
175
|
+
*/
|
|
176
|
+
export function removeAttribute(content: string, selector: string, attrName: string): CheerioInfo {
|
|
177
|
+
const $ = cheerio.load(content, luxCherioParserOptions);
|
|
178
|
+
|
|
179
|
+
const result = new CheerioInfo(content);
|
|
180
|
+
|
|
181
|
+
$(selector).each(function (i, elem) {
|
|
182
|
+
const attrNameNoBinding = attrName;
|
|
183
|
+
if ($(elem).attr(attrNameNoBinding)) {
|
|
184
|
+
$(elem).removeAttr(attrNameNoBinding);
|
|
185
|
+
result.updated = true;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
const attrNameDataBinding = '[' + attrName + ']';
|
|
189
|
+
if ($(elem).attr(attrNameDataBinding)) {
|
|
190
|
+
$(elem).removeAttr(attrNameDataBinding);
|
|
191
|
+
result.updated = true;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
const attrNameTwoWayBinding = '[(' + attrName + ')]';
|
|
195
|
+
if ($(elem).attr(attrNameTwoWayBinding)) {
|
|
196
|
+
$(elem).removeAttr(attrNameTwoWayBinding);
|
|
197
|
+
result.updated = true;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
const attrNameEventBinding = '(' + attrName + ')';
|
|
201
|
+
if ($(elem).attr(attrNameEventBinding)) {
|
|
202
|
+
$(elem).removeAttr(attrNameEventBinding);
|
|
203
|
+
result.updated = true;
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
if (result.updated) {
|
|
208
|
+
result.content = $.xml();
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
return result;
|
|
212
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Tree } from '@angular-devkit/schematics';
|
|
2
|
+
import { FormattingOptions, Node } from 'jsonc-parser';
|
|
3
|
+
export declare const jsonFormattingOptions: FormattingOptions;
|
|
4
|
+
/**
|
|
5
|
+
* Liest die Json-Datei aus und wirft Fehlermeldungen, sollte die Json-Datei nicht gefunden oder
|
|
6
|
+
* in einem falschen Format sein.
|
|
7
|
+
* @param context
|
|
8
|
+
* @param tree
|
|
9
|
+
*/
|
|
10
|
+
export declare function readJson(tree: Tree, filePath: string): Node;
|
|
11
|
+
/**
|
|
12
|
+
* Liest die Json-Datei aus und wirft Fehlermeldungen, sollte die Json-Datei nicht gefunden oder
|
|
13
|
+
* in einem falschen Format sein.
|
|
14
|
+
* @param context
|
|
15
|
+
* @param tree
|
|
16
|
+
*/
|
|
17
|
+
export declare function readJsonAsString(tree: Tree, filePath: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Diese Methode fügt dem Skript den Teil am Index hinzu.
|
|
20
|
+
* Beispiel 1:
|
|
21
|
+
* script: 'ng build --aot && npm run move-de-files'
|
|
22
|
+
* part: ' --localize'
|
|
23
|
+
* Ergebnis: 'ng build --aot --localize && npm run move-de-files'
|
|
24
|
+
*
|
|
25
|
+
* Beispiel 2:
|
|
26
|
+
* script: 'ng build --aot && npm run move-de-files'
|
|
27
|
+
* part: ' --localize'
|
|
28
|
+
* index: 1
|
|
29
|
+
* Ergebnis: 'ng build --aot && npm run move-de-files --localize'
|
|
30
|
+
* @param script Ein NPM-Skript aus der Datei "package.json" (z.B 'ng build --aot && npm run move-de-files').
|
|
31
|
+
* @param part Ein Teil (z.B. --localize).
|
|
32
|
+
* @param index Ein Index (z.B. 0).
|
|
33
|
+
*/
|
|
34
|
+
export declare function appendScript(script: string, part: string, index?: number): string;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.appendScript = exports.readJsonAsString = exports.readJson = exports.jsonFormattingOptions = void 0;
|
|
4
|
+
const jsonc_parser_1 = require("jsonc-parser");
|
|
5
|
+
const logging_1 = require("./logging");
|
|
6
|
+
exports.jsonFormattingOptions = {
|
|
7
|
+
insertSpaces: true,
|
|
8
|
+
tabSize: 2,
|
|
9
|
+
eol: '\n'
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Liest die Json-Datei aus und wirft Fehlermeldungen, sollte die Json-Datei nicht gefunden oder
|
|
13
|
+
* in einem falschen Format sein.
|
|
14
|
+
* @param context
|
|
15
|
+
* @param tree
|
|
16
|
+
*/
|
|
17
|
+
function readJson(tree, filePath) {
|
|
18
|
+
const buffer = tree.read(filePath);
|
|
19
|
+
if (buffer === null) {
|
|
20
|
+
throw logging_1.formattedSchematicsException(`Konnte die Datei ${filePath} nicht lesen.`);
|
|
21
|
+
}
|
|
22
|
+
const content = buffer.toString();
|
|
23
|
+
let result = jsonc_parser_1.parseTree(content);
|
|
24
|
+
return result;
|
|
25
|
+
}
|
|
26
|
+
exports.readJson = readJson;
|
|
27
|
+
/**
|
|
28
|
+
* Liest die Json-Datei aus und wirft Fehlermeldungen, sollte die Json-Datei nicht gefunden oder
|
|
29
|
+
* in einem falschen Format sein.
|
|
30
|
+
* @param context
|
|
31
|
+
* @param tree
|
|
32
|
+
*/
|
|
33
|
+
function readJsonAsString(tree, filePath) {
|
|
34
|
+
const buffer = tree.read(filePath);
|
|
35
|
+
if (buffer === null) {
|
|
36
|
+
throw logging_1.formattedSchematicsException(`Konnte die Datei ${filePath} nicht lesen.`);
|
|
37
|
+
}
|
|
38
|
+
return buffer.toString();
|
|
39
|
+
}
|
|
40
|
+
exports.readJsonAsString = readJsonAsString;
|
|
41
|
+
/**
|
|
42
|
+
* Diese Methode fügt dem Skript den Teil am Index hinzu.
|
|
43
|
+
* Beispiel 1:
|
|
44
|
+
* script: 'ng build --aot && npm run move-de-files'
|
|
45
|
+
* part: ' --localize'
|
|
46
|
+
* Ergebnis: 'ng build --aot --localize && npm run move-de-files'
|
|
47
|
+
*
|
|
48
|
+
* Beispiel 2:
|
|
49
|
+
* script: 'ng build --aot && npm run move-de-files'
|
|
50
|
+
* part: ' --localize'
|
|
51
|
+
* index: 1
|
|
52
|
+
* Ergebnis: 'ng build --aot && npm run move-de-files --localize'
|
|
53
|
+
* @param script Ein NPM-Skript aus der Datei "package.json" (z.B 'ng build --aot && npm run move-de-files').
|
|
54
|
+
* @param part Ein Teil (z.B. --localize).
|
|
55
|
+
* @param index Ein Index (z.B. 0).
|
|
56
|
+
*/
|
|
57
|
+
function appendScript(script, part, index) {
|
|
58
|
+
let newSkript = '';
|
|
59
|
+
const splitArr = script.split(' && ');
|
|
60
|
+
if (splitArr.length === 1) {
|
|
61
|
+
newSkript = script + part;
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
splitArr[index ? index : 0] = splitArr[index ? index : 0] + part;
|
|
65
|
+
newSkript = splitArr.join(' && ');
|
|
66
|
+
}
|
|
67
|
+
return newSkript;
|
|
68
|
+
}
|
|
69
|
+
exports.appendScript = appendScript;
|
|
70
|
+
//# sourceMappingURL=json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json.js","sourceRoot":"","sources":["json.ts"],"names":[],"mappings":";;;AACA,+CAAkE;AAClE,uCAAyD;AAE5C,QAAA,qBAAqB,GAAsB;IACtD,YAAY,EAAE,IAAI;IAClB,OAAO,EAAE,CAAC;IACV,GAAG,EAAE,IAAI;CACV,CAAC;AAEF;;;;;GAKG;AACH,SAAgB,QAAQ,CAAC,IAAU,EAAE,QAAgB;IACnD,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACnC,IAAI,MAAM,KAAK,IAAI,EAAE;QACnB,MAAM,sCAA4B,CAAC,oBAAoB,QAAQ,eAAe,CAAC,CAAC;KACjF;IACD,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;IAElC,IAAI,MAAM,GAAG,wBAAS,CAAC,OAAO,CAAS,CAAC;IACxC,OAAO,MAAM,CAAC;AAChB,CAAC;AATD,4BASC;AAED;;;;;GAKG;AACH,SAAgB,gBAAgB,CAAC,IAAU,EAAE,QAAgB;IAC3D,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACnC,IAAI,MAAM,KAAK,IAAI,EAAE;QACnB,MAAM,sCAA4B,CAAC,oBAAoB,QAAQ,eAAe,CAAC,CAAC;KACjF;IACD,OAAO,MAAM,CAAC,QAAQ,EAAE,CAAC;AAC3B,CAAC;AAND,4CAMC;AAED;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,YAAY,CAAC,MAAc,EAAE,IAAY,EAAE,KAAc;IACvE,IAAI,SAAS,GAAG,EAAE,CAAC;IAEnB,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACtC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;QACzB,SAAS,GAAG,MAAM,GAAG,IAAI,CAAC;KAC3B;SAAM;QACL,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;QACjE,SAAS,GAAG,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;KACnC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAZD,oCAYC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Tree } from '@angular-devkit/schematics';
|
|
2
|
+
import { FormattingOptions, Node, parseTree } from 'jsonc-parser';
|
|
3
|
+
import { formattedSchematicsException } from './logging';
|
|
4
|
+
|
|
5
|
+
export const jsonFormattingOptions: FormattingOptions = {
|
|
6
|
+
insertSpaces: true,
|
|
7
|
+
tabSize: 2,
|
|
8
|
+
eol: '\n'
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Liest die Json-Datei aus und wirft Fehlermeldungen, sollte die Json-Datei nicht gefunden oder
|
|
13
|
+
* in einem falschen Format sein.
|
|
14
|
+
* @param context
|
|
15
|
+
* @param tree
|
|
16
|
+
*/
|
|
17
|
+
export function readJson(tree: Tree, filePath: string): Node {
|
|
18
|
+
const buffer = tree.read(filePath);
|
|
19
|
+
if (buffer === null) {
|
|
20
|
+
throw formattedSchematicsException(`Konnte die Datei ${filePath} nicht lesen.`);
|
|
21
|
+
}
|
|
22
|
+
const content = buffer.toString();
|
|
23
|
+
|
|
24
|
+
let result = parseTree(content) as Node;
|
|
25
|
+
return result;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Liest die Json-Datei aus und wirft Fehlermeldungen, sollte die Json-Datei nicht gefunden oder
|
|
30
|
+
* in einem falschen Format sein.
|
|
31
|
+
* @param context
|
|
32
|
+
* @param tree
|
|
33
|
+
*/
|
|
34
|
+
export function readJsonAsString(tree: Tree, filePath: string): string {
|
|
35
|
+
const buffer = tree.read(filePath);
|
|
36
|
+
if (buffer === null) {
|
|
37
|
+
throw formattedSchematicsException(`Konnte die Datei ${filePath} nicht lesen.`);
|
|
38
|
+
}
|
|
39
|
+
return buffer.toString();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Diese Methode fügt dem Skript den Teil am Index hinzu.
|
|
44
|
+
* Beispiel 1:
|
|
45
|
+
* script: 'ng build --aot && npm run move-de-files'
|
|
46
|
+
* part: ' --localize'
|
|
47
|
+
* Ergebnis: 'ng build --aot --localize && npm run move-de-files'
|
|
48
|
+
*
|
|
49
|
+
* Beispiel 2:
|
|
50
|
+
* script: 'ng build --aot && npm run move-de-files'
|
|
51
|
+
* part: ' --localize'
|
|
52
|
+
* index: 1
|
|
53
|
+
* Ergebnis: 'ng build --aot && npm run move-de-files --localize'
|
|
54
|
+
* @param script Ein NPM-Skript aus der Datei "package.json" (z.B 'ng build --aot && npm run move-de-files').
|
|
55
|
+
* @param part Ein Teil (z.B. --localize).
|
|
56
|
+
* @param index Ein Index (z.B. 0).
|
|
57
|
+
*/
|
|
58
|
+
export function appendScript(script: string, part: string, index?: number) {
|
|
59
|
+
let newSkript = '';
|
|
60
|
+
|
|
61
|
+
const splitArr = script.split(' && ');
|
|
62
|
+
if (splitArr.length === 1) {
|
|
63
|
+
newSkript = script + part;
|
|
64
|
+
} else {
|
|
65
|
+
splitArr[index ? index : 0] = splitArr[index ? index : 0] + part;
|
|
66
|
+
newSkript = splitArr.join(' && ');
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return newSkript;
|
|
70
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { SchematicsException } from '@angular-devkit/schematics';
|
|
2
|
+
export declare const TAB = "\t ";
|
|
3
|
+
/**
|
|
4
|
+
* Erzeugt eine Info-Log-Ausgabe in hellem Blau mit einem [INFO] an der linken Seite.
|
|
5
|
+
* @param messages
|
|
6
|
+
*/
|
|
7
|
+
export declare const logInfoWithDescriptor: (...messages: string[]) => void;
|
|
8
|
+
/**
|
|
9
|
+
* Erzeugt eine Info-Log-Ausgabe in hellem Weiß ohne Icon.
|
|
10
|
+
* @param messages
|
|
11
|
+
*/
|
|
12
|
+
export declare const logInfo: (...messages: string[]) => void;
|
|
13
|
+
/**
|
|
14
|
+
* Erzeugt eine Success-Log-Ausgabe in hellem Grün mit einem [SUCCESS] an der linken Seite.
|
|
15
|
+
* @param messages
|
|
16
|
+
*/
|
|
17
|
+
export declare const logSuccess: (...messages: string[]) => void;
|
|
18
|
+
/**
|
|
19
|
+
* Erzeugt eine Success-Log-Ausgabe in hellem Gelb mit einem [WARN] an der linken Seite.
|
|
20
|
+
* @param messages
|
|
21
|
+
*/
|
|
22
|
+
export declare const logWarn: (...messages: string[]) => void;
|
|
23
|
+
/**
|
|
24
|
+
* Erzeugt eine Error-Log-Ausgabe in hellem Grün mit einem [ERROR] an der linken Seite.
|
|
25
|
+
* @param messages
|
|
26
|
+
*/
|
|
27
|
+
export declare const logError: (...messages: string[]) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Wrapper um SchematicsException, welcher im Prinzip nur eine formatierte Log-Ausgabe des Fehler erzeugt und diesen zurückgibt.
|
|
30
|
+
* @constructor
|
|
31
|
+
*/
|
|
32
|
+
export declare const formattedSchematicsException: (...messages: string[]) => SchematicsException;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formattedSchematicsException = exports.logError = exports.logWarn = exports.logSuccess = exports.logInfo = exports.logInfoWithDescriptor = exports.TAB = void 0;
|
|
4
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
+
const chalk = require("chalk");
|
|
6
|
+
exports.TAB = '\t ';
|
|
7
|
+
/**
|
|
8
|
+
* Erzeugt eine Info-Log-Ausgabe in hellem Blau mit einem [INFO] an der linken Seite.
|
|
9
|
+
* @param messages
|
|
10
|
+
*/
|
|
11
|
+
const logInfoWithDescriptor = (...messages) => {
|
|
12
|
+
let message = generateLogMessage(...messages);
|
|
13
|
+
console.log(chalk.blueBright(`[INFO]${exports.TAB}${message}`));
|
|
14
|
+
};
|
|
15
|
+
exports.logInfoWithDescriptor = logInfoWithDescriptor;
|
|
16
|
+
/**
|
|
17
|
+
* Erzeugt eine Info-Log-Ausgabe in hellem Weiß ohne Icon.
|
|
18
|
+
* @param messages
|
|
19
|
+
*/
|
|
20
|
+
const logInfo = (...messages) => {
|
|
21
|
+
let message = generateLogMessage(...messages);
|
|
22
|
+
console.log(chalk.whiteBright(`${exports.TAB}${message}`));
|
|
23
|
+
};
|
|
24
|
+
exports.logInfo = logInfo;
|
|
25
|
+
/**
|
|
26
|
+
* Erzeugt eine Success-Log-Ausgabe in hellem Grün mit einem [SUCCESS] an der linken Seite.
|
|
27
|
+
* @param messages
|
|
28
|
+
*/
|
|
29
|
+
const logSuccess = (...messages) => {
|
|
30
|
+
let message = generateLogMessage(...messages);
|
|
31
|
+
console.log(chalk.yellowBright(`[SUCCESS] ${message}`));
|
|
32
|
+
};
|
|
33
|
+
exports.logSuccess = logSuccess;
|
|
34
|
+
/**
|
|
35
|
+
* Erzeugt eine Success-Log-Ausgabe in hellem Gelb mit einem [WARN] an der linken Seite.
|
|
36
|
+
* @param messages
|
|
37
|
+
*/
|
|
38
|
+
const logWarn = (...messages) => {
|
|
39
|
+
let message = generateLogMessage(...messages);
|
|
40
|
+
console.log(chalk.yellowBright(`[WARN] ${message}`));
|
|
41
|
+
};
|
|
42
|
+
exports.logWarn = logWarn;
|
|
43
|
+
/**
|
|
44
|
+
* Erzeugt eine Error-Log-Ausgabe in hellem Grün mit einem [ERROR] an der linken Seite.
|
|
45
|
+
* @param messages
|
|
46
|
+
*/
|
|
47
|
+
const logError = (...messages) => {
|
|
48
|
+
let message = generateLogMessage(...messages);
|
|
49
|
+
// Für den Fall, dass ein weitergereichter Fehler hier ankommt [ERROR] preventiv entfernen
|
|
50
|
+
message = message.replace('[ERROR] ', '');
|
|
51
|
+
console.log(chalk.redBright(`[ERROR] ${message}`));
|
|
52
|
+
};
|
|
53
|
+
exports.logError = logError;
|
|
54
|
+
/**
|
|
55
|
+
* Wrapper um SchematicsException, welcher im Prinzip nur eine formatierte Log-Ausgabe des Fehler erzeugt und diesen zurückgibt.
|
|
56
|
+
* @constructor
|
|
57
|
+
*/
|
|
58
|
+
const formattedSchematicsException = (...messages) => {
|
|
59
|
+
let message = generateLogMessage(...messages);
|
|
60
|
+
// Die eigentliche Exception zum Aufrufer zurückgeben '
|
|
61
|
+
return new schematics_1.SchematicsException(`[ERROR] ${message}`);
|
|
62
|
+
};
|
|
63
|
+
exports.formattedSchematicsException = formattedSchematicsException;
|
|
64
|
+
/**
|
|
65
|
+
* Erzeugt eine Log-Message aus einem Array von Nachrichten.
|
|
66
|
+
* Die Log-Message ist eingerückt und jede Message ist in einer neuen Zeile.
|
|
67
|
+
* @param messages
|
|
68
|
+
*/
|
|
69
|
+
function generateLogMessage(...messages) {
|
|
70
|
+
let fullMessage = '';
|
|
71
|
+
for (let i = 0; i < messages.length; i++) {
|
|
72
|
+
if (i !== 0) {
|
|
73
|
+
fullMessage += exports.TAB;
|
|
74
|
+
}
|
|
75
|
+
fullMessage += messages[i];
|
|
76
|
+
if (i !== messages.length - 1) {
|
|
77
|
+
fullMessage += '\r\n';
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return fullMessage;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=logging.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logging.js","sourceRoot":"","sources":["logging.ts"],"names":[],"mappings":";;;AAAA,2DAAiE;AACjE,+BAA+B;AAElB,QAAA,GAAG,GAAG,OAAO,CAAC;AAE3B;;;GAGG;AACI,MAAM,qBAAqB,GAAG,CAAC,GAAG,QAAkB,EAAE,EAAE;IAC7D,IAAI,OAAO,GAAG,kBAAkB,CAAC,GAAG,QAAQ,CAAC,CAAC;IAC9C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,WAAG,GAAG,OAAO,EAAE,CAAC,CAAC,CAAC;AAC1D,CAAC,CAAC;AAHW,QAAA,qBAAqB,yBAGhC;AAEF;;;GAGG;AACI,MAAM,OAAO,GAAG,CAAC,GAAG,QAAkB,EAAE,EAAE;IAC/C,IAAI,OAAO,GAAG,kBAAkB,CAAC,GAAG,QAAQ,CAAC,CAAC;IAC9C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,WAAG,GAAG,OAAO,EAAE,CAAC,CAAC,CAAC;AACrD,CAAC,CAAC;AAHW,QAAA,OAAO,WAGlB;AAEF;;;GAGG;AACI,MAAM,UAAU,GAAG,CAAC,GAAG,QAAkB,EAAE,EAAE;IAClD,IAAI,OAAO,GAAG,kBAAkB,CAAC,GAAG,QAAQ,CAAC,CAAC;IAC9C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,YAAY,CAAC,cAAc,OAAO,EAAE,CAAC,CAAC,CAAC;AAC3D,CAAC,CAAC;AAHW,QAAA,UAAU,cAGrB;AAEF;;;GAGG;AACI,MAAM,OAAO,GAAG,CAAC,GAAG,QAAkB,EAAE,EAAE;IAC/C,IAAI,OAAO,GAAG,kBAAkB,CAAC,GAAG,QAAQ,CAAC,CAAC;IAC9C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,YAAY,CAAC,cAAc,OAAO,EAAE,CAAC,CAAC,CAAC;AAC3D,CAAC,CAAC;AAHW,QAAA,OAAO,WAGlB;AAEF;;;GAGG;AACI,MAAM,QAAQ,GAAG,CAAC,GAAG,QAAkB,EAAE,EAAE;IAChD,IAAI,OAAO,GAAG,kBAAkB,CAAC,GAAG,QAAQ,CAAC,CAAC;IAC9C,0FAA0F;IAC1F,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;IAC7C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,cAAc,OAAO,EAAE,CAAC,CAAC,CAAC;AACxD,CAAC,CAAC;AALW,QAAA,QAAQ,YAKnB;AAEF;;;GAGG;AACI,MAAM,4BAA4B,GAAmD,CAAC,GAAG,QAAkB,EAAE,EAAE;IACpH,IAAI,OAAO,GAAG,kBAAkB,CAAC,GAAG,QAAQ,CAAC,CAAC;IAC9C,uDAAuD;IACvD,OAAO,IAAI,gCAAmB,CAAC,cAAc,OAAO,EAAE,CAAC,CAAC;AAC1D,CAAC,CAAC;AAJW,QAAA,4BAA4B,gCAIvC;AAEF;;;;GAIG;AACH,SAAS,kBAAkB,CAAC,GAAG,QAAkB;IAC/C,IAAI,WAAW,GAAW,EAAE,CAAC;IAC7B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACxC,IAAI,CAAC,KAAK,CAAC,EAAE;YACX,WAAW,IAAI,WAAG,CAAC;SACpB;QACD,WAAW,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC;QAC3B,IAAI,CAAC,KAAK,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;YAC7B,WAAW,IAAI,MAAM,CAAC;SACvB;KACF;IACD,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { SchematicsException } from '@angular-devkit/schematics';
|
|
2
|
+
import * as chalk from 'chalk';
|
|
3
|
+
|
|
4
|
+
export const TAB = '\t ';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Erzeugt eine Info-Log-Ausgabe in hellem Blau mit einem [INFO] an der linken Seite.
|
|
8
|
+
* @param messages
|
|
9
|
+
*/
|
|
10
|
+
export const logInfoWithDescriptor = (...messages: string[]) => {
|
|
11
|
+
let message = generateLogMessage(...messages);
|
|
12
|
+
console.log(chalk.blueBright(`[INFO]${TAB}${message}`));
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Erzeugt eine Info-Log-Ausgabe in hellem Weiß ohne Icon.
|
|
17
|
+
* @param messages
|
|
18
|
+
*/
|
|
19
|
+
export const logInfo = (...messages: string[]) => {
|
|
20
|
+
let message = generateLogMessage(...messages);
|
|
21
|
+
console.log(chalk.whiteBright(`${TAB}${message}`));
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Erzeugt eine Success-Log-Ausgabe in hellem Grün mit einem [SUCCESS] an der linken Seite.
|
|
26
|
+
* @param messages
|
|
27
|
+
*/
|
|
28
|
+
export const logSuccess = (...messages: string[]) => {
|
|
29
|
+
let message = generateLogMessage(...messages);
|
|
30
|
+
console.log(chalk.yellowBright(`[SUCCESS] ${message}`));
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Erzeugt eine Success-Log-Ausgabe in hellem Gelb mit einem [WARN] an der linken Seite.
|
|
35
|
+
* @param messages
|
|
36
|
+
*/
|
|
37
|
+
export const logWarn = (...messages: string[]) => {
|
|
38
|
+
let message = generateLogMessage(...messages);
|
|
39
|
+
console.log(chalk.yellowBright(`[WARN] ${message}`));
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Erzeugt eine Error-Log-Ausgabe in hellem Grün mit einem [ERROR] an der linken Seite.
|
|
44
|
+
* @param messages
|
|
45
|
+
*/
|
|
46
|
+
export const logError = (...messages: string[]) => {
|
|
47
|
+
let message = generateLogMessage(...messages);
|
|
48
|
+
// Für den Fall, dass ein weitergereichter Fehler hier ankommt [ERROR] preventiv entfernen
|
|
49
|
+
message = message.replace('[ERROR] ', '');
|
|
50
|
+
console.log(chalk.redBright(`[ERROR] ${message}`));
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Wrapper um SchematicsException, welcher im Prinzip nur eine formatierte Log-Ausgabe des Fehler erzeugt und diesen zurückgibt.
|
|
55
|
+
* @constructor
|
|
56
|
+
*/
|
|
57
|
+
export const formattedSchematicsException: (...messages: string[]) => SchematicsException = (...messages: string[]) => {
|
|
58
|
+
let message = generateLogMessage(...messages);
|
|
59
|
+
// Die eigentliche Exception zum Aufrufer zurückgeben '
|
|
60
|
+
return new SchematicsException(`[ERROR] ${message}`);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Erzeugt eine Log-Message aus einem Array von Nachrichten.
|
|
65
|
+
* Die Log-Message ist eingerückt und jede Message ist in einer neuen Zeile.
|
|
66
|
+
* @param messages
|
|
67
|
+
*/
|
|
68
|
+
function generateLogMessage(...messages: string[]): string {
|
|
69
|
+
let fullMessage: string = '';
|
|
70
|
+
for (let i = 0; i < messages.length; i++) {
|
|
71
|
+
if (i !== 0) {
|
|
72
|
+
fullMessage += TAB;
|
|
73
|
+
}
|
|
74
|
+
fullMessage += messages[i];
|
|
75
|
+
if (i !== messages.length - 1) {
|
|
76
|
+
fullMessage += '\r\n';
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return fullMessage;
|
|
80
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Schema as ApplicationOptions } from '@schematics/angular/application/schema';
|
|
2
|
+
import { Schema as WorkspaceOptions } from '@schematics/angular/workspace/schema';
|
|
3
|
+
/**
|
|
4
|
+
* Standard-Optionen für das Test-Workspace.
|
|
5
|
+
*/
|
|
6
|
+
export declare const workspaceOptions: WorkspaceOptions;
|
|
7
|
+
/**
|
|
8
|
+
* Standard-Optionen für die Test-Applikation.
|
|
9
|
+
*/
|
|
10
|
+
export declare const appOptions: ApplicationOptions;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.appOptions = exports.workspaceOptions = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Standard-Optionen für das Test-Workspace.
|
|
6
|
+
*/
|
|
7
|
+
exports.workspaceOptions = {
|
|
8
|
+
name: 'workspace',
|
|
9
|
+
newProjectRoot: 'projects',
|
|
10
|
+
version: '6.0.0'
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Standard-Optionen für die Test-Applikation.
|
|
14
|
+
*/
|
|
15
|
+
exports.appOptions = {
|
|
16
|
+
name: 'bar',
|
|
17
|
+
inlineStyle: false,
|
|
18
|
+
inlineTemplate: false,
|
|
19
|
+
routing: false,
|
|
20
|
+
style: 'scss',
|
|
21
|
+
skipTests: false,
|
|
22
|
+
skipPackageJson: false
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":[],"mappings":";;;AAGA;;GAEG;AACU,QAAA,gBAAgB,GAAqB;IAChD,IAAI,EAAE,WAAW;IACjB,cAAc,EAAE,UAAU;IAC1B,OAAO,EAAE,OAAO;CACjB,CAAC;AAEF;;GAEG;AACU,QAAA,UAAU,GAAuB;IAC5C,IAAI,EAAE,KAAK;IACX,WAAW,EAAE,KAAK;IAClB,cAAc,EAAE,KAAK;IACrB,OAAO,EAAE,KAAK;IACd,KAAK,EAAS,MAAM;IACpB,SAAS,EAAE,KAAK;IAChB,eAAe,EAAE,KAAK;CACvB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Schema as ApplicationOptions, Style } from '@schematics/angular/application/schema';
|
|
2
|
+
import { Schema as WorkspaceOptions } from '@schematics/angular/workspace/schema';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Standard-Optionen für das Test-Workspace.
|
|
6
|
+
*/
|
|
7
|
+
export const workspaceOptions: WorkspaceOptions = {
|
|
8
|
+
name: 'workspace',
|
|
9
|
+
newProjectRoot: 'projects',
|
|
10
|
+
version: '6.0.0'
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Standard-Optionen für die Test-Applikation.
|
|
15
|
+
*/
|
|
16
|
+
export const appOptions: ApplicationOptions = {
|
|
17
|
+
name: 'bar',
|
|
18
|
+
inlineStyle: false,
|
|
19
|
+
inlineTemplate: false,
|
|
20
|
+
routing: false,
|
|
21
|
+
style: <Style>'scss',
|
|
22
|
+
skipTests: false,
|
|
23
|
+
skipPackageJson: false
|
|
24
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Tree } from '@angular-devkit/schematics';
|
|
2
|
+
import * as ts from 'typescript';
|
|
3
|
+
export declare function getSourceNodes(sourceFile: ts.SourceFile): ts.Node[];
|
|
4
|
+
export declare function addInterface(tree: Tree, filePath: string, interfaceName: string, logMessage?: boolean): void;
|
|
5
|
+
export declare function removeInterface(tree: Tree, filePath: string, interfaceName: string, logMessage?: boolean): void;
|
|
6
|
+
export declare function addImport(tree: Tree, filePath: string, packageName: string, importName?: string, logMessage?: boolean): void;
|
|
7
|
+
export declare function removeImport(tree: Tree, filePath: string, packageName: string, importName?: string, logMessage?: boolean): void;
|
|
8
|
+
export declare function removeProvider(tree: Tree, filePath: string, providerName: string, logMessage?: boolean): void;
|
|
9
|
+
export declare function getSiblings(node: ts.Node, childKind?: ts.SyntaxKind): ts.Node[];
|
|
10
|
+
export declare function getPrevSibling(node: ts.Node, childKind?: ts.SyntaxKind): ts.Node | null;
|
|
11
|
+
export declare function getNextSibling(node: ts.Node, childKind?: ts.SyntaxKind): ts.Node | null;
|
|
12
|
+
export declare function getNextSiblings(node: ts.Node): ts.Node[];
|
|
13
|
+
export declare function showTree(node: ts.Node, indent?: string): void;
|
|
14
|
+
export declare function findChild(node: ts.Node, kind: ts.SyntaxKind, text?: string, depth?: number): ts.Node | undefined;
|
|
15
|
+
export declare function getSyntaxListOfClass(tree: Tree, filePath: string): ts.Node;
|
|
16
|
+
export declare function getConstructor(tree: Tree, filePath: string): ts.Node | undefined;
|
|
17
|
+
export declare function getMethod(tree: Tree, filePath: string, methodeName: any): ts.Node | undefined;
|
|
18
|
+
export declare function addParameter(tree: Tree, filePath: string, syntaxListNode: ts.Node, service: string): void;
|
|
19
|
+
export declare function addMethod(tree: Tree, filePath: string, syntaxListNode: ts.Node, method: string): void;
|
|
20
|
+
export declare function addConstructorParameter(tree: Tree, filePath: string, service: string): void;
|
|
21
|
+
export declare function addClassProperty(tree: Tree, filePath: string, property: string): void;
|
|
22
|
+
export declare function addConstructorContent(tree: Tree, filePath: string, content: string, append: boolean): void;
|