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

feat: update dependencies of nextjs to 15, payload to 3.0, move paylo… #150

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
77 changes: 0 additions & 77 deletions webapp/next.config.js

This file was deleted.

85 changes: 85 additions & 0 deletions webapp/next.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
// next.config.js
// import {
// PHASE_DEVELOPMENT_SERVER,
// PHASE_PRODUCTION_BUILD,
// } from "next/constants";
import { withPayload } from "@payloadcms/next/withPayload";
import { withSentryConfig } from "@sentry/nextjs";
import path from "path";
import { fileURLToPath } from "url";
// import { version } from "./package.json";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

/** @type {import('next').NextConfig} */
const nextOptions = {
reactStrictMode: true,
images: {
remotePatterns: [
{
protocol: "https",
hostname:
`https://${process.env.S3_BUCKET_NAME || ""}.${(process.env.S3_ENDPOINT || "https://s3.endpoint.loc").replace("https://", "")}`.replace(
/^(https?:\/\/)/,
""
),
port: "",
pathname: `/**`,
},
],
minimumCacheTTL: 604800,
},
experimental: {
reactCompiler: false,
},
env: {
NEXT_PUBLIC_CURRENT_PACKAGE_VERSION: "0.0.0",
},
transpilePackages: ["@choc-ui/chakra-autocomplete", "react-image-crop"],
};

const sentryWebpackPluginOptions = {
silent: false,
org: "incubateur",
project: "carte-jeune-engage",
url: "https://sentry.fabrique.social.gouv.fr/",
};

const sentryOptions = {
widenClientFileUpload: true,
transpileClientSDK: true,
tunnelRoute: "/monitoring",
hideSourceMaps: true,
disableLogger: true,
automaticVercelMonitors: true,
};

const payloadOptions = {
configPath: path.resolve(__dirname, "./src/payload/payload.config.ts"),
payloadPath: path.resolve(process.cwd(), "./src/payload/payloadClient.ts"),
adminRoute: "/admin",
};

// module.exports = async () => {
// if (
// process.env.NODE_ENV === "development" ||
// process.env.NODE_ENV === "production"
// ) {
// const withSerwist = (await import("@serwist/next")).default({
// swSrc: "worker/index.ts",
// swDest: "public/sw.js",
// });

// return withPayload(
// withSerwist(
// withSentryConfig(nextOptions, sentryWebpackPluginOptions, sentryOptions)
// ),
// payloadOptions
// );
// }

// return
// };

export default withPayload(nextOptions, payloadOptions);
37 changes: 23 additions & 14 deletions webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
"name": "webapp",
"version": "0.70.3",
"private": true,
"type": "module",
"scripts": {
"dev": "next dev",
"dev": "next dev --turbo",
"build": "next build",
"start": "next start",
"seed:dev": "PAYLOAD_DROP_DATABASE=true tsx ./src/payload/seed/index.ts",
"seed:prod": "tsx ./src/payload/seed/index.ts",
"cron-job": "tsx ./src/notifications/index.ts",
"payload": "PAYLOAD_CONFIG_PATH=./src/payload/payload.config.ts payload",
"payload": "cross-env PAYLOAD_CONFIG_PATH=./src/payload/payload.config.ts payload",
"format": "prettier --write .",
"lint": "next lint"
},
Expand All @@ -25,11 +26,13 @@
"@emotion/styled": "^11.11.0",
"@gsap/react": "^2.1.0",
"@hookform/resolvers": "^3.9.1",
"@payloadcms/bundler-webpack": "^1.0.5",
"@payloadcms/db-postgres": "^0.7.0",
"@payloadcms/next-payload": "^0.1.11",
"@payloadcms/plugin-cloud-storage": "^1.1.1",
"@payloadcms/richtext-slate": "^1.3.1",
"@payloadcms/db-postgres": "^3.0.1",
"@payloadcms/email-nodemailer": "^3.0.1",
"@payloadcms/next": "^3.0.1",
"@payloadcms/plugin-cloud-storage": "^3.0.1",
"@payloadcms/richtext-slate": "^3.0.1",
"@payloadcms/storage-s3": "^3.0.1",
"@payloadcms/ui": "^3.0.1",
"@sentry/nextjs": "^7.100.1",
"@serwist/next": "^9.0.2",
"@socialgouv/matomo-next": "^1.8.0",
Expand All @@ -43,23 +46,25 @@
"bowser": "^2.11.0",
"cookies-next": "^4.1.0",
"crisp-sdk-web": "^1.0.21",
"cross-env": "^7.0.3",
"dotenv": "^16.3.1",
"framer-motion": "^11.0.0",
"graphql": "^16.9.0",
"gsap": "^3.12.5",
"ignore-styles": "^5.0.1",
"js-cookie": "^3.0.5",
"jsonwebtoken": "^9.0.2",
"jwt-decode": "^4.0.0",
"matter-js": "^0.20.0",
"next": "13.5.6",
"next": "^15.0.3",
"papaparse": "^5.4.1",
"payload": "^2.10.0",
"payload": "^3.0.1",
"pdf-lib": "^1.17.1",
"react": "^18",
"react": "19.0.0-rc-65a56d0e-20241020",
"react-barcode": "^1.4.6",
"react-csv-downloader": "^3.1.0",
"react-dom": "^18",
"react-easy-crop": "^5.0.5",
"react-dom": "19.0.0-rc-65a56d0e-20241020",
"react-easy-crop": "^5.1.0",
"react-hook-form": "^7.50.1",
"react-icons": "^5.0.0",
"react-otp-input": "^3.1.1",
Expand All @@ -79,13 +84,17 @@
"@types/matter-js": "^0.19.7",
"@types/node": "^20",
"@types/papaparse": "^5",
"@types/react": "^18",
"@types/react-dom": "^18",
"@types/react": "npm:[email protected]",
"@types/react-dom": "npm:[email protected]",
"@types/web-push": "^3",
"prettier": "^3.1.1",
"serwist": "^9.0.2",
"typescript": "5.4.5",
"webpack": "^5.89.0"
},
"overrides": {
"@types/react": "npm:[email protected]",
"@types/react-dom": "npm:[email protected]"
},
"packageManager": "[email protected]"
}
27 changes: 27 additions & 0 deletions webapp/src/app/(payload)/admin/[[...segments]]/not-found.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */
import type { Metadata } from "next";

import config from "@payload-config";
import { NotFoundPage, generatePageMetadata } from "@payloadcms/next/views";
import { importMap } from "../importMap";

type Args = {
params: Promise<{
segments: string[];
}>;
searchParams: Promise<{
[key: string]: string | string[];
}>;
};

export const generateMetadata = ({
params,
searchParams,
}: Args): Promise<Metadata> =>
generatePageMetadata({ config, params, searchParams });

const NotFound = ({ params, searchParams }: Args) =>
NotFoundPage({ config, params, searchParams, importMap });

export default NotFound;
27 changes: 27 additions & 0 deletions webapp/src/app/(payload)/admin/[[...segments]]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */
import type { Metadata } from "next";

import config from "@payload-config";
import { RootPage, generatePageMetadata } from "@payloadcms/next/views";
import { importMap } from "../importMap";

type Args = {
params: Promise<{
segments: string[];
}>;
searchParams: Promise<{
[key: string]: string | string[];
}>;
};

export const generateMetadata = ({
params,
searchParams,
}: Args): Promise<Metadata> =>
generatePageMetadata({ config, params, searchParams });

const Page = ({ params, searchParams }: Args) =>
RootPage({ config, params, searchParams, importMap });

export default Page;
9 changes: 9 additions & 0 deletions webapp/src/app/(payload)/admin/importMap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { CustomSelectKind as CustomSelectKind_9dcf769af922a51107998c78ff4db18a } from '~/payload/components/CustomSelectKind'
import { OfferRowLabel as OfferRowLabel_96c0a6bbcec834bdb17d8993615131f7 } from '~/payload/components/RowLabels'
import { OrderRowLabel as OrderRowLabel_96c0a6bbcec834bdb17d8993615131f7 } from '~/payload/components/RowLabels'

export const importMap = {
"~/payload/components/CustomSelectKind#CustomSelectKind": CustomSelectKind_9dcf769af922a51107998c78ff4db18a,
"~/payload/components/RowLabels#OfferRowLabel": OfferRowLabel_96c0a6bbcec834bdb17d8993615131f7,
"~/payload/components/RowLabels#OrderRowLabel": OrderRowLabel_96c0a6bbcec834bdb17d8993615131f7
}
19 changes: 19 additions & 0 deletions webapp/src/app/(payload)/api/[...slug]/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */
import config from "@payload-config";
import "@payloadcms/next/css";
import {
REST_DELETE,
REST_GET,
REST_OPTIONS,
REST_PATCH,
REST_POST,
REST_PUT,
} from "@payloadcms/next/routes";

export const GET = REST_GET(config);
export const POST = REST_POST(config);
export const DELETE = REST_DELETE(config);
export const PATCH = REST_PATCH(config);
export const PUT = REST_PUT(config);
export const OPTIONS = REST_OPTIONS(config);
34 changes: 34 additions & 0 deletions webapp/src/app/(payload)/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */
import config from "@payload-config";
import "@payloadcms/next/css";
import type { ServerFunctionClient } from "payload";
import { handleServerFunctions, RootLayout } from "@payloadcms/next/layouts";
import React from "react";

import { importMap } from "./admin/importMap.js";

type Args = {
children: React.ReactNode;
};

const serverFunction: ServerFunctionClient = async function (args) {
"use server";
return handleServerFunctions({
...args,
config,
importMap,
});
};

const Layout = ({ children }: Args) => (
<RootLayout
config={config}
importMap={importMap}
serverFunction={serverFunction}
>
{children}
</RootLayout>
);

export default Layout;
4 changes: 2 additions & 2 deletions webapp/src/components/account/PassCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,10 @@ const PassCard = ({ offer }: PropsPassCard) => {
</Flex>
</Flex>
</Flex>
<NewPassComponent
{/* <NewPassComponent
isOpen={isOpenNewPassComponent}
onClose={onCloseNewPassComponent}
/>
/> */}
</>
);
};
Expand Down
Loading
Loading