Skip to content

Commit 7d7c763

Browse files
authored
Upgrade frontend dependencies (#378)
Signed-off-by: Cintia Sánchez García <[email protected]>
1 parent ff893a4 commit 7d7c763

File tree

12 files changed

+1483
-9239
lines changed

12 files changed

+1483
-9239
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,4 @@ jobs:
5959
run: yarn lint
6060
- name: Run frontend tests
6161
working-directory: ./web
62-
run: yarn test --watchAll=false --passWithNoTests --verbose --maxWorkers=4
62+
run: yarn test --reporter verbose --maxWorkers 4

web/index.html

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<!DOCTYPE html>
2+
<html lang="en" data-theme="light">
3+
<head>
4+
<meta charset="utf-8" />
5+
<link
6+
rel="shortcut icon"
7+
type="image/png"
8+
href="https://clowarden.io/static/media/logo.png"
9+
/>
10+
<meta
11+
name="viewport"
12+
content="width=device-width, initial-scale=1, maximum-scale=1"
13+
/>
14+
<meta name="theme-color" content="#2a0552" />
15+
<meta name="description" content="CLOWarden" />
16+
<link
17+
rel="apple-touch-icon"
18+
href="https://clowarden.io/static/media/logo192.png"
19+
/>
20+
<link
21+
rel="apple-touch-icon"
22+
sizes="512x512"
23+
href="https://clowarden.io/static/media/logo512.png"
24+
/>
25+
<link rel="manifest" href="/manifest.json" />
26+
<title>CLOWarden</title>
27+
<meta property="og:type" content="website" />
28+
<meta property="og:title" content="CLOWarden" />
29+
<meta property="og:description" content="CLOWarden" />
30+
<meta
31+
property="og:image"
32+
content="https://clowarden.io/static/media/clowarden.png"
33+
/>
34+
<meta name="twitter:card" content="summary_large_image" />
35+
<meta name="twitter:title" content="CLOWarden" />
36+
<meta name="twitter:description" content="CLOWarden" />
37+
<meta
38+
name="twitter:image"
39+
content="https://clowarden.io/static/media/clowarden.png"
40+
/>
41+
<script type="module" src="/src/index.tsx"></script>
42+
</head>
43+
<body>
44+
<noscript>You need to enable JavaScript to run this app.</noscript>
45+
<div id="clo-wrapper"></div>
46+
</body>
47+
</html>
48+

web/package.json

Lines changed: 25 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -6,65 +6,57 @@
66
"type": "module",
77
"dependencies": {
88
"classnames": "^2.5.1",
9-
"clo-ui": "https://github.com/cncf/clo-ui.git#v0.5.1",
9+
"clo-ui": "https://github.com/cncf/clo-ui.git#v0.5.5",
10+
"date-fns": "^4.1.0",
1011
"lodash": "^4.17.21",
11-
"moment": "^2.30.1",
12-
"react": "^18.3.1",
13-
"react-dom": "^18.3.1",
12+
"react": "^19.2.0",
13+
"react-dom": "^19.2.0",
1414
"react-icons": "^5.4.0",
15-
"react-router-dom": "^7.9.2",
15+
"react-router-dom": "^7.9.5",
1616
"source-map-explorer": "^2.5.3"
1717
},
1818
"devDependencies": {
1919
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
20-
"@eslint/js": "^9.36.0",
21-
"@testing-library/jest-dom": "^6.8.0",
20+
"@eslint/js": "^9.39.0",
21+
"@testing-library/jest-dom": "^6.9.1",
2222
"@testing-library/react": "^16.3.0",
2323
"@testing-library/user-event": "^14.6.1",
24-
"@types/jest": "^30.0.0",
2524
"@types/lodash": "^4.17.20",
26-
"@types/node": "^24.5.2",
27-
"@types/react": "^19.1.13",
28-
"@types/react-dom": "^19.1.9",
29-
"eslint": "^9.36.0",
25+
"@types/node": "^24.10.0",
26+
"@types/react": "^19.2.2",
27+
"@types/react-dom": "^19.2.2",
28+
"@vitejs/plugin-react": "^5.1.0",
29+
"@vitest/coverage-v8": "^4.0.6",
30+
"eslint": "^9.39.0",
3031
"eslint-config-prettier": "^10.1.8",
3132
"eslint-plugin-prettier": "^5.5.4",
32-
"eslint-plugin-react-hooks": "^5.1.0",
33+
"eslint-plugin-react-hooks": "^7.0.1",
3334
"eslint-plugin-simple-import-sort": "^12.1.1",
34-
"globals": "^16.4.0",
35+
"globals": "^16.5.0",
36+
"jsdom": "^27.1.0",
3537
"postcss": "^8.5.6",
3638
"prettier": "^3.6.2",
37-
"react-scripts": "5.0.1",
38-
"sass": "^1.93.2",
39+
"sass": "^1.93.3",
3940
"shx": "^0.4.0",
40-
"typescript": "^5.9.2",
41-
"typescript-eslint": "^8.44.1"
42-
},
43-
"resolutions": {
44-
"react-scripts/**/core-js-pure": "3.45.1"
41+
"typescript": "^5.9.3",
42+
"typescript-eslint": "^8.46.2",
43+
"vite": "^7.1.12",
44+
"vitest": "^4.0.6"
4545
},
4646
"scripts": {
4747
"copy:static": "shx rm -rf src/static && shx mkdir src/static && shx cp -r public/static/* src",
4848
"copy:root-index": "cp build/audit/root_index.html build/index.html && shx rm build/audit/root_index.html",
4949
"copy:images": "shx mkdir -p build/media && cp -r build/audit/media/*.png build/media",
5050
"copy:manifest": "mv build/audit/manifest.json build",
51-
"analyze": "source-map-explorer 'build/static/js/*.js'",
52-
"start": "yarn copy:static && DANGEROUSLY_DISABLE_HOST_CHECK=true DISABLE_ESLINT_PLUGIN=true react-scripts start",
53-
"build": "yarn copy:static && BUILD_PATH=./build/audit PUBLIC_URL=/audit INLINE_RUNTIME_CHUNK=false DISABLE_ESLINT_PLUGIN=true IMAGE_INLINE_SIZE_LIMIT=0 react-scripts build && shx cp -r build/audit/static/* build/audit && shx rm -rf build/audit/static && yarn copy:root-index && yarn copy:images && yarn copy:manifest",
54-
"test": "react-scripts test",
55-
"eject": "react-scripts eject",
51+
"analyze": "source-map-explorer --no-border-checks 'build/audit/js/*.js'",
52+
"start": "yarn copy:static && vite",
53+
"build": "yarn copy:static && vite build && shx cp -r build/audit/static/* build/audit && shx rm -rf build/audit/static && yarn copy:root-index && yarn copy:images && yarn copy:manifest",
54+
"test": "vitest --run --passWithNoTests",
5655
"lint": "eslint src --max-warnings 0",
5756
"lint:fix": "eslint src --max-warnings 0 --fix",
5857
"format": "prettier --write \"src/**/*.{js,jsx,ts,tsx,json,css,scss,md}\"",
5958
"format:diff": "prettier --list-different \"src/**/*.{js,jsx,ts,tsx,json,css,scss,md}\""
6059
},
61-
"proxy": "http://127.0.0.1:9000",
62-
"jest": {
63-
"moduleNameMapper": {
64-
"\\.(jpg|ico|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
65-
"\\.(css|less)$": "<rootDir>/__mocks__/fileMock.js"
66-
}
67-
},
6860
"browserslist": {
6961
"production": [
7062
">0.2%",

web/public/index.html

Lines changed: 0 additions & 26 deletions
This file was deleted.

web/src/layout/audit/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ import { SortOptions } from 'clo-ui/components/SortOptions';
99
import { SubNavbar } from 'clo-ui/components/SubNavbar';
1010
import { useBreakpointDetect } from 'clo-ui/hooks/useBreakpointDetect';
1111
import { scrollToTop } from 'clo-ui/utils/scrollToTop';
12+
import { format, fromUnixTime } from 'date-fns';
1213
import isEmpty from 'lodash/isEmpty';
1314
import isNull from 'lodash/isNull';
1415
import isUndefined from 'lodash/isUndefined';
15-
import moment from 'moment';
1616
import { Fragment, useContext, useEffect, useState } from 'react';
1717
import { AiFillCheckCircle, AiFillCloseCircle } from 'react-icons/ai';
1818
import { FaFilter } from 'react-icons/fa';
@@ -734,7 +734,7 @@ const Audit = () => {
734734
</div>
735735
</td>
736736
<td className="text-center align-middle">
737-
{moment.unix(change.applied_at).format('L LT')}
737+
{format(fromUnixTime(change.applied_at), 'MM/dd/yyyy h:mm a')}
738738
</td>
739739
<td className="text-center align-middle">
740740
{!isUndefined(change.reconciliation.pr_number)

web/src/react-app-env.d.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

web/src/setupTests.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
1-
// jest-dom adds custom jest matchers for asserting on DOM nodes.
2-
// allows you to do things like:
3-
// expect(element).toHaveTextContent(/react/i)
4-
// learn more: https://github.com/testing-library/jest-dom
5-
import '@testing-library/jest-dom';
1+
// Testing Library DOM matchers available when running Vitest specs.
2+
import '@testing-library/jest-dom/vitest';

web/src/utils/calculateTimeRange.ts

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,49 @@
1-
import moment, { DurationInputArg1, DurationInputArg2 } from 'moment';
1+
import type { Duration } from 'date-fns';
2+
import { format, sub } from 'date-fns';
23

34
export interface TimeRangeData {
45
from: string;
56
to: string;
67
}
78

89
const calculateTimeRange = (timeRange: string): TimeRangeData => {
9-
const amount = timeRange.substring(0, timeRange.length - 1);
10+
const amount = Number.parseInt(timeRange.substring(0, timeRange.length - 1), 10);
1011
const unit = timeRange.slice(-1);
12+
const now = new Date();
13+
14+
if (Number.isNaN(amount)) {
15+
const formattedNow = format(now, 'yyyy-MM-dd HH:mm:ssxxxx');
16+
return {
17+
from: formattedNow,
18+
to: formattedNow,
19+
};
20+
}
21+
22+
const duration: Duration = {};
23+
24+
switch (unit) {
25+
case 'h':
26+
duration.hours = amount;
27+
break;
28+
case 'd':
29+
duration.days = amount;
30+
break;
31+
case 'w':
32+
duration.weeks = amount;
33+
break;
34+
case 'M':
35+
duration.months = amount;
36+
break;
37+
default:
38+
duration.hours = amount;
39+
break;
40+
}
41+
42+
const from = sub(now, duration);
1143

1244
return {
13-
from: moment()
14-
.subtract(amount as DurationInputArg1, unit as DurationInputArg2)
15-
.format('YYYY-MM-DD HH:mm:ssZZ'),
16-
to: moment().format('YYYY-MM-DD HH:mm:ssZZ'),
45+
from: format(from, 'yyyy-MM-dd HH:mm:ssxxxx'),
46+
to: format(now, 'yyyy-MM-dd HH:mm:ssxxxx'),
1747
};
1848
};
1949

web/src/vite-env.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference types="vite/client" />

web/tsconfig.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"compilerOptions": {
3-
"target": "es5",
3+
"target": "ES2020",
44
"lib": [
5-
"dom",
6-
"dom.iterable",
7-
"esnext"
5+
"ES2020",
6+
"DOM",
7+
"DOM.Iterable"
88
],
99
"allowJs": true,
1010
"skipLibCheck": true,
@@ -16,6 +16,10 @@
1616
"module": "esnext",
1717
"moduleResolution": "bundler",
1818
"resolveJsonModule": true,
19+
"types": [
20+
"vite/client",
21+
"vitest"
22+
],
1923
"isolatedModules": true,
2024
"noEmit": true,
2125
"jsx": "react-jsx"

0 commit comments

Comments
 (0)