forked from baron/baron-sso
refactor(frontend): centralize configurations and deduplicate dependencies in common workspace
- Centralized biome.json, tailwind.config.ts, and vite.config.ts into common/config. - Updated sub-apps to inherit from shared base configurations. - Deduplicated dependencies across apps using common workspace. - Fixed TypeScript resolution issues by restoring necessary build dependencies. - Removed obsolete package-lock.json files. - Applied minor import fixes via Biome. - Fixed react-router-dom v7 type errors.
This commit is contained in:
32
common/config/biome.base.json
Normal file
32
common/config/biome.base.json
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
|
||||
"formatter": {
|
||||
"enabled": true,
|
||||
"indentStyle": "space"
|
||||
},
|
||||
"linter": {
|
||||
"enabled": true,
|
||||
"rules": {
|
||||
"style": {
|
||||
"useEnumInitializers": "off"
|
||||
},
|
||||
"a11y": {
|
||||
"noLabelWithoutControl": "off"
|
||||
}
|
||||
}
|
||||
},
|
||||
"organizeImports": {
|
||||
"enabled": true
|
||||
},
|
||||
"files": {
|
||||
"ignore": [
|
||||
"dist",
|
||||
".vite",
|
||||
"node_modules",
|
||||
"tsconfig*.json",
|
||||
"test-results",
|
||||
"test-results.nobody-backup",
|
||||
"playwright-report"
|
||||
]
|
||||
}
|
||||
}
|
||||
42
common/config/vite.base.ts
Normal file
42
common/config/vite.base.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import react from "@vitejs/plugin-react";
|
||||
import { defineConfig, type UserConfig } from "vite";
|
||||
|
||||
export const commonViteConfig: UserConfig = {
|
||||
plugins: [react()],
|
||||
// Since we are using pnpm and common is our root, we might not need the strict aliases
|
||||
// for react and lucide-react anymore, as pnpm will resolve them correctly from the root node_modules.
|
||||
// If we do need them, we can add them back per-app or dynamically resolve from common's __dirname.
|
||||
build: {
|
||||
emptyOutDir: true,
|
||||
},
|
||||
};
|
||||
|
||||
export function hostFromUrl(value: string | undefined) {
|
||||
if (!value) return undefined;
|
||||
try {
|
||||
return new URL(value).hostname;
|
||||
} catch {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
export function getAllowedHosts(
|
||||
defaultHosts: string[],
|
||||
envUrl?: string,
|
||||
envAllowedHosts?: string
|
||||
) {
|
||||
return Array.from(
|
||||
new Set(
|
||||
[
|
||||
...defaultHosts,
|
||||
hostFromUrl(envUrl),
|
||||
...(envAllowedHosts ?? "")
|
||||
.split(",")
|
||||
.map((host) => host.trim())
|
||||
.filter(Boolean),
|
||||
].filter((host): host is string => Boolean(host))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export default defineConfig(commonViteConfig);
|
||||
4172
common/pnpm-lock.yaml
generated
Normal file
4172
common/pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
68
common/theme/tailwind.preset.ts
Normal file
68
common/theme/tailwind.preset.ts
Normal file
@@ -0,0 +1,68 @@
|
||||
import type { Config } from "tailwindcss";
|
||||
import { fontFamily } from "tailwindcss/defaultTheme";
|
||||
import animatePlugin from "tailwindcss-animate";
|
||||
|
||||
const commonPreset: Config = {
|
||||
darkMode: ["class"],
|
||||
content: [], // Content should be defined by the consuming app
|
||||
theme: {
|
||||
container: {
|
||||
center: true,
|
||||
padding: "1.5rem",
|
||||
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))",
|
||||
},
|
||||
destructive: {
|
||||
DEFAULT: "hsl(var(--destructive))",
|
||||
foreground: "hsl(var(--destructive-foreground))",
|
||||
},
|
||||
muted: {
|
||||
DEFAULT: "hsl(var(--muted))",
|
||||
foreground: "hsl(var(--muted-foreground))",
|
||||
},
|
||||
accent: {
|
||||
DEFAULT: "hsl(var(--accent))",
|
||||
foreground: "hsl(var(--accent-foreground))",
|
||||
},
|
||||
popover: {
|
||||
DEFAULT: "hsl(var(--popover))",
|
||||
foreground: "hsl(var(--popover-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)",
|
||||
},
|
||||
fontFamily: {
|
||||
sans: ["Space Grotesk", "Pretendard Variable", ...fontFamily.sans],
|
||||
},
|
||||
boxShadow: {
|
||||
card: "0 12px 40px rgba(7, 15, 26, 0.25)",
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [animatePlugin],
|
||||
};
|
||||
|
||||
export default commonPreset;
|
||||
Reference in New Issue
Block a user