Skip to content

Commit d7b2b66

Browse files
committed
chore: html
1 parent c05cd1a commit d7b2b66

File tree

6 files changed

+25
-5
lines changed

6 files changed

+25
-5
lines changed

after_build.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
const { rename, existsSync } = require('fs');
2+
const path = require('path');
3+
4+
const outDir = path.join(__dirname, 'out');
5+
const enHtmlPath = path.join(outDir, 'en.html');
6+
const indexHtmlPath = path.join(outDir, 'index.html');
7+
8+
if (existsSync(enHtmlPath)) {
9+
rename(enHtmlPath, indexHtmlPath, (err) => {
10+
if (err) {
11+
console.error('Rename Failed:', err);
12+
process.exit(1);
13+
} else {
14+
console.log('✅ En Html Has Been Renamed To Index Html');
15+
}
16+
});
17+
} else {
18+
console.log('⚠️ En Html File Not Found, Skipping Rename');
19+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "0.0.0",
44
"private": true,
55
"scripts": {
6-
"build": "next build",
6+
"build": "next build && node after_build.js",
77
"dev": "next dev -p 4000 --turbo",
88
"start": "next start",
99
"preview": "pnpx serve out",

src/app/[lang]/(home)/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ export default async function Layout({
1111
}) {
1212
const { lang } = await params;
1313

14-
return <HomeLayout {...baseOptions()} links={linkItems(lang)}>{children}</HomeLayout>;
14+
return <HomeLayout {...baseOptions({lang})} links={linkItems(lang)}>{children}</HomeLayout>;
1515
}

src/app/[lang]/(home)/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ export function ContactForm() {
475475
>
476476
<iframe
477477
className="w-full h-200 border-0"
478-
src="https://stackblitz.com/edit/vitejs-vite-mmjycpjj?file=src%2Fcomponents%2FSelect.tsx,src%2Fcomponents%2FRadioGroup.tsx,src%2Fcomponents%2FRadio.tsx,src%2Fcomponents%2FInputNumber.tsx,tsconfig.app.json,src%2Fcomponents%2FInput.tsx,src%2Fcomponents%2FCascader.tsx,src%2Fcomponents%2FArrayField.tsx,src%2Fcomponents%2FCheckbox.tsx,src%2Fcomponents%2FContainer.tsx,src%2FApp.tsx,src%2Fsignals-form%2Fstore%2Findex.js,tsconfig.json&terminal=dev"
478+
src="https://stackblitz.com/edit/signals-form-mmjycpjj?file=src%2FApp.tsx&terminal=dev"
479479
loading="lazy"
480480
title="Signals Form Live Demo"
481481
/>

src/app/[lang]/docs/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export default async function Layout({
8888
children: ReactNode;
8989
}) {
9090
const { lang } = await params;
91-
const options = baseOptions();
91+
const options = baseOptions({ lang });
9292
return (
9393
<DocsLayout
9494
{...options}

src/app/layout.config.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,11 @@ export function linkItems(locale: string): BaseLayoutProps['links'] {
5252
]
5353
}
5454

55-
export function baseOptions(): BaseLayoutProps {
55+
export function baseOptions({ lang }: { lang: string }): BaseLayoutProps {
5656
return {
5757
i18n,
5858
nav: {
59+
url: lang === "en" ? "/" : "/cn",
5960
title: (
6061
<>
6162
<span className="font-medium [.uwu_&]:hidden [header_&]:text-[15px]">

0 commit comments

Comments
 (0)