Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: update Next.js, React.js and Node.js #815

Merged
merged 38 commits into from
Jun 23, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
9ab5fa5
refactor: update Next.js and React.js
gauthier-th Jun 13, 2024
63d8f55
refactor: update Next.js images
gauthier-th Jun 15, 2024
c680202
refactor: update ESLint rules and fix warnings/errors
gauthier-th Jun 15, 2024
5d6e7f0
fix: remove old intl polyfill
gauthier-th Jun 15, 2024
48d178c
fix: add proper size to next/image components
gauthier-th Jun 15, 2024
65239a9
fix: adjust full-size for next/image components
gauthier-th Jun 17, 2024
5fb1c68
fix: temporary allow all domains for image optimization
gauthier-th Jun 18, 2024
06e465d
build: fixes an issue where dev env could lead to javascript heap out…
Fallenbagel Jun 18, 2024
cb8cada
chore: merge origin/develop
gauthier-th Jun 19, 2024
5efa1d7
fix: resolve webpack cache issue with country-flag-icons
gauthier-th Jun 19, 2024
6b248d9
refactor: switch compiler from Babel to SWC
gauthier-th Jun 19, 2024
5c212ae
fix: resize logo in sidebar
gauthier-th Jun 20, 2024
f7de241
fix: break word on long path to avoid text overflow
gauthier-th Jun 20, 2024
5070000
chore: added sharp for production image optimisation
Fallenbagel Jun 20, 2024
43f8260
fix: change extract script for i18n to a custom script
gauthier-th Jun 21, 2024
966a721
fix: resolve GitHub CodeQL alert
gauthier-th Jun 21, 2024
b5738b4
chore: temporarily remove builds for ARMv7
gauthier-th Jun 22, 2024
f3e180a
fix: resize avatar images
gauthier-th Jun 23, 2024
ea43e3b
refactor: update Node.js to v20
gauthier-th Jun 23, 2024
fac81f7
fix: resolve various UI issues
gauthier-th Jun 23, 2024
99ee19c
build: migrate yarn to pnpm and restrict engine to node@^20.0.0
Fallenbagel Jun 23, 2024
588b1e3
ci: specify the pnpm version to use in workflow actions
Fallenbagel Jun 23, 2024
cb7e2f0
ci: fix typo in pnpm action-setup for cypress workflow
Fallenbagel Jun 23, 2024
ffb20eb
test(cypress): use pnpm instead of yarn
Fallenbagel Jun 23, 2024
878afb9
style: ran prettier on pnpm-lock
Fallenbagel Jun 23, 2024
e50df22
ci(cypress): setup nodejs v20 in cypress workflow
Fallenbagel Jun 23, 2024
37ba36f
ci: pnpm cache to reduce install time
Fallenbagel Jun 23, 2024
a58811e
ci: use sh shell to get pnpm store directory
Fallenbagel Jun 23, 2024
182aeaa
build(dockerfile): migrate to pnpm from yarn in docker builds
Fallenbagel Jun 23, 2024
1168c77
build(dockerfile): copy the proper pnpm lockfile
Fallenbagel Jun 23, 2024
2c52dbc
build: install pnpm for all platforms
Fallenbagel Jun 23, 2024
cc80bf2
build(dockerfile): remove unnecessary `&&` on apk installation steps
Fallenbagel Jun 23, 2024
e30a3ea
build: migrate pnpm 8 to 9
Fallenbagel Jun 23, 2024
f5a5091
build(dockerfile): add node-gyp back in
Fallenbagel Jun 23, 2024
d5e37e4
build(dockerfile): install node-gyp through npm
Fallenbagel Jun 23, 2024
0da85ca
build(dockerfile): ignore scripts to not run husky install when devde…
Fallenbagel Jun 23, 2024
efab06b
build: migrate to pnpm from yarn
Fallenbagel Jun 23, 2024
013312c
chore: remove a section that is no longer relevant
gauthier-th Jun 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ module.exports = {
'eslint:recommended',
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
'plugin:jsx-a11y/recommended',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:react/jsx-runtime',
'plugin:@next/next/recommended',
'prettier',
],
parserOptions: {
Expand Down
25 changes: 0 additions & 25 deletions babel.config.js

This file was deleted.

6 changes: 5 additions & 1 deletion next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ module.exports = {
JELLYFIN_TYPE: process.env.JELLYFIN_TYPE,
},
images: {
domains: ['image.tmdb.org'],
remotePatterns: [
{ hostname: 'gravatar.com' },
{ hostname: 'image.tmdb.org' },
{ hostname: '*', protocol: 'https' },
],
},
webpack(config) {
config.module.rules.push({
Expand Down
27 changes: 11 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"lint": "eslint \"./server/**/*.{ts,tsx}\" \"./src/**/*.{ts,tsx}\" --cache",
"lintfix": "eslint \"./server/**/*.{ts,tsx}\" \"./src/**/*.{ts,tsx}\" --fix",
"start": "NODE_ENV=production node dist/index.js",
"i18n:extract": "extract-messages -l=en -o src/i18n/locale -d en --flat true --overwriteDefault true \"./src/**/!(*.test).{ts,tsx}\"",
"i18n:extract": "ts-node --project server/tsconfig.json src/i18n/extractMessages.ts",
"migration:generate": "ts-node -r tsconfig-paths/register --project server/tsconfig.json ./node_modules/typeorm/cli.js migration:generate -d server/datasource.ts",
"migration:create": "ts-node -r tsconfig-paths/register --project server/tsconfig.json ./node_modules/typeorm/cli.js migration:create -d server/datasource.ts",
"migration:run": "ts-node -r tsconfig-paths/register --project server/tsconfig.json ./node_modules/typeorm/cli.js migration:run -d server/datasource.ts",
Expand All @@ -34,6 +34,7 @@
"@formatjs/intl-locale": "3.1.1",
"@formatjs/intl-pluralrules": "5.1.10",
"@formatjs/intl-utils": "3.8.4",
"@formatjs/swc-plugin-experimental": "^0.4.0",
"@headlessui/react": "1.7.12",
"@heroicons/react": "2.0.16",
"@supercharge/request-ip": "1.2.0",
Expand All @@ -59,25 +60,24 @@
"express-openapi-validator": "4.13.8",
"express-rate-limit": "6.7.0",
"express-session": "1.17.3",
"formik": "2.2.9",
"formik": "^2.4.6",
"gravatar-url": "3.1.0",
"intl": "1.2.5",
"lodash": "4.17.21",
"next": "12.3.4",
"next": "^14.2.4",
"node-cache": "5.1.2",
"node-gyp": "9.3.1",
"node-schedule": "2.1.1",
"nodemailer": "6.9.1",
"openpgp": "5.7.0",
"plex-api": "5.3.2",
"pug": "3.0.2",
"react": "18.2.0",
"react": "^18.3.1",
"react-ace": "10.1.0",
"react-animate-height": "2.1.2",
"react-aria": "3.23.0",
"react-dom": "18.2.0",
"react-dom": "^18.3.1",
"react-intersection-observer": "9.4.3",
"react-intl": "6.2.10",
"react-intl": "^6.6.8",
"react-markdown": "8.0.5",
"react-popper-tooltip": "4.4.2",
"react-select": "5.7.0",
Expand All @@ -89,6 +89,7 @@
"reflect-metadata": "0.1.13",
"secure-random-password": "0.2.3",
"semver": "7.3.8",
"sharp": "^0.33.4",
"sqlite3": "5.1.4",
"swagger-ui-express": "4.6.2",
"swr": "2.0.4",
Expand All @@ -102,7 +103,6 @@
"zod": "3.20.6"
},
"devDependencies": {
"@babel/cli": "7.21.0",
"@commitlint/cli": "17.4.4",
"@commitlint/config-conventional": "17.4.4",
"@semantic-release/changelog": "6.0.2",
Expand All @@ -123,8 +123,8 @@
"@types/node": "17.0.36",
"@types/node-schedule": "2.1.0",
"@types/nodemailer": "6.4.7",
"@types/react": "18.0.28",
"@types/react-dom": "18.0.11",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@types/react-transition-group": "4.4.5",
"@types/secure-random-password": "0.2.1",
"@types/semver": "7.3.13",
Expand All @@ -136,23 +136,20 @@
"@typescript-eslint/eslint-plugin": "5.54.0",
"@typescript-eslint/parser": "5.54.0",
"autoprefixer": "10.4.13",
"babel-plugin-react-intl": "8.2.25",
"babel-plugin-react-intl-auto": "3.3.0",
"commitizen": "4.3.0",
"copyfiles": "2.4.1",
"cy-mobile-commands": "0.3.0",
"cypress": "12.7.0",
"cz-conventional-changelog": "3.3.0",
"eslint": "8.35.0",
"eslint-config-next": "12.3.4",
"eslint-config-next": "^14.2.4",
"eslint-config-prettier": "8.6.0",
"eslint-plugin-formatjs": "4.9.0",
"eslint-plugin-jsx-a11y": "6.7.1",
"eslint-plugin-no-relative-import-paths": "1.5.2",
"eslint-plugin-prettier": "4.2.1",
"eslint-plugin-react": "7.32.2",
"eslint-plugin-react-hooks": "4.6.0",
"extract-react-intl-messages": "4.1.1",
"husky": "8.0.3",
"lint-staged": "13.1.2",
"nodemon": "2.0.20",
Expand All @@ -170,8 +167,6 @@
},
"resolutions": {
"sqlite3/node-gyp": "8.4.1",
"@types/react": "18.0.28",
"@types/react-dom": "18.0.11",
"@types/express-session": "1.17.6"
},
"config": {
Expand Down
2 changes: 1 addition & 1 deletion server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ app
try {
const descriptor = Object.getOwnPropertyDescriptor(req, 'ip');
if (descriptor?.writable === true) {
req.ip = getClientIp(req) ?? '';
(req as any).ip = getClientIp(req) ?? '';
}
} catch (e) {
logger.error('Failed to attach the ip to the request', {
Expand Down
1 change: 1 addition & 0 deletions server/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"module": "commonjs",
"outDir": "../dist",
"noEmit": false,
"incremental": true,
"baseUrl": ".",
"paths": {
"@server/*": ["*"]
Expand Down
5 changes: 3 additions & 2 deletions src/components/AirDateBadge/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import Badge from '@app/components/Common/Badge';
import { defineMessages, FormattedRelativeTime, useIntl } from 'react-intl';
import defineMessages from '@app/utils/defineMessages';
import { FormattedRelativeTime, useIntl } from 'react-intl';

const messages = defineMessages({
const messages = defineMessages('components.AirDateBadge', {
airedrelative: 'Aired {relativeTime}',
airsrelative: 'Airing {relativeTime}',
});
Expand Down
5 changes: 3 additions & 2 deletions src/components/AppDataWarning/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import Alert from '@app/components/Common/Alert';
import { defineMessages, useIntl } from 'react-intl';
import defineMessages from '@app/utils/defineMessages';
import { useIntl } from 'react-intl';
import useSWR from 'swr';

const messages = defineMessages({
const messages = defineMessages('components.AppDataWarning', {
dockerVolumeMissingDescription:
'The <code>{appDataPath}</code> volume mount was not configured properly. All data will be cleared when the container is stopped or restarted.',
});
Expand Down
17 changes: 9 additions & 8 deletions src/components/CollectionDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import useSettings from '@app/hooks/useSettings';
import { Permission, useUser } from '@app/hooks/useUser';
import globalMessages from '@app/i18n/globalMessages';
import Error from '@app/pages/_error';
import defineMessages from '@app/utils/defineMessages';
import { refreshIntervalHelper } from '@app/utils/refreshIntervalHelper';
import { ArrowDownTrayIcon } from '@heroicons/react/24/outline';
import { MediaStatus } from '@server/constants/media';
Expand All @@ -18,10 +19,10 @@ import { uniq } from 'lodash';
import Link from 'next/link';
import { useRouter } from 'next/router';
import { useMemo, useState } from 'react';
import { defineMessages, useIntl } from 'react-intl';
import { useIntl } from 'react-intl';
import useSWR from 'swr';

const messages = defineMessages({
const messages = defineMessages('components.CollectionDetails', {
overview: 'Overview',
numberofmovies: '{count} Movies',
requestcollection: 'Request Collection',
Expand Down Expand Up @@ -166,10 +167,9 @@ const CollectionDetails = ({ collection }: CollectionDetailsProps) => {
<Link
href={`/discover/movies/genre/${genreId}`}
key={`genre-${genreId}`}
className="hover:underline"
>
<a className="hover:underline">
{genres.find((g) => g.id === genreId)?.name}
</a>
{genres.find((g) => g.id === genreId)?.name}
</Link>
))
.reduce((prev, curr) => (
Expand All @@ -195,8 +195,8 @@ const CollectionDetails = ({ collection }: CollectionDetailsProps) => {
<CachedImage
alt=""
src={`https://image.tmdb.org/t/p/w1920_and_h800_multi_faces/${data.backdropPath}`}
layout="fill"
objectFit="cover"
style={{ width: '100%', height: '100%', objectFit: 'cover' }}
fill
priority
/>
<div
Expand Down Expand Up @@ -229,7 +229,8 @@ const CollectionDetails = ({ collection }: CollectionDetailsProps) => {
: '/images/overseerr_poster_not_found.png'
}
alt=""
layout="responsive"
sizes="100vw"
style={{ width: '100%', height: 'auto' }}
width={600}
height={900}
priority
Expand Down
1 change: 0 additions & 1 deletion src/components/Common/Accordion/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import type * as React from 'react';
import { useState } from 'react';
import AnimateHeight from 'react-animate-height';

Expand Down
13 changes: 6 additions & 7 deletions src/components/Common/Badge/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,12 @@ const Badge = (
);
} else if (href) {
return (
<Link href={href}>
<a
className={badgeStyle.join(' ')}
ref={ref as React.Ref<HTMLAnchorElement>}
>
{children}
</a>
<Link
href={href}
className={badgeStyle.join(' ')}
ref={ref as React.Ref<HTMLAnchorElement>}
>
{children}
</Link>
);
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/components/Common/ImageFader/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ const ImageFader: ForwardRefRenderFunction<HTMLDivElement, ImageFaderProps> = (
className="absolute inset-0 h-full w-full"
alt=""
src={imageUrl}
layout="fill"
objectFit="cover"
style={{ width: '100%', height: '100%', objectFit: 'cover' }}
fill
{...overrides}
/>
<div
Expand Down
4 changes: 2 additions & 2 deletions src/components/Common/Modal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ const Modal = React.forwardRef<HTMLDivElement, ModalProps>(
<CachedImage
alt=""
src={backdrop}
layout="fill"
objectFit="cover"
style={{ width: '100%', height: '100%', objectFit: 'cover' }}
fill
priority
/>
<div
Expand Down
17 changes: 8 additions & 9 deletions src/components/Common/SettingsTabs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,14 @@ const SettingsLink = ({
}

return (
<Link href={route}>
<a
className={`${linkClasses} ${
currentPath.match(regex) ? activeLinkColor : inactiveLinkColor
}`}
aria-current="page"
>
{children}
</a>
<Link
href={route}
className={`${linkClasses} ${
currentPath.match(regex) ? activeLinkColor : inactiveLinkColor
}`}
aria-current="page"
>
{children}
</Link>
);
};
Expand Down
63 changes: 31 additions & 32 deletions src/components/CompanyCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,40 +12,39 @@ const CompanyCard = ({ image, url, name }: CompanyCardProps) => {
const [isHovered, setHovered] = useState(false);

return (
<Link href={url}>
<a
className={`relative flex h-32 w-56 transform-gpu cursor-pointer items-center justify-center p-8 shadow ring-1 transition duration-300 ease-in-out sm:h-36 sm:w-72 ${
isHovered
? 'scale-105 bg-gray-700 ring-gray-500'
: 'scale-100 bg-gray-800 ring-gray-700'
} rounded-xl`}
onMouseEnter={() => {
<Link
href={url}
className={`relative flex h-32 w-56 transform-gpu cursor-pointer items-center justify-center p-8 shadow ring-1 transition duration-300 ease-in-out sm:h-36 sm:w-72 ${
isHovered
? 'scale-105 bg-gray-700 ring-gray-500'
: 'scale-100 bg-gray-800 ring-gray-700'
} rounded-xl`}
onMouseEnter={() => {
setHovered(true);
}}
onMouseLeave={() => setHovered(false)}
onKeyDown={(e) => {
if (e.key === 'Enter') {
setHovered(true);
}}
onMouseLeave={() => setHovered(false)}
onKeyDown={(e) => {
if (e.key === 'Enter') {
setHovered(true);
}
}}
role="link"
tabIndex={0}
>
<div className="relative h-full w-full">
<CachedImage
src={image}
alt={name}
className="relative z-40 h-full w-full"
layout="fill"
objectFit="contain"
/>
</div>
<div
className={`absolute bottom-0 left-0 right-0 z-0 h-12 rounded-b-xl bg-gradient-to-t ${
isHovered ? 'from-gray-800' : 'from-gray-900'
}`}
}
}}
role="link"
tabIndex={0}
>
<div className="relative h-full w-full">
<CachedImage
src={image}
alt={name}
className="relative z-40 h-full w-full"
style={{ width: '100%', height: '100%', objectFit: 'contain' }}
fill
/>
</a>
</div>
<div
className={`absolute bottom-0 left-0 right-0 z-0 h-12 rounded-b-xl bg-gradient-to-t ${
isHovered ? 'from-gray-800' : 'from-gray-900'
}`}
/>
</Link>
);
};
Expand Down
Loading
Loading