@eui/cli 22.0.0-alpha.9 → 22.0.0-alpha.90

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 (72) hide show
  1. package/README.md +357 -88
  2. package/bin/eui-cli.js +26 -0
  3. package/bin/scripts/migrate.js +5 -0
  4. package/lib/app-utils/build.js +26 -0
  5. package/lib/app-utils/migrate.js +610 -0
  6. package/lib/app-utils/serve.js +32 -0
  7. package/lib/build.js +28 -7
  8. package/lib/cli.js +16 -2
  9. package/lib/config.js +10 -1
  10. package/lib/skeletons/_angular/base/mock/app/routes/{index.js → index.cjs} +1 -1
  11. package/lib/skeletons/_angular/base/mock/app/routes/{user_routes.js → user_routes.cjs} +1 -1
  12. package/lib/skeletons/_angular/base/mock/{server.js → server.cjs} +1 -1
  13. package/lib/skeletons/_angular/base/package.json +9 -13
  14. package/lib/skeletons/_angular/base/src/app/app-starter.service.ts +10 -2
  15. package/lib/skeletons/_angular/base/src/app/app.component.spec.ts +1 -1
  16. package/lib/skeletons/_angular/base/src/app/features/home/home.component.ts +0 -4
  17. package/lib/skeletons/_angular/base/src/config/global.ts +4 -1
  18. package/lib/skeletons/_angular/base/tsconfig.json +1 -2
  19. package/lib/skeletons/_angular/base-mobile/package.json +6 -19
  20. package/lib/skeletons/_angular/base-mobile/src/app/app-starter.service.ts +10 -1
  21. package/lib/skeletons/_angular/base-mobile/src/app/features/about/opensource-licences/opensource-licences.component.ts +0 -1
  22. package/lib/skeletons/_angular/base-mobile/src/config/global.ts +4 -1
  23. package/lib/skeletons/_angular/options/ecl-ec/angular.json +2 -2
  24. package/lib/skeletons/_angular/options/ecl-ec/src/app/app.component.html +2 -2
  25. package/lib/skeletons/_angular/options/ecl-ec/src/app/app.component.ts +4 -6
  26. package/lib/skeletons/_angular/options/ecl-ec/src/app/features/home/home.component.ts +0 -4
  27. package/lib/skeletons/_angular/options/ecl-ec/src/config/global.ts +4 -1
  28. package/lib/skeletons/_angular/options/ecl-eu/angular.json +2 -2
  29. package/lib/skeletons/_angular/options/ecl-eu/src/app/app.component.html +2 -2
  30. package/lib/skeletons/_angular/options/ecl-eu/src/app/app.component.ts +4 -6
  31. package/lib/skeletons/_angular/options/ecl-eu/src/app/features/home/home.component.ts +0 -4
  32. package/lib/skeletons/_angular/options/ecl-eu/src/config/global.ts +4 -1
  33. package/lib/skeletons/_angular/options/eds/src/app/app.component.html +35 -0
  34. package/lib/skeletons/_angular/options/eds/src/app/app.component.spec.ts +56 -0
  35. package/lib/skeletons/_angular/options/eds/src/app/app.component.ts +44 -0
  36. package/lib/skeletons/_angular/options/eds/src/index.html +21 -0
  37. package/lib/skeletons/_angular/options/pnpm/package.json +91 -48
  38. package/lib/skeletons/_react/base/README.md +65 -0
  39. package/lib/skeletons/_react/base/eslint.config.mjs +17 -0
  40. package/lib/skeletons/_react/base/gitignore_TO_REPLACE +34 -0
  41. package/lib/skeletons/_react/base/index.html +13 -0
  42. package/lib/skeletons/_react/base/mock/app/models/user.cjs +6 -0
  43. package/lib/skeletons/_react/base/mock/app/routes/index.cjs +5 -0
  44. package/lib/skeletons/_react/base/mock/app/routes/user_routes.cjs +44 -0
  45. package/lib/skeletons/_react/base/mock/db/db.json +10 -0
  46. package/lib/skeletons/_react/base/mock/server.cjs +23 -0
  47. package/lib/skeletons/_react/base/package.json +29 -0
  48. package/lib/skeletons/_react/base/public/.gitkeep +0 -0
  49. package/lib/skeletons/_react/base/src/App.tsx +73 -0
  50. package/lib/skeletons/_react/base/src/main.tsx +30 -0
  51. package/lib/skeletons/_react/base/src/pages/about.tsx +27 -0
  52. package/lib/skeletons/_react/base/src/pages/home.tsx +50 -0
  53. package/lib/skeletons/_react/base/src/routes.ts +18 -0
  54. package/lib/skeletons/_react/base/src/styles.css +37 -0
  55. package/lib/skeletons/_react/base/src/vite-env.d.ts +1 -0
  56. package/lib/skeletons/_react/base/tsconfig.app.json +18 -0
  57. package/lib/skeletons/_react/base/tsconfig.json +7 -0
  58. package/lib/skeletons/_react/base/tsconfig.node.json +15 -0
  59. package/lib/skeletons/_react/base/vite.config.ts +77 -0
  60. package/lib/skeletons/_react/options/pnpm/package.json +46 -0
  61. package/lib/skeletons/web-maven/pom.xml +2 -2
  62. package/lib/skeletons/web-spring-boot/myapp-web/pom.xml +4 -5
  63. package/lib/skeletons/web-spring-boot/myapp-web-rest/pom.xml +2 -4
  64. package/lib/skeletons/web-spring-boot/myapp-web-rest/src/main/java/myapp/security/FakeAuthenticationFilter.java +0 -2
  65. package/lib/skeletons/web-spring-boot/pom.xml +1 -1
  66. package/lib/utils/fs-extra.js +38 -0
  67. package/lib/utils/glob.js +144 -0
  68. package/lib/utils/rimraf.js +14 -0
  69. package/lib/utils.js +39 -15
  70. package/package.json +2 -7
  71. package/sonar-project.properties +0 -14
  72. /package/lib/skeletons/_angular/base/mock/app/models/{user.js → user.cjs} +0 -0
package/lib/build.js CHANGED
@@ -5,11 +5,7 @@ const utils = require('./utils');
5
5
  const config = require('./config');
6
6
 
7
7
  module.exports.start = (options) => {
8
- try {
9
- build(options.config, options.targetPath)
10
- } catch (e) {
11
- throw e;
12
- }
8
+ build(options.config, options.targetPath);
13
9
  }
14
10
 
15
11
  const build = (cliConfig, targetPath) => {
@@ -33,6 +29,14 @@ const build = (cliConfig, targetPath) => {
33
29
  copyAngular(angularPath, cliConfig, true);
34
30
  }
35
31
 
32
+ // BUILD REACT
33
+ if (appType === 'react') {
34
+ console.log('---building react');
35
+ const reactPath = utils.getAngularPath(targetPath, appName, appType, artifactId);
36
+ console.log(reactPath);
37
+ copyReact(reactPath, cliConfig);
38
+ }
39
+
36
40
  // BUILD web-maven
37
41
  if (appType === 'web-maven') {
38
42
  console.log('--building web-maven');
@@ -63,12 +67,29 @@ const copyAngular = (targetPath, cliConfig, overwrite = true) => {
63
67
  utils.copydir(config.angularBaseMobilePath, targetPath, overwrite);
64
68
  }
65
69
 
66
- if (cliConfig.appOptions === 'ecl') {
70
+ // appOptions may be a plain string (interactive mode) or an array (automated `--config`
71
+ // parses `appOptions` on `_`, e.g. `ecl_something` -> ['ecl', ...]). Normalize to an array.
72
+ const appOptions = [].concat(cliConfig.appOptions || []);
73
+
74
+ if (appOptions.includes('ecl')) {
67
75
  console.log(`eUI ECL theme selected : ` + cliConfig.appOptionsEclTheme);
68
76
  utils.copydir(config.optionsPath[cliConfig.appOptionsEclTheme], targetPath, true);
69
77
  }
70
78
 
79
+ if (appOptions.includes('eds')) {
80
+ console.log(`eUI EDS desktop app-shell selected`);
81
+ utils.copydir(config.edsOptionPath, targetPath, true);
82
+ }
83
+
84
+ if (cliConfig.packageManager === 'pnpm') {
85
+ utils.copy(path.join(config.pnpmOptionPath.angular, 'package.json'), path.join(targetPath, 'package.json'));
86
+ }
87
+ }
88
+
89
+ const copyReact = (targetPath, cliConfig) => {
90
+ utils.copydir(config.reactBasePath, targetPath, true);
91
+
71
92
  if (cliConfig.packageManager === 'pnpm') {
72
- utils.copy(path.join(config.pnpmOptionPath, 'package.json'), path.join(targetPath, 'package.json'));
93
+ utils.copy(path.join(config.pnpmOptionPath.react, 'package.json'), path.join(targetPath, 'package.json'));
73
94
  }
74
95
  }
package/lib/cli.js CHANGED
@@ -50,9 +50,11 @@ module.exports.start = async (options) => {
50
50
 
51
51
  const appTypePrompt = new Select({
52
52
  name: 'appType',
53
- message: 'Select an eUI Angular application type :',
53
+ message: 'Select an eUI application type :',
54
54
  choices: [
55
55
  'Desktop',
56
+ // 'Desktop EDS',
57
+ // 'React EDS',
56
58
  'Mobile Ionic',
57
59
  'eUI + Spring Boot web module - JDK + Maven required !!!',
58
60
  'eUI + Maven web module (JEE Spring maven web module) - JDK + Maven required !!!'
@@ -64,12 +66,22 @@ module.exports.start = async (options) => {
64
66
  // Map display name to value
65
67
  const appTypeMap = {
66
68
  'Desktop': 'angular',
69
+ // 'Desktop EDS': 'angular',
70
+ // 'React EDS': 'react',
67
71
  'Mobile Ionic': 'mobile',
68
72
  'eUI + Spring Boot web module - JDK + Maven required !!!': 'web-spring-boot',
69
73
  'eUI + Maven web module (JEE Spring maven web module) - JDK + Maven required !!!': 'web-maven'
70
74
  };
71
75
  answers.appType = appTypeMap[appTypeChoice];
72
76
 
77
+ // "Desktop EDS" is an Angular desktop app whose shell is composed with @eui/eds (eds-shell +
78
+ // EDS components) instead of the legacy @eui/components app-shell. It pre-selects the `eds`
79
+ // app-shell option, so the ECL/default app-shell prompt below is skipped for it.
80
+ const isEdsDesktop = appTypeChoice === 'Desktop EDS';
81
+ if (isEdsDesktop) {
82
+ answers.appOptions = 'eds';
83
+ }
84
+
73
85
  if (answers.appType === 'web-spring-boot') {
74
86
  const groupIdPrompt = new Input({
75
87
  name: 'groupId',
@@ -88,7 +100,9 @@ module.exports.start = async (options) => {
88
100
  answers.artifactId = await artifactIdPrompt.run();
89
101
  }
90
102
 
91
- if (answers.appType !== 'mobile') {
103
+ // ECL app-shell options apply to the Angular-based types only (not mobile, not react, and
104
+ // not when the EDS desktop shell was already chosen up-front).
105
+ if (answers.appType !== 'mobile' && answers.appType !== 'react' && !isEdsDesktop) {
92
106
  const appOptionsPrompt = new Select({
93
107
  name: 'appOptions',
94
108
  message: 'Select one or more additional configuration options :',
package/lib/config.js CHANGED
@@ -9,6 +9,8 @@ module.exports.skeletonsPath = skeletonsPath;
9
9
  module.exports.angularBasePath = path.join(skeletonsPath, '_angular/base');
10
10
  module.exports.angularBaseMobilePath = path.join(skeletonsPath, '_angular/base-mobile');
11
11
 
12
+ module.exports.reactBasePath = path.join(skeletonsPath, '_react/base');
13
+
12
14
  module.exports.webMavenPath = path.join(skeletonsPath, 'web-maven');
13
15
  module.exports.webSpringBootPath = path.join(skeletonsPath, 'web-spring-boot');
14
16
 
@@ -19,7 +21,14 @@ module.exports.optionsPath = {
19
21
  "ecl-ec": path.join(skeletonsPath, '_angular/options/ecl-ec'),
20
22
  "ecl-eu": path.join(skeletonsPath, '_angular/options/ecl-eu'),
21
23
  };
22
- module.exports.pnpmOptionPath = path.join(skeletonsPath, '_angular/options/pnpm');
24
+ // pnpm package.json overlays, keyed by the app stack (Angular vs React). The pnpm variant lists
25
+ // all dependencies explicitly (no @eui/deps-* meta-package) since pnpm is stricter about
26
+ // hoisting; each stack needs its own set.
27
+ module.exports.pnpmOptionPath = {
28
+ angular: path.join(skeletonsPath, '_angular/options/pnpm'),
29
+ react: path.join(skeletonsPath, '_react/options/pnpm'),
30
+ };
31
+ module.exports.edsOptionPath = path.join(skeletonsPath, '_angular/options/eds');
23
32
 
24
33
  module.exports.version = version;
25
34
 
@@ -1,4 +1,4 @@
1
- const userRoutes = require('./user_routes');
1
+ const userRoutes = require('./user_routes.cjs');
2
2
 
3
3
  module.exports = function (app, db) {
4
4
  userRoutes(app, db);
@@ -1,4 +1,4 @@
1
- const User = require('../models/user');
1
+ const User = require('../models/user.cjs');
2
2
  const uuid = require('uuid');
3
3
 
4
4
  module.exports = function (app, db) {
@@ -16,7 +16,7 @@ app.use(bodyParser.urlencoded({ extended: true }));
16
16
  // credentials: true,
17
17
  // }));
18
18
 
19
- require('./app/routes')(app, db);
19
+ require('./app/routes/index.cjs')(app, db);
20
20
 
21
21
  app.listen(port, () => {
22
22
  console.log('We are live on ' + port);
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "eui-angular-app",
3
- "version": "22.0.0-alpha.9",
3
+ "version": "22.0.0-alpha.90",
4
4
  "license": "EUPL-1.1",
5
5
  "scripts": {
6
6
  "ng": "ng",
7
- "start-mock-server": "nodemon --watch ./mock ./mock/server.js",
7
+ "start-mock-server": "nodemon --watch ./mock ./mock/server.cjs",
8
8
  "start-serve": "eui-cli serve-app --configuration=proxy-mock --configEnvTarget=mock",
9
9
  "start": "npm-run-all --parallel start-mock-server start-serve",
10
10
  "start-proxy": "eui-cli serve-app --configuration=proxy",
@@ -20,20 +20,16 @@
20
20
  },
21
21
  "private": true,
22
22
  "dependencies": {
23
- "@eui/deps-base": "22.0.0-alpha.9"
23
+ "@eui/deps-base": "22.0.0-alpha.90"
24
24
  },
25
25
  "devDependencies": {
26
+ "@eui/deps-base-dev": "22.0.0-alpha.90",
26
27
  "npm-run-all": "4.1.5",
27
- "json-server": "1.0.0-beta.3",
28
- "nodemon": "3.1.11",
28
+ "json-server": "1.0.0-beta.15",
29
+ "nodemon": "3.1.14",
29
30
  "lowdb": "1.0.0",
30
- "body-parser": "1.20.3",
31
- "express": "4.21.2"
31
+ "body-parser": "1.20.9",
32
+ "express": "4.22.3"
32
33
  },
33
- "resolutions": {
34
- "semver": ">=7.5.2",
35
- "dompurify": ">=3.2.4",
36
- "tmp": ">0.2.4",
37
- "tablesort": "5.6.0"
38
- }
34
+ "resolutions": {}
39
35
  }
@@ -12,11 +12,20 @@ import {
12
12
  import { catchError, Observable, of } from 'rxjs';
13
13
  import { switchMap } from 'rxjs/operators';
14
14
 
15
+ /**
16
+ * Shape of the `dashboard` user preference of this app.
17
+ * Nothing is stored there by this skeleton: declare your own fields here.
18
+ */
19
+ export type AppDashboardPreferences = Record<string, never>;
20
+
21
+ /** User preferences of this app: typed dashboard, no additional custom keys. */
22
+ export type AppUserPreferences = UserPreferences<AppDashboardPreferences, never>;
23
+
15
24
  @Injectable({
16
25
  providedIn: 'root',
17
26
  })
18
27
  export class AppStarterService {
19
- defaultUserPreferences: UserPreferences | undefined;
28
+ defaultUserPreferences: AppUserPreferences | undefined;
20
29
  private userService: UserService = inject(UserService);
21
30
  private i18nService: I18nService = inject(I18nService);
22
31
  private config: EuiAppConfig = inject(CONFIG_TOKEN);
@@ -25,7 +34,6 @@ export class AppStarterService {
25
34
  start(): Observable<EuiServiceStatus> {
26
35
  return this.initUserService().pipe(
27
36
  switchMap((userStatus) => {
28
- console.log(userStatus);
29
37
  return this.i18nService.init();
30
38
  }),
31
39
  );
@@ -41,9 +41,9 @@ describe('AppComponent', () => {
41
41
  imports: [
42
42
  RouterModule.forRoot(routes),
43
43
  ...EUI_LAYOUT,
44
- provideTranslateService(translateConfig),
45
44
  ],
46
45
  providers: [
46
+ provideTranslateService(translateConfig),
47
47
  provideHttpClient(withInterceptorsFromDi()),
48
48
  provideHttpClientTesting(),
49
49
  AppStarterService,
@@ -12,8 +12,4 @@ import { TranslatePipe } from '@ngx-translate/core';
12
12
  })
13
13
  export class HomeComponent {
14
14
  protected config: EuiAppConfig = inject(CONFIG_TOKEN);
15
-
16
- constructor() {
17
- console.log(this.config);
18
- }
19
15
  }
@@ -1,6 +1,9 @@
1
1
  import { GlobalConfig } from '@eui/core';
2
2
 
3
- export const GLOBAL: GlobalConfig = {
3
+ /** Type of the custom (non-eUI) values added at the root of the global config, e.g. `appTitle`. */
4
+ export type AppGlobalConfigValue = string;
5
+
6
+ export const GLOBAL: GlobalConfig<AppGlobalConfigValue> = {
4
7
  appTitle: 'CSDR-app',
5
8
  i18n: {
6
9
  i18nService: {
@@ -3,7 +3,6 @@
3
3
  {
4
4
  "compileOnSave": false,
5
5
  "compilerOptions": {
6
- "baseUrl": "./",
7
6
  "outDir": "./dist/out-tsc",
8
7
  "target": "ES2022",
9
8
  "module": "ES2022",
@@ -27,7 +26,7 @@
27
26
  ],
28
27
  "paths": {
29
28
  "@shared/*": [
30
- "src/app/shared/*"
29
+ "./src/app/shared/*"
31
30
  ]
32
31
  }
33
32
  }
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "eui-angular-app",
3
- "version": "22.0.0-alpha.9",
3
+ "version": "22.0.0-alpha.90",
4
4
  "license": "EUPL-1.1",
5
5
  "scripts": {
6
6
  "ng": "ng",
7
- "start-mock-server": "nodemon --watch ./mock ./mock/server.js",
7
+ "start-mock-server": "nodemon --watch ./mock ./mock/server.cjs",
8
8
  "start-serve": "eui-cli serve-app --configuration=proxy-mock --configEnvTarget=mock",
9
9
  "start": "npm-run-all --parallel start-mock-server start-serve",
10
10
  "start-proxy": "eui-cli serve-app --configuration=proxy",
@@ -20,22 +20,9 @@
20
20
  },
21
21
  "private": true,
22
22
  "dependencies": {
23
- "@eui/deps-base-next": "19.3.17",
24
- "@eui/mobile-core": "20.0.2",
25
- "@eui/mobile-styles": "20.0.2"
23
+ "@eui/mobile-core": "22.0.0-alpha.1",
24
+ "@eui/mobile-styles": "22.0.0-alpha.1",
25
+ "@eui/deps-base": "22.0.0-alpha.90"
26
26
  },
27
- "resolutions": {
28
- "js-yaml": ">=3.13.1",
29
- "pdfjs-dist": "4.10.38",
30
- "tar": ">=6.2.1",
31
- "katex": ">=0.16.10",
32
- "follow-redirects": ">=1.15.4",
33
- "word-wrap": ">=1.2.4",
34
- "postcss": ">=8.4.31",
35
- "semver": ">=7.5.2",
36
- "express": "4.21.2",
37
- "path-to-regexp": "1.9.0",
38
- "tablesort": "5.6.0",
39
- "yargs": "17.7.2"
40
- }
27
+ "resolutions": {}
41
28
  }
@@ -11,11 +11,20 @@ import { HttpClient } from '@angular/common/http';
11
11
  import { Observable, of, zip, catchError } from 'rxjs';
12
12
  import { switchMap } from 'rxjs/operators';
13
13
 
14
+ /**
15
+ * Shape of the `dashboard` user preference of this app.
16
+ * Nothing is stored there by this skeleton: declare your own fields here.
17
+ */
18
+ export type AppDashboardPreferences = Record<string, never>;
19
+
20
+ /** User preferences of this app: typed dashboard, no additional custom keys. */
21
+ export type AppUserPreferences = UserPreferences<AppDashboardPreferences, never>;
22
+
14
23
  @Injectable({
15
24
  providedIn: 'root',
16
25
  })
17
26
  export class AppStarterService {
18
- defaultUserPreferences: UserPreferences;
27
+ defaultUserPreferences: AppUserPreferences;
19
28
 
20
29
  constructor(
21
30
  protected userService: UserService,
@@ -28,7 +28,6 @@ export class OpensourceLicencesComponent {
28
28
  }
29
29
 
30
30
  onClickedItems(clickedItem: string[]): void {
31
- console.log('Selected Item - ', clickedItem);
32
31
  this.onNavigate('screen/about/opensource-licences/licence-details');
33
32
  }
34
33
 
@@ -1,6 +1,9 @@
1
1
  import { GlobalConfig } from '@eui/core';
2
2
 
3
- export const GLOBAL: GlobalConfig = {
3
+ /** Type of the custom (non-eUI) values added at the root of the global config, e.g. `appTitle`. */
4
+ export type AppGlobalConfigValue = string;
5
+
6
+ export const GLOBAL: GlobalConfig<AppGlobalConfigValue> = {
4
7
  appTitle: 'CSDR-app',
5
8
  i18n: {
6
9
  i18nService: {
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "architect": {
23
23
  "build": {
24
- "builder": "@angular-devkit/build-angular:application",
24
+ "builder": "@angular/build:application",
25
25
  "options": {
26
26
  "outputPath": "dist",
27
27
  "index": "src/index.html",
@@ -119,7 +119,7 @@
119
119
  "defaultConfiguration": "production"
120
120
  },
121
121
  "serve": {
122
- "builder": "@angular-devkit/build-angular:dev-server",
122
+ "builder": "@angular/build:dev-server",
123
123
  "options": {
124
124
  "buildTarget": "app:build"
125
125
  },
@@ -55,7 +55,7 @@
55
55
  </picture>
56
56
  <div eclPageHeaderContainer>
57
57
  <div eclContainer>
58
- <ecl-breadcrumb>
58
+ <nav eclBreadcrumb>
59
59
  <ol eclBreadcrumbContainer>
60
60
  <li eclBreadcrumbSegment href="http://ec.europa.eu">Home</li>
61
61
  <li eclBreadcrumbSegment routerLink="about">About the European Commission</li>
@@ -63,7 +63,7 @@
63
63
  <li eclBreadcrumbSegment routerLink="org">How the Commission is organized</li>
64
64
  <li eclBreadcrumbSegment isCurrentPage>News</li>
65
65
  </ol>
66
- </ecl-breadcrumb>
66
+ </nav>
67
67
  <h1 eclPageHeaderTitle>Consectetur adipiscing elit</h1>
68
68
  <ul eclPageHeaderMeta>
69
69
  <li eclPageHeaderMetaItem>News article</li>
@@ -36,8 +36,8 @@ import { TranslatePipe } from '@ngx-translate/core';
36
36
  export class AppComponent implements OnInit {
37
37
 
38
38
  isLoggedIn = false;
39
- userState: Signal<UserState>;
40
- userInfos: UserState;
39
+ userState!: Signal<UserState>;
40
+ userInfos!: UserState;
41
41
  private userService = inject(UserService<UserState>);
42
42
 
43
43
  ngOnInit(): void {
@@ -47,20 +47,18 @@ export class AppComponent implements OnInit {
47
47
 
48
48
  onLogin(evt: EclSiteHeaderLoginEvent): void {
49
49
  this.isLoggedIn = true;
50
- console.log(evt);
51
50
  }
52
51
 
53
52
  onLogout(evt: MouseEvent): void {
54
53
  this.isLoggedIn = false;
55
54
  evt.preventDefault();
56
- console.log('logout');
57
55
  }
58
56
 
59
57
  onSearch(evt: EclSiteHeaderSearchEvent): void {
60
- console.log(evt);
58
+ /** noop */
61
59
  }
62
60
 
63
61
  onMenuItemSelected(evt: EclMenuItemSelectEvent): void {
64
- console.log('menu item selected', evt);
62
+ /** noop */
65
63
  }
66
64
  }
@@ -13,8 +13,4 @@ import { EUI_ECL_LIST } from '@eui/ecl/components/ecl-list';
13
13
  })
14
14
  export class HomeComponent {
15
15
  protected config: EuiAppConfig = inject(CONFIG_TOKEN);
16
-
17
- constructor() {
18
- console.log(this.config);
19
- }
20
16
  }
@@ -1,6 +1,9 @@
1
1
  import { GlobalConfig } from '@eui/core';
2
2
 
3
- export const GLOBAL: GlobalConfig = {
3
+ /** Type of the custom (non-eUI) values added at the root of the global config, e.g. `appTitle`. */
4
+ export type AppGlobalConfigValue = string;
5
+
6
+ export const GLOBAL: GlobalConfig<AppGlobalConfigValue> = {
4
7
  appTitle: 'CSDR-app',
5
8
  i18n: {
6
9
  i18nService: {
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "architect": {
23
23
  "build": {
24
- "builder": "@angular-devkit/build-angular:application",
24
+ "builder": "@angular/build:application",
25
25
  "options": {
26
26
  "outputPath": "dist",
27
27
  "index": "src/index.html",
@@ -119,7 +119,7 @@
119
119
  "defaultConfiguration": "production"
120
120
  },
121
121
  "serve": {
122
- "builder": "@angular-devkit/build-angular:dev-server",
122
+ "builder": "@angular/build:dev-server",
123
123
  "options": {
124
124
  "buildTarget": "app:build"
125
125
  },
@@ -55,7 +55,7 @@
55
55
  </picture>
56
56
  <div eclPageHeaderContainer>
57
57
  <div eclContainer>
58
- <ecl-breadcrumb>
58
+ <nav eclBreadcrumb>
59
59
  <ol eclBreadcrumbContainer>
60
60
  <li eclBreadcrumbSegment href="http://ec.europa.eu">Home</li>
61
61
  <li eclBreadcrumbSegment routerLink="about">About the European Commission</li>
@@ -63,7 +63,7 @@
63
63
  <li eclBreadcrumbSegment routerLink="org">How the Commission is organized</li>
64
64
  <li eclBreadcrumbSegment isCurrentPage>News</li>
65
65
  </ol>
66
- </ecl-breadcrumb>
66
+ </nav>
67
67
  <h1 eclPageHeaderTitle>Consectetur adipiscing elit</h1>
68
68
  <ul eclPageHeaderMeta>
69
69
  <li eclPageHeaderMetaItem>News article</li>
@@ -34,8 +34,8 @@ import { TranslatePipe } from '@ngx-translate/core';
34
34
  export class AppComponent implements OnInit {
35
35
 
36
36
  isLoggedIn = false;
37
- userState: Signal<UserState>;
38
- userInfos: UserState;
37
+ userState!: Signal<UserState>;
38
+ userInfos!: UserState;
39
39
  private userService = inject(UserService<UserState>);
40
40
 
41
41
  ngOnInit(): void {
@@ -45,20 +45,18 @@ export class AppComponent implements OnInit {
45
45
 
46
46
  onLogin(evt: EclSiteHeaderLoginEvent): void {
47
47
  this.isLoggedIn = true;
48
- console.log(evt);
49
48
  }
50
49
 
51
50
  onLogout(evt: MouseEvent): void {
52
51
  this.isLoggedIn = false;
53
52
  evt.preventDefault();
54
- console.log('logout');
55
53
  }
56
54
 
57
55
  onSearch(evt: EclSiteHeaderSearchEvent): void {
58
- console.log(evt);
56
+ /** noop */
59
57
  }
60
58
 
61
59
  onMenuItemSelected(evt: EclMenuItemSelectEvent): void {
62
- console.log('menu item selected', evt);
60
+ /** noop */
63
61
  }
64
62
  }
@@ -13,8 +13,4 @@ import { EUI_ECL_LIST } from '@eui/ecl/components/ecl-list';
13
13
  })
14
14
  export class HomeComponent {
15
15
  protected config: EuiAppConfig = inject(CONFIG_TOKEN);
16
-
17
- constructor() {
18
- console.log(this.config);
19
- }
20
16
  }
@@ -1,6 +1,9 @@
1
1
  import { GlobalConfig } from '@eui/core';
2
2
 
3
- export const GLOBAL: GlobalConfig = {
3
+ /** Type of the custom (non-eUI) values added at the root of the global config, e.g. `appTitle`. */
4
+ export type AppGlobalConfigValue = string;
5
+
6
+ export const GLOBAL: GlobalConfig<AppGlobalConfigValue> = {
4
7
  appTitle: 'CSDR-app',
5
8
  i18n: {
6
9
  i18nService: {
@@ -0,0 +1,35 @@
1
+ <eds-shell>
2
+ <!-- Toolbar -->
3
+ <eds-shell-toolbar>
4
+ <eds-shell-menu-toggle (menuToggle)="onToggleSidebar()"></eds-shell-menu-toggle>
5
+ <eds-shell-toolbar-logo></eds-shell-toolbar-logo>
6
+ <eds-shell-toolbar-environment>MOCK</eds-shell-toolbar-environment>
7
+ <eds-shell-toolbar-app appName="appName"></eds-shell-toolbar-app>
8
+
9
+ <eds-shell-toolbar-end>
10
+ <button edsIconButton color="brand" icon="bell" ariaLabel="Notifications"></button>
11
+ <button edsIconButton color="brand" icon="gear" ariaLabel="Settings"></button>
12
+ <eds-user-profile
13
+ fullName="John Doe"
14
+ [isShowUserInfos]="false"
15
+ [isShowAvatarInitials]="true">
16
+ <eds-user-profile-menu>
17
+ <eds-user-profile-menu-item>{{ 'eui.my-profile-informations' | translate }}</eds-user-profile-menu-item>
18
+ <eds-user-profile-menu-item>{{ 'eui.sign-out' | translate }}</eds-user-profile-menu-item>
19
+ </eds-user-profile-menu>
20
+ </eds-user-profile>
21
+ </eds-shell-toolbar-end>
22
+ </eds-shell-toolbar>
23
+
24
+ <!-- Sidebar -->
25
+ <eds-shell-sidebar collapseMode="icons">
26
+ <eds-shell-sidebar-nav [items]="sidebarItems" [hasIcons]="true"></eds-shell-sidebar-nav>
27
+ </eds-shell-sidebar>
28
+
29
+ <!-- Main content -->
30
+ <eds-shell-content>
31
+ <router-outlet></router-outlet>
32
+ </eds-shell-content>
33
+
34
+ <eds-shell-footer copyright="© European Union"></eds-shell-footer>
35
+ </eds-shell>
@@ -0,0 +1,56 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+ import { RouterModule } from '@angular/router';
3
+ import { AppComponent } from './app.component';
4
+ import { EDS_SHELL } from '@eui/eds/eds-shell';
5
+ import { routes } from './app.routes';
6
+ import { provideHttpClientTesting } from '@angular/common/http/testing';
7
+ import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
8
+ import { AppStarterService } from './app-starter.service';
9
+ import { CONFIG_TOKEN, I18nService, I18nState, translateConfig, UserService } from '@eui/core';
10
+ import { EuiAppConfig } from '@eui/core';
11
+ import { Observable, of } from 'rxjs';
12
+ import { provideTranslateService } from '@ngx-translate/core';
13
+ import { describe, it, beforeEach, expect, vi } from 'vitest';
14
+ // eslint-disable-next-line
15
+ type SpyObj<T> = { [K in keyof T]: T[K] extends (...args: any[]) => any ? ReturnType<typeof vi.fn> : T[K] };
16
+ describe('AppComponent', () => {
17
+ let component: AppComponent;
18
+ let fixture: ComponentFixture<AppComponent>;
19
+ let userServiceMock: SpyObj<UserService>;
20
+ let i18nServiceMock: SpyObj<I18nService>;
21
+ let configMock: EuiAppConfig;
22
+ beforeEach(async () => {
23
+ type GetStateReturnType<T> = T extends keyof I18nState ? Observable<I18nState[T]> : Observable<I18nState>;
24
+ userServiceMock = { init: vi.fn() } as SpyObj<UserService>;
25
+ i18nServiceMock = {
26
+ init: vi.fn(),
27
+ getState: vi.fn(<K extends keyof I18nState>(key?: K): GetStateReturnType<K> => {
28
+ if (typeof key === 'string') {
29
+ return of({ activeLang: 'en' }[key]) as GetStateReturnType<K>;
30
+ }
31
+ return of({ activeLang: 'en' }) as GetStateReturnType<K>;
32
+ })
33
+ } as SpyObj<I18nService>;
34
+ configMock = {global: {}, modules: {core: {base: 'localhost:3000', userDetails: 'dummy'}}};
35
+ await TestBed.configureTestingModule({
36
+ imports: [
37
+ RouterModule.forRoot(routes),
38
+ ...EDS_SHELL,
39
+ provideTranslateService(translateConfig),
40
+ ],
41
+ providers: [
42
+ provideHttpClient(withInterceptorsFromDi()),
43
+ provideHttpClientTesting(),
44
+ AppStarterService,
45
+ {provide: UserService, useValue: userServiceMock},
46
+ {provide: I18nService, useValue: i18nServiceMock},
47
+ {provide: CONFIG_TOKEN, useValue: configMock},
48
+ ],
49
+ }).compileComponents();
50
+ fixture = TestBed.createComponent(AppComponent);
51
+ component = fixture.componentInstance;
52
+ });
53
+ it('should create the app', () => {
54
+ expect(component).toBeTruthy();
55
+ });
56
+ });