@eui/tools 4.19.0 → 4.19.4

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.
@@ -1 +1 @@
1
- 4.19.0
1
+ 4.19.4
package/CHANGELOG.md CHANGED
@@ -1,3 +1,39 @@
1
+ ## 4.19.4 (2022-02-03)
2
+
3
+ ##### Chores
4
+
5
+ * **other:**
6
+ * added pwa injection in angular config - EUI-4107 [EUI-4107](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-4107) ([d36f21fd](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/d36f21fd0c80a10daed260f09d79b03917ce1322))
7
+
8
+ * * *
9
+ * * *
10
+ ## 4.19.3 (2022-02-02)
11
+
12
+ ##### Chores
13
+
14
+ * **other:**
15
+ * added pathsMapping replacement for v10 remotes config - EUI-4107 [EUI-4107](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-4107) ([6e5651cf](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/6e5651cfcf2533ced316b5e04650d65f88520185))
16
+
17
+ * * *
18
+ * * *
19
+ ## 4.19.2 (2022-01-25)
20
+
21
+ ##### Bug Fixes
22
+
23
+ * **other:**
24
+ * hotfix pipeline metadata issues - added missing v10 pkg skeleton files - EUI-4107 [EUI-4107](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-4107) ([bb59cdbf](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/bb59cdbf98e13cca49017c6268318c4573bd73b4))
25
+
26
+ * * *
27
+ * * *
28
+ ## 4.19.1 (2022-01-21)
29
+
30
+ ##### Bug Fixes
31
+
32
+ * **other:**
33
+ * csdr v13 app config skeleton - EUI-4107 [EUI-4107](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-4107) ([876f5336](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/876f5336f186d3bb245f132b0269ad38d72a1314))
34
+
35
+ * * *
36
+ * * *
1
37
  ## 4.19.0 (2022-01-21)
2
38
 
3
39
  ##### New Features
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eui/tools",
3
- "version": "4.19.0",
3
+ "version": "4.19.4",
4
4
  "tag": "latest",
5
5
  "license": "EUPL-1.1",
6
6
  "description": "eUI common tools and scripts",
package/sandbox.js CHANGED
@@ -631,10 +631,22 @@ const notificationUtils = require('./scripts/utils/notification/notification-uti
631
631
  // tools.logBanner('this is the content of the banner');
632
632
  // })
633
633
 
634
+ // return Promise.resolve()
635
+ // .then(() => {
636
+ // const prjName = 'eui-showcase-ux';
637
+ // const prj = configUtils.projects.getCsdrProject(prjName);
638
+
639
+ // return compositeUtils.getDeps(prj, 'TST');
640
+ // })
641
+
642
+
643
+ const prjName = 'my-workplace';
644
+ const prj = configUtils.projects.getCsdrProject(prjName);
645
+
634
646
  return Promise.resolve()
647
+ // .then(() => {
648
+ // return injectionUtils.externals.injectExternalAppSources(prj);
649
+ // })
635
650
  .then(() => {
636
- const prjName = 'eui-showcase-ux';
637
- const prj = configUtils.projects.getCsdrProject(prjName);
638
-
639
- return compositeUtils.getDeps(prj, 'TST');
651
+ return injectionUtils.externals.remapRoutesByEnvConfig(prj, 'DEV', true);
640
652
  })
@@ -0,0 +1,5 @@
1
+ describe('First test', () => {
2
+ it('should work', () => {
3
+ expect(true).toBe(true);
4
+ });
5
+ });
@@ -0,0 +1 @@
1
+ Hello from <strong>@module.name@-cmp1</strong>
@@ -0,0 +1,25 @@
1
+ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { Cmp1Component } from './cmp1.component';
4
+
5
+ describe('ModuleComponent', () => {
6
+ let component: Cmp1Component;
7
+ let fixture: ComponentFixture<Cmp1Component>;
8
+
9
+ beforeEach(async(() => {
10
+ TestBed.configureTestingModule({
11
+ declarations: [Cmp1Component],
12
+ })
13
+ .compileComponents();
14
+ }));
15
+
16
+ beforeEach(() => {
17
+ fixture = TestBed.createComponent(Cmp1Component);
18
+ component = fixture.componentInstance;
19
+ fixture.detectChanges();
20
+ });
21
+
22
+ it('should create', () => {
23
+ expect(component).toBeTruthy();
24
+ });
25
+ });
@@ -0,0 +1,14 @@
1
+ import { Component, OnInit } from '@angular/core';
2
+
3
+ @Component({
4
+ selector: '@module.scope.string@-cmp1-component',
5
+ templateUrl: './cmp1.component.html',
6
+ })
7
+ export class Cmp1Component implements OnInit {
8
+
9
+ constructor() { }
10
+
11
+ ngOnInit() {
12
+ }
13
+
14
+ }
@@ -223,7 +223,126 @@ const angularProjectDef = {
223
223
  }
224
224
  };
225
225
 
226
-
226
+ const angularProjectDefV13 = {
227
+ "root": "",
228
+ "sourceRoot": "apps/@project.name@/src",
229
+ "projectType": "application",
230
+ "prefix": "app",
231
+ "schematics": {
232
+ "@schematics/angular:component": {
233
+ "style": "scss"
234
+ },
235
+ "@schematics/angular:application": {
236
+ "strict": true
237
+ }
238
+ },
239
+ "architect": {
240
+ "build": {
241
+ "builder": "@angular-devkit/build-angular:browser",
242
+ "options": {
243
+ "outputPath": "apps/@project.name@/dist",
244
+ "index": "apps/@project.name@/src/index.html",
245
+ "main": "apps/@project.name@/src/main.ts",
246
+ "polyfills": "apps/@project.name@/src/polyfills.ts",
247
+ "tsConfig": "apps/@project.name@/tsconfig.app.json",
248
+ "assets": [
249
+ "apps/@project.name@/src/favicon.ico",
250
+ "apps/@project.name@/src/assets",
251
+ {
252
+ "glob": "**/*",
253
+ "input": "node_modules/@eui/core/assets/",
254
+ "output": "./assets"
255
+ }
256
+ ],
257
+ "styles": [
258
+ ]
259
+ },
260
+ "configurations": {
261
+ "production": {
262
+ "fileReplacements": [
263
+ {
264
+ "replace": "apps/@project.name@/src/environments/environment.ts",
265
+ "with": "apps/@project.name@/src/environments/environment.prod.ts"
266
+ }
267
+ ],
268
+ "optimization": false,
269
+ "outputHashing": "all",
270
+ "sourceMap": false,
271
+ "namedChunks": true,
272
+ "aot": true,
273
+ "extractLicenses": true,
274
+ "vendorChunk": false,
275
+ "buildOptimizer": false,
276
+ "budgets": [
277
+ {
278
+ "type": "initial",
279
+ "maximumWarning": "2mb",
280
+ "maximumError": "6mb"
281
+ }
282
+ ]
283
+ },
284
+ "production-optimized": {
285
+ "fileReplacements": [
286
+ {
287
+ "replace": "apps/@project.name@/src/environments/environment.ts",
288
+ "with": "apps/@project.name@/src/environments/environment.prod.ts"
289
+ }
290
+ ],
291
+ "optimization": {
292
+ "scripts": true,
293
+ "styles": {
294
+ "minify": false,
295
+ "inlineCritical": true
296
+ },
297
+ "fonts": true
298
+ },
299
+ "outputHashing": "all",
300
+ "sourceMap": false,
301
+ "namedChunks": true,
302
+ "aot": true,
303
+ "extractLicenses": true,
304
+ "vendorChunk": false,
305
+ "buildOptimizer": true,
306
+ "budgets": [
307
+ {
308
+ "type": "initial",
309
+ "maximumWarning": "2mb",
310
+ "maximumError": "6mb"
311
+ }
312
+ ]
313
+ },
314
+ "development": {
315
+ "buildOptimizer": false,
316
+ "optimization": false,
317
+ "vendorChunk": true,
318
+ "extractLicenses": false,
319
+ "sourceMap": true,
320
+ "namedChunks": true
321
+ }
322
+ },
323
+ "defaultConfiguration": "production"
324
+ },
325
+ "serve": {
326
+ "builder": "@angular-devkit/build-angular:dev-server",
327
+ "options": {
328
+ "browserTarget": "@project.name@:build"
329
+ },
330
+ "configurations": {
331
+ "proxy-mock": {
332
+ "browserTarget": "@project.name@:build",
333
+ "proxyConfig": "apps/@project.name@/proxy-mock.conf.json"
334
+ },
335
+ "production": {
336
+ "browserTarget": "@project.name@:build:production"
337
+ },
338
+ "development": {
339
+ "browserTarget": "@project.name@:build:development"
340
+ }
341
+ },
342
+ "defaultConfiguration": "development"
343
+ }
344
+ }
345
+ };
227
346
 
228
347
  const angularProjectLightDef = {
229
348
  "root": "",
@@ -929,10 +1048,14 @@ module.exports.registerAngularProjectDef = (project, build = false) => {
929
1048
  }
930
1049
 
931
1050
  } else {
932
- if (project.build && project.build.csdrFileReplacement === true) {
933
- projectDef = JSON.stringify(angularProjectLightDef);
1051
+ if (project.build && project.build.euiVersion === '13.x') {
1052
+ projectDef = JSON.stringify(angularProjectDefV13);
934
1053
  } else {
935
- projectDef = JSON.stringify(angularProjectDef);
1054
+ if (project.build && project.build.csdrFileReplacement === true) {
1055
+ projectDef = JSON.stringify(angularProjectLightDef);
1056
+ } else {
1057
+ projectDef = JSON.stringify(angularProjectDef);
1058
+ }
936
1059
  }
937
1060
  }
938
1061
  let replaceProject = tools.replaceAll(projectDef, '@project.name@', project.name);
@@ -997,6 +1120,13 @@ module.exports.registerAngularProjectDef = (project, build = false) => {
997
1120
  jsonFile['projects'][project.name].architect.serve.configurations[confKey] = serveConf;
998
1121
  })
999
1122
  }
1123
+
1124
+ // checking pwa additional injection
1125
+ if (project.build && project.build.pwa) {
1126
+ jsonFile['projects'][project.name].architect.build.options.serviceWorker = true;
1127
+ jsonFile['projects'][project.name].architect.build.options.ngswConfigPath = "ngsw-config.json";
1128
+ jsonFile['projects'][project.name].architect.build.options.assets.push("src/manifest.webmanifest");
1129
+ }
1000
1130
  }
1001
1131
 
1002
1132
  tools.writeJsonFileSync(file, jsonFile);
@@ -222,7 +222,7 @@ module.exports.storeMetadata = (
222
222
  if (pkgIdxHOTFIX > -1) {
223
223
  packagesHotfixTag[pkgIdxHOTFIX] = newPackage;
224
224
  } else {
225
- if (!packagesNextTag) {
225
+ if (!packagesHotfixTag) {
226
226
  packagesHotfixTag = [];
227
227
  }
228
228
  packagesHotfixTag.push(newPackage);
@@ -256,11 +256,14 @@ module.exports.remapRoutesByEnvConfig = (project, envTarget, build) => {
256
256
 
257
257
  // get routes file content and replace tokens
258
258
  routesRemapping.forEach((route) => {
259
- tools.logInfo(`checking replacement for : ${JSON.stringify(route)}`);
259
+ tools.logInfo(`\nchecking replacement for : ${JSON.stringify(route)}`);
260
260
  const tokenToSearch = `./features/${route.featureModule}-lib.module#Module`;
261
+ tools.logInfo(`Searching token : ${tokenToSearch}`);
261
262
  if (routesFileContent.indexOf(tokenToSearch) > -1) {
262
263
  tools.logInfo(`token ${tokenToSearch} found...replacing by ${route.routeModuleDef}`);
263
264
  routesFileContent = tools.replaceAll(routesFileContent, tokenToSearch, route.routeModuleDef);
265
+ } else {
266
+ tools.logWarning(`token ${tokenToSearch} NOT FOUND`);
264
267
  }
265
268
  })
266
269
 
@@ -277,6 +280,54 @@ module.exports.remapRoutesByEnvConfig = (project, envTarget, build) => {
277
280
  if (routesFileContent.indexOf(tokenToSearch) > -1) {
278
281
  tools.logInfo(`token ${tokenToSearch} found...replacing by ${route.updatedRoute}`);
279
282
  routesFileContent = tools.replaceAll(routesFileContent, tokenToSearch, route.updatedRoute);
283
+ } else {
284
+ tools.logWarning(`token ${tokenToSearch} NOT FOUND`);
285
+ }
286
+ })
287
+ }
288
+
289
+ // checking paths mapping (new method for v10 remotes)
290
+ const pathsMapping = config.pathsMapping;
291
+ if (!pathsMapping) {
292
+ tools.logWarning('No pathsMapping found in current config...skipping');
293
+
294
+ } else {
295
+ tools.logInfo('Paths mappings for v10 remotes activation');
296
+ pathsMapping.forEach((pathMapping) => {
297
+ tools.logInfo(`Checking path: ${pathMapping.path}`);
298
+ const placeholderToSearch = `// ${pathMapping.path}-placeholder`;
299
+
300
+ if (routesFileContent.indexOf(placeholderToSearch) > -1) {
301
+ tools.logInfo(`path placeholder: "${placeholderToSearch}" found...replacing`);
302
+
303
+ let placeholderContent = '';
304
+ if (pathMapping.data) {
305
+ placeholderContent += 'data:{';
306
+ if (pathMapping.data.featureName) {
307
+ placeholderContent += `featureName: "${pathMapping.data.featureName}"`;
308
+ }
309
+ if (pathMapping.data.moduleId) {
310
+ placeholderContent += `, moduleId: "${pathMapping.data.moduleId}"`;
311
+ }
312
+ if (pathMapping.data.elementTag) {
313
+ placeholderContent += `, elementTag: "${pathMapping.data.elementTag}"`;
314
+ }
315
+ if (pathMapping.data.iframe) {
316
+ placeholderContent += `, iframe: ${pathMapping.data.iframe}`;
317
+ }
318
+ placeholderContent += '}';
319
+ }
320
+ if (pathMapping.loadChildren) {
321
+ placeholderContent += `, loadChildren: "${pathMapping.loadChildren}"`;
322
+ }
323
+
324
+ tools.logInfo('Generated content for route: ');
325
+ console.log(placeholderContent);
326
+
327
+ routesFileContent = tools.replaceAll(routesFileContent, placeholderToSearch, placeholderContent);
328
+
329
+ } else {
330
+ tools.logWarning(`token ${placeholderToSearch} NOT FOUND`);
280
331
  }
281
332
  })
282
333
  }