Skip to content

Commit

Permalink
easy
Browse files Browse the repository at this point in the history
  • Loading branch information
0-don committed May 19, 2024
1 parent 4f285b7 commit f65b78d
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 32 deletions.
2 changes: 1 addition & 1 deletion web/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "next/core-web-vitals",
"extends": ["next/core-web-vitals"],
"overrides": [
{
"files": ["**/*.tsx"],
Expand Down
16 changes: 16 additions & 0 deletions web/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const { loadEnvConfig } = require("@next/env");
const withNextIntl = require("next-intl/plugin")();

loadEnvConfig(process.cwd());

/** @type {import('next').NextConfig} */
const config = {
poweredByHeader: false,
logging: {
fetches: {
fullUrl: process.env.NODE_ENV === "production",
},
},
};

module.exports = withNextIntl({ ...config });
10 changes: 0 additions & 10 deletions web/next.config.mjs

This file was deleted.

6 changes: 6 additions & 0 deletions web/postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
8 changes: 0 additions & 8 deletions web/postcss.config.mjs

This file was deleted.

5 changes: 0 additions & 5 deletions web/src/app/page.tsx

This file was deleted.

2 changes: 0 additions & 2 deletions web/src/locales.ts

This file was deleted.

16 changes: 12 additions & 4 deletions web/src/middleware.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
import createIntlMiddleware from "next-intl/middleware";
import type { NextRequest } from "next/server";
import { LOCALES } from "./locales";
import { NextRequest } from "next/server";

export const LOCALES = ["de", "en"] as const;
export const X_URL = "x-url";

export default async function middleware(request: NextRequest) {
// Step 2: Create and call the next-intl middleware (example)
const handleI18nRouting = createIntlMiddleware({
locales: LOCALES,
defaultLocale: "de",
localePrefix: "never",
defaultLocale: LOCALES[0],
localeDetection: true,
});
const response = handleI18nRouting(request);

response.headers.set("x-url", request.url);
response.headers.set(X_URL, request.url);

return response;
}

export const config = {
matcher: ["/((?!api|_next|_vercel|.*\\..*).*)"],
};
2 changes: 1 addition & 1 deletion web/src/navigation.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createSharedPathnamesNavigation } from "next-intl/navigation";
import { LOCALES } from "./locales";
import { LOCALES } from "./middleware";

export const { Link, redirect, usePathname, useRouter } =
createSharedPathnamesNavigation({ locales: LOCALES });
8 changes: 7 additions & 1 deletion web/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"moduleResolution": "Node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"plugins": [
{
"name": "next"
},
{
"name": "@0no-co/graphqlsp",
"schema": "./schema.graphql",
"tadaOutputLocation": "src/graphql-env.d.ts"
}
],
"paths": {
Expand Down

0 comments on commit f65b78d

Please sign in to comment.