virastack 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "virastack",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Scaffold new projects and add tools from the ViraStack ecosystem with a single command.",
5
5
  "author": {
6
6
  "name": "Ömer Gülçiçek (ViraStack)",
@@ -8,7 +8,7 @@ const withBundleAnalyzer = createBundleAnalyzer({
8
8
  });
9
9
 
10
10
  const nextConfig: NextConfig = {
11
- reactCompiler: true,
11
+ reactCompiler: process.env.NODE_ENV === "production",
12
12
  turbopack: {
13
13
  root: path.join(import.meta.dirname),
14
14
  },
@@ -11,7 +11,7 @@ const withBundleAnalyzer = createBundleAnalyzer({
11
11
  });
12
12
 
13
13
  const nextConfig: NextConfig = {
14
- reactCompiler: true,
14
+ reactCompiler: process.env.NODE_ENV === "production",
15
15
  turbopack: {
16
16
  root: path.join(import.meta.dirname),
17
17
  },
@@ -0,0 +1,5 @@
1
+ import { notFound } from "next/navigation";
2
+
3
+ export default function CatchAllPage() {
4
+ notFound();
5
+ }
@@ -2,8 +2,8 @@ import type { Metadata } from "next";
2
2
  import { Inter } from "next/font/google";
3
3
  import { notFound } from "next/navigation";
4
4
 
5
- import { NextIntlClientProvider } from "next-intl";
6
- import { getMessages, setRequestLocale } from "next-intl/server";
5
+ import { hasLocale, NextIntlClientProvider } from "next-intl";
6
+ import { setRequestLocale } from "next-intl/server";
7
7
  import { NuqsAdapter } from "nuqs/adapters/next/app";
8
8
 
9
9
  import { defaultMetadata } from "@/config/seo.config";
@@ -24,6 +24,10 @@ const inter = Inter({
24
24
 
25
25
  export const metadata: Metadata = defaultMetadata;
26
26
 
27
+ export function generateStaticParams() {
28
+ return routing.locales.map((locale) => ({ locale }));
29
+ }
30
+
27
31
  export default async function RootLayout({
28
32
  children,
29
33
  params,
@@ -33,14 +37,12 @@ export default async function RootLayout({
33
37
  }>) {
34
38
  const { locale } = await params;
35
39
 
36
- if (!routing.locales.includes(locale as "en" | "tr")) {
40
+ if (!hasLocale(routing.locales, locale)) {
37
41
  notFound();
38
42
  }
39
43
 
40
44
  setRequestLocale(locale);
41
45
 
42
- const messages = await getMessages();
43
-
44
46
  return (
45
47
  <html
46
48
  lang={locale}
@@ -49,7 +51,7 @@ export default async function RootLayout({
49
51
  data-scroll-behavior="smooth"
50
52
  >
51
53
  <body className="flex min-h-full flex-col antialiased" suppressHydrationWarning>
52
- <NextIntlClientProvider messages={messages}>
54
+ <NextIntlClientProvider>
53
55
  <NuqsAdapter>
54
56
  <Providers>{children}</Providers>
55
57
  </NuqsAdapter>
@@ -0,0 +1,6 @@
1
+ import type { ReactNode } from "react";
2
+
3
+ // Required by Next.js when `app/not-found.tsx` exists.
4
+ export default function RootLayout({ children }: { children: ReactNode }) {
5
+ return children;
6
+ }
@@ -0,0 +1,13 @@
1
+ "use client";
2
+
3
+ import Error from "next/error";
4
+
5
+ export default function GlobalNotFound() {
6
+ return (
7
+ <html lang="en">
8
+ <body>
9
+ <Error statusCode={404} />
10
+ </body>
11
+ </html>
12
+ );
13
+ }
@@ -1,13 +1,11 @@
1
+ import { hasLocale } from "next-intl";
1
2
  import { getRequestConfig } from "next-intl/server";
2
3
 
3
4
  import { routing } from "./routing";
4
5
 
5
6
  export default getRequestConfig(async ({ requestLocale }) => {
6
- let locale = await requestLocale;
7
-
8
- if (!locale || !routing.locales.includes(locale as "en" | "tr")) {
9
- locale = routing.defaultLocale;
10
- }
7
+ const requested = await requestLocale;
8
+ const locale = hasLocale(routing.locales, requested) ? requested : routing.defaultLocale;
11
9
 
12
10
  return {
13
11
  locale,
@@ -1,16 +1,9 @@
1
- import type { NextRequest } from "next/server";
2
-
3
1
  import createMiddleware from "next-intl/middleware";
4
2
 
5
3
  import { routing } from "./i18n/routing";
6
4
 
7
- const handleI18nRouting = createMiddleware(routing);
8
-
9
- export default async function proxy(request: NextRequest) {
10
- return handleI18nRouting(request);
11
- }
5
+ export default createMiddleware(routing);
12
6
 
13
7
  export const config = {
14
- // Match all pathnames except for api, trpc, _next, _vercel, and static files
15
8
  matcher: "/((?!api|trpc|_next|_vercel|.*\\..*).*)",
16
9
  };