From ef08a7b7818181ccab31a5fdaed8c33749a3aeee Mon Sep 17 00:00:00 2001 From: Igor Klepacki Date: Thu, 23 Jan 2025 14:27:03 +0100 Subject: [PATCH] refactor: update next.config to typescript --- next.config.mjs | 26 -------------------------- next.config.ts | 21 +++++++++++++++++++++ package.json | 5 ++--- pnpm-lock.yaml | 18 +++++------------- 4 files changed, 28 insertions(+), 42 deletions(-) delete mode 100644 next.config.mjs create mode 100644 next.config.ts diff --git a/next.config.mjs b/next.config.mjs deleted file mode 100644 index 3d1d976..0000000 --- a/next.config.mjs +++ /dev/null @@ -1,26 +0,0 @@ -import withBundleAnalyzer from "@next/bundle-analyzer" -import withPlugins from "next-compose-plugins" -import { env } from "./env.mjs" - -/** - * @type {import('next').NextConfig} - */ -const config = withPlugins([[withBundleAnalyzer({ enabled: env.ANALYZE })]], { - reactStrictMode: true, - logging: { - fetches: { - fullUrl: true, - }, - }, - experimental: { instrumentationHook: true }, - rewrites() { - return [ - { source: "/healthz", destination: "/api/health" }, - { source: "/api/healthz", destination: "/api/health" }, - { source: "/health", destination: "/api/health" }, - { source: "/ping", destination: "/api/health" }, - ] - }, -}) - -export default config diff --git a/next.config.ts b/next.config.ts new file mode 100644 index 0000000..98ca220 --- /dev/null +++ b/next.config.ts @@ -0,0 +1,21 @@ +import withBundleAnalyzer from "@next/bundle-analyzer" +import { type NextConfig } from "next" + +import { env } from "./env.mjs" + +const config: NextConfig = { + reactStrictMode: true, + logging: { + fetches: { + fullUrl: true, + }, + }, + rewrites: async () => [ + { source: "/healthz", destination: "/api/health" }, + { source: "/api/healthz", destination: "/api/health" }, + { source: "/health", destination: "/api/health" }, + { source: "/ping", destination: "/api/health" }, + ], +} + +export default env.ANALYZE ? withBundleAnalyzer({ enabled: env.ANALYZE })(config) : config diff --git a/package.json b/package.json index e4e4c53..d6e26e2 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "0.0.0", "private": true, "scripts": { - "dev": "cross-env FORCE_COLOR=1 next dev", + "dev": "cross-env FORCE_COLOR=1 next dev --turbo", "build": "next build", "start": "next start", "lint": "next lint", @@ -22,7 +22,7 @@ "coupling-graph": "npx madge --extensions js,jsx,ts,tsx,css,md,mdx ./ --exclude '.next|tailwind.config.js|reset.d.ts|prettier.config.js|postcss.config.js|playwright.config.ts|next.config.js|next-env.d.ts|instrumentation.ts|e2e/|README.md|.storybook/|.eslintrc.js' --image graph.svg" }, "dependencies": { - "@next/bundle-analyzer": "^14.2.3", + "@next/bundle-analyzer": "^15.1.6", "@radix-ui/react-accordion": "^1.1.2", "@radix-ui/react-checkbox": "^1.0.4", "@radix-ui/react-dialog": "^1.0.5", @@ -49,7 +49,6 @@ "class-variance-authority": "^0.7.0", "lodash": "^4.17.21", "next": "15.1.6", - "next-compose-plugins": "^2.2.1", "react": "^19.0.0", "react-dom": "^19.0.0", "tailwind-merge": "^2.3.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4b4fafe..f501d20 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,8 +9,8 @@ importers: .: dependencies: '@next/bundle-analyzer': - specifier: ^14.2.3 - version: 14.2.23 + specifier: ^15.1.6 + version: 15.1.6 '@radix-ui/react-accordion': specifier: ^1.1.2 version: 1.2.2(@types/react-dom@19.0.3(@types/react@19.0.8))(@types/react@19.0.8)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) @@ -89,9 +89,6 @@ importers: next: specifier: 15.1.6 version: 15.1.6(@babel/core@7.26.0)(@opentelemetry/api@1.7.0)(@playwright/test@1.49.1)(babel-plugin-macros@3.1.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) - next-compose-plugins: - specifier: ^2.2.1 - version: 2.2.1 react: specifier: ^19.0.0 version: 19.0.0 @@ -1405,8 +1402,8 @@ packages: '@ndelangen/get-tarball@3.0.9': resolution: {integrity: sha512-9JKTEik4vq+yGosHYhZ1tiH/3WpUS0Nh0kej4Agndhox8pAdWhEx5knFVRcb/ya9knCRCs1rPxNrSXTDdfVqpA==} - '@next/bundle-analyzer@14.2.23': - resolution: {integrity: sha512-BZJTrSZY1kemDMl8hOEu5Vj7Oy5rCa5ZPJ/bSAFPoaOQS21YVwX4xbZCEteCKu6FiXnTwnprxbGgEOmyhH0aoA==} + '@next/bundle-analyzer@15.1.6': + resolution: {integrity: sha512-hGzQyDqJzFHcHNCyTqM3o05BpVq5tGnRODccZBVJDBf5Miv/26UJPMB0wh9L9j3ylgHC+0/v8BaBnBBek1rC6Q==} '@next/env@15.1.6': resolution: {integrity: sha512-d9AFQVPEYNr+aqokIiPLNK/MTyt3DWa/dpKveiAaVccUadFbhFEvY6FXYX2LJO2Hv7PHnLBu2oWwB4uBuHjr/w==} @@ -6523,9 +6520,6 @@ packages: nerf-dart@1.0.0: resolution: {integrity: sha512-EZSPZB70jiVsivaBLYDCyntd5eH8NTSMOn3rB+HxwdmKThGELLdYv8qVIMWvZEFy9w8ZZpW9h9OB32l1rGtj7g==} - next-compose-plugins@2.2.1: - resolution: {integrity: sha512-OjJ+fV15FXO2uQXQagLD4C0abYErBjyjE0I0FHpOEIB8upw0hg1ldFP6cqHTJBH1cZqy96OeR3u1dJ+Ez2D4Bg==} - next@15.1.6: resolution: {integrity: sha512-Hch4wzbaX0vKQtalpXvUiw5sYivBy4cm5rzUKrBnUB/y436LGrvOUqYvlSeNVCWFO/770gDlltR9gqZH62ct4Q==} engines: {node: ^18.18.0 || ^19.8.0 || >= 20.0.0} @@ -10162,7 +10156,7 @@ snapshots: pump: 3.0.2 tar-fs: 2.1.2 - '@next/bundle-analyzer@14.2.23': + '@next/bundle-analyzer@15.1.6': dependencies: webpack-bundle-analyzer: 4.10.1 transitivePeerDependencies: @@ -16667,8 +16661,6 @@ snapshots: nerf-dart@1.0.0: {} - next-compose-plugins@2.2.1: {} - next@15.1.6(@babel/core@7.26.0)(@opentelemetry/api@1.7.0)(@playwright/test@1.49.1)(babel-plugin-macros@3.1.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0): dependencies: '@next/env': 15.1.6