Skip to content

Commit 4e9acdf

Browse files
committed
Merge remote-tracking branch 'origin/feature/259-create-react-app-is-deprecated'
2 parents 8e6ab0f + 6e61004 commit 4e9acdf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+2919
-9369
lines changed

client/.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v20.8.0
1+
v24.11.0

client/build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash
22
rm -Rf public/bundle*
33
rm -Rf target/*
4+
rm -Rf dist/*
45
source $NVM_DIR/nvm.sh
56
nvm use
67
yarn install --force && CI=true yarn test && yarn build

client/docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
FROM ghcr.io/openconext/openconext-basecontainers/apache2:latest
2-
ADD ./build/ /var/www/
2+
ADD ./dist/ /var/www/
33
RUN rm -rf /etc/apache2/sites-enabled/*.conf
44
COPY ./docker/appconf.conf /etc/apache2/sites-enabled/
55

client/eslint.config.mjs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import js from "@eslint/js";
2+
import globals from "globals";
3+
import pluginReact from "eslint-plugin-react";
4+
import reactHooks from 'eslint-plugin-react-hooks';
5+
import { defineConfig } from "eslint/config";
6+
7+
export default defineConfig([
8+
{
9+
files: ["**/*.{js,mjs,cjs,jsx}"],
10+
plugins: {
11+
js ,
12+
'react-hooks': reactHooks
13+
},
14+
extends: ["js/recommended"],
15+
languageOptions: { globals: globals.browser }
16+
},
17+
pluginReact.configs.flat.recommended, // React config first
18+
reactHooks.configs.flat.recommended,
19+
{
20+
rules: {
21+
"react/prop-types": "off",
22+
"react/no-children-prop": "off",
23+
'react-hooks/exhaustive-deps': 'warn',
24+
"react/react-in-jsx-scope" : "off",
25+
"react-hooks/set-state-in-effect": "warn",
26+
"react-hooks/immutability":"off"
27+
},
28+
},
29+
30+
]);
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html lang="en">
33
<head>
44
<meta charset="utf-8" />
5-
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
5+
<link rel="icon" href="/favicon.ico" />
66
<meta name="viewport" content="width=device-width, initial-scale=1" />
77
<meta name="theme-color" content="#000000" />
88
<link href="/api/v1/disclaimer" rel="stylesheet">
@@ -14,6 +14,8 @@
1414
</head>
1515
<body class="sds--color-palette--green">
1616
<noscript>You need to enable JavaScript to run this app.</noscript>
17+
<!-- ToDo rename to root-->
1718
<div id="app"></div>
19+
<script type="module" src="/src/main.jsx"></script>
1820
</body>
1921
</html>

client/package.json

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,16 @@
22
"name": "client",
33
"version": "0.1.0",
44
"private": true,
5+
"scripts": {
6+
"dev": "vite",
7+
"build": "vite build",
8+
"lint": "eslint .",
9+
"preview": "vite preview",
10+
"test": "vitest"
11+
},
512
"dependencies": {
613
"@surfnet/sds": "^0.0.150",
14+
"@vitejs/plugin-react": "^5.1.0",
715
"dompurify": "^3.2.6",
816
"i18n-js": "^4.5.1",
917
"isomorphic-dompurify": "^2.26.0",
@@ -20,32 +28,32 @@
2028
"react-tooltip": "^5.29.1",
2129
"timeago.js": "^4.0.2",
2230
"tough-cookie": "^5.1.2",
31+
"vite": "^7.2.2",
2332
"word-wrap": "^1.2.5",
2433
"zustand": "^5.0.7"
2534
},
2635
"devDependencies": {
2736
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
37+
"@eslint/js": "^9.39.1",
2838
"@testing-library/jest-dom": "^6.7.0",
2939
"@testing-library/react": "^16.3.0",
3040
"@testing-library/user-event": "^14.6.1",
41+
"eslint": "^9.39.1",
42+
"eslint-plugin-react": "^7.37.5",
43+
"eslint-plugin-react-hooks": "^7.0.1",
44+
"globals": "^16.5.0",
3145
"http-proxy-middleware": "^3.0.5",
3246
"nth-check": "^2.1.1",
3347
"react-json-view-lite": "^2.4.2",
34-
"react-scripts": "5.0.1",
35-
"sass": "^1.90.0"
48+
"sass": "^1.90.0",
49+
"vite-plugin-svgr": "^4.5.0",
50+
"vitest": "^4.0.8"
3651
},
3752
"resolutions": {
3853
"nth-check": "^2.1.1",
3954
"tough-cookie": "^5.1.2",
4055
"word-wrap": "^1.2.3"
4156
},
42-
"scripts": {
43-
"start": "react-scripts start",
44-
"build": "react-scripts build",
45-
"test": "react-scripts test",
46-
"eject": "react-scripts eject"
47-
},
48-
"proxy": "http://127.0.0.1:8888/",
4957
"eslintConfig": {
5058
"extends": [
5159
"react-app",
Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, it, expect } from 'vitest';
12
import en from "../../locale/en";
23
import nl from "../../locale/nl";
34

@@ -9,22 +10,24 @@ expect.extend({
910
};
1011
},
1112
});
13+
describe('En', () => {
14+
it('All translations exists in all bundles', () => {
15+
const contains = (translation, translationToVerify, keyCollection, parents) => {
16+
Object.keys(translation).forEach(key => {
17+
expect(translationToVerify).toContainKey(key);
18+
const value = translation[key];
19+
keyCollection.push(parents + key);
20+
if (typeof value === "object") {
21+
contains(value, translationToVerify[key], keyCollection, parents + key + ".")
22+
}
23+
});
24+
};
25+
const keyCollectionEN = [];
26+
contains(en, nl, keyCollectionEN, '');
27+
const keyCollectionNL = [];
28+
contains(nl, en, keyCollectionNL, '');
29+
const positionalMismatches = keyCollectionEN.filter((item, index) => keyCollectionNL[index] !== item);
30+
expect(positionalMismatches).toEqual([])
31+
});
1232

13-
test("All translations exists in all bundles", () => {
14-
const contains = (translation, translationToVerify, keyCollection, parents) => {
15-
Object.keys(translation).forEach(key => {
16-
expect(translationToVerify).toContainKey(key);
17-
const value = translation[key];
18-
keyCollection.push(parents + key);
19-
if (typeof value === "object") {
20-
contains(value, translationToVerify[key], keyCollection, parents + key + ".")
21-
}
22-
});
23-
};
24-
const keyCollectionEN = [];
25-
contains(en, nl, keyCollectionEN, '');
26-
const keyCollectionNL = [];
27-
contains(nl, en, keyCollectionNL, '');
28-
const positionalMismatches = keyCollectionEN.filter((item, index) => keyCollectionNL[index] !== item);
29-
expect(positionalMismatches).toEqual([])
3033
});
Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1+
import { describe, it, expect } from 'vitest';
12
import {useAppStore} from "../../stores/AppStore";
23

3-
test("Store outside functional component", () => {
4-
const csrfToken = useAppStore.getState().csrfToken;
5-
expect(csrfToken).toBeNull();
4+
describe('AppStore', () => {
5+
it('Store outside functional component', () => {
6+
const csrfToken = useAppStore.getState().csrfToken;
7+
expect(csrfToken).toBeNull();
68

7-
useAppStore.setState({csrfToken: "test"});
9+
useAppStore.setState({csrfToken: "test"});
810

9-
const updatedCsrfToken = useAppStore.getState().csrfToken;
10-
expect(updatedCsrfToken).toEqual("test");
11+
const updatedCsrfToken = useAppStore.getState().csrfToken;
12+
expect(updatedCsrfToken).toEqual("test");
13+
});
1114
});
Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,35 @@
1+
import { describe, it, expect } from 'vitest';
12
import {mergeProvidersProvisioningsRoles, reduceApplicationFromUserRoles} from "../../utils/Manage";
23
import applications from "./applications.json";
34
import userRoles from "./userRoles.json";
45

5-
test("mergeProvidersProvisioningsRoles", () => {
6-
const results = mergeProvidersProvisioningsRoles(applications.providers, applications.provisionings);
7-
expect(results.length).toEqual(6);
8-
});
6+
describe('Manage', () => {
7+
it("mergeProvidersProvisioningsRoles", () => {
8+
const results = mergeProvidersProvisioningsRoles(applications.providers, applications.provisionings);
9+
expect(results.length).toEqual(6);
10+
});
911

10-
test("reduceApplicationFromUserRoles", () => {
11-
const results = reduceApplicationFromUserRoles(userRoles, "en");
12-
const applicationNames = results.map(app => app.applicationName);
13-
//Sorting alphabetically on applicationName
14-
expect(applicationNames).toEqual([
15-
"Calendar EN (SURF bv)",
16-
"Research EN (SURF bv)",
17-
"Research EN (SURF bv)",
18-
"Wiki EN (SURF bv)",
19-
"Wiki EN (SURF bv)",
20-
"Wiki EN (SURF bv)"
21-
]);
22-
const roleNames = results
23-
.filter(app => app.applicationName.startsWith("Wiki"))
24-
.map(app => app.roleName);
25-
//Sub-sorting alphabetically on roleName
26-
expect(roleNames).toEqual([
27-
"Wiki 1 Role",
28-
"Wiki 2 Role",
29-
"Wiki Another Role (3) - Calendar (1)"
30-
]);
12+
it("reduceApplicationFromUserRoles", () => {
13+
const results = reduceApplicationFromUserRoles(userRoles, "en");
14+
const applicationNames = results.map(app => app.applicationName);
15+
//Sorting alphabetically on applicationName
16+
expect(applicationNames).toEqual([
17+
"Calendar EN (SURF bv)",
18+
"Research EN (SURF bv)",
19+
"Research EN (SURF bv)",
20+
"Wiki EN (SURF bv)",
21+
"Wiki EN (SURF bv)",
22+
"Wiki EN (SURF bv)"
23+
]);
24+
const roleNames = results
25+
.filter(app => app.applicationName.startsWith("Wiki"))
26+
.map(app => app.roleName);
27+
//Sub-sorting alphabetically on roleName
28+
expect(roleNames).toEqual([
29+
"Wiki 1 Role",
30+
"Wiki 2 Role",
31+
"Wiki Another Role (3) - Calendar (1)"
32+
]);
33+
});
3134
});
3235

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1+
import { describe, it, expect } from 'vitest';
12
import {defaultPagination, paginationQueryParams} from "../../utils/Pagination";
23

3-
test("paginationQueryParams defaults", () => {
4-
const page = defaultPagination("desc", "DESC");
5-
const queryParams = paginationQueryParams(page, {custom: "val"});
6-
expect(queryParams).toEqual("custom=val&pageNumber=0&pageSize=10&sort=desc&sortDirection=DESC&");
7-
});
4+
describe('Pagination', () => {
5+
it("paginationQueryParams defaults", () => {
6+
const page = defaultPagination("desc", "DESC");
7+
const queryParams = paginationQueryParams(page, {custom: "val"});
8+
expect(queryParams).toEqual("custom=val&pageNumber=0&pageSize=10&sort=desc&sortDirection=DESC&");
9+
});
810

9-
test("paginationQueryParams empty", () => {
10-
const queryParams = paginationQueryParams({});
11-
expect(queryParams).toEqual("");
11+
it("paginationQueryParams empty", () => {
12+
const queryParams = paginationQueryParams({});
13+
expect(queryParams).toEqual("");
14+
});
1215
});

0 commit comments

Comments
 (0)