@eui/cli 22.0.0-alpha.21 → 22.0.0-alpha.22

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 (39) hide show
  1. package/README.md +303 -90
  2. package/lib/app-utils/build.js +26 -0
  3. package/lib/app-utils/serve.js +32 -0
  4. package/lib/build.js +28 -7
  5. package/lib/cli.js +16 -2
  6. package/lib/config.js +10 -1
  7. package/lib/skeletons/_angular/base/package.json +3 -2
  8. package/lib/skeletons/_angular/base-mobile/package.json +1 -1
  9. package/lib/skeletons/_angular/options/eds/src/app/app.component.html +35 -0
  10. package/lib/skeletons/_angular/options/eds/src/app/app.component.spec.ts +56 -0
  11. package/lib/skeletons/_angular/options/eds/src/app/app.component.ts +44 -0
  12. package/lib/skeletons/_angular/options/eds/src/index.html +21 -0
  13. package/lib/skeletons/_angular/options/pnpm/package.json +97 -47
  14. package/lib/skeletons/_react/base/README.md +65 -0
  15. package/lib/skeletons/_react/base/eslint.config.mjs +17 -0
  16. package/lib/skeletons/_react/base/gitignore_TO_REPLACE +34 -0
  17. package/lib/skeletons/_react/base/index.html +13 -0
  18. package/lib/skeletons/_react/base/mock/app/models/user.js +6 -0
  19. package/lib/skeletons/_react/base/mock/app/routes/index.js +5 -0
  20. package/lib/skeletons/_react/base/mock/app/routes/user_routes.js +44 -0
  21. package/lib/skeletons/_react/base/mock/db/db.json +10 -0
  22. package/lib/skeletons/_react/base/mock/server.js +23 -0
  23. package/lib/skeletons/_react/base/package.json +29 -0
  24. package/lib/skeletons/_react/base/public/.gitkeep +0 -0
  25. package/lib/skeletons/_react/base/src/App.tsx +73 -0
  26. package/lib/skeletons/_react/base/src/main.tsx +30 -0
  27. package/lib/skeletons/_react/base/src/pages/about.tsx +27 -0
  28. package/lib/skeletons/_react/base/src/pages/home.tsx +50 -0
  29. package/lib/skeletons/_react/base/src/routes.ts +18 -0
  30. package/lib/skeletons/_react/base/src/styles.css +37 -0
  31. package/lib/skeletons/_react/base/src/vite-env.d.ts +1 -0
  32. package/lib/skeletons/_react/base/tsconfig.app.json +18 -0
  33. package/lib/skeletons/_react/base/tsconfig.json +7 -0
  34. package/lib/skeletons/_react/base/tsconfig.node.json +15 -0
  35. package/lib/skeletons/_react/base/vite.config.ts +77 -0
  36. package/lib/skeletons/_react/options/pnpm/package.json +45 -0
  37. package/lib/utils.js +24 -0
  38. package/package.json +1 -1
  39. package/sonar-project.properties +0 -14
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,6 +1,6 @@
1
1
  {
2
2
  "name": "eui-angular-app",
3
- "version": "22.0.0-alpha.21",
3
+ "version": "22.0.0-alpha.22",
4
4
  "license": "EUPL-1.1",
5
5
  "scripts": {
6
6
  "ng": "ng",
@@ -20,9 +20,10 @@
20
20
  },
21
21
  "private": true,
22
22
  "dependencies": {
23
- "@eui/deps-base": "22.0.0-alpha.21"
23
+ "@eui/deps-base": "22.0.0-alpha.22"
24
24
  },
25
25
  "devDependencies": {
26
+ "@eui/deps-base-dev": "22.0.0-alpha.22",
26
27
  "npm-run-all": "4.1.5",
27
28
  "json-server": "1.0.0-beta.3",
28
29
  "nodemon": "3.1.11",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eui-angular-app",
3
- "version": "22.0.0-alpha.21",
3
+ "version": "22.0.0-alpha.22",
4
4
  "license": "EUPL-1.1",
5
5
  "scripts": {
6
6
  "ng": "ng",
@@ -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
+ });
@@ -0,0 +1,44 @@
1
+ import { Component, viewChild } from '@angular/core';
2
+ import { RouterOutlet } from '@angular/router';
3
+ import { TranslatePipe } from '@ngx-translate/core';
4
+ import { EDS_SHELL, EdsShell, EdsMenuItem } from '@eui/eds/eds-shell';
5
+ import { EDS_ICON_BUTTON } from '@eui/eds/eds-icon-button';
6
+ import { EDS_USER_PROFILE } from '@eui/eds/eds-user-profile';
7
+
8
+ /**
9
+ * Desktop EDS application shell. Mirrors the default Angular desktop skeleton (same routes,
10
+ * features, config and interceptors) but composes the layout with the modern `@eui/eds`
11
+ * `eds-shell` and EDS components instead of the legacy `@eui/components` `eui-app`.
12
+ *
13
+ * The sidebar nav items carry a `url` that the `eds-menu` resolves through Angular's router
14
+ * (`[routerLink]`), so navigation is declarative — no manual `navigate()` call is needed.
15
+ */
16
+ @Component({
17
+ selector: 'app-root',
18
+ templateUrl: './app.component.html',
19
+ imports: [
20
+ RouterOutlet,
21
+ TranslatePipe,
22
+ ...EDS_SHELL,
23
+ ...EDS_ICON_BUTTON,
24
+ ...EDS_USER_PROFILE,
25
+ ],
26
+ })
27
+ export class AppComponent {
28
+ private shell = viewChild.required(EdsShell);
29
+
30
+ sidebarItems: EdsMenuItem[] = [
31
+ { label: 'Home', url: 'screen/home', icon: 'house' },
32
+ {
33
+ label: 'Module 1', url: 'screen/module1', icon: 'stack', children: [
34
+ { label: 'page 1', url: 'screen/module1/page1' },
35
+ { label: 'page 2', url: 'screen/module1/page2' },
36
+ ],
37
+ },
38
+ { label: 'Module 2', url: 'screen/module2', icon: 'folder' },
39
+ ];
40
+
41
+ onToggleSidebar(): void {
42
+ this.shell().toggleSidebar();
43
+ }
44
+ }
@@ -0,0 +1,21 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>Application name</title>
6
+ <base href="/">
7
+
8
+ <meta name="viewport" content="width=device-width, initial-scale=1">
9
+ <link rel="icon" type="image/x-icon" href="favicon.ico">
10
+ </head>
11
+
12
+ <!-- The `eui-21` scope class is required by EDS styling (it provides the --eds-* tokens). -->
13
+ <body class="eui-21">
14
+ <app-root>
15
+ <div id="loader-wrapper">
16
+ <div id="loader"></div>
17
+ </div>
18
+ </app-root>
19
+ </body>
20
+
21
+ </html>
@@ -1,71 +1,121 @@
1
1
  {
2
2
  "name": "eui-angular-app",
3
- "version": "22.0.0-alpha.21",
3
+ "version": "22.0.0-alpha.22",
4
4
  "license": "EUPL-1.1",
5
5
  "scripts": {
6
6
  "ng": "ng",
7
7
  "start-mock-server": "nodemon --watch ./mock ./mock/server.js",
8
- "start-serve": "eui-cli serve-app --configuration=proxy-mock",
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",
11
11
  "start-local": "eui-cli serve-app",
12
12
  "build": "eui-cli build-app",
13
13
  "build-dev": "eui-cli build-app --configuration=development --configEnvTarget=dev",
14
- "build-prod": "eui-cli build-app --configuration=production-optimized --configEnvTarget=prod --skipLint --skipTest",
15
- "app:inject-config": "eui-cli inject-config-app"
14
+ "build-prod": "eui-cli build-app --configuration=production-optimized --configEnvTarget=prod",
15
+ "build-prod-skip-test": "eui-cli build-app --configuration=production-optimized --configEnvTarget=prod --skipTest",
16
+ "build-prod-stats": "eui-cli build-app --configuration=production-optimized --configEnvTarget=prod",
17
+ "app:build": "eui-cli build-app",
18
+ "app:inject-config": "eui-cli inject-config-app",
19
+ "generate-sprite": "eui-cli generate-sprite"
16
20
  },
17
21
  "private": true,
18
22
  "dependencies": {
19
- "@angular/animations": "21.2.5",
20
- "@angular/common": "21.2.5",
21
- "@angular/compiler": "21.2.5",
22
- "@angular/core": "21.2.5",
23
- "@angular/forms": "21.2.5",
24
- "@angular/platform-browser": "21.2.5",
25
- "@angular/platform-browser-dynamic": "21.2.5",
26
- "@angular/router": "21.2.5",
27
- "@angular/elements": "21.2.5",
28
- "@angular/language-service": "21.2.5",
29
- "@angular/service-worker": "21.2.5",
30
- "@angular/cdk": "21.2.3",
31
- "@angular/material": "21.2.3",
32
- "@angular/material-moment-adapter": "21.2.3",
33
- "@angular-devkit/build-angular": "21.2.3",
23
+ "@angular/animations": "22.1.2",
24
+ "@angular/common": "22.1.2",
25
+ "@angular/compiler": "22.1.2",
26
+ "@angular/core": "22.1.2",
27
+ "@angular/forms": "22.1.2",
28
+ "@angular/platform-browser": "22.1.2",
29
+ "@angular/platform-browser-dynamic": "22.1.2",
30
+ "@angular/router": "22.1.2",
31
+ "@angular/elements": "22.1.2",
32
+ "@angular/service-worker": "22.1.2",
33
+ "@angular/cdk": "22.1.2",
34
+ "@angular/material": "22.1.2",
35
+ "@angular/material-moment-adapter": "22.1.2",
36
+ "@angular/material-luxon-adapter": "22.1.2",
37
+ "luxon": "3.7.2",
34
38
  "rxjs": "7.8.2",
35
39
  "tslib": "2.8.1",
36
- "zone.js": "0.15.1",
37
- "@types/lodash": "4.17.20",
38
- "intl": "1.2.5",
39
- "deepmerge-ts": "7.1.5",
40
- "@ngx-translate/core": "15.0.0",
41
- "@ngx-translate/http-loader": "8.0.0",
42
- "reselect": "5.1.1",
43
- "ngx-mask": "20.0.3",
44
- "hammerjs": "2.0.8",
45
- "pikaday": "1.8.2",
46
- "lodash-es": "4.17.23",
40
+ "zone.js": "0.16.2",
41
+ "deepmerge-ts": "8.0.1",
42
+ "deepmerge": "4.3.1",
43
+ "reselect": "5.2.0",
44
+ "ngx-mask": "22.0.1",
45
+ "@ngx-translate/core": "18.0.0",
46
+ "@ngx-translate/http-loader": "18.0.0",
47
+ "lodash-es": "4.18.1",
47
48
  "localforage": "1.10.0",
48
- "@eui/base": "22.0.0-alpha.21",
49
- "@eui/core": "22.0.0-alpha.21",
50
- "@eui/styles": "22.0.0-alpha.21",
51
- "@eui/components": "22.0.0-alpha.21",
52
- "@eui/ecl": "22.0.0-alpha.21",
53
- "@eui/eds": "22.0.0-alpha.21",
54
- "@eui/eds-styles": "22.0.0-alpha.21"
49
+ "hammerjs": "2.0.8",
50
+ "@duetds/date-picker": "1.4.0",
51
+ "embla-carousel": "8.6.0",
52
+ "embla-carousel-reactive-utils": "8.6.0",
53
+ "embla-carousel-angular": "22.0.0",
54
+ "embla-carousel-auto-scroll": "8.6.0",
55
+ "moment": "2.31.0",
56
+ "quill": "2.0.3",
57
+ "quill-delta": "5.1.0",
58
+ "quill-better-table": "1.2.10",
59
+ "apexcharts": "5.16.0",
60
+ "marked": "18.0.5",
61
+ "ngx-markdown": "22.0.0",
62
+ "prismjs": "1.30.0",
63
+ "@stackblitz/sdk": "1.11.1",
64
+ "@eui/base": "22.0.0-alpha.22",
65
+ "@eui/core": "22.0.0-alpha.22",
66
+ "@eui/styles": "22.0.0-alpha.22",
67
+ "@eui/components": "22.0.0-alpha.22",
68
+ "@eui/showcase": "22.0.0-alpha.22",
69
+ "@eui/ecl": "22.0.0-alpha.22",
70
+ "@eui/eds": "22.0.0-alpha.22",
71
+ "@eui/eds-styles": "22.0.0-alpha.22",
72
+ "@eui/eds-wc": "22.0.0-alpha.22"
55
73
  },
56
74
  "devDependencies": {
57
- "@angular/compiler-cli": "21.2.5",
58
- "@angular/build": "21.2.3",
59
- "@angular/cli": "21.2.3",
60
- "ng-packagr": "23.0.0-alpha.1",
61
- "@eui/cli": "22.0.0-alpha.21",
62
- "typescript": "~6.0.2",
75
+ "@eui/cli": "22.0.0-alpha.22",
76
+ "@angular/compiler-cli": "22.1.2",
77
+ "@angular/language-service": "22.1.2",
78
+ "@angular/build": "22.1.4",
79
+ "@angular/cli": "22.1.4",
80
+ "ng-packagr": "22.1.1",
81
+ "typescript": "6.0.3",
82
+ "@types/node": "24.13.3",
83
+ "@types/lodash-es": "4.17.12",
84
+ "@types/quill": "2.0.14",
85
+ "ts-node": "10.9.2",
86
+ "eslint": "10.8.1",
87
+ "angular-eslint": "22.1.0",
88
+ "@angular-eslint/builder": "22.1.0",
89
+ "@angular-eslint/eslint-plugin": "22.1.0",
90
+ "@angular-eslint/eslint-plugin-template": "22.1.0",
91
+ "@angular-eslint/schematics": "22.1.0",
92
+ "@angular-eslint/template-parser": "22.1.0",
93
+ "eslint-plugin-prefer-arrow": "1.2.3",
94
+ "eslint-plugin-jsdoc": "63.0.12",
95
+ "eslint-plugin-import": "2.32.0",
96
+ "typescript-eslint": "8.63.0",
97
+ "@typescript-eslint/parser": "8.63.0",
98
+ "@typescript-eslint/eslint-plugin": "8.63.0",
99
+ "@eslint/js": "9.39.1",
100
+ "@eslint/eslintrc": "3.3.5",
101
+ "vitest": "4.1.11",
102
+ "@vitest/ui": "4.1.11",
103
+ "@vitest/coverage-v8": "4.1.11",
104
+ "@vitest/coverage-istanbul": "4.1.11",
105
+ "jsdom": "30.0.1",
106
+ "xhr-mock": "2.5.1",
107
+ "@compodoc/compodoc": "2.0.0",
63
108
  "npm-run-all": "4.1.5",
64
109
  "json-server": "1.0.0-beta.3",
65
- "nodemon": "3.1.10",
110
+ "nodemon": "3.1.11",
66
111
  "lowdb": "1.0.0",
67
- "body-parser": "2.2.0",
68
- "express": "5.1.0",
69
- "uuid": "13.0.0"
112
+ "body-parser": "1.20.3",
113
+ "express": "4.21.2"
114
+ },
115
+ "resolutions": {
116
+ "semver": ">=7.5.2",
117
+ "dompurify": ">=3.2.4",
118
+ "tmp": ">0.2.4",
119
+ "tablesort": "5.6.0"
70
120
  }
71
121
  }
@@ -0,0 +1,65 @@
1
+ # eUI React App
2
+
3
+ A React + Vite starter application built with [`@eui/eds-react`](https://eui.ecdevops.eu) — the
4
+ pure-React port of the EU Design System (EDS) components — and React Router.
5
+
6
+ ## Prerequisites
7
+
8
+ - Node.js `^20.19.0 || ^22.12.0 || >=24.15.0`
9
+ - Yarn 1.x (or pnpm)
10
+
11
+ ## Getting started
12
+
13
+ Install dependencies (done automatically by the eUI CLI when you opt in):
14
+
15
+ ```sh
16
+ yarn
17
+ ```
18
+
19
+ Start the dev server (opens on http://localhost:4200):
20
+
21
+ ```sh
22
+ npm start
23
+ ```
24
+
25
+ ## Available scripts
26
+
27
+ | Script | Description |
28
+ | --- | --- |
29
+ | `npm start` | Start the Vite dev server with HMR |
30
+ | `npm run build` | Type-check and build the production bundle into `dist/` |
31
+ | `npm run preview` | Preview the production build locally |
32
+ | `npm run lint` | Lint the `src` folder with ESLint |
33
+ | `npm run test` | Run unit tests with Vitest |
34
+
35
+ ## Project structure
36
+
37
+ ```
38
+ ├── index.html # App entry; <body class="eui-21"> provides the EDS token scope
39
+ ├── vite.config.ts # Vite config; serves EDS icon sprites under /assets/eds
40
+ ├── tsconfig*.json # TypeScript project references
41
+ ├── eslint.config.mjs # Flat ESLint config (single quotes, TS recommended)
42
+ └── src/
43
+ ├── main.tsx # Mounts <App/> in a HashRouter; loads EDS + component styles
44
+ ├── App.tsx # The EdsShell (toolbar + sidebar + routed content)
45
+ ├── routes.ts # Navigation table (sidebar items)
46
+ ├── styles.css # App-level styles
47
+ └── pages/ # Route pages (home, about)
48
+ ```
49
+
50
+ ## Adding a page
51
+
52
+ 1. Create `src/pages/my-page.tsx` exporting a component.
53
+ 2. Add an entry to `NAV_ITEMS` in `src/routes.ts` (path, label, EDS icon name).
54
+ 3. Add a `<Route>` for it in `src/App.tsx`.
55
+
56
+ ## Styling
57
+
58
+ The EDS design tokens (`--eds-*`) are provided by `@eui/eds-styles` and are available anywhere
59
+ under the `eui-21` scope (set on `<body>`). Prefer the `eds-u-*` utility classes for layout. All
60
+ `@eui/eds-react` component styles are loaded via the combined `@eui/eds-react/styles.css` barrel
61
+ in `main.tsx`; to reduce bundle size you can instead import only the per-component CSS you use.
62
+
63
+ ## License
64
+
65
+ EUPL-1.1
@@ -0,0 +1,17 @@
1
+ import js from '@eslint/js';
2
+ import tseslint from 'typescript-eslint';
3
+
4
+ export default tseslint.config(
5
+ { ignores: ['dist', 'node_modules'] },
6
+ {
7
+ files: ['src/**/*.{ts,tsx}'],
8
+ extends: [js.configs.recommended, ...tseslint.configs.recommended],
9
+ rules: {
10
+ quotes: ['error', 'single', { avoidEscape: true }],
11
+ '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
12
+ '@typescript-eslint/no-explicit-any': 'warn',
13
+ 'prefer-const': 'error',
14
+ 'no-var': 'error',
15
+ },
16
+ },
17
+ );
@@ -0,0 +1,34 @@
1
+ # See http://help.github.com/ignore-files/ for more about ignoring files.
2
+
3
+ # compiled output
4
+ **/node_modules
5
+ **/dist
6
+ **/out-tsc
7
+ **/tmp
8
+ **/coverage
9
+
10
+ # IDEs and editors
11
+ /.idea
12
+ .project
13
+ .classpath
14
+ *.launch
15
+ .settings/
16
+
17
+ # IDE - VSCode
18
+ .vscode/*
19
+ !.vscode/settings.json
20
+ !.vscode/tasks.json
21
+ !.vscode/launch.json
22
+ !.vscode/extensions.json
23
+
24
+ # misc
25
+ npm-debug.log
26
+ yarn-error.log
27
+ *.local
28
+
29
+ # Vite
30
+ .vite
31
+
32
+ # System Files
33
+ .DS_Store
34
+ Thumbs.db
@@ -0,0 +1,13 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>eUI React App</title>
7
+ </head>
8
+ <!-- The `eui-21` scope class is required by EDS styling (it provides the --eds-* tokens). -->
9
+ <body class="eui-21">
10
+ <div id="root"></div>
11
+ <script type="module" src="/src/main.tsx"></script>
12
+ </body>
13
+ </html>
@@ -0,0 +1,6 @@
1
+ module.exports = {
2
+ userId: '',
3
+ firstName: '',
4
+ lastName: '',
5
+ email: '',
6
+ }
@@ -0,0 +1,5 @@
1
+ const userRoutes = require('./user_routes');
2
+
3
+ module.exports = function (app, db) {
4
+ userRoutes(app, db);
5
+ };
@@ -0,0 +1,44 @@
1
+ const crypto = require('crypto');
2
+ const User = require('../models/user');
3
+
4
+ module.exports = function (app, db) {
5
+ db.then(db => {
6
+ app.get('/api/user-details', (req, res) => {
7
+ res.send(db.get('user-details'))
8
+ });
9
+
10
+ app.get('/api/users', (req, res) => {
11
+ res.send(db.get('users'))
12
+ });
13
+
14
+ app.get('/api/users/:userId', (req, res) => {
15
+ res.send(
16
+ db.get('users')
17
+ .find({ userId: req.params.userId })
18
+ );
19
+ });
20
+
21
+ app.put('/api/users/:userId', (req, res) => {
22
+ db.get('users')
23
+ .find({ userId: req.params.userId })
24
+ .assign( { ...req.body } )
25
+ .write()
26
+ .then(user => res.send(user))
27
+ });
28
+
29
+ app.delete('/api/users/:userId', (req, res) => {
30
+ db.get('users')
31
+ .remove({ userId: req.params.userId })
32
+ .write()
33
+ .then(res.send())
34
+ });
35
+
36
+ app.post('/api/users', (req, res) => {
37
+ db.get('users')
38
+ .push({ ...User, ...req.body, ...{ userId: crypto.randomUUID() } })
39
+ .last()
40
+ .write()
41
+ .then(user => res.send(user))
42
+ });
43
+ });
44
+ };
@@ -0,0 +1,10 @@
1
+ {
2
+ "user-details": {
3
+ "userId": "doejohn",
4
+ "firstName": "John",
5
+ "lastName": "Doe",
6
+ "email": "John.DOE@ec.europa.eu"
7
+ },
8
+ "users": [
9
+ ]
10
+ }
@@ -0,0 +1,23 @@
1
+ const express = require('express');
2
+ const bodyParser = require('body-parser');
3
+ const app = express();
4
+ const low = require('lowdb');
5
+ const FileAsync = require('lowdb/adapters/FileAsync');
6
+ const adapter = new FileAsync('mock/db/db.json');
7
+ const db = low(adapter);
8
+ const port = 3000;
9
+
10
+ app.use(express.json());
11
+ app.use(bodyParser.urlencoded({ extended: true }));
12
+ // const cors = require('cors');
13
+ // if needed to be reached from another localhost server for local testing a distributed app f.e.
14
+ // app.use(cors({
15
+ // origin: 'http://127.0.0.1:8080',
16
+ // credentials: true,
17
+ // }));
18
+
19
+ require('./app/routes')(app, db);
20
+
21
+ app.listen(port, () => {
22
+ console.log('We are live on ' + port);
23
+ });
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "eui-react-app",
3
+ "version": "22.0.0-alpha.22",
4
+ "license": "EUPL-1.1",
5
+ "private": true,
6
+ "type": "module",
7
+ "scripts": {
8
+ "start-mock-server": "nodemon --watch ./mock ./mock/server.js",
9
+ "start-serve": "eui-cli serve-app",
10
+ "start": "npm-run-all --parallel start-mock-server start-serve",
11
+ "start-local": "eui-cli serve-app",
12
+ "build": "tsc -b && eui-cli build-app",
13
+ "preview": "vite preview",
14
+ "lint": "eslint src --ext .ts,.tsx",
15
+ "test": "vitest run"
16
+ },
17
+ "dependencies": {
18
+ "@eui/deps-base-react": "22.0.0-alpha.22"
19
+ },
20
+ "devDependencies": {
21
+ "@eui/cli": "22.0.0-alpha.22",
22
+ "npm-run-all": "4.1.5",
23
+ "json-server": "1.0.0-beta.3",
24
+ "nodemon": "3.1.11",
25
+ "lowdb": "1.0.0",
26
+ "body-parser": "1.20.3",
27
+ "express": "4.21.2"
28
+ }
29
+ }
File without changes