diff --git a/apps/cms/package.json b/apps/cms/package.json index 166d0680..048efd67 100644 --- a/apps/cms/package.json +++ b/apps/cms/package.json @@ -29,7 +29,6 @@ "dotenv": "^16.4.7", "express": "^4.21.2", "form-data": "^4.0.1", - "lodash": "^4.17.21", "mailgun.js": "^10.2.4", "nanoid": "^3.3.8", "papaparse": "^5.4.1", @@ -43,7 +42,6 @@ "@tietokilta/ui": "workspace:*", "@types/express": "^4.17.21", "@types/express-fileupload": "^1.5.1", - "@types/lodash": "^4.17.13", "@types/papaparse": "^5.3.15", "@types/react": "catalog:", "copyfiles": "^2.4.1", diff --git a/apps/web/package.json b/apps/web/package.json index adeb42ac..dec1a0cc 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -17,7 +17,6 @@ "autoprefixer": "catalog:", "clsx": "catalog:", "date-fns": "^4.1.0", - "lodash": "^4.17.21", "next": "^14.2.20", "next-international": "^1.3.1", "nextjs-toploader": "^3.7.15", @@ -30,6 +29,7 @@ "react-markdown": "^9.0.1", "remark": "^15.0.1", "remark-gfm": "^4.0.0", + "remeda": "^2.19.0", "server-only": "^0.0.1", "sharp": "^0.33.5", "strip-markdown": "^6.0.0", @@ -46,7 +46,6 @@ "@tietokilta/cms-types": "workspace:*", "@tietokilta/config-typescript": "workspace:*", "@tietokilta/eslint-config": "workspace:*", - "@types/lodash": "^4.17.13", "@types/mdast": "^4.0.4", "@types/node": "catalog:", "@types/qs": "^6.9.17", diff --git a/apps/web/src/components/events-display/index.tsx b/apps/web/src/components/events-display/index.tsx index 280e699d..58786531 100644 --- a/apps/web/src/components/events-display/index.tsx +++ b/apps/web/src/components/events-display/index.tsx @@ -1,7 +1,7 @@ import { Button, ClockIcon, MapPinIcon } from "@tietokilta/ui"; import Link from "next/link"; import { Suspense } from "react"; -import _ from "lodash"; +import { chunk } from "remeda"; import { notFound } from "next/navigation"; import { Pagination, @@ -112,7 +112,7 @@ async function EventList({ currentPage = 1 }: { currentPage?: number }) { return null; } - const paginatedEvents = _.chunk(eventsList, 5); + const paginatedEvents = chunk(eventsList, 5); const pageCount = paginatedEvents.length; if (pageCount !== 0 && (currentPage < 1 || currentPage > pageCount)) { diff --git a/apps/web/src/components/hero/index.tsx b/apps/web/src/components/hero/index.tsx index c091391f..3c3ef6ae 100644 --- a/apps/web/src/components/hero/index.tsx +++ b/apps/web/src/components/hero/index.tsx @@ -3,7 +3,7 @@ import Image from "next/image"; import { useEffect, useState } from "react"; import { useScramble } from "use-scramble"; -import _ from "lodash"; +import { shuffle } from "remeda"; import { cn } from "../../lib/utils"; export interface ImageWithPhotographer { @@ -86,7 +86,7 @@ export function Hero({ }); useEffect(() => { - const shuffledTexts = _.shuffle(texts); + const shuffledTexts = shuffle(texts); setCurrentText(shuffledTexts[0]); const interval = setInterval(() => { diff --git a/apps/web/src/components/honors-list/index.tsx b/apps/web/src/components/honors-list/index.tsx index 2ddbf7c6..ed8b3f72 100644 --- a/apps/web/src/components/honors-list/index.tsx +++ b/apps/web/src/components/honors-list/index.tsx @@ -1,7 +1,7 @@ import type { AwardedHonor, Honor } from "@tietokilta/cms-types/payload"; import { ChevronDownIcon } from "@tietokilta/ui"; -import _ from "lodash"; import type { JSX } from "react"; +import { unique } from "remeda"; import { cn } from "../../lib/utils"; function AwardedPersonDropdown({ @@ -58,11 +58,11 @@ export function HonorsList({ honor }: { honor: Honor }): JSX.Element { const awardedPersons = honor.awardedHonors.map( (item) => item.awardedHonor as AwardedHonor, ); - const awardsByYear = _.groupBy( + const awardsByYear = Object.groupBy( awardedPersons, (awardedPerson) => awardedPerson.guildYear, ); - const years = _.uniq( + const years = unique( awardedPersons.map((awardedPerson) => awardedPerson.guildYear), ).sort((a, b) => Number(b) - Number(a)); @@ -71,7 +71,7 @@ export function HonorsList({ honor }: { honor: Honor }): JSX.Element { {Object.entries(years).map((awardYear) => ( ))} diff --git a/apps/web/src/components/magazine-list/index.tsx b/apps/web/src/components/magazine-list/index.tsx index 39669682..a46fe9f0 100644 --- a/apps/web/src/components/magazine-list/index.tsx +++ b/apps/web/src/components/magazine-list/index.tsx @@ -4,8 +4,8 @@ import type { MagazineIssue, Media, } from "@tietokilta/cms-types/payload"; -import _ from "lodash"; import Image from "next/image"; +import { unique } from "remeda"; import TikLogo from "../../assets/TiK-logo.png"; function IssueCard({ issue }: { issue: MagazineIssue }) { @@ -33,12 +33,12 @@ export function MagazineList({ }): React.ReactNode { if (magazine.type !== "Alkorytmi" || !magazine.issues) return null; - const issuesByYear = _.groupBy( + const issuesByYear = Object.groupBy( magazine.issues, (issue) => (issue.issue as MagazineIssue).year, ); - const years = _.uniq( + const years = unique( magazine.issues.map((issue) => (issue.issue as MagazineIssue).year), ).sort((a, b) => Number(b) - Number(a)); @@ -59,7 +59,7 @@ export function MagazineList({
{issuesByYear[year] - .sort( + ?.sort( (a, b) => Number((a.issue as MagazineIssue).issueNumber) - Number((b.issue as MagazineIssue).issueNumber), diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4ef5d3b7..d19faa77 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -114,9 +114,6 @@ importers: form-data: specifier: ^4.0.1 version: 4.0.1 - lodash: - specifier: ^4.17.21 - version: 4.17.21 mailgun.js: specifier: ^10.2.4 version: 10.2.4 @@ -151,9 +148,6 @@ importers: '@types/express-fileupload': specifier: ^1.5.1 version: 1.5.1 - '@types/lodash': - specifier: ^4.17.13 - version: 4.17.13 '@types/papaparse': specifier: ^5.3.15 version: 5.3.15 @@ -202,9 +196,6 @@ importers: date-fns: specifier: ^4.1.0 version: 4.1.0 - lodash: - specifier: ^4.17.21 - version: 4.17.21 next: specifier: ^14.2.20 version: 14.2.20(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.79.3) @@ -241,6 +232,9 @@ importers: remark-gfm: specifier: ^4.0.0 version: 4.0.0 + remeda: + specifier: ^2.19.0 + version: 2.19.0 server-only: specifier: ^0.0.1 version: 0.0.1 @@ -284,9 +278,6 @@ importers: '@tietokilta/eslint-config': specifier: workspace:* version: link:../../packages/config-eslint - '@types/lodash': - specifier: ^4.17.13 - version: 4.17.13 '@types/mdast': specifier: ^4.0.4 version: 4.0.4 @@ -7286,6 +7277,9 @@ packages: remark@15.0.1: resolution: {integrity: sha512-Eht5w30ruCXgFmxVUSlNWQ9iiimq07URKeFS3hNc8cUWy1llX4KDWfyEDZRycMc+znsN9Ux5/tJ/BFdgdOwA3A==} + remeda@2.19.0: + resolution: {integrity: sha512-B/2+zHNPXu0BAopJU8ZrqMjA0u56M/l6BUxDq8AcU+3LWlOYVuf98I6qpYrB5BeeEICunpmXPcQl2ReGXkiQyw==} + renderkid@3.0.0: resolution: {integrity: sha512-q/7VIQA8lmM1hF+jn+sFSPWGlMkSAeNYcPLmDQx2zzuiDfaLrOmumR8iaUKlenFgh0XRPIUeSPlH3A+AW3Z5pg==} @@ -8033,6 +8027,10 @@ packages: resolution: {integrity: sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==} engines: {node: '>=8'} + type-fest@4.31.0: + resolution: {integrity: sha512-yCxltHW07Nkhv/1F6wWBr8kz+5BGMfP+RbRSYFnegVb0qV/UMT0G0ElBloPVerqn4M2ZV80Ir1FtCcYv1cT6vQ==} + engines: {node: '>=16'} + type-is@1.6.18: resolution: {integrity: sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==} engines: {node: '>= 0.6'} @@ -16512,6 +16510,10 @@ snapshots: transitivePeerDependencies: - supports-color + remeda@2.19.0: + dependencies: + type-fest: 4.31.0 + renderkid@3.0.0: dependencies: css-select: 4.3.0 @@ -17377,6 +17379,8 @@ snapshots: type-fest@0.8.1: {} + type-fest@4.31.0: {} + type-is@1.6.18: dependencies: media-typer: 0.3.0