fix(package): update

This commit is contained in:
2026-02-10 13:40:55 +08:00
parent bdede98cde
commit db7155d20b
12 changed files with 181 additions and 151 deletions

15
eslint.config.mjs Normal file
View File

@@ -0,0 +1,15 @@
import tseslint from "typescript-eslint";
import next from "@next/eslint-plugin-next";
export default [
{ ignores: [".next/**", "node_modules/**", "scripts/**", "next.config.js"] },
...tseslint.configs.recommended,
{
files: ["**/*.{js,jsx,ts,tsx}"],
plugins: { "@next/next": next },
rules: {
...next.configs.recommended.rules,
...next.configs["core-web-vitals"].rules,
},
},
];

3
next-env.d.ts vendored
View File

@@ -1,5 +1,6 @@
/// <reference types="next" /> /// <reference types="next" />
/// <reference types="next/image-types/global" /> /// <reference types="next/image-types/global" />
import "./.next/dev/types/routes.d.ts";
// NOTE: This file should not be edited // NOTE: This file should not be edited
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information. // see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

View File

@@ -1,40 +1,6 @@
/** @type {import('next').NextConfig} */ /** @type {import('next').NextConfig} */
const nextConfig = { const nextConfig = {
output: "standalone", output: "standalone",
async headers() { };
const isDev = process.env.NODE_ENV === "development"
const csp = [
"default-src 'self'",
"base-uri 'self'",
"frame-ancestors 'none'",
"object-src 'none'",
"form-action 'self'",
"img-src 'self' data:",
isDev
? "script-src 'self' 'unsafe-eval' 'unsafe-inline'"
: "script-src 'self'",
"style-src 'self' 'unsafe-inline'",
"connect-src 'self'",
].join("; ")
return [
{
source: "/(.*)",
headers: [
{ key: "Content-Security-Policy", value: csp },
{ key: "X-Frame-Options", value: "DENY" },
{ key: "X-Content-Type-Options", value: "nosniff" },
{ key: "Referrer-Policy", value: "no-referrer" },
{
key: "Strict-Transport-Security",
value: "max-age=63072000; includeSubDomains; preload",
},
{ key: "Permissions-Policy", value: "geolocation=(), microphone=(), camera=()" },
],
},
]
},
}
module.exports = nextConfig
module.exports = nextConfig;

View File

@@ -1,34 +1,38 @@
{ {
"name": "cms-front", "name": "cms-front",
"private": true, "private": true,
"version": "0.1.0", "version": "0.1.0",
"scripts": { "scripts": {
"dev": "next dev -p 6031", "dev": "next dev --turbopack -p 6031",
"build": "next build", "build": "next build",
"start": "next start -p 6031", "start": "next start -p 6031",
"lint": "next lint" "lint": "eslint .",
}, "typecheck": "tsc --noEmit"
"dependencies": { },
"@radix-ui/react-checkbox": "^1.3.0", "dependencies": {
"@radix-ui/react-label": "^2.1.0", "@radix-ui/react-checkbox": "^1.3.0",
"@radix-ui/react-slot": "^1.2.0", "@radix-ui/react-label": "^2.1.0",
"class-variance-authority": "^0.7.1", "@radix-ui/react-slot": "^1.2.0",
"clsx": "^2.1.1", "class-variance-authority": "^0.7.1",
"lucide-react": "^0.468.0", "clsx": "^2.1.1",
"next": "^14.2.25", "lucide-react": "^0.468.0",
"react": "^18.3.1", "next": "^16.1.6",
"react-dom": "^18.3.1", "react": "^19.2.4",
"tailwind-merge": "^2.5.4" "react-dom": "^19.2.4",
}, "tailwind-merge": "^3.4.0"
"devDependencies": { },
"@types/node": "^20.17.16", "devDependencies": {
"@types/react": "^18.3.18", "@next/eslint-plugin-next": "^16.1.6",
"@types/react-dom": "^18.3.5", "@tailwindcss/postcss": "^4.1.18",
"autoprefixer": "^10.4.20", "@types/node": "^20.17.16",
"eslint": "^8.57.1", "@types/react": "^19.2.0",
"eslint-config-next": "^14.2.25", "@types/react-dom": "^19.2.0",
"postcss": "^8.5.1", "autoprefixer": "^10.4.20",
"tailwindcss": "^3.4.17", "eslint": "^9.39.2",
"typescript": "^5.7.3" "eslint-config-next": "^16.1.6",
} "postcss": "^8.5.1",
"tailwindcss": "^4.1.18",
"typescript": "^5.7.3",
"typescript-eslint": "^8.54.0"
}
} }

View File

@@ -1,7 +0,0 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}

6
postcss.config.mjs Normal file
View File

@@ -0,0 +1,6 @@
export default {
plugins: {
"@tailwindcss/postcss": {},
autoprefixer: {},
},
}

View File

@@ -1,18 +1,21 @@
export default function AuthErrorPage({ import Link from "next/link";
export default async function AuthErrorPage({
searchParams, searchParams,
}: { }: {
searchParams?: { message?: string } searchParams: Promise<{ message?: string }>
}) { }) {
const message = searchParams?.message ?? "认证失败" const sp = await searchParams;
const message = sp?.message ?? "认证失败"
return ( return (
<main className="min-h-screen flex items-center justify-center p-6"> <main className="min-h-screen flex items-center justify-center p-6">
<div className="max-w-md text-sm"> <div className="max-w-md text-sm">
<div className="font-medium"></div> <div className="font-medium"></div>
<div className="mt-2 break-words text-muted-foreground">{message}</div> <div className="mt-2 break-words text-muted-foreground">{message}</div>
<div className="mt-4"> <div className="mt-4">
<a className="underline underline-offset-4" href="/"> <Link className="underline underline-offset-4" href="/">
</a> </Link>
</div> </div>
</div> </div>
</main> </main>

View File

@@ -1,6 +1,96 @@
@tailwind base; @import "tailwindcss";
@tailwind components;
@tailwind utilities; @custom-variant dark (&:where(.dark, .dark *));
@theme {
--color-border: hsl(var(--border));
--color-input: hsl(var(--input));
--color-ring: hsl(var(--ring));
--color-background: hsl(var(--background));
--color-foreground: hsl(var(--foreground));
--color-primary: hsl(var(--primary));
--color-primary-foreground: hsl(var(--primary-foreground));
--color-secondary: hsl(var(--secondary));
--color-secondary-foreground: hsl(var(--secondary-foreground));
--color-destructive: hsl(var(--destructive));
--color-destructive-foreground: hsl(var(--destructive-foreground));
--color-muted: hsl(var(--muted));
--color-muted-foreground: hsl(var(--muted-foreground));
--color-accent: hsl(var(--accent));
--color-accent-foreground: hsl(var(--accent-foreground));
--color-card: hsl(var(--card));
--color-card-foreground: hsl(var(--card-foreground));
--radius-lg: var(--radius);
--radius-md: calc(var(--radius) - 2px);
--radius-sm: calc(var(--radius) - 4px);
/* Custom Container Max Width */
--container-max-width: 1200px;
}
/* Fluid Typography & Base Styles */
@layer base {
html {
/* Mobile base size */
font-size: 14px;
/* Desktop base size (md breakpoint approx 768px) */
@media (min-width: 768px) {
font-size: 16px;
}
}
h1, h2, h3, h4, h5, h6 {
/* Fluid scaling using clamp/calc */
font-size: clamp(1.25rem, 1rem + 1vw, 2.5rem);
line-height: 1.2;
}
}
/* Utility for Grid System */
@utility grid-responsive {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 1rem;
@media (min-width: 768px) {
grid-template-columns: repeat(8, minmax(0, 1fr));
}
@media (min-width: 1024px) {
grid-template-columns: repeat(12, minmax(0, 1fr));
}
}
/* Utility for Responsive Content Container */
@utility container-responsive {
width: 100%;
margin-left: auto;
margin-right: auto;
max-width: 1200px;
/* Mobile Padding */
padding-left: 1rem; /* 16px */
padding-right: 1rem;
@media (min-width: 768px) {
/* Tablet/Desktop Padding */
padding-left: 2.5rem; /* 40px */
padding-right: 2.5rem;
}
@media (min-width: 1024px) {
padding-left: 3.75rem; /* 60px */
padding-right: 3.75rem;
}
}
:root { :root {
--background: 0 0% 100%; --background: 0 0% 100%;
@@ -27,4 +117,3 @@ body {
background: hsl(var(--background)); background: hsl(var(--background));
color: hsl(var(--foreground)); color: hsl(var(--foreground));
} }

View File

@@ -1,8 +1,9 @@
import { cookies } from "next/headers" import { cookies } from "next/headers"
export default function Home() { export default async function Home() {
const tenantId = cookies().get("tenantId")?.value ?? "" const cookieStore = await cookies()
const userId = cookies().get("userId")?.value ?? "" const tenantId = cookieStore.get("tenantId")?.value ?? ""
const userId = cookieStore.get("userId")?.value ?? ""
return ( return (
<main className="min-h-screen p-6"> <main className="min-h-screen p-6">

View File

@@ -19,7 +19,7 @@ function isExpired(jwt: string): boolean {
} }
} }
export function middleware(req: NextRequest) { export function proxy(req: NextRequest) {
if (process.env.NODE_ENV === "production") { if (process.env.NODE_ENV === "production") {
const proto = req.headers.get("x-forwarded-proto"); const proto = req.headers.get("x-forwarded-proto");
if (proto && proto !== "https") { if (proto && proto !== "https") {

View File

@@ -1,57 +0,0 @@
import type { Config } from "tailwindcss"
const config: Config = {
darkMode: ["class"],
content: ["./src/**/*.{ts,tsx}"],
theme: {
container: {
center: true,
padding: "2rem",
screens: {
"2xl": "1400px",
},
},
extend: {
colors: {
border: "hsl(var(--border))",
input: "hsl(var(--input))",
ring: "hsl(var(--ring))",
background: "hsl(var(--background))",
foreground: "hsl(var(--foreground))",
primary: {
DEFAULT: "hsl(var(--primary))",
foreground: "hsl(var(--primary-foreground))",
},
secondary: {
DEFAULT: "hsl(var(--secondary))",
foreground: "hsl(var(--secondary-foreground))",
},
muted: {
DEFAULT: "hsl(var(--muted))",
foreground: "hsl(var(--muted-foreground))",
},
accent: {
DEFAULT: "hsl(var(--accent))",
foreground: "hsl(var(--accent-foreground))",
},
destructive: {
DEFAULT: "hsl(var(--destructive))",
foreground: "hsl(var(--destructive-foreground))",
},
card: {
DEFAULT: "hsl(var(--card))",
foreground: "hsl(var(--card-foreground))",
},
},
borderRadius: {
lg: "var(--radius)",
md: "calc(var(--radius) - 2px)",
sm: "calc(var(--radius) - 4px)",
},
},
},
plugins: [],
}
export default config

View File

@@ -11,15 +11,24 @@
"moduleResolution": "bundler", "moduleResolution": "bundler",
"resolveJsonModule": true, "resolveJsonModule": true,
"isolatedModules": true, "isolatedModules": true,
"jsx": "preserve", "jsx": "react-jsx",
"incremental": true, "incremental": true,
"plugins": [{ "name": "next" }], "plugins": [
{
"name": "next"
}
],
"baseUrl": ".", "baseUrl": ".",
"paths": { "paths": {
"@/*": ["src/*"] "@/*": ["src/*"]
} }
}, },
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], "include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts",
".next/dev/types/**/*.ts"
],
"exclude": ["node_modules"] "exclude": ["node_modules"]
} }