@eui/tools 6.2.48 → 6.2.50

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.
Files changed (27) hide show
  1. package/.version.properties +1 -1
  2. package/CHANGELOG.md +18 -0
  3. package/package.json +6 -6
  4. package/scripts/csdr/init/remotes/15.x/{angular.json → base/angular.json} +0 -0
  5. package/scripts/csdr/init/remotes/15.x/{browserslist → base/browserslist} +0 -0
  6. package/scripts/csdr/init/remotes/15.x/{package.json_TO_REPLACE → base/package.json_TO_REPLACE} +0 -0
  7. package/scripts/csdr/init/remotes/15.x/{tsconfig.app.json → base/tsconfig.app.json} +0 -0
  8. package/scripts/csdr/init/remotes/15.x/full/src/app/dummy.scss +3 -0
  9. package/scripts/csdr/init/remotes/15.x/full/src/app/dummy.spec.ts +6 -0
  10. package/scripts/csdr/init/remotes/15.x/full/src/app/eui-components.ts +9 -0
  11. package/scripts/csdr/init/remotes/15.x/full/src/app/fallback.component.ts +11 -0
  12. package/scripts/csdr/init/remotes/15.x/full/src/app/module.component.ts +91 -0
  13. package/scripts/csdr/init/remotes/15.x/full/src/app/reducers/custom-route-serializer.ts +28 -0
  14. package/scripts/csdr/init/remotes/15.x/full/src/app/reducers/index.ts +66 -0
  15. package/scripts/csdr/init/remotes/15.x/full/src/assets/.gitkeep +0 -0
  16. package/scripts/csdr/init/remotes/15.x/full/src/config/index.ts +20 -0
  17. package/scripts/csdr/init/remotes/15.x/full/src/config/modules.ts +3 -0
  18. package/scripts/csdr/init/remotes/15.x/full/src/environments/environment.prod.ts +3 -0
  19. package/scripts/csdr/init/remotes/15.x/full/src/environments/environment.ts +3 -0
  20. package/scripts/csdr/init/remotes/15.x/full/src/favicon.ico +0 -0
  21. package/scripts/csdr/init/remotes/15.x/full/src/index.html +10 -0
  22. package/scripts/csdr/init/remotes/15.x/full/src/main.ts +11 -0
  23. package/scripts/csdr/init/remotes/15.x/full/src/polyfills.ts +87 -0
  24. package/scripts/csdr/init/remotes/15.x/full/src/test.ts +20 -0
  25. package/scripts/csdr/init/remotes.js +11 -2
  26. package/scripts/utils/pre-build/injection/externals.js +5 -3
  27. package/scripts/utils/test/test-utils.js +1 -1
@@ -1 +1 @@
1
- 6.2.48
1
+ 6.2.50
package/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ ## 6.2.50 (2023-01-23)
2
+
3
+ ##### Chores
4
+
5
+ * **other:**
6
+ * adapted dependencies for security - EUI-7035 [EUI-7035](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-7035) ([9ce0bd90](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/9ce0bd90fdf3088bd9cbcea3cbec54d911653cc7))
7
+
8
+ * * *
9
+ * * *
10
+ ## 6.2.49 (2023-01-19)
11
+
12
+ ##### Chores
13
+
14
+ * **other:**
15
+ * optional full skeleton for v15 remote injection - MWP-9204 [MWP-9204](https://webgate.ec.europa.eu/CITnet/jira/browse/MWP-9204) ([930fa7b1](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/930fa7b1808f340f90595194c2d6d2950ce9148b))
16
+
17
+ * * *
18
+ * * *
1
19
  ## 6.2.48 (2023-01-11)
2
20
 
3
21
  ##### Chores
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eui/tools",
3
- "version": "6.2.48",
3
+ "version": "6.2.50",
4
4
  "tag": "latest",
5
5
  "license": "EUPL-1.1",
6
6
  "description": "eUI common tools and scripts",
@@ -22,12 +22,12 @@
22
22
  "rimraf": "3.0.2",
23
23
  "ncp": "2.0.0",
24
24
  "moment": "2.29.4",
25
- "moment-timezone": "0.5.37",
25
+ "moment-timezone": "0.5.40",
26
26
  "npm-run-all": "4.1.5",
27
27
  "figures": "3.2.0",
28
28
  "xml2js": "0.4.23",
29
29
  "https-proxy-agent": "2.2.3",
30
- "json-server": "0.16.3",
30
+ "json-server": "0.17.1",
31
31
  "faker": "5.5.3",
32
32
  "nodemon": "2.0.20",
33
33
  "lowdb": "1.0.0",
@@ -38,10 +38,10 @@
38
38
  "postcss": "7.0.36",
39
39
  "cssnano": "4.1.11",
40
40
  "extend": "3.0.2",
41
- "mocha": "8.4.0",
42
- "chai": "4.3.6",
41
+ "mocha": "10.2.0",
42
+ "chai": "4.3.7",
43
43
  "nyc": "15.1.0",
44
- "node-fetch": "2.6.7",
44
+ "node-fetch": "3.3.0",
45
45
  "sendmail": "1.6.1",
46
46
  "svg-sprite": "2.0.0",
47
47
  "imagemin": "7.0.1",
@@ -0,0 +1,3 @@
1
+ .example {
2
+ padding: 10px;
3
+ }
@@ -0,0 +1,6 @@
1
+ // Dummy test
2
+ describe('Test', () => {
3
+ it('should work', () => {
4
+ expect(true).toBe(true);
5
+ });
6
+ });
@@ -0,0 +1,9 @@
1
+ import { EuiBlockContentModule } from '@eui/components/eui-block-content';
2
+ import { EuiButtonModule } from '@eui/components/eui-button';
3
+ import { EuiLabelModule } from '@eui/components/eui-label';
4
+
5
+ export const EUI_COMPONENTS_MODULES = [
6
+ EuiBlockContentModule,
7
+ EuiButtonModule,
8
+ EuiLabelModule,
9
+ ];
@@ -0,0 +1,11 @@
1
+ import { Component } from '@angular/core';
2
+
3
+ @Component({
4
+ template: `
5
+ <eui-block-content [isBlocked]="true">
6
+ <div style="height: 100%"></div>
7
+ </eui-block-content>
8
+ `,
9
+ })
10
+ export class FallbackComponent {
11
+ }
@@ -0,0 +1,91 @@
1
+ import { Component, OnInit, Inject, ElementRef, OnDestroy } from '@angular/core';
2
+
3
+ import { take } from 'rxjs/operators';
4
+
5
+ import { CONFIG_TOKEN } from '@eui/core';
6
+ import { ElementSetupService, ElementLifeCycleService } from '@csdr/integration/element';
7
+
8
+ enum ElementStatus {
9
+ Loading = 'loading',
10
+ Loaded = 'loaded',
11
+ Error = 'error',
12
+ }
13
+
14
+ @Component({
15
+ template: `
16
+ <eui-block-content *ngIf="moduleStatus === ElementStatus.Loading" [isBlocked]="true">
17
+ <div style="height: 100%"></div>
18
+ </eui-block-content>
19
+ <ng-container *ngIf="moduleStatus === ElementStatus.Loaded">
20
+ <router-outlet></router-outlet>
21
+ </ng-container>
22
+ <ng-container *ngIf="moduleStatus === ElementStatus.Error">
23
+ <div class="error-container">
24
+ <div>
25
+ <h1>Translations or user data for this module failed to load.</h1>
26
+ <p>Do you want to try again?</p>
27
+ <button euiButton euiPrimary (click)="loadData()">
28
+ <span euiLabel>{{ 'global.RELOAD' | translate }}</span>
29
+ </button>
30
+ </div>
31
+ </div>
32
+ </ng-container>
33
+ `,
34
+ styles: [`
35
+ .error-container {
36
+ width: 50vw;
37
+ height: 50vh;
38
+ position: absolute;
39
+ top: 50%;
40
+ left: 50%;
41
+ transform: translate(-50%, -50%);
42
+ }
43
+
44
+ .error-container div {
45
+ text-align: center
46
+ }
47
+ `],
48
+ })
49
+ export class ModuleComponent implements OnInit, OnDestroy {
50
+ ElementStatus = ElementStatus;
51
+ moduleStatus: ElementStatus;
52
+
53
+ constructor(private elRef: ElementRef,
54
+ @Inject(CONFIG_TOKEN) public config: any,
55
+ private elementLifeCycleService: ElementLifeCycleService,
56
+ private elementSetupService: ElementSetupService) {
57
+ }
58
+
59
+ ngOnInit() {
60
+ const elementData = this.elementLifeCycleService.getElementData(this.elRef);
61
+ this.elementLifeCycleService.setup(elementData);
62
+ this.loadData();
63
+ }
64
+
65
+ ngOnDestroy(): void {
66
+ this.elementLifeCycleService.cleanup();
67
+ }
68
+
69
+ private loadData() {
70
+ this.setStatus(ElementStatus.Loading);
71
+ try {
72
+ this.elementSetupService.init()
73
+ .pipe(take(1))
74
+ .subscribe((loadStatus: { success: boolean; error?: string }) => {
75
+ if (!loadStatus.success) {
76
+ this.setStatus(ElementStatus.Error);
77
+ console.error(`[ELEMENT: ${this.config.global.elementName}] `, loadStatus.error);
78
+ } else {
79
+ this.setStatus(ElementStatus.Loaded);
80
+ }
81
+ });
82
+ } catch (e) {
83
+ console.log(e);
84
+ this.setStatus(ElementStatus.Error);
85
+ }
86
+ }
87
+
88
+ private setStatus(status: ElementStatus) {
89
+ this.moduleStatus = status;
90
+ }
91
+ }
@@ -0,0 +1,28 @@
1
+ import { Params, RouterStateSnapshot } from '@angular/router';
2
+ import { RouterStateSerializer } from '@ngrx/router-store';
3
+
4
+ export interface RouterStateUrl {
5
+ url: string;
6
+ params: Params;
7
+ queryParams: Params;
8
+ }
9
+
10
+ export class CustomSerializer implements RouterStateSerializer<RouterStateUrl> {
11
+ serialize(routerState: RouterStateSnapshot): RouterStateUrl {
12
+ let route = routerState.root;
13
+
14
+ while (route.firstChild) {
15
+ route = route.firstChild;
16
+ }
17
+
18
+ const {
19
+ url,
20
+ root: { queryParams },
21
+ } = routerState;
22
+ const { params } = route;
23
+
24
+ // Only return an object including the URL, params and query params
25
+ // instead of the entire snapshot
26
+ return { url, params, queryParams };
27
+ }
28
+ }
@@ -0,0 +1,66 @@
1
+ import { InjectionToken } from '@angular/core';
2
+ import { ActionReducer, ActionReducerMap, MetaReducer, INIT } from '@ngrx/store';
3
+ import * as fromRouter from '@ngrx/router-store';
4
+ import { storeFreeze } from 'ngrx-store-freeze';
5
+
6
+ import { reducers as coreReducers, CoreState, localStorageSync } from '@eui/core';
7
+ import { ElementStorageService } from '@csdr/core';
8
+
9
+ import { environment } from '../../environments/environment';
10
+
11
+ export interface AppState extends CoreState {
12
+ router: fromRouter.RouterReducerState<any>;
13
+ }
14
+
15
+ // -----------------
16
+ // ------------ AOT
17
+ export const TOKEN = new InjectionToken<any>('AppReducers');
18
+
19
+ export function getReducers(): ActionReducerMap<AppState, any> {
20
+ return {
21
+ router: fromRouter.routerReducer,
22
+ ...coreReducers,
23
+ };
24
+ }
25
+
26
+ export const reducerProvider = [
27
+ { provide: TOKEN, useFactory: getReducers },
28
+ ];
29
+
30
+ // console.log all actions
31
+ export function logger(reducer: ActionReducer<AppState>): ActionReducer<AppState> {
32
+ return (state, action) => {
33
+ const result = reducer(state, action);
34
+ console.groupCollapsed(action.type);
35
+ console.log('prev state', state);
36
+ console.log('action', action);
37
+ console.log('next state', result);
38
+ console.groupEnd();
39
+
40
+ return result;
41
+ };
42
+ }
43
+
44
+ export function hydrationFactory(config: any, elementStorage: ElementStorageService): MetaReducer<AppState> {
45
+ return (reducer: ActionReducer<AppState>): ActionReducer<any> => {
46
+ return (state, action) => {
47
+ const key = `NgRx store: ${config.global.elementName}`;
48
+ if (action.type === INIT && elementStorage.hasData(key)) {
49
+ const cachedState = elementStorage.getData(key);
50
+ const nextStateFromCache = reducer(cachedState as AppState, action);
51
+ elementStorage.setData(key, nextStateFromCache);
52
+ return nextStateFromCache;
53
+ }
54
+ const nextState = reducer(state, action);
55
+ elementStorage.setData(key, nextState);
56
+ return nextState;
57
+ };
58
+ };
59
+ }
60
+
61
+ export function getMetaReducers(config: any, elementStorage: ElementStorageService): MetaReducer<AppState>[] {
62
+ if (!environment.production) {
63
+ return [logger, localStorageSync, storeFreeze, hydrationFactory(config, elementStorage)];
64
+ }
65
+ return [localStorageSync, hydrationFactory(config, elementStorage)];
66
+ }
@@ -0,0 +1,20 @@
1
+ import { GLOBAL } from './global';
2
+ import { MODULES } from './modules';
3
+ import { EuiAppConfig, LogLevel, ConsoleAppender, LogConfig } from '@eui/core';
4
+
5
+ /**
6
+ * Log Configuration
7
+ */
8
+ const logConfig: LogConfig = {
9
+ logLevel: LogLevel.ALL,
10
+ logAppenders: [{
11
+ type: ConsoleAppender,
12
+ prefixFormat: '[{level}]',
13
+ }],
14
+ };
15
+
16
+ export const appConfig: EuiAppConfig = {
17
+ global: GLOBAL,
18
+ modules: MODULES,
19
+ log: logConfig,
20
+ };
@@ -0,0 +1,3 @@
1
+ import { ModulesConfig } from '@eui/core';
2
+
3
+ export const MODULES: ModulesConfig = JSON.parse(JSON.stringify(window['PROVIDERS']['CONFIG_TOKEN'].modules));
@@ -0,0 +1,3 @@
1
+ export const environment = {
2
+ production: true,
3
+ };
@@ -0,0 +1,3 @@
1
+ export const environment = {
2
+ production: false,
3
+ };
@@ -0,0 +1,10 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <base href="/">
6
+ </head>
7
+ <body>
8
+ dummy index.html
9
+ </body>
10
+ </html>
@@ -0,0 +1,11 @@
1
+ import { enableProdMode } from '@angular/core';
2
+ import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
3
+ import { AppModule } from './app/module';
4
+ import { environment } from './environments/environment';
5
+ if (environment.production) {
6
+ enableProdMode();
7
+ }
8
+
9
+ platformBrowserDynamic()
10
+ .bootstrapModule(AppModule)
11
+ .catch(err => console.log(err));
@@ -0,0 +1,87 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * This file includes polyfills needed by Angular and is loaded before the app.
4
+ * You can add your own extra polyfills to this file.
5
+ *
6
+ * This file is divided into 2 sections:
7
+ * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
8
+ * 2. Application imports. Files imported after ZoneJS that should be loaded before your main
9
+ * file.
10
+ *
11
+ * The current setup is for so-called "evergreen" browsers; the last versions of browsers that
12
+ * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
13
+ * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
14
+ *
15
+ * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
16
+ */
17
+
18
+ /***************************************************************************************************
19
+ * BROWSER POLYFILLS
20
+ */
21
+
22
+ /** IE9, IE10 and IE11 requires all of the following polyfills. **/
23
+ // import 'core-js/es6/symbol';
24
+ // import 'core-js/es6/object';
25
+ // import 'core-js/es6/function';
26
+ // import 'core-js/es6/parse-int';
27
+ // import 'core-js/es6/parse-float';
28
+ // import 'core-js/es6/number';
29
+ // import 'core-js/es6/math';
30
+ // import 'core-js/es6/string';
31
+ // import 'core-js/es6/date';
32
+ // import 'core-js/es6/array';
33
+ // import 'core-js/es6/regexp';
34
+ // import 'core-js/es6/map';
35
+ // import 'core-js/es6/weak-map';
36
+ // import 'core-js/es6/set';
37
+
38
+ /** IE10 and IE11 requires the following for NgClass support on SVG elements */
39
+ // import 'classlist.js'; // Run `npm install --save classlist.js`.
40
+
41
+ /** IE10 and IE11 requires the following for the Reflect API. */
42
+ // import 'core-js/es6/reflect';
43
+
44
+ /** Evergreen browsers require these. **/
45
+ // Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.
46
+ // import 'core-js/es7/reflect';
47
+
48
+ /**
49
+ * Web Animations `@angular/platform-browser/animations`
50
+ * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
51
+ * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
52
+ **/
53
+ // import 'web-animations-js'; // Run `npm install --save web-animations-js`.
54
+
55
+ /**
56
+ * By default, zone.js will patch all possible macroTask and DomEvents
57
+ * user can disable parts of macroTask/DomEvents patch by setting following flags
58
+ */
59
+
60
+ // (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
61
+ // (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
62
+ // (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
63
+
64
+ /*
65
+ * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
66
+ * with the following flag, it will bypass `zone.js` patch for IE/Edge
67
+ */
68
+ // (window as any).__Zone_enable_cross_context_check = true;
69
+
70
+ /***************************************************************************************************
71
+ * Zone JS is required by default for Angular itself.
72
+ */
73
+ import 'zone.js/dist/zone'; // Included with Angular CLI.
74
+
75
+ /***************************************************************************************************
76
+ * APPLICATION IMPORTS
77
+ */
78
+
79
+ /**
80
+ * Date, currency, decimal and percent pipes.
81
+ * Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10
82
+ */
83
+ // import 'intl'; // Run `npm install --save intl`.
84
+ /**
85
+ * Need to import at least one locale-data with intl.
86
+ */
87
+ // import 'intl/locale-data/jsonp/en';
@@ -0,0 +1,20 @@
1
+ // This file is required by karma.conf.js and loads recursively all the .spec and framework files
2
+
3
+ import 'zone.js/dist/zone-testing';
4
+ import { getTestBed } from '@angular/core/testing';
5
+ import {
6
+ BrowserDynamicTestingModule,
7
+ platformBrowserDynamicTesting,
8
+ } from '@angular/platform-browser-dynamic/testing';
9
+
10
+ declare const require: any;
11
+
12
+ // First, initialize the Angular testing environment.
13
+ getTestBed().initTestEnvironment(
14
+ BrowserDynamicTestingModule,
15
+ platformBrowserDynamicTesting(),
16
+ );
17
+ // Then we find all the tests.
18
+ const context = require.context('./', true, /\.spec\.ts$/);
19
+ // And load the modules.
20
+ context.keys().map(context);
@@ -61,9 +61,10 @@ module.exports.generateVirtualRemote = (remoteName, cloneRemote = true) => {
61
61
 
62
62
  // constructing the remote folder
63
63
  const remotePath = path.join(process.cwd(), 'remotes', remote.name);
64
- const remoteSkeletonPath = path.join(__dirname, 'remotes', remote.euiVersion);
64
+ const remoteSkeletonPath = path.join(__dirname, 'remotes', remote.euiVersion, 'base');
65
+ const remoteSkeletonFullPath = path.join(__dirname, 'remotes', remote.euiVersion, 'full');
65
66
 
66
- tools.logInfo(`Copying angular.json => ${remoteSkeletonPath} ==> ${remotePath}`);
67
+ tools.logInfo(`Copying base sources => ${remoteSkeletonPath} ==> ${remotePath}`);
67
68
 
68
69
  tools.copy(remoteSkeletonPath, remotePath);
69
70
 
@@ -118,6 +119,14 @@ module.exports.generateVirtualRemote = (remoteName, cloneRemote = true) => {
118
119
  tools.writeJsonFileSync(packageJsonPath, packageJson);
119
120
 
120
121
  tools.logSuccess('OK => package.json generated');
122
+
123
+ // initializing "full" remote sources
124
+ if (remote.fullSkeletonSources) {
125
+ tools.logInfo(`copying full sources skeleton : ${remoteSkeletonFullPath} ==> ${remotePath}`);
126
+ tools.copy(remoteSkeletonFullPath, remotePath);
127
+
128
+ tools.logSuccess('OK => copy done');
129
+ }
121
130
  })
122
131
 
123
132
 
@@ -301,9 +301,11 @@ module.exports.injectElementExternalSources = (pkg) => {
301
301
  throw new Error('External sources not found');
302
302
 
303
303
  } else {
304
- if (tools.isDirExists(pkgSrcPath)) {
305
- tools.logInfo(`Removing ${pkgSrcPath} content`);
306
- tools.rmdirFull(pkgSrcPath, false);
304
+ if (!pkg.fullSkeletonSources) {
305
+ if (tools.isDirExists(pkgSrcPath)) {
306
+ tools.logInfo(`Removing ${pkgSrcPath} content`);
307
+ tools.rmdirFull(pkgSrcPath, false);
308
+ }
307
309
  }
308
310
 
309
311
  tools.logInfo(`${externalSourcesSrcPath} injecting in ${pkgSrcPath}`);
@@ -48,7 +48,7 @@ module.exports.runMocha = (pkg) => {
48
48
  tools.logTitle(`Executing Mocha test for pkg: ${pkg.name}`);
49
49
 
50
50
  // set jest binary
51
- const mocha = path.resolve(process.cwd(), 'node_modules', 'mocha', 'bin', 'mocha');
51
+ const mocha = path.resolve(process.cwd(), 'node_modules', 'mocha', 'bin', '_mocha');
52
52
  const nyc = path.resolve(process.cwd(), 'node_modules', 'nyc', 'bin', 'nyc');
53
53
 
54
54
  // default arguments