add code chunking to vite.config.ts

This commit is contained in:
Amruth Pillai
2024-05-07 11:45:33 +02:00
parent e21430a421
commit e3785030e1
11 changed files with 616 additions and 707 deletions
+1
View File
@@ -46,6 +46,7 @@ STORAGE_SECRET_KEY=minioadmin
STORAGE_USE_SSL=false STORAGE_USE_SSL=false
# Sentry (for error reporting, Optional) # Sentry (for error reporting, Optional)
# SENTRY_AUTH_TOKEN=
# SERVER_SENTRY_DSN= # SERVER_SENTRY_DSN=
# VITE_CLIENT_SENTRY_DSN= # VITE_CLIENT_SENTRY_DSN=
+1 -1
View File
@@ -3,5 +3,5 @@
"upgrade": true, "upgrade": true,
"install": "always", "install": "always",
"packageManager": "pnpm", "packageManager": "pnpm",
"reject": ["eslint", "@reactive-resume/*"] "reject": ["eslint", "vite-plugin-chunk-split", "@reactive-resume/*"]
} }
+8 -1
View File
@@ -3,6 +3,7 @@
import { nxViteTsPaths } from "@nx/vite/plugins/nx-tsconfig-paths.plugin"; import { nxViteTsPaths } from "@nx/vite/plugins/nx-tsconfig-paths.plugin";
import react from "@vitejs/plugin-react-swc"; import react from "@vitejs/plugin-react-swc";
import { defineConfig, searchForWorkspaceRoot } from "vite"; import { defineConfig, searchForWorkspaceRoot } from "vite";
import { chunkSplitPlugin } from "vite-plugin-chunk-split";
export default defineConfig({ export default defineConfig({
base: "/artboard/", base: "/artboard/",
@@ -20,7 +21,13 @@ export default defineConfig({
fs: { allow: [searchForWorkspaceRoot(process.cwd())] }, fs: { allow: [searchForWorkspaceRoot(process.cwd())] },
}, },
plugins: [react(), nxViteTsPaths()], plugins: [
react(),
nxViteTsPaths(),
chunkSplitPlugin({
strategy: "unbundle",
}),
],
resolve: { resolve: {
alias: { alias: {
+3 -3
View File
@@ -24,9 +24,9 @@ if (import.meta.env.VITE_CLIENT_SENTRY_DSN) {
}), }),
Sentry.replayIntegration(), Sentry.replayIntegration(),
], ],
tracesSampleRate: 0.5, tracesSampleRate: 1,
replaysOnErrorSampleRate: 0.5, replaysOnErrorSampleRate: 1,
replaysSessionSampleRate: 0.25, replaysSessionSampleRate: 1,
}); });
} }
+1
View File
@@ -4,6 +4,7 @@
declare const appVersion: string; declare const appVersion: string;
interface ImportMetaEnv { interface ImportMetaEnv {
SENTRY_AUTH_TOKEN: string | undefined;
VITE_CLIENT_SENTRY_DSN: string | undefined; VITE_CLIENT_SENTRY_DSN: string | undefined;
VITE_DISABLE_SIGNUPS: string | undefined; VITE_DISABLE_SIGNUPS: string | undefined;
} }
+6
View File
@@ -1,9 +1,11 @@
/// <reference types='vitest' /> /// <reference types='vitest' />
import { lingui } from "@lingui/vite-plugin"; import { lingui } from "@lingui/vite-plugin";
import { nxViteTsPaths } from "@nx/vite/plugins/nx-tsconfig-paths.plugin"; import { nxViteTsPaths } from "@nx/vite/plugins/nx-tsconfig-paths.plugin";
import { sentryVitePlugin } from "@sentry/vite-plugin"; import { sentryVitePlugin } from "@sentry/vite-plugin";
import react from "@vitejs/plugin-react"; import react from "@vitejs/plugin-react";
import { defineConfig, searchForWorkspaceRoot } from "vite"; import { defineConfig, searchForWorkspaceRoot } from "vite";
import { chunkSplitPlugin } from "vite-plugin-chunk-split";
export default defineConfig({ export default defineConfig({
cacheDir: "../../node_modules/.vite/client", cacheDir: "../../node_modules/.vite/client",
@@ -39,7 +41,11 @@ export default defineConfig({
}), }),
lingui(), lingui(),
nxViteTsPaths(), nxViteTsPaths(),
chunkSplitPlugin({
strategy: "unbundle",
}),
sentryVitePlugin({ sentryVitePlugin({
disable: process.env.SENTRY_AUTH_TOKEN === undefined,
org: "reactive-resume", org: "reactive-resume",
project: "client", project: "client",
}), }),
+7
View File
@@ -70,6 +70,12 @@ export class AuthService {
} }
} }
async setLastSignedIn(email: string) {
await this.userService.updateByEmail(email, {
secrets: { update: { lastSignedIn: new Date() } },
});
}
async setRefreshToken(email: string, token: string | null) { async setRefreshToken(email: string, token: string | null) {
await this.userService.updateByEmail(email, { await this.userService.updateByEmail(email, {
secrets: { secrets: {
@@ -129,6 +135,7 @@ export class AuthService {
} }
await this.validatePassword(password, user.secrets.password); await this.validatePassword(password, user.secrets.password);
await this.setLastSignedIn(user.email);
return user; return user;
} catch { } catch {
+21 -20
View File
@@ -1,7 +1,7 @@
{ {
"name": "@reactive-resume/source", "name": "@reactive-resume/source",
"description": "A free and open-source resume builder that simplifies the process of creating, updating, and sharing your resume.", "description": "A free and open-source resume builder that simplifies the process of creating, updating, and sharing your resume.",
"version": "4.1.0", "version": "4.1.1",
"license": "MIT", "license": "MIT",
"private": true, "private": true,
"author": { "author": {
@@ -37,20 +37,20 @@
"@lingui/vite-plugin": "^4.10.1", "@lingui/vite-plugin": "^4.10.1",
"@nestjs/schematics": "^10.1.1", "@nestjs/schematics": "^10.1.1",
"@nestjs/testing": "^10.3.8", "@nestjs/testing": "^10.3.8",
"@nx/eslint": "18.3.4", "@nx/eslint": "19.0.0",
"@nx/eslint-plugin": "18.3.4", "@nx/eslint-plugin": "19.0.0",
"@nx/jest": "18.3.4", "@nx/jest": "19.0.0",
"@nx/js": "18.3.4", "@nx/js": "19.0.0",
"@nx/nest": "18.3.4", "@nx/nest": "19.0.0",
"@nx/node": "18.3.4", "@nx/node": "19.0.0",
"@nx/react": "18.3.4", "@nx/react": "19.0.0",
"@nx/vite": "18.3.4", "@nx/vite": "19.0.0",
"@nx/web": "18.3.4", "@nx/web": "19.0.0",
"@nx/webpack": "18.3.4", "@nx/webpack": "19.0.0",
"@nx/workspace": "18.3.4", "@nx/workspace": "19.0.0",
"@swc-node/register": "~1.9.1", "@swc-node/register": "~1.9.1",
"@swc/cli": "~0.3.12", "@swc/cli": "~0.3.12",
"@swc/core": "~1.4.17", "@swc/core": "~1.5.3",
"@tailwindcss/container-queries": "^0.1.1", "@tailwindcss/container-queries": "^0.1.1",
"@tailwindcss/forms": "^0.5.7", "@tailwindcss/forms": "^0.5.7",
"@tailwindcss/typography": "^0.5.13", "@tailwindcss/typography": "^0.5.13",
@@ -66,7 +66,7 @@
"@types/lodash.get": "^4.4.9", "@types/lodash.get": "^4.4.9",
"@types/lodash.set": "^4.3.9", "@types/lodash.set": "^4.3.9",
"@types/multer": "^1.4.11", "@types/multer": "^1.4.11",
"@types/node": "20.12.8", "@types/node": "20.12.10",
"@types/nodemailer": "^6.4.15", "@types/nodemailer": "^6.4.15",
"@types/papaparse": "^5.3.14", "@types/papaparse": "^5.3.14",
"@types/passport": "^1.0.16", "@types/passport": "^1.0.16",
@@ -101,7 +101,7 @@
"jest": "^29.7.0", "jest": "^29.7.0",
"jest-environment-node": "^29.7.0", "jest-environment-node": "^29.7.0",
"jsdom": "~24.0.0", "jsdom": "~24.0.0",
"nx": "18.3.4", "nx": "19.0.0",
"postcss": "8.4.38", "postcss": "8.4.38",
"postcss-import": "^16.1.0", "postcss-import": "^16.1.0",
"postcss-nested": "^6.0.1", "postcss-nested": "^6.0.1",
@@ -112,6 +112,7 @@
"ts-node": "10.9.2", "ts-node": "10.9.2",
"typescript": "~5.4.5", "typescript": "~5.4.5",
"vite": "~5.2.11", "vite": "~5.2.11",
"vite-plugin-chunk-split": "^0.4.7",
"vite-plugin-dts": "~3.9.1", "vite-plugin-dts": "~3.9.1",
"vitest": "~1.6.0" "vitest": "~1.6.0"
}, },
@@ -168,7 +169,7 @@
"@sentry/react": "^7.113.0", "@sentry/react": "^7.113.0",
"@sentry/vite-plugin": "^2.16.1", "@sentry/vite-plugin": "^2.16.1",
"@swc/helpers": "~0.5.11", "@swc/helpers": "~0.5.11",
"@tanstack/react-query": "^5.34.2", "@tanstack/react-query": "^5.35.1",
"@tiptap/extension-bold": "^2.3.1", "@tiptap/extension-bold": "^2.3.1",
"@tiptap/extension-bullet-list": "^2.3.1", "@tiptap/extension-bullet-list": "^2.3.1",
"@tiptap/extension-code": "^2.3.1", "@tiptap/extension-code": "^2.3.1",
@@ -203,7 +204,7 @@
"dayjs": "^1.11.11", "dayjs": "^1.11.11",
"deepmerge": "^4.3.1", "deepmerge": "^4.3.1",
"file-saver": "^2.0.5", "file-saver": "^2.0.5",
"framer-motion": "^11.1.7", "framer-motion": "^11.1.9",
"fuzzy": "^0.1.3", "fuzzy": "^0.1.3",
"helmet": "^7.1.0", "helmet": "^7.1.0",
"immer": "^10.1.1", "immer": "^10.1.1",
@@ -217,7 +218,7 @@
"nestjs-prisma": "^0.23.0", "nestjs-prisma": "^0.23.0",
"nestjs-zod": "^3.0.0", "nestjs-zod": "^3.0.0",
"nodemailer": "^6.9.13", "nodemailer": "^6.9.13",
"openai": "^4.40.2", "openai": "^4.42.0",
"otplib": "^12.0.1", "otplib": "^12.0.1",
"papaparse": "^5.4.1", "papaparse": "^5.4.1",
"passport": "^0.7.0", "passport": "^0.7.0",
@@ -227,12 +228,12 @@
"passport-local": "^1.0.0", "passport-local": "^1.0.0",
"pdf-lib": "^1.17.1", "pdf-lib": "^1.17.1",
"prisma": "^5.13.0", "prisma": "^5.13.0",
"puppeteer": "^22.7.1", "puppeteer": "^22.8.0",
"qrcode.react": "^3.1.0", "qrcode.react": "^3.1.0",
"react": "18.3.1", "react": "18.3.1",
"react-colorful": "^5.6.1", "react-colorful": "^5.6.1",
"react-dom": "18.3.1", "react-dom": "18.3.1",
"react-helmet-async": "^2.0.4", "react-helmet-async": "^2.0.5",
"react-hook-form": "^7.51.4", "react-hook-form": "^7.51.4",
"react-parallax-tilt": "^1.7.225", "react-parallax-tilt": "^1.7.225",
"react-resizable-panels": "^2.0.19", "react-resizable-panels": "^2.0.19",
+554 -676
View File
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,8 @@
-- Migrate the `Secrets` table to make the `lastSignedIn` column non-nullable
UPDATE "Secrets"
SET "lastSignedIn" = CURRENT_TIMESTAMP
WHERE "lastSignedIn" IS NULL;
-- AlterTable
ALTER TABLE "Secrets" ALTER COLUMN "lastSignedIn" SET NOT NULL,
ALTER COLUMN "lastSignedIn" SET DEFAULT CURRENT_TIMESTAMP;
+6 -6
View File
@@ -35,16 +35,16 @@ model User {
} }
model Secrets { model Secrets {
id String @id @default(cuid()) id String @id @default(cuid())
password String? password String?
lastSignedIn DateTime? lastSignedIn DateTime @default(now())
verificationToken String? verificationToken String?
twoFactorSecret String? twoFactorSecret String?
twoFactorBackupCodes String[] @default([]) twoFactorBackupCodes String[] @default([])
refreshToken String? refreshToken String?
resetToken String? @unique resetToken String? @unique
userId String @unique userId String @unique
user User @relation(fields: [userId], references: [id], onDelete: Cascade) user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@unique([userId, id]) @@unique([userId, id])
} }