create-nextblock 0.2.30 → 0.2.31
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,18 +1,18 @@
|
|
|
1
1
|
// app/[slug]/page.tsx
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { getSsgSupabaseClient } from "@nextblock-cms/db/server";
|
|
4
|
-
import { notFound } from "next/navigation";
|
|
5
|
-
import type { Metadata } from 'next';
|
|
4
|
+
import { notFound } from "next/navigation";
|
|
5
|
+
import type { Metadata } from 'next';
|
|
6
6
|
import PageClientContent from "./PageClientContent";
|
|
7
|
-
import { getPageDataBySlug } from "./page.utils";
|
|
8
|
-
import BlockRenderer from "../../components/BlockRenderer";
|
|
9
|
-
import type { HeroBlockContent } from '../../lib/blocks/blockRegistry';
|
|
10
|
-
import { cookies, headers } from "next/headers";
|
|
7
|
+
import { getPageDataBySlug } from "./page.utils";
|
|
8
|
+
import BlockRenderer from "../../components/BlockRenderer";
|
|
9
|
+
import type { HeroBlockContent } from '../../lib/blocks/blockRegistry';
|
|
10
|
+
import { cookies, headers } from "next/headers";
|
|
11
11
|
|
|
12
|
-
export const dynamicParams = true;
|
|
13
|
-
export const revalidate = 360;
|
|
14
|
-
export const dynamic = 'force-dynamic'; // keeps per-request locale; paired with short revalidate
|
|
15
|
-
export const fetchCache = 'force-no-store';
|
|
12
|
+
export const dynamicParams = true;
|
|
13
|
+
export const revalidate = 360;
|
|
14
|
+
export const dynamic = 'force-dynamic'; // keeps per-request locale; paired with short revalidate
|
|
15
|
+
export const fetchCache = 'force-no-store';
|
|
16
16
|
|
|
17
17
|
interface ResolvedPageParams {
|
|
18
18
|
slug: string;
|
|
@@ -40,30 +40,30 @@ export async function generateStaticParams(): Promise<ResolvedPageParams[]> {
|
|
|
40
40
|
console.error("SSG: Error fetching page slugs for static params:", error);
|
|
41
41
|
return [];
|
|
42
42
|
}
|
|
43
|
-
return pages.map((page) => ({ slug: page.slug }));
|
|
43
|
+
return pages.map((page: { slug: string }) => ({ slug: page.slug }));
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
export async function generateMetadata(
|
|
47
|
-
{ params: paramsPromise }: PageProps,
|
|
48
|
-
): Promise<Metadata> {
|
|
49
|
-
const params = await paramsPromise;
|
|
50
|
-
let preferredLocale: string | undefined;
|
|
51
|
-
try {
|
|
52
|
-
const store = await cookies();
|
|
53
|
-
preferredLocale = store.get("NEXT_USER_LOCALE")?.value || store.get("NEXT_LOCALE")?.value;
|
|
54
|
-
} catch {
|
|
55
|
-
preferredLocale = undefined;
|
|
56
|
-
}
|
|
57
|
-
if (!preferredLocale) {
|
|
58
|
-
try {
|
|
59
|
-
const hdrs = await headers();
|
|
60
|
-
const al = hdrs.get("accept-language");
|
|
61
|
-
if (al) preferredLocale = al.split(",")[0]?.split("-")[0];
|
|
62
|
-
} catch {
|
|
63
|
-
// ignore header lookup errors
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
const pageData = await getPageDataBySlug(params.slug, preferredLocale);
|
|
46
|
+
export async function generateMetadata(
|
|
47
|
+
{ params: paramsPromise }: PageProps,
|
|
48
|
+
): Promise<Metadata> {
|
|
49
|
+
const params = await paramsPromise;
|
|
50
|
+
let preferredLocale: string | undefined;
|
|
51
|
+
try {
|
|
52
|
+
const store = await cookies();
|
|
53
|
+
preferredLocale = store.get("NEXT_USER_LOCALE")?.value || store.get("NEXT_LOCALE")?.value;
|
|
54
|
+
} catch {
|
|
55
|
+
preferredLocale = undefined;
|
|
56
|
+
}
|
|
57
|
+
if (!preferredLocale) {
|
|
58
|
+
try {
|
|
59
|
+
const hdrs = await headers();
|
|
60
|
+
const al = hdrs.get("accept-language");
|
|
61
|
+
if (al) preferredLocale = al.split(",")[0]?.split("-")[0];
|
|
62
|
+
} catch {
|
|
63
|
+
// ignore header lookup errors
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
const pageData = await getPageDataBySlug(params.slug, preferredLocale);
|
|
67
67
|
|
|
68
68
|
if (!pageData) {
|
|
69
69
|
return { title: "Page Not Found" };
|
|
@@ -87,8 +87,8 @@ export async function generateMetadata(
|
|
|
87
87
|
|
|
88
88
|
const alternates: { [key: string]: string } = {};
|
|
89
89
|
if (languages && pageTranslations) {
|
|
90
|
-
pageTranslations.forEach(pt => {
|
|
91
|
-
const langInfo = languages.find(l => l.id === pt.language_id);
|
|
90
|
+
pageTranslations.forEach((pt: { language_id: string; slug: string }) => {
|
|
91
|
+
const langInfo = languages.find((l: { id: string; code: string }) => l.id === pt.language_id);
|
|
92
92
|
if (langInfo) {
|
|
93
93
|
alternates[langInfo.code] = `${siteUrl}/${pt.slug}`;
|
|
94
94
|
}
|
|
@@ -105,25 +105,25 @@ export async function generateMetadata(
|
|
|
105
105
|
};
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
export default async function DynamicPage({ params: paramsPromise }: PageProps) {
|
|
109
|
-
const params = await paramsPromise;
|
|
110
|
-
let preferredLocale: string | undefined;
|
|
111
|
-
try {
|
|
112
|
-
const store = await cookies();
|
|
113
|
-
preferredLocale = store.get("NEXT_USER_LOCALE")?.value || store.get("NEXT_LOCALE")?.value;
|
|
114
|
-
} catch {
|
|
115
|
-
preferredLocale = undefined;
|
|
116
|
-
}
|
|
117
|
-
if (!preferredLocale) {
|
|
118
|
-
try {
|
|
119
|
-
const hdrs = await headers();
|
|
120
|
-
const al = hdrs.get("accept-language");
|
|
121
|
-
if (al) preferredLocale = al.split(",")[0]?.split("-")[0];
|
|
122
|
-
} catch {
|
|
123
|
-
// ignore header lookup errors
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
const pageData = await getPageDataBySlug(params.slug, preferredLocale);
|
|
108
|
+
export default async function DynamicPage({ params: paramsPromise }: PageProps) {
|
|
109
|
+
const params = await paramsPromise;
|
|
110
|
+
let preferredLocale: string | undefined;
|
|
111
|
+
try {
|
|
112
|
+
const store = await cookies();
|
|
113
|
+
preferredLocale = store.get("NEXT_USER_LOCALE")?.value || store.get("NEXT_LOCALE")?.value;
|
|
114
|
+
} catch {
|
|
115
|
+
preferredLocale = undefined;
|
|
116
|
+
}
|
|
117
|
+
if (!preferredLocale) {
|
|
118
|
+
try {
|
|
119
|
+
const hdrs = await headers();
|
|
120
|
+
const al = hdrs.get("accept-language");
|
|
121
|
+
if (al) preferredLocale = al.split(",")[0]?.split("-")[0];
|
|
122
|
+
} catch {
|
|
123
|
+
// ignore header lookup errors
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
const pageData = await getPageDataBySlug(params.slug, preferredLocale);
|
|
127
127
|
|
|
128
128
|
if (!pageData) {
|
|
129
129
|
notFound();
|
|
@@ -151,7 +151,7 @@ export default async function DynamicPage({ params: paramsPromise }: PageProps)
|
|
|
151
151
|
const r2BaseUrl = process.env.NEXT_PUBLIC_R2_BASE_URL || "";
|
|
152
152
|
|
|
153
153
|
if (pageData && pageData.blocks && r2BaseUrl) {
|
|
154
|
-
const heroBlock = pageData.blocks.find(block => block.block_type === 'hero');
|
|
154
|
+
const heroBlock = pageData.blocks.find((block: { block_type: string; content: unknown }) => block.block_type === 'hero');
|
|
155
155
|
if (heroBlock) {
|
|
156
156
|
const heroContent = heroBlock.content as unknown as HeroBlockContent;
|
|
157
157
|
if (
|
|
@@ -177,4 +177,4 @@ export default async function DynamicPage({ params: paramsPromise }: PageProps)
|
|
|
177
177
|
</PageClientContent>
|
|
178
178
|
</>
|
|
179
179
|
);
|
|
180
|
-
}
|
|
180
|
+
}
|
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
import nx from '@nx/eslint-plugin';
|
|
2
1
|
import nextPlugin from '@next/eslint-plugin-next';
|
|
3
|
-
|
|
4
|
-
const nextRules = {
|
|
5
|
-
...nextPlugin.configs.recommended.rules,
|
|
6
|
-
...nextPlugin.configs['core-web-vitals'].rules,
|
|
7
|
-
};
|
|
2
|
+
import tseslint from 'typescript-eslint';
|
|
8
3
|
|
|
9
4
|
const config = [
|
|
10
|
-
...nx.configs['flat/react-typescript'],
|
|
11
5
|
{
|
|
12
|
-
ignores: ['.next/**/*', '**/next-env.d.ts', '
|
|
6
|
+
ignores: ['.next/**/*', '**/next-env.d.ts', 'next-env.d.ts'],
|
|
13
7
|
},
|
|
8
|
+
...tseslint.configs.recommended,
|
|
14
9
|
{
|
|
15
10
|
files: [
|
|
16
11
|
'**/*.ts',
|
|
@@ -20,12 +15,21 @@ const config = [
|
|
|
20
15
|
'**/*.mjs',
|
|
21
16
|
'**/*.cjs',
|
|
22
17
|
],
|
|
18
|
+
languageOptions: {
|
|
19
|
+
parserOptions: {
|
|
20
|
+
project: true,
|
|
21
|
+
tsconfigRootDir: import.meta.dirname,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
23
24
|
plugins: {
|
|
24
25
|
'@next/next': nextPlugin,
|
|
25
26
|
},
|
|
26
27
|
rules: {
|
|
27
|
-
...
|
|
28
|
-
'
|
|
28
|
+
...nextPlugin.configs.recommended.rules,
|
|
29
|
+
...nextPlugin.configs['core-web-vitals'].rules,
|
|
30
|
+
'@next/next/no-html-link-for-pages': 'off',
|
|
31
|
+
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
|
|
32
|
+
'@typescript-eslint/no-explicit-any': 'warn',
|
|
29
33
|
},
|
|
30
34
|
},
|
|
31
35
|
];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextblock-cms/template",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.9",
|
|
4
4
|
"private": true,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "next dev",
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
"lint": "next lint"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@aws-sdk/client-s3": "^3.
|
|
12
|
+
"@aws-sdk/client-s3": "^3.920.0",
|
|
13
|
+
"@aws-sdk/s3-request-presigner": "^3.920.0",
|
|
13
14
|
"@dnd-kit/core": "^6.3.1",
|
|
14
15
|
"@dnd-kit/sortable": "^10.0.0",
|
|
15
16
|
"@dnd-kit/utilities": "^3.2.2",
|
|
@@ -47,6 +48,7 @@
|
|
|
47
48
|
"eslint-config-next": "^15.5.4",
|
|
48
49
|
"postcss": "^8.4.38",
|
|
49
50
|
"tailwindcss": "^3.4.3",
|
|
50
|
-
"typescript": "~5.8.2"
|
|
51
|
+
"typescript": "~5.8.2",
|
|
52
|
+
"typescript-eslint": "^8.0.0"
|
|
51
53
|
}
|
|
52
54
|
}
|