Skip to content

Commit e3fa4a8

Browse files
authored
Merge pull request #74 from arrhes/local-emile-development
⚡️ perf(website): implement lazy loading and caching optimizations
2 parents 7326eff + c8c8aa7 commit e3fa4a8

83 files changed

Lines changed: 459 additions & 239 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ dist
1919
**/dist
2020
styled-system
2121
**/styled-system
22-
*.tsbuildinfo
22+
**/*.tsbuildinfo
2323

2424
# Test artifacts (but keep tests/ directory for CI)
2525
test-results

.workflows/.build/packages/website/nginx/default.conf

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,21 @@ http {
1919
gzip_min_length 256;
2020
gzip_vary on;
2121
gzip_proxied any;
22-
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
22+
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript font/woff2;
2323
gzip_comp_level 9;
2424

2525
root /usr/share/nginx/html;
2626
index index.html;
2727

28+
# Immutable hashed assets (JS, CSS, fonts, images) - cache for 1 year
29+
location ~* \.(?:js|css|woff2?|ttf|eot|svg|png|jpg|jpeg|gif|webp|ico|webmanifest)$ {
30+
add_header Cache-Control "public, max-age=31536000, immutable";
31+
try_files $uri =404;
32+
}
33+
34+
# HTML and other mutable files - always revalidate
2835
location / {
36+
add_header Cache-Control "no-cache";
2937
try_files $uri $uri/ /index.html =404;
3038
}
3139
}

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v1.0.3
1+
v1.0.4

packages/tools/package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
"type": "module",
44
"private": true,
55
"scripts": {
6+
"build:metadata": "pnpm --filter @arrhes/application-metadata build",
67
"generate": "pnpm drizzle-kit generate --config=./src/drizzle.config.ts",
7-
"push": "tsx --env-file=.env ./src/push.ts",
8+
"push": "pnpm run build:metadata && tsx --env-file=.env ./src/push.ts",
89
"pull": "pnpm drizzle-kit introspect --config=./src/drizzle.config.ts",
910
"migrate": "pnpm drizzle-kit migrate --config=./src/drizzle.config.ts",
10-
"seed": "tsx --env-file=.env ./src/seed/seed.ts",
11-
"migration": "tsx --env-file=.env ./src/seed/migration.ts",
12-
"clear": "tsx --env-file=.env ./src/clearDB.ts",
13-
"reset": "tsx --env-file=.env ./src/clearDB.ts && pnpm run push && tsx --env-file=.env ./src/seed/seed.ts",
11+
"seed": "pnpm run build:metadata && tsx --env-file=.env ./src/seed/seed.ts",
12+
"migration": "pnpm run build:metadata && tsx --env-file=.env ./src/seed/migration.ts",
13+
"clear": "pnpm run build:metadata && tsx --env-file=.env ./src/clearDB.ts",
14+
"reset": "pnpm run build:metadata && tsx --env-file=.env ./src/clearDB.ts && pnpm run push && tsx --env-file=.env ./src/seed/seed.ts",
1415
"drop": "pnpm drizzle-kit drop --config=./src/drizzle.config.ts"
1516
},
1617
"devDependencies": {

packages/tools/src/push.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
// It runs with tsx, which properly handles .js → .ts extension resolution.
99
// =============================================================================
1010

11-
import { modelSchemas } from "@arrhes/application-metadata/models"
11+
import { modelSchemas } from "@arrhes/application-metadata"
1212
import { pushSchema } from "drizzle-kit/api"
1313
import { sql } from "drizzle-orm"
1414
import type { PgDatabase } from "drizzle-orm/pg-core"
1515
import { drizzle } from "drizzle-orm/postgres-js"
1616
import postgres from "postgres"
17-
import { env } from "./env"
17+
import { env } from "./env.js"
1818

1919
const connection = postgres(env()?.SQL_DATABASE_URL ?? "", { max: 1 })
2020
const db = drizzle(connection)

packages/tools/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,6 @@
2020
"outDir": "./build"
2121
},
2222
"exclude": ["./node_modules", "./build"],
23-
"include": ["./src"]
23+
"include": ["./src"],
24+
"references": [{ "path": "../metadata" }]
2425
}

packages/ui/src/fonts/fonts.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
font-stretch: 75% 125%;
1717
font-style: normal;
1818
font-optical-sizing: auto;
19+
font-display: swap;
1920
}
2021

2122
@font-face {
@@ -27,4 +28,5 @@
2728
font-stretch: 75% 125%;
2829
font-style: italic;
2930
font-optical-sizing: auto;
31+
font-display: swap;
3032
}

packages/website/src/root.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Profiler, StrictMode } from "react"
1+
import { StrictMode } from "react"
22
import { createRoot } from "react-dom/client"
33
import "./assets/css/root.css"
44
import { RootProvider } from "./contexts/rootProvider.js"
@@ -9,9 +9,7 @@ if (!rootElement.innerHTML) {
99
const root = createRoot(rootElement)
1010
root.render(
1111
<StrictMode>
12-
<Profiler id="website" onRender={() => {}}>
13-
<RootProvider />
14-
</Profiler>
12+
<RootProvider />
1513
</StrictMode>,
1614
)
1715
}

packages/website/src/routes/root/dashboard/dashboardLayoutRoute.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { CircularLoader } from "@arrhes/ui"
2-
import { createRoute, redirect } from "@tanstack/react-router"
3-
import { DashboardLayout } from "../../../features/dashboard/dashboardLayout.js"
2+
import { createRoute, lazyRouteComponent, redirect } from "@tanstack/react-router"
43
import { rootLayoutRoute } from "../../rootLayoutRoute.js"
54

65
export const dashboardLayoutRoute = createRoute({
@@ -14,5 +13,5 @@ export const dashboardLayoutRoute = createRoute({
1413
})
1514
}
1615
},
17-
component: () => <DashboardLayout />,
16+
component: lazyRouteComponent(() => import("../../../features/dashboard/dashboardLayout.js"), "DashboardLayout"),
1817
})
Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { createRoute } from "@tanstack/react-router"
2-
import { OrganizationApiKeysPage } from "../../../../../../features/dashboard/$idOrganization/organizationApi/keys/organizationApiKeysPage.js"
1+
import { createRoute, lazyRouteComponent } from "@tanstack/react-router"
32
import { organizationApiLayoutRoute } from "./organizationApiLayoutRoute.js"
43

54
export const organizationApiKeysRoute = createRoute({
@@ -8,5 +7,11 @@ export const organizationApiKeysRoute = createRoute({
87
beforeLoad: () => ({
98
title: "Clés",
109
}),
11-
component: () => <OrganizationApiKeysPage />,
10+
component: lazyRouteComponent(
11+
() =>
12+
import(
13+
"../../../../../../features/dashboard/$idOrganization/organizationApi/keys/organizationApiKeysPage.js"
14+
),
15+
"OrganizationApiKeysPage",
16+
),
1217
})

0 commit comments

Comments
 (0)