@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,990 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
13
|
+
const testing_1 = require("@angular-devkit/schematics/testing");
|
|
14
|
+
const path = require("path");
|
|
15
|
+
const rxjs_1 = require("rxjs");
|
|
16
|
+
const dependencies_1 = require("../utility/dependencies");
|
|
17
|
+
const test_1 = require("../utility/test");
|
|
18
|
+
const util_1 = require("../utility/util");
|
|
19
|
+
const index_1 = require("./index");
|
|
20
|
+
const collectionPath = path.join(__dirname, '../collection.json');
|
|
21
|
+
describe('update', () => {
|
|
22
|
+
let appTree;
|
|
23
|
+
let runner;
|
|
24
|
+
let context;
|
|
25
|
+
const testOptions = {};
|
|
26
|
+
beforeEach(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
27
|
+
runner = new testing_1.SchematicTestRunner('schematics', collectionPath);
|
|
28
|
+
appTree = yield runner.runExternalSchematicAsync('@schematics/angular', 'workspace', test_1.workspaceOptions).toPromise();
|
|
29
|
+
appTree = yield runner
|
|
30
|
+
.runExternalSchematicAsync('@schematics/angular', 'application', test_1.appOptions, appTree)
|
|
31
|
+
.toPromise();
|
|
32
|
+
util_1.UtilConfig.defaultWaitMS = 0;
|
|
33
|
+
const collection = runner.engine.createCollection(collectionPath);
|
|
34
|
+
const schematic = runner.engine.createSchematic('update', collection);
|
|
35
|
+
context = runner.engine.createContext(schematic);
|
|
36
|
+
testOptions.project = test_1.appOptions.name;
|
|
37
|
+
testOptions.path = test_1.workspaceOptions.newProjectRoot + '/' + test_1.appOptions.name;
|
|
38
|
+
testOptions.verbose = true;
|
|
39
|
+
}));
|
|
40
|
+
describe('[Rule] addNg2PdfViewer', () => {
|
|
41
|
+
it('Sollte Ng2PdfViewer hinzufügen', (done) => {
|
|
42
|
+
appTree.overwrite('/angular.json', `
|
|
43
|
+
{
|
|
44
|
+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
|
45
|
+
"version": 1,
|
|
46
|
+
"newProjectRoot": "projects",
|
|
47
|
+
"projects": {
|
|
48
|
+
"bar": {
|
|
49
|
+
"root": "",
|
|
50
|
+
"sourceRoot": "src",
|
|
51
|
+
"projectType": "application",
|
|
52
|
+
"i18n": {
|
|
53
|
+
"sourceLocale": {
|
|
54
|
+
"code": "de",
|
|
55
|
+
"baseHref": "/"
|
|
56
|
+
},
|
|
57
|
+
"locales": {
|
|
58
|
+
"en": "src/locale/messages.en.xlf"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"architect": {
|
|
62
|
+
"build": {
|
|
63
|
+
"builder": "ngx-build-plus:browser",
|
|
64
|
+
"options": {
|
|
65
|
+
"outputPath": "dist",
|
|
66
|
+
"allowedCommonJsDependencies": [
|
|
67
|
+
"hammerjs"
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
"defaultProject": "lux-components",
|
|
75
|
+
"schematics": {
|
|
76
|
+
"@schematics/angular:component": {
|
|
77
|
+
"prefix": "lux",
|
|
78
|
+
"style": "scss"
|
|
79
|
+
},
|
|
80
|
+
"@schematics/angular:directive": {
|
|
81
|
+
"prefix": "lux"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
`);
|
|
87
|
+
schematics_1.callRule(index_1.addNg2PdfViewer(testOptions), rxjs_1.of(appTree), context).subscribe((success) => {
|
|
88
|
+
var _a;
|
|
89
|
+
const content = (_a = success.read('/angular.json')) === null || _a === void 0 ? void 0 : _a.toString();
|
|
90
|
+
if (content) {
|
|
91
|
+
console.log('aaa', content);
|
|
92
|
+
}
|
|
93
|
+
expect(content).toContain('"allowedCommonJsDependencies": [\n "ng2-pdf-viewer",\n "hammerjs"\n ]');
|
|
94
|
+
done();
|
|
95
|
+
}, (reason) => expect(reason).toBeUndefined());
|
|
96
|
+
});
|
|
97
|
+
it('Sollte Ng2PdfViewer nicht hinzufügen', (done) => {
|
|
98
|
+
appTree.overwrite('/angular.json', `
|
|
99
|
+
{
|
|
100
|
+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
|
101
|
+
"version": 1,
|
|
102
|
+
"newProjectRoot": "projects",
|
|
103
|
+
"projects": {
|
|
104
|
+
"bar": {
|
|
105
|
+
"root": "",
|
|
106
|
+
"sourceRoot": "src",
|
|
107
|
+
"projectType": "application",
|
|
108
|
+
"i18n": {
|
|
109
|
+
"sourceLocale": {
|
|
110
|
+
"code": "de",
|
|
111
|
+
"baseHref": "/"
|
|
112
|
+
},
|
|
113
|
+
"locales": {
|
|
114
|
+
"en": "src/locale/messages.en.xlf"
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
"architect": {
|
|
118
|
+
"build": {
|
|
119
|
+
"builder": "ngx-build-plus:browser",
|
|
120
|
+
"options": {
|
|
121
|
+
"outputPath": "dist",
|
|
122
|
+
"allowedCommonJsDependencies": [
|
|
123
|
+
"hammerjs",
|
|
124
|
+
"ng2-pdf-viewer"
|
|
125
|
+
]
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
"defaultProject": "lux-components",
|
|
132
|
+
"schematics": {
|
|
133
|
+
"@schematics/angular:component": {
|
|
134
|
+
"prefix": "lux",
|
|
135
|
+
"style": "scss"
|
|
136
|
+
},
|
|
137
|
+
"@schematics/angular:directive": {
|
|
138
|
+
"prefix": "lux"
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
`);
|
|
144
|
+
schematics_1.callRule(index_1.addNg2PdfViewer(testOptions), rxjs_1.of(appTree), context).subscribe((success) => {
|
|
145
|
+
var _a;
|
|
146
|
+
const content = (_a = success.read('/angular.json')) === null || _a === void 0 ? void 0 : _a.toString();
|
|
147
|
+
if (content) {
|
|
148
|
+
console.log('aaa', content);
|
|
149
|
+
}
|
|
150
|
+
expect(content).toContain('"allowedCommonJsDependencies": [\n "hammerjs",\n "ng2-pdf-viewer"\n ]');
|
|
151
|
+
done();
|
|
152
|
+
}, (reason) => expect(reason).toBeUndefined());
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
describe('[Rule] update', () => {
|
|
156
|
+
it('Sollte einen Fehler werfen, wenn Version < n - 1', () => {
|
|
157
|
+
dependencies_1.updatePackageJsonDependency(appTree, { type: dependencies_1.NodeDependencyType.Default, version: '1.9.3', name: '@ihk-gfi/lux-components' });
|
|
158
|
+
Object.defineProperty(process.versions, 'node', {
|
|
159
|
+
get: () => '12.16.3'
|
|
160
|
+
});
|
|
161
|
+
schematics_1.callRule(index_1.update(testOptions), rxjs_1.of(appTree), context).subscribe((success) => { }, (reason) => expect(reason.toString()).toContain('wird nicht unterstützt.'));
|
|
162
|
+
});
|
|
163
|
+
it('Sollte LUX-Components 10 einrichten', (done) => {
|
|
164
|
+
appTree.overwrite('/package.json', `
|
|
165
|
+
{
|
|
166
|
+
"name": "Lorem ipsum",
|
|
167
|
+
"version": "0.0.32",
|
|
168
|
+
"scripts": {
|
|
169
|
+
"build": "tsc -p tsconfig.json",
|
|
170
|
+
"test": "npm run build && jasmine src/**/*_spec.js"
|
|
171
|
+
},
|
|
172
|
+
"keywords": [
|
|
173
|
+
"schematics",
|
|
174
|
+
"lux-components"
|
|
175
|
+
],
|
|
176
|
+
"dependencies": {
|
|
177
|
+
"@ihk-gfi/lux-components": "10.8.2"
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
`);
|
|
181
|
+
schematics_1.callRule(index_1.update(testOptions), rxjs_1.of(appTree), context).subscribe(() => {
|
|
182
|
+
expect(dependencies_1.getPackageJsonDependency(appTree, '@ihk-gfi/lux-components').version).toEqual('' + index_1.updateMajorVersion + '.0.0');
|
|
183
|
+
done();
|
|
184
|
+
}, (reason) => expect(reason).toBeUndefined());
|
|
185
|
+
});
|
|
186
|
+
});
|
|
187
|
+
describe('[Rule] updateBrowserList', () => {
|
|
188
|
+
it('Sollte die alten IE-Versionen (9 und 10) entfernt haben', (done) => {
|
|
189
|
+
appTree.create('/.browserslistrc', `
|
|
190
|
+
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
|
|
191
|
+
# For additional information regarding the format and rule options, please see:
|
|
192
|
+
# https://github.com/browserslist/browserslist#queries
|
|
193
|
+
|
|
194
|
+
# You can see what browsers were selected by your queries by running:
|
|
195
|
+
# npx browserslist
|
|
196
|
+
|
|
197
|
+
> 0.5%
|
|
198
|
+
last 2 versions
|
|
199
|
+
Firefox ESR
|
|
200
|
+
not dead
|
|
201
|
+
IE 9-11 # For IE 9-11 support, remove 'not'.
|
|
202
|
+
|
|
203
|
+
`);
|
|
204
|
+
schematics_1.callRule(index_1.updateBrowserList(testOptions), rxjs_1.of(appTree), context).subscribe((success) => {
|
|
205
|
+
const browserListContent = success.read('/.browserslistrc');
|
|
206
|
+
expect(browserListContent).toBeDefined();
|
|
207
|
+
const content = browserListContent === null || browserListContent === void 0 ? void 0 : browserListContent.toString();
|
|
208
|
+
expect(content).toContain('not IE 9-10');
|
|
209
|
+
expect(content).toContain('IE 11');
|
|
210
|
+
done();
|
|
211
|
+
}, (reason) => expect(reason).toBeNull());
|
|
212
|
+
});
|
|
213
|
+
});
|
|
214
|
+
describe('[Rule] deleteOldThemeDir', () => {
|
|
215
|
+
it('Sollte das alte Theming-Verzeichnis löschen.', (done) => {
|
|
216
|
+
const oldThemePath = testOptions.path + '/src/theming/';
|
|
217
|
+
appTree.create(oldThemePath + '_luxcommon.scss', `---`);
|
|
218
|
+
appTree.create(oldThemePath + '_luxfocus.scss', `---`);
|
|
219
|
+
appTree.create(oldThemePath + '_luxpalette.scss', `---`);
|
|
220
|
+
appTree.create(oldThemePath + '_luxstyles.scss', `---`);
|
|
221
|
+
appTree.create(oldThemePath + 'luxtheme.scss', `---`);
|
|
222
|
+
expect(appTree.exists(oldThemePath + '_luxcommon.scss')).toBeTrue();
|
|
223
|
+
expect(appTree.exists(oldThemePath + '_luxfocus.scss')).toBeTrue();
|
|
224
|
+
expect(appTree.exists(oldThemePath + '_luxpalette.scss')).toBeTrue();
|
|
225
|
+
expect(appTree.exists(oldThemePath + '_luxstyles.scss')).toBeTrue();
|
|
226
|
+
expect(appTree.exists(oldThemePath + 'luxtheme.scss')).toBeTrue();
|
|
227
|
+
schematics_1.callRule(index_1.deleteOldThemeDir(testOptions), rxjs_1.of(appTree), context).subscribe((success) => {
|
|
228
|
+
expect(appTree.exists(oldThemePath + '_luxcommon.scss')).toBeFalse();
|
|
229
|
+
expect(appTree.exists(oldThemePath + '_luxfocus.scss')).toBeFalse();
|
|
230
|
+
expect(appTree.exists(oldThemePath + '_luxpalette.scss')).toBeFalse();
|
|
231
|
+
expect(appTree.exists(oldThemePath + '_luxstyles.scss')).toBeFalse();
|
|
232
|
+
expect(appTree.exists(oldThemePath + 'luxtheme.scss')).toBeFalse();
|
|
233
|
+
done();
|
|
234
|
+
}, (reason) => expect(reason).toBeNull());
|
|
235
|
+
});
|
|
236
|
+
});
|
|
237
|
+
describe('[Rule] clearStylesScss', () => {
|
|
238
|
+
it('Sollte die alten Styles aus der styles.scss entfernen.', (done) => {
|
|
239
|
+
appTree.overwrite(testOptions.path + '/src/styles.scss', `
|
|
240
|
+
/* You can add global styles to this file, and also import other style files */
|
|
241
|
+
/* Themenamen: deeppurple-amber.css, indigo-pink.css, pink-bluegrey.css und purple-green.css */
|
|
242
|
+
$fa-font-path: '~@fortawesome/fontawesome-free/webfonts';
|
|
243
|
+
@import '~@fortawesome/fontawesome-free/scss/fontawesome';
|
|
244
|
+
@import '~@fortawesome/fontawesome-free/scss/regular';
|
|
245
|
+
@import '~@fortawesome/fontawesome-free/scss/solid';
|
|
246
|
+
@import '~@fortawesome/fontawesome-free/scss/brands';
|
|
247
|
+
@import '~material-design-icons-iconfont/dist/material-design-icons.css';
|
|
248
|
+
@import '../node_modules/@angular/material/theming';
|
|
249
|
+
@import './theming/luxtheme';
|
|
250
|
+
|
|
251
|
+
@include mat-core();
|
|
252
|
+
|
|
253
|
+
@include angular-material-theme($lux-theme);
|
|
254
|
+
|
|
255
|
+
`);
|
|
256
|
+
schematics_1.callRule(index_1.clearStylesScss(testOptions), rxjs_1.of(appTree), context).subscribe((success) => {
|
|
257
|
+
var _a;
|
|
258
|
+
const content = (_a = success.read(testOptions.path + '/src/styles.scss')) === null || _a === void 0 ? void 0 : _a.toString();
|
|
259
|
+
expect(content).not.toContain('$fa-font-path: \'~@fortawesome/fontawesome-free/webfonts\';');
|
|
260
|
+
expect(content).not.toContain('@import \'~@fortawesome/fontawesome-free/scss/fontawesome\';');
|
|
261
|
+
expect(content).not.toContain('@import \'~@fortawesome/fontawesome-free/scss/regular\';');
|
|
262
|
+
expect(content).not.toContain('@import \'~@fortawesome/fontawesome-free/scss/solid\';');
|
|
263
|
+
expect(content).not.toContain('@import \'~@fortawesome/fontawesome-free/scss/brands\';');
|
|
264
|
+
expect(content).not.toContain('@import \'~material-design-icons-iconfont/dist/material-design-icons.css\';');
|
|
265
|
+
expect(content).not.toContain('@import \'../node_modules/@angular/material/theming\';');
|
|
266
|
+
expect(content).not.toContain('@import \'./theming/luxtheme\';');
|
|
267
|
+
expect(content).not.toContain('@include mat-core();');
|
|
268
|
+
expect(content).not.toContain('@include angular-material-theme($lux-theme);');
|
|
269
|
+
done();
|
|
270
|
+
}, (reason) => expect(reason).toBeNull());
|
|
271
|
+
});
|
|
272
|
+
});
|
|
273
|
+
describe('[Rule] addThemeAssets', () => {
|
|
274
|
+
it('Sollte das Theme in das Assets-Array eintragen', (done) => {
|
|
275
|
+
appTree.overwrite('/angular.json', `
|
|
276
|
+
{
|
|
277
|
+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
|
278
|
+
"version": 1,
|
|
279
|
+
"newProjectRoot": "projects",
|
|
280
|
+
"projects": {
|
|
281
|
+
"bar": {
|
|
282
|
+
"projectType": "application",
|
|
283
|
+
"schematics": {
|
|
284
|
+
"@schematics/angular:component": {
|
|
285
|
+
"style": "scss"
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
"root": "projects/bar",
|
|
289
|
+
"sourceRoot": "projects/bar/src",
|
|
290
|
+
"prefix": "app",
|
|
291
|
+
"architect": {
|
|
292
|
+
"build": {
|
|
293
|
+
"builder": "@angular-devkit/build-angular:browser",
|
|
294
|
+
"options": {
|
|
295
|
+
"assets": [
|
|
296
|
+
"projects/bar/src/favicon.ico",
|
|
297
|
+
"projects/bar/src/assets"
|
|
298
|
+
],
|
|
299
|
+
"styles": [
|
|
300
|
+
"projects/bar/src/styles.scss"
|
|
301
|
+
],
|
|
302
|
+
"scripts": []
|
|
303
|
+
}
|
|
304
|
+
},
|
|
305
|
+
"test": {
|
|
306
|
+
"builder": "@angular-devkit/build-angular:karma",
|
|
307
|
+
"options": {
|
|
308
|
+
"main": "projects/bar/src/test.ts",
|
|
309
|
+
"polyfills": "projects/bar/src/polyfills.ts",
|
|
310
|
+
"tsConfig": "projects/bar/tsconfig.spec.json",
|
|
311
|
+
"karmaConfig": "projects/bar/karma.conf.js",
|
|
312
|
+
"assets": [
|
|
313
|
+
"projects/bar/src/favicon.ico",
|
|
314
|
+
"projects/bar/src/assets"
|
|
315
|
+
],
|
|
316
|
+
"styles": [
|
|
317
|
+
"projects/bar/src/styles.scss"
|
|
318
|
+
],
|
|
319
|
+
"scripts": []
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
},
|
|
325
|
+
"defaultProject": "bar"
|
|
326
|
+
}
|
|
327
|
+
`);
|
|
328
|
+
schematics_1.callRule(index_1.addThemeAssets(testOptions), rxjs_1.of(appTree), context).subscribe((success) => {
|
|
329
|
+
var _a;
|
|
330
|
+
const content = (_a = success.read('/angular.json')) === null || _a === void 0 ? void 0 : _a.toString();
|
|
331
|
+
expect(content).toContain(`
|
|
332
|
+
"options": {
|
|
333
|
+
"assets": [
|
|
334
|
+
{
|
|
335
|
+
"glob": "*.css",
|
|
336
|
+
"input": "./node_modules/@ihk-gfi/lux-components-theme/prebuilt-themes",
|
|
337
|
+
"output": "./assets/themes"
|
|
338
|
+
},
|
|
339
|
+
"projects/bar/src/favicon.ico",
|
|
340
|
+
"projects/bar/src/assets"
|
|
341
|
+
],
|
|
342
|
+
`);
|
|
343
|
+
expect(content).toContain(`
|
|
344
|
+
"karmaConfig": "projects/bar/karma.conf.js",
|
|
345
|
+
"assets": [
|
|
346
|
+
{
|
|
347
|
+
"glob": "*.css",
|
|
348
|
+
"input": "./node_modules/@ihk-gfi/lux-components-theme/prebuilt-themes",
|
|
349
|
+
"output": "./assets/themes"
|
|
350
|
+
},
|
|
351
|
+
"projects/bar/src/favicon.ico",
|
|
352
|
+
"projects/bar/src/assets"
|
|
353
|
+
],
|
|
354
|
+
`);
|
|
355
|
+
done();
|
|
356
|
+
}, (reason) => expect(reason).toBeUndefined());
|
|
357
|
+
});
|
|
358
|
+
});
|
|
359
|
+
describe('[Rule] removeThemeAssets', () => {
|
|
360
|
+
it('Sollte das Theme aus dem Assets-Array austragen', (done) => {
|
|
361
|
+
appTree.overwrite('/angular.json', `
|
|
362
|
+
{
|
|
363
|
+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
|
364
|
+
"version": 1,
|
|
365
|
+
"newProjectRoot": "projects",
|
|
366
|
+
"projects": {
|
|
367
|
+
"bar": {
|
|
368
|
+
"projectType": "application",
|
|
369
|
+
"schematics": {
|
|
370
|
+
"@schematics/angular:component": {
|
|
371
|
+
"style": "scss"
|
|
372
|
+
}
|
|
373
|
+
},
|
|
374
|
+
"root": "projects/bar",
|
|
375
|
+
"sourceRoot": "projects/bar/src",
|
|
376
|
+
"prefix": "app",
|
|
377
|
+
"architect": {
|
|
378
|
+
"build": {
|
|
379
|
+
"builder": "@angular-devkit/build-angular:browser",
|
|
380
|
+
"options": {
|
|
381
|
+
"styles": [
|
|
382
|
+
"projects/bar/src/styles.scss",
|
|
383
|
+
"src/theming/luxtheme.scss"
|
|
384
|
+
],
|
|
385
|
+
"scripts": []
|
|
386
|
+
}
|
|
387
|
+
},
|
|
388
|
+
"test": {
|
|
389
|
+
"builder": "@angular-devkit/build-angular:karma",
|
|
390
|
+
"options": {
|
|
391
|
+
"main": "projects/bar/src/test.ts",
|
|
392
|
+
"polyfills": "projects/bar/src/polyfills.ts",
|
|
393
|
+
"tsConfig": "projects/bar/tsconfig.spec.json",
|
|
394
|
+
"karmaConfig": "projects/bar/karma.conf.js",
|
|
395
|
+
"styles": [
|
|
396
|
+
"src/theming/luxtheme.scss",
|
|
397
|
+
"projects/bar/src/styles.scss"
|
|
398
|
+
],
|
|
399
|
+
"scripts": []
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
},
|
|
405
|
+
"defaultProject": "bar"
|
|
406
|
+
}
|
|
407
|
+
`);
|
|
408
|
+
schematics_1.callRule(index_1.removeThemeAssets(testOptions), rxjs_1.of(appTree), context).subscribe((success) => {
|
|
409
|
+
var _a;
|
|
410
|
+
const content = (_a = success.read('/angular.json')) === null || _a === void 0 ? void 0 : _a.toString();
|
|
411
|
+
expect(content).toContain(`
|
|
412
|
+
"options": {
|
|
413
|
+
"styles": [
|
|
414
|
+
"projects/bar/src/styles.scss"
|
|
415
|
+
],
|
|
416
|
+
`);
|
|
417
|
+
expect(content).toContain(`
|
|
418
|
+
"karmaConfig": "projects/bar/karma.conf.js",
|
|
419
|
+
"styles": [
|
|
420
|
+
"projects/bar/src/styles.scss"
|
|
421
|
+
],
|
|
422
|
+
`);
|
|
423
|
+
done();
|
|
424
|
+
}, (reason) => expect(reason).toBeUndefined());
|
|
425
|
+
});
|
|
426
|
+
});
|
|
427
|
+
describe('[Rule] updateAppComponent', () => {
|
|
428
|
+
it('Sollte die app.component.ts (mit Constructor) anpassen', (done) => {
|
|
429
|
+
appTree.overwrite(testOptions.path + '/src/app/app.component.ts', `
|
|
430
|
+
import { Component, OnInit } from '@angular/core';
|
|
431
|
+
import { Router } from '@angular/router';
|
|
432
|
+
|
|
433
|
+
@Component({
|
|
434
|
+
selector: 'app-root',
|
|
435
|
+
templateUrl: './app.component.html',
|
|
436
|
+
styleUrls: ['./app.component.scss']
|
|
437
|
+
})
|
|
438
|
+
export class AppComponent implements OnInit {
|
|
439
|
+
constructor(public router: Router) {}
|
|
440
|
+
|
|
441
|
+
ngOnInit(): void {}
|
|
442
|
+
}
|
|
443
|
+
`);
|
|
444
|
+
schematics_1.callRule(index_1.updateAppComponent(testOptions), rxjs_1.of(appTree), context).subscribe((success) => {
|
|
445
|
+
var _a;
|
|
446
|
+
const content = (_a = success.read(testOptions.path + '/src/app/app.component.ts')) === null || _a === void 0 ? void 0 : _a.toString();
|
|
447
|
+
expect(content).toContain('import { LuxThemeService } from \'@ihk-gfi/lux-components\';');
|
|
448
|
+
expect(content).toContain('constructor(public router: Router, private themeService: LuxThemeService)');
|
|
449
|
+
expect(content).toContain('themeService.loadTheme();');
|
|
450
|
+
done();
|
|
451
|
+
}, (reason) => expect(reason).toBeUndefined());
|
|
452
|
+
});
|
|
453
|
+
it('Sollte die app.component.ts (leerer Constructor) anpassen', (done) => {
|
|
454
|
+
appTree.overwrite(testOptions.path + '/src/app/app.component.ts', `
|
|
455
|
+
import { Component, OnInit } from '@angular/core';
|
|
456
|
+
import { Router } from '@angular/router';
|
|
457
|
+
|
|
458
|
+
@Component({
|
|
459
|
+
selector: 'app-root',
|
|
460
|
+
templateUrl: './app.component.html',
|
|
461
|
+
styleUrls: ['./app.component.scss']
|
|
462
|
+
})
|
|
463
|
+
export class AppComponent implements OnInit {
|
|
464
|
+
constructor() {
|
|
465
|
+
console.log('Test');
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
ngOnInit(): void {}
|
|
469
|
+
}
|
|
470
|
+
`);
|
|
471
|
+
schematics_1.callRule(index_1.updateAppComponent(testOptions), rxjs_1.of(appTree), context).subscribe((success) => {
|
|
472
|
+
var _a;
|
|
473
|
+
const content = (_a = success.read(testOptions.path + '/src/app/app.component.ts')) === null || _a === void 0 ? void 0 : _a.toString();
|
|
474
|
+
expect(content).toContain('import { LuxThemeService } from \'@ihk-gfi/lux-components\';');
|
|
475
|
+
expect(content).toContain('constructor(private themeService: LuxThemeService)');
|
|
476
|
+
expect(content).toContain('themeService.loadTheme();');
|
|
477
|
+
done();
|
|
478
|
+
}, (reason) => expect(reason).toBeUndefined());
|
|
479
|
+
});
|
|
480
|
+
it('Sollte die app.component.ts (ohne Constructor) anpassen', (done) => {
|
|
481
|
+
appTree.overwrite(testOptions.path + '/src/app/app.component.ts', `
|
|
482
|
+
import { Component, OnInit } from '@angular/core';
|
|
483
|
+
import { Router } from '@angular/router';
|
|
484
|
+
|
|
485
|
+
@Component({
|
|
486
|
+
selector: 'app-root',
|
|
487
|
+
templateUrl: './app.component.html',
|
|
488
|
+
styleUrls: ['./app.component.scss']
|
|
489
|
+
})
|
|
490
|
+
export class AppComponent implements OnInit {
|
|
491
|
+
|
|
492
|
+
ngOnInit(): void {}
|
|
493
|
+
}
|
|
494
|
+
`);
|
|
495
|
+
schematics_1.callRule(index_1.updateAppComponent(testOptions), rxjs_1.of(appTree), context).subscribe((success) => {
|
|
496
|
+
var _a;
|
|
497
|
+
const content = (_a = success.read(testOptions.path + '/src/app/app.component.ts')) === null || _a === void 0 ? void 0 : _a.toString();
|
|
498
|
+
expect(content).toContain('import { LuxThemeService } from \'@ihk-gfi/lux-components\';');
|
|
499
|
+
expect(content).toContain('constructor(private themeService: LuxThemeService)');
|
|
500
|
+
expect(content).toContain('themeService.loadTheme();');
|
|
501
|
+
done();
|
|
502
|
+
}, (reason) => expect(reason).toBeUndefined());
|
|
503
|
+
});
|
|
504
|
+
});
|
|
505
|
+
describe('[Rule] updateAppModule', () => {
|
|
506
|
+
it('Sollte die Root-Services aus den Providern entfernen', (done) => {
|
|
507
|
+
appTree.overwrite(testOptions.path + '/src/app/app.module.ts', `
|
|
508
|
+
import { BrowserModule } from '@angular/platform-browser';
|
|
509
|
+
import { FlexLayoutModule } from '@angular/flex-layout';
|
|
510
|
+
import {
|
|
511
|
+
LuxActionModule,
|
|
512
|
+
LuxAppFooterButtonService,
|
|
513
|
+
LuxAppFooterLinkService,
|
|
514
|
+
LuxCommonModule,
|
|
515
|
+
LuxComponentsConfigModule,
|
|
516
|
+
LuxComponentsConfigParameters,
|
|
517
|
+
LuxConsoleService,
|
|
518
|
+
LuxDirectivesModule,
|
|
519
|
+
LuxErrorModule,
|
|
520
|
+
LuxErrorService,
|
|
521
|
+
LuxFormModule,
|
|
522
|
+
LuxIconModule,
|
|
523
|
+
LuxLayoutModule,
|
|
524
|
+
LuxMasterDetailMobileHelperService,
|
|
525
|
+
LuxPipesModule,
|
|
526
|
+
LuxPopupsModule,
|
|
527
|
+
LuxSnackbarService,
|
|
528
|
+
LuxStepperHelperService
|
|
529
|
+
} from '@ihk-gfi/lux-components';
|
|
530
|
+
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
531
|
+
|
|
532
|
+
const luxComponentsConfig: LuxComponentsConfigParameters = {
|
|
533
|
+
generateLuxTagIds: true,
|
|
534
|
+
labelConfiguration: {
|
|
535
|
+
allUppercase: true,
|
|
536
|
+
notAppliedTo: ['lux-side-nav-item', 'lux-menu-item', 'lux-link']
|
|
537
|
+
},
|
|
538
|
+
lookupServiceUrl: '/lookup/'
|
|
539
|
+
};
|
|
540
|
+
|
|
541
|
+
@NgModule({
|
|
542
|
+
declarations: [AppComponent, HomeComponent, ErrorComponent, ProfilComponent],
|
|
543
|
+
imports: [
|
|
544
|
+
BrowserModule,
|
|
545
|
+
BrowserAnimationsModule,
|
|
546
|
+
AppRoutingModule,
|
|
547
|
+
LuxDirectivesModule,
|
|
548
|
+
LuxIconModule,
|
|
549
|
+
LuxLayoutModule,
|
|
550
|
+
LuxActionModule,
|
|
551
|
+
LuxFormModule,
|
|
552
|
+
LuxCommonModule,
|
|
553
|
+
LuxPipesModule,
|
|
554
|
+
LuxPopupsModule,
|
|
555
|
+
LuxErrorModule,
|
|
556
|
+
FlexLayoutModule,
|
|
557
|
+
LuxComponentsConfigModule.forRoot(luxComponentsConfig)
|
|
558
|
+
],
|
|
559
|
+
providers: [
|
|
560
|
+
LuxAppFooterButtonService,
|
|
561
|
+
LuxAppFooterLinkService,
|
|
562
|
+
LuxSnackbarService,
|
|
563
|
+
LuxErrorService,
|
|
564
|
+
LuxMasterDetailMobileHelperService,
|
|
565
|
+
LuxStepperHelperService,
|
|
566
|
+
LuxConsoleService
|
|
567
|
+
],
|
|
568
|
+
bootstrap: [AppComponent]
|
|
569
|
+
})
|
|
570
|
+
export class AppModule {}
|
|
571
|
+
`);
|
|
572
|
+
schematics_1.callRule(index_1.updateAppModule(testOptions), rxjs_1.of(appTree), context).subscribe((success) => {
|
|
573
|
+
var _a;
|
|
574
|
+
const content = (_a = success.read(testOptions.path + '/src/app/app.module.ts')) === null || _a === void 0 ? void 0 : _a.toString();
|
|
575
|
+
expect(content).not.toContain('LuxAppFooterButtonService,');
|
|
576
|
+
expect(content).not.toContain('LuxAppFooterLinkService,');
|
|
577
|
+
expect(content).not.toContain('LuxSnackbarService,');
|
|
578
|
+
expect(content).not.toContain('LuxErrorService,');
|
|
579
|
+
expect(content).not.toContain('LuxMasterDetailMobileHelperService,');
|
|
580
|
+
expect(content).not.toContain('LuxStepperHelperService,');
|
|
581
|
+
expect(content).not.toContain('LuxConsoleService,');
|
|
582
|
+
expect(content).toContain('LuxIconModule,');
|
|
583
|
+
expect(content).toContain('LuxCommonModule,');
|
|
584
|
+
expect(content).not.toContain('displayBindingDebugHint');
|
|
585
|
+
expect(content).toContain(`
|
|
586
|
+
const luxComponentsConfig: LuxComponentsConfigParameters = {
|
|
587
|
+
generateLuxTagIds: environment.generateLuxTagIds
|
|
588
|
+
};`);
|
|
589
|
+
done();
|
|
590
|
+
}, (reason) => expect(reason).toBeUndefined());
|
|
591
|
+
});
|
|
592
|
+
});
|
|
593
|
+
describe('[Rule] i18nUpdateAppModule', () => {
|
|
594
|
+
it('Sollte die Datei "app.module.ts" (i18n) angepasst haben', (done) => {
|
|
595
|
+
appTree.overwrite(testOptions.path + '/src/app/app.module.ts', `
|
|
596
|
+
import '@angular/common/locales/global/de';
|
|
597
|
+
import { Configuration, ConfigurationParameters } from './../../src-gen/bsclient/configuration';
|
|
598
|
+
import { SDApiModule } from '@ihk-gfi/lux-stammdaten';
|
|
599
|
+
import { BSApiModule } from './../../src-gen/bsclient/api.module';
|
|
600
|
+
import {registerLocaleData, DatePipe} from '@angular/common';
|
|
601
|
+
import {HTTP_INTERCEPTORS, HttpClientModule} from '@angular/common/http';
|
|
602
|
+
import {LOCALE_ID, NgModule, ErrorHandler} from '@angular/core';
|
|
603
|
+
import {FlexLayoutModule} from '@angular/flex-layout';
|
|
604
|
+
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
|
|
605
|
+
import {BrowserModule} from '@angular/platform-browser';
|
|
606
|
+
|
|
607
|
+
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
|
|
608
|
+
import {
|
|
609
|
+
LuxFilePreviewModule,
|
|
610
|
+
LuxFilePreviewComponent
|
|
611
|
+
} from '@ihk-gfi/lux-components';
|
|
612
|
+
|
|
613
|
+
import { TimeoutComponent } from './components/basic/timeout/timeout.component';
|
|
614
|
+
import {UnauthorizedComponent} from './components/basic/unauthorized/unauthorized.component';
|
|
615
|
+
import {SharedService} from './services/shared.service';
|
|
616
|
+
|
|
617
|
+
@NgModule({
|
|
618
|
+
declarations : [
|
|
619
|
+
AppComponent,
|
|
620
|
+
DatenschutzComponent,
|
|
621
|
+
ImpressumComponent,
|
|
622
|
+
MaintenanceComponent,
|
|
623
|
+
ErrorComponent,
|
|
624
|
+
WelcomeComponent,
|
|
625
|
+
UnauthorizedComponent,
|
|
626
|
+
TimeoutComponent,
|
|
627
|
+
ByeComponent
|
|
628
|
+
],
|
|
629
|
+
imports : [
|
|
630
|
+
HttpClientModule,
|
|
631
|
+
BrowserModule,
|
|
632
|
+
FormsModule,
|
|
633
|
+
ReactiveFormsModule,
|
|
634
|
+
AppRoutingModule,
|
|
635
|
+
BrowserAnimationsModule,
|
|
636
|
+
LuxDirectivesModule,
|
|
637
|
+
LuxIconModule,
|
|
638
|
+
LuxLayoutModule,
|
|
639
|
+
LuxActionModule,
|
|
640
|
+
LuxFormModule,
|
|
641
|
+
LuxCommonModule,
|
|
642
|
+
LuxPipesModule,
|
|
643
|
+
LuxPopupsModule,
|
|
644
|
+
LuxErrorModule,
|
|
645
|
+
FlexLayoutModule,
|
|
646
|
+
LuxFilePreviewModule,
|
|
647
|
+
FeedbackModule,
|
|
648
|
+
HomeModule,
|
|
649
|
+
ConfigurationModule,
|
|
650
|
+
SDApiModule.forRoot(apiSDConfigFactory),
|
|
651
|
+
BSApiModule.forRoot(apiConfigFactory),
|
|
652
|
+
LuxComponentsConfigModule.forRoot(luxComponentsConfig)
|
|
653
|
+
],
|
|
654
|
+
entryComponents: [
|
|
655
|
+
LuxSnackbarComponent,
|
|
656
|
+
LuxFilePreviewComponent
|
|
657
|
+
],
|
|
658
|
+
providers : [
|
|
659
|
+
LuxConsoleService,
|
|
660
|
+
{
|
|
661
|
+
provide : HTTP_INTERCEPTORS,
|
|
662
|
+
useClass: CSRFInterceptor,
|
|
663
|
+
multi : true
|
|
664
|
+
},
|
|
665
|
+
{
|
|
666
|
+
provide : HTTP_INTERCEPTORS,
|
|
667
|
+
useClass: CorrelationInterceptor,
|
|
668
|
+
multi : true
|
|
669
|
+
},
|
|
670
|
+
{
|
|
671
|
+
provide : HTTP_INTERCEPTORS,
|
|
672
|
+
useClass: UnauthorizedInterceptor,
|
|
673
|
+
multi : true
|
|
674
|
+
},
|
|
675
|
+
{provide: LOCALE_ID, useValue: (document[ 'locale' ] ? document[ 'locale' ] : 'de-DE')},
|
|
676
|
+
{ provide: Window, useValue: window },
|
|
677
|
+
],
|
|
678
|
+
bootstrap : [
|
|
679
|
+
AppComponent
|
|
680
|
+
]
|
|
681
|
+
})
|
|
682
|
+
export class AppModule {
|
|
683
|
+
}
|
|
684
|
+
`);
|
|
685
|
+
schematics_1.callRule(index_1.i18nUpdateAppModule(testOptions), rxjs_1.of(appTree), context).subscribe((success) => {
|
|
686
|
+
var _a;
|
|
687
|
+
const content = (_a = success.read(testOptions.path + '/src/app/app.module.ts')) === null || _a === void 0 ? void 0 : _a.toString();
|
|
688
|
+
expect(content).not.toContain('import \'@angular/common/locales/global/de\';');
|
|
689
|
+
expect(content).not.toContain('{provide: LOCALE_ID, useValue: (document[ \'locale\' ] ? document[ \'locale\' ] : \'de-DE\')},');
|
|
690
|
+
expect(content).not.toContain('import {LOCALE_ID');
|
|
691
|
+
expect(content).toContain('import { NgModule, ErrorHandler} from \'@angular/core\';');
|
|
692
|
+
expect(content).not.toContain('import {registerLocaleData');
|
|
693
|
+
expect(content).toContain('import { DatePipe} from \'@angular/common\';');
|
|
694
|
+
done();
|
|
695
|
+
}, (reason) => expect(reason).toBeUndefined());
|
|
696
|
+
});
|
|
697
|
+
});
|
|
698
|
+
describe('[Rule] i18nCopyMessages', () => {
|
|
699
|
+
it('Sollte die I18N-Dateien kopieren', (done) => {
|
|
700
|
+
schematics_1.callRule(index_1.i18nCopyMessages(testOptions), rxjs_1.of(appTree), context).subscribe((success) => {
|
|
701
|
+
expect(success.exists(testOptions.path + '/src/locale/messages.xlf')).toBeTrue();
|
|
702
|
+
expect(success.exists(testOptions.path + '/src/locale/messages.en.xlf')).toBeTrue();
|
|
703
|
+
expect(success.exists(testOptions.path + '/move-de-files.js')).toBeTrue();
|
|
704
|
+
done();
|
|
705
|
+
}, (reason) => expect(reason).toBeUndefined());
|
|
706
|
+
});
|
|
707
|
+
});
|
|
708
|
+
describe('[Rule] i18nUpdateAngularJson', () => {
|
|
709
|
+
it('Sollte die Datei "angular.json" (i18n) angepasst haben', (done) => {
|
|
710
|
+
appTree.overwrite('/angular.json', `
|
|
711
|
+
{
|
|
712
|
+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
|
713
|
+
"version": 1,
|
|
714
|
+
"newProjectRoot": "projects",
|
|
715
|
+
"projects": {
|
|
716
|
+
"bar": {
|
|
717
|
+
"root": "",
|
|
718
|
+
"sourceRoot": "src",
|
|
719
|
+
"projectType": "application",
|
|
720
|
+
"architect": {
|
|
721
|
+
"build": {
|
|
722
|
+
"builder": "@angular-devkit/build-angular:browser",
|
|
723
|
+
"options": {
|
|
724
|
+
"outputPath": "dist",
|
|
725
|
+
"index": "src/index.html",
|
|
726
|
+
"main": "src/main.ts",
|
|
727
|
+
"tsConfig": "src/tsconfig.app.json",
|
|
728
|
+
"polyfills": "src/polyfills.ts",
|
|
729
|
+
"assets": [
|
|
730
|
+
"src/assets",
|
|
731
|
+
\t\t\t { "glob": "**/*", "input": "./node_modules/pdfjs-dist/cmaps/", "output": "./assets/cmaps" }
|
|
732
|
+
],
|
|
733
|
+
"styles": [
|
|
734
|
+
"src/styles.scss",
|
|
735
|
+
"src/theming/luxtheme.scss"
|
|
736
|
+
],
|
|
737
|
+
"scripts": [],
|
|
738
|
+
"allowedCommonJsDependencies": ["hammerjs", "ng2-pdf-viewer"]
|
|
739
|
+
},
|
|
740
|
+
"configurations": {
|
|
741
|
+
"production": {
|
|
742
|
+
"budgets": [
|
|
743
|
+
{
|
|
744
|
+
"type": "anyComponentStyle",
|
|
745
|
+
"maximumWarning": "6kb"
|
|
746
|
+
}
|
|
747
|
+
],
|
|
748
|
+
"optimization": true,
|
|
749
|
+
"outputHashing": "all",
|
|
750
|
+
"sourceMap": false,
|
|
751
|
+
"namedChunks": false,
|
|
752
|
+
"aot": true,
|
|
753
|
+
"extractLicenses": true,
|
|
754
|
+
"vendorChunk": false,
|
|
755
|
+
"buildOptimizer": true,
|
|
756
|
+
"fileReplacements": [
|
|
757
|
+
{
|
|
758
|
+
"replace": "src/environments/environment.ts",
|
|
759
|
+
"with": "src/environments/environment.prod.ts"
|
|
760
|
+
}
|
|
761
|
+
]
|
|
762
|
+
},
|
|
763
|
+
"es5": {
|
|
764
|
+
"budgets": [
|
|
765
|
+
{
|
|
766
|
+
"type": "anyComponentStyle",
|
|
767
|
+
"maximumWarning": "6kb"
|
|
768
|
+
}
|
|
769
|
+
],
|
|
770
|
+
"tsConfig": "src/tsconfig.app.ie.json"
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
},
|
|
774
|
+
"serve": {
|
|
775
|
+
"builder": "@angular-devkit/build-angular:dev-server",
|
|
776
|
+
"options": {
|
|
777
|
+
"browserTarget": "lux-bp:build"
|
|
778
|
+
},
|
|
779
|
+
"configurations": {
|
|
780
|
+
"production": {
|
|
781
|
+
"browserTarget": "lux-bp:build:production"
|
|
782
|
+
},
|
|
783
|
+
"es5": {
|
|
784
|
+
"browserTarget": "lux-bp:build:es5"
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
},
|
|
788
|
+
"extract-i18n": {
|
|
789
|
+
"builder": "@angular-devkit/build-angular:extract-i18n",
|
|
790
|
+
"options": {
|
|
791
|
+
"browserTarget": "lux-bp:build"
|
|
792
|
+
}
|
|
793
|
+
},
|
|
794
|
+
"test": {
|
|
795
|
+
"builder": "@angular-devkit/build-angular:karma",
|
|
796
|
+
"options": {
|
|
797
|
+
"main": "src/test.ts",
|
|
798
|
+
"karmaConfig": "./karma.conf.js",
|
|
799
|
+
"polyfills": "src/polyfills.ts",
|
|
800
|
+
"tsConfig": "src/tsconfig.spec.json",
|
|
801
|
+
"scripts": [],
|
|
802
|
+
"styles": [
|
|
803
|
+
"src/styles.scss",
|
|
804
|
+
"src/theming/luxtheme.scss"
|
|
805
|
+
],
|
|
806
|
+
"assets": [
|
|
807
|
+
"src/assets",
|
|
808
|
+
\t\t\t { "glob": "**/*", "input": "./node_modules/pdfjs-dist/cmaps/", "output": "./assets/cmaps" }
|
|
809
|
+
]
|
|
810
|
+
}
|
|
811
|
+
},
|
|
812
|
+
"app-lint": {
|
|
813
|
+
"builder": "@angular-devkit/build-angular:tslint",
|
|
814
|
+
"options": {
|
|
815
|
+
"tsConfig": [
|
|
816
|
+
"src/tsconfig.app.json"
|
|
817
|
+
],
|
|
818
|
+
"tslintConfig": "./tslint.json"
|
|
819
|
+
}
|
|
820
|
+
\t\t},
|
|
821
|
+
"spec-lint": {
|
|
822
|
+
"builder": "@angular-devkit/build-angular:tslint",
|
|
823
|
+
"options": {
|
|
824
|
+
"tsConfig": [
|
|
825
|
+
"src/tsconfig.spec.json"
|
|
826
|
+
],
|
|
827
|
+
"tslintConfig": "./tslint.spec.json"
|
|
828
|
+
}
|
|
829
|
+
\t\t}
|
|
830
|
+
}
|
|
831
|
+
},
|
|
832
|
+
"lux-bp-e2e": {
|
|
833
|
+
"root": "e2e",
|
|
834
|
+
"sourceRoot": "e2e",
|
|
835
|
+
"projectType": "application",
|
|
836
|
+
"architect": {
|
|
837
|
+
"e2e": {
|
|
838
|
+
"builder": "@angular-devkit/build-angular:protractor",
|
|
839
|
+
"options": {
|
|
840
|
+
"protractorConfig": "./protractor.conf.js",
|
|
841
|
+
"devServerTarget": "lux-bp:serve"
|
|
842
|
+
}
|
|
843
|
+
},
|
|
844
|
+
"lint": {
|
|
845
|
+
"builder": "@angular-devkit/build-angular:tslint",
|
|
846
|
+
"options": {
|
|
847
|
+
"tsConfig": [
|
|
848
|
+
"e2e/tsconfig.e2e.json"
|
|
849
|
+
],
|
|
850
|
+
"exclude": [
|
|
851
|
+
"**/node_modules/**"
|
|
852
|
+
]
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
},
|
|
858
|
+
"defaultProject": "lux-bp",
|
|
859
|
+
"schematics": {
|
|
860
|
+
"@schematics/angular:component": {
|
|
861
|
+
"prefix": "bp",
|
|
862
|
+
"style": "scss"
|
|
863
|
+
},
|
|
864
|
+
"@schematics/angular:directive": {
|
|
865
|
+
"prefix": "bp"
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
`);
|
|
871
|
+
schematics_1.callRule(index_1.i18nUpdateAngularJson(testOptions), rxjs_1.of(appTree), context).subscribe((success) => {
|
|
872
|
+
var _a;
|
|
873
|
+
const content = (_a = success.read('angular.json')) === null || _a === void 0 ? void 0 : _a.toString();
|
|
874
|
+
expect(content).toContain('"i18n": {\n' +
|
|
875
|
+
' "sourceLocale": {\n' +
|
|
876
|
+
' "code": "de",\n' +
|
|
877
|
+
' "baseHref": "/"\n' +
|
|
878
|
+
' }');
|
|
879
|
+
expect(content).toContain(`"localize": [
|
|
880
|
+
"de"
|
|
881
|
+
]`);
|
|
882
|
+
expect(content).toContain('"i18nMissingTranslation": "error"');
|
|
883
|
+
expect(content).toContain(`"en": {
|
|
884
|
+
"localize": [
|
|
885
|
+
"en"
|
|
886
|
+
],
|
|
887
|
+
"aot": true,
|
|
888
|
+
"outputPath": "dist/en",
|
|
889
|
+
"i18nMissingTranslation": "error"
|
|
890
|
+
}
|
|
891
|
+
`);
|
|
892
|
+
expect(content).toContain(`"en": {
|
|
893
|
+
"browserTarget": "bar:build:en"
|
|
894
|
+
}
|
|
895
|
+
`);
|
|
896
|
+
done();
|
|
897
|
+
}, (reason) => expect(reason).toBeUndefined());
|
|
898
|
+
});
|
|
899
|
+
});
|
|
900
|
+
describe('[Rule] i18nUpdatePackageJson', () => {
|
|
901
|
+
it('Sollte die Datei "package.json" (i18n) angepasst haben', (done) => {
|
|
902
|
+
appTree.overwrite('/package.json', `
|
|
903
|
+
{
|
|
904
|
+
"name": "BP",
|
|
905
|
+
"version": "0.0.1",
|
|
906
|
+
"license": "MIT",
|
|
907
|
+
"scripts": {
|
|
908
|
+
"ng": "ng",
|
|
909
|
+
"start": "ng serve --public-host=http://localhost:4200",
|
|
910
|
+
"start_en": "ng serve --public-host=http://localhost:4200 --configuration en",
|
|
911
|
+
"build": "node --max_old_space_size=4024 ./node_modules/@angular/cli/bin/ng build --source-map",
|
|
912
|
+
"build-aot": "node --max_old_space_size=4024 ./node_modules/@angular/cli/bin/ng build --aot",
|
|
913
|
+
"buildzentral": "node --max_old_space_size=4024 ./node_modules/@angular/cli/bin/ng build --prod",
|
|
914
|
+
"start-ie": "ng serve --configuration es5 --public-host=http://localhost:4200",
|
|
915
|
+
"test": "ng test",
|
|
916
|
+
"test_no_sm": "ng test --no-sourceMap",
|
|
917
|
+
"test_single_run": "ng test --watch=false --code-coverage=true --browsers=ChromeHeadless",
|
|
918
|
+
"test_coverage": "ng test --watch=false --code-coverage=true",
|
|
919
|
+
"lint": "ng run lux-bp:app-lint --format=stylish && ng run lux-bp:spec-lint --format=stylish",
|
|
920
|
+
"e2e": "ng e2e",
|
|
921
|
+
"compodoc": "./node_modules/.bin/compodoc -p tsconfig.json",
|
|
922
|
+
"docStart": "compodoc src -s --port 8888",
|
|
923
|
+
"security": "npm audit --registry=https://registry.npmjs.org --audit-level high",
|
|
924
|
+
"smoketest": "npm run test_single_run && npm run build-aot && npm run lint --bailOnLintError true",
|
|
925
|
+
"generate_bsclient": "openapi-generator generate -i http://localhost:8081/business-service/openapi/v3/api-docs -g typescript-angular -o src-gen/bsclient --additional-properties apiModulePrefix=BS",
|
|
926
|
+
"generate_bsclient_zentral": "openapi-generator generate -i ../business-service/target/swagger.json -g typescript-angular -o src-gen/bsclient --additional-properties apiModulePrefix=BS"
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
`);
|
|
931
|
+
schematics_1.callRule(index_1.i18nUpdatePackageJson(testOptions), rxjs_1.of(appTree), context).subscribe((success) => {
|
|
932
|
+
var _a;
|
|
933
|
+
const content = (_a = success.read('package.json')) === null || _a === void 0 ? void 0 : _a.toString();
|
|
934
|
+
expect(content).toContain('"xi18n": "ng extract-i18n --output-path src/locale --ivy"');
|
|
935
|
+
expect(content).toContain('"build-aot": "node --max_old_space_size=4024 ./node_modules/@angular/cli/bin/ng build --aot && npm run move-de-files"');
|
|
936
|
+
expect(content).toContain('"buildzentral": "node --max_old_space_size=4024 ./node_modules/@angular/cli/bin/ng build --prod && npm run move-de-files"');
|
|
937
|
+
expect(content).toContain('"start_en": "ng serve --public-host=http://localhost:4200 --configuration en"');
|
|
938
|
+
done();
|
|
939
|
+
}, (reason) => expect(reason).toBeUndefined());
|
|
940
|
+
});
|
|
941
|
+
});
|
|
942
|
+
describe('[Rule] updateTsConfigJson', () => {
|
|
943
|
+
it('Sollte die tsconfig.json anpassen', (done) => {
|
|
944
|
+
appTree.overwrite('/tsconfig.json', `
|
|
945
|
+
{
|
|
946
|
+
"compileOnSave": false,
|
|
947
|
+
"compilerOptions": {
|
|
948
|
+
"downlevelIteration": true,
|
|
949
|
+
"outDir": "./dist/out-tsc",
|
|
950
|
+
"sourceMap": true,
|
|
951
|
+
"declaration": false,
|
|
952
|
+
"moduleResolution": "node",
|
|
953
|
+
"emitDecoratorMetadata": true,
|
|
954
|
+
"experimentalDecorators": true,
|
|
955
|
+
"target": "es2015",
|
|
956
|
+
"typeRoots": [
|
|
957
|
+
"node_modules/@types"
|
|
958
|
+
],
|
|
959
|
+
"lib": [
|
|
960
|
+
"es2017",
|
|
961
|
+
"dom"
|
|
962
|
+
],
|
|
963
|
+
"module": "esnext",
|
|
964
|
+
"baseUrl": "./"
|
|
965
|
+
},
|
|
966
|
+
"angularCompilerOptions": {
|
|
967
|
+
"fullTemplateTypeCheck": true,
|
|
968
|
+
"preserveWhiteSpace": false,
|
|
969
|
+
"strictInjectionParameters": true,
|
|
970
|
+
"enableIvy": true
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
`);
|
|
974
|
+
schematics_1.callRule(index_1.updateTsConfigJson(testOptions), rxjs_1.of(appTree), context).subscribe((success) => {
|
|
975
|
+
var _a;
|
|
976
|
+
const content = (_a = success.read('/tsconfig.json')) === null || _a === void 0 ? void 0 : _a.toString();
|
|
977
|
+
expect(content).toContain('"strict": false');
|
|
978
|
+
expect(content).toContain('"noImplicitReturns": true');
|
|
979
|
+
expect(content).toContain('"noFallthroughCasesInSwitch": true');
|
|
980
|
+
expect(content).toContain('"forceConsistentCasingInFileNames": true');
|
|
981
|
+
expect(content).toContain('"lib": [\n "es2018",\n "dom"\n ]');
|
|
982
|
+
expect(content).toContain('"module": "es2020"');
|
|
983
|
+
expect(content).toContain('"strictInputAccessModifiers": true');
|
|
984
|
+
expect(content).toContain('"strictTemplates": false');
|
|
985
|
+
done();
|
|
986
|
+
}, (reason) => expect(reason).toBeUndefined());
|
|
987
|
+
});
|
|
988
|
+
});
|
|
989
|
+
});
|
|
990
|
+
//# sourceMappingURL=index_spec.js.map
|