mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2026-01-04 06:24:07 +08:00
chore: upgrade to vite 7 (@miodec) (#7051)
This commit is contained in:
parent
cd8ebd1430
commit
7e6a73aac2
13 changed files with 1794 additions and 1644 deletions
|
|
@ -75,7 +75,7 @@
|
|||
"@types/lodash": "4.14.178",
|
||||
"@types/mjml": "4.7.4",
|
||||
"@types/mustache": "4.2.2",
|
||||
"@types/node": "20.14.11",
|
||||
"@types/node": "24.9.1",
|
||||
"@types/nodemailer": "6.4.15",
|
||||
"@types/object-hash": "3.0.6",
|
||||
"@types/readline-sync": "1.4.8",
|
||||
|
|
@ -84,7 +84,7 @@
|
|||
"@types/swagger-stats": "0.95.11",
|
||||
"@types/ua-parser-js": "0.7.36",
|
||||
"@types/uuid": "10.0.0",
|
||||
"@vitest/coverage-v8": "3.2.4",
|
||||
"@vitest/coverage-v8": "4.0.4",
|
||||
"concurrently": "8.2.2",
|
||||
"eslint": "8.57.1",
|
||||
"eslint-watch": "8.0.0",
|
||||
|
|
@ -95,6 +95,6 @@
|
|||
"testcontainers": "11.4.0",
|
||||
"tsx": "4.16.2",
|
||||
"typescript": "5.5.4",
|
||||
"vitest": "3.2.4"
|
||||
"vitest": "4.0.4"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,9 +34,9 @@ describe("date-and-time", () => {
|
|||
it.for(testCases)(`$locale`, ({ locale, firstDayOfWeek }) => {
|
||||
//GIVEN
|
||||
languageMock.mockReturnValue(locale);
|
||||
localeMock.mockImplementationOnce(
|
||||
() => ({ weekInfo: { firstDay: firstDayOfWeek } } as any)
|
||||
);
|
||||
localeMock.mockImplementation(function (this: any) {
|
||||
return { weekInfo: { firstDay: firstDayOfWeek } } as any;
|
||||
});
|
||||
|
||||
//WHEN/THEN
|
||||
expect(DateAndTime.getFirstDayOfTheWeek()).toEqual(firstDayOfWeek);
|
||||
|
|
@ -46,18 +46,18 @@ describe("date-and-time", () => {
|
|||
describe("with getWeekInfo", () => {
|
||||
it("with getWeekInfo on monday", () => {
|
||||
languageMock.mockReturnValue("en-US");
|
||||
localeMock.mockImplementationOnce(
|
||||
() => ({ getWeekInfo: () => ({ firstDay: 1 }) } as any)
|
||||
);
|
||||
localeMock.mockImplementationOnce(function (this: any) {
|
||||
return { getWeekInfo: () => ({ firstDay: 1 }) } as any;
|
||||
});
|
||||
|
||||
//WHEN/THEN
|
||||
expect(DateAndTime.getFirstDayOfTheWeek()).toEqual(1);
|
||||
});
|
||||
it("with getWeekInfo on sunday", () => {
|
||||
languageMock.mockReturnValue("en-US");
|
||||
localeMock.mockImplementationOnce(
|
||||
() => ({ getWeekInfo: () => ({ firstDay: 7 }) } as any)
|
||||
);
|
||||
localeMock.mockImplementationOnce(function (this: any) {
|
||||
return { getWeekInfo: () => ({ firstDay: 7 }) } as any;
|
||||
});
|
||||
|
||||
//WHEN/THEN
|
||||
expect(DateAndTime.getFirstDayOfTheWeek()).toEqual(0);
|
||||
|
|
@ -66,7 +66,9 @@ describe("date-and-time", () => {
|
|||
|
||||
describe("without weekInfo (firefox)", () => {
|
||||
beforeEach(() => {
|
||||
localeMock.mockImplementationOnce(() => ({} as any));
|
||||
localeMock.mockImplementation(function (this: any) {
|
||||
return {} as any;
|
||||
});
|
||||
});
|
||||
|
||||
it.for(testCases)(
|
||||
|
|
|
|||
|
|
@ -41,11 +41,11 @@
|
|||
"@types/damerau-levenshtein": "1.0.0",
|
||||
"@types/howler": "2.2.7",
|
||||
"@types/jquery": "3.5.14",
|
||||
"@types/node": "20.14.11",
|
||||
"@types/node": "24.9.1",
|
||||
"@types/object-hash": "3.0.6",
|
||||
"@types/subset-font": "1.4.3",
|
||||
"@types/throttle-debounce": "5.0.2",
|
||||
"@vitest/coverage-v8": "3.2.4",
|
||||
"@vitest/coverage-v8": "4.0.4",
|
||||
"autoprefixer": "10.4.20",
|
||||
"concurrently": "8.2.2",
|
||||
"dotenv": "16.4.5",
|
||||
|
|
@ -64,16 +64,15 @@
|
|||
"tsx": "4.16.2",
|
||||
"typescript": "5.5.4",
|
||||
"unplugin-inject-preload": "3.0.0",
|
||||
"vite": "6.3.6",
|
||||
"vite-bundle-visualizer": "1.0.1",
|
||||
"vite-plugin-checker": "0.7.2",
|
||||
"vite": "7.1.12",
|
||||
"vite-bundle-visualizer": "1.2.1",
|
||||
"vite-plugin-checker": "0.11.0",
|
||||
"vite-plugin-filter-replace": "0.1.14",
|
||||
"vite-plugin-html-inject": "1.1.2",
|
||||
"vite-plugin-inspect": "11.0.0",
|
||||
"vite-plugin-inspect": "11.3.3",
|
||||
"vite-plugin-minify": "2.1.0",
|
||||
"vite-plugin-oxlint": "1.3.1",
|
||||
"vite-plugin-pwa": "1.0.0",
|
||||
"vitest": "3.2.4"
|
||||
"vite-plugin-pwa": "1.1.0",
|
||||
"vitest": "4.0.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"@date-fns/utc": "1.2.0",
|
||||
|
|
|
|||
|
|
@ -54,13 +54,15 @@ export async function init(callback: ReadyCallback): Promise<void> {
|
|||
try {
|
||||
let firebaseConfig: FirebaseOptions | null;
|
||||
|
||||
const constants = import.meta.glob("./constants/*.ts");
|
||||
const constants = import.meta.glob("./constants/firebase-config*.ts");
|
||||
const loader = constants["./constants/firebase-config.ts"];
|
||||
if (loader) {
|
||||
firebaseConfig = ((await loader()) as { firebaseConfig: FirebaseOptions })
|
||||
.firebaseConfig;
|
||||
} else {
|
||||
throw new Error("No firebase config found.");
|
||||
throw new Error(
|
||||
"No config file found. Make sure frontend/src/ts/constants/firebase-config.ts exists"
|
||||
);
|
||||
}
|
||||
|
||||
readyCallback = callback;
|
||||
|
|
@ -79,12 +81,11 @@ export async function init(callback: ReadyCallback): Promise<void> {
|
|||
} catch (e) {
|
||||
app = undefined;
|
||||
Auth = undefined;
|
||||
console.error("Authentication failed to initialize", e);
|
||||
console.error("Firebase failed to initialize", e);
|
||||
await callback(false, null);
|
||||
if (isDevEnvironment()) {
|
||||
Notifications.addPSA(
|
||||
createErrorMessage(e, "Authentication uninitialized") +
|
||||
" Check your firebase-config.ts",
|
||||
createErrorMessage(e, "Firebase uninitialized"),
|
||||
0,
|
||||
undefined,
|
||||
false
|
||||
|
|
|
|||
|
|
@ -514,7 +514,7 @@ export function isPasswordStrong(password: string): boolean {
|
|||
export function htmlToText(html: string): string {
|
||||
const el = document.createElement("div");
|
||||
el.innerHTML = html;
|
||||
return (el.textContent as string) || el.innerText || "";
|
||||
return el.textContent || el.innerText || "";
|
||||
}
|
||||
|
||||
export function loadCSS(href: string, prepend = false): void {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import { checker } from "vite-plugin-checker";
|
||||
import oxlintPlugin from "vite-plugin-oxlint";
|
||||
import Inspect from "vite-plugin-inspect";
|
||||
import path from "node:path";
|
||||
import { getFontsConig } from "./vite.config";
|
||||
|
|
@ -7,15 +6,14 @@ import { getFontsConig } from "./vite.config";
|
|||
/** @type {import("vite").UserConfig} */
|
||||
export default {
|
||||
plugins: [
|
||||
oxlintPlugin({
|
||||
configFile: path.resolve(__dirname, "./.oxlintrc.json"),
|
||||
}),
|
||||
checker({
|
||||
typescript: {
|
||||
tsconfigPath: path.resolve(__dirname, "./tsconfig.json"),
|
||||
},
|
||||
oxlint: true,
|
||||
eslint: {
|
||||
lintCommand: `eslint "${path.resolve(__dirname, "./src/ts/**/*.ts")}"`,
|
||||
watchPath: path.resolve(__dirname, "./src/"),
|
||||
},
|
||||
overlay: {
|
||||
initialIsOpen: false,
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@
|
|||
"@commitlint/cli": "17.7.1",
|
||||
"@commitlint/config-conventional": "19.2.2",
|
||||
"@monkeytype/release": "workspace:*",
|
||||
"@vitest/coverage-v8": "3.2.4",
|
||||
"@vitest/coverage-v8": "4.0.4",
|
||||
"conventional-changelog": "6.0.0",
|
||||
"eslint": "8.57.1",
|
||||
"husky": "8.0.1",
|
||||
|
|
@ -77,7 +77,7 @@
|
|||
"oxlint": "1.15.0",
|
||||
"prettier": "2.8.8",
|
||||
"turbo": "2.5.6",
|
||||
"vitest": "3.2.4"
|
||||
"vitest": "4.0.4"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{json,scss,css,html}": [
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
"oxlint": "1.15.0",
|
||||
"tsup": "8.4.0",
|
||||
"typescript": "5.5.4",
|
||||
"vitest": "3.2.4"
|
||||
"vitest": "4.0.4"
|
||||
},
|
||||
"exports": {
|
||||
".": {
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
"name": "@monkeytype/eslint-config",
|
||||
"private": true,
|
||||
"devDependencies": {
|
||||
"@typescript-eslint/eslint-plugin": "8.41.0",
|
||||
"@typescript-eslint/parser": "8.2.0",
|
||||
"@typescript-eslint/eslint-plugin": "8.46.2",
|
||||
"@typescript-eslint/parser": "8.46.2",
|
||||
"eslint-config-prettier": "9.1.0",
|
||||
"eslint-import-resolver-typescript": "3.6.1",
|
||||
"eslint-plugin-import": "2.29.0",
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
"oxlint": "1.15.0",
|
||||
"tsup": "8.4.0",
|
||||
"typescript": "5.5.4",
|
||||
"vitest": "3.2.4"
|
||||
"vitest": "4.0.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"@monkeytype/schemas": "workspace:*",
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
"oxlint": "1.15.0",
|
||||
"tsup": "8.4.0",
|
||||
"typescript": "5.5.4",
|
||||
"vitest": "3.2.4"
|
||||
"vitest": "4.0.4"
|
||||
},
|
||||
"exports": {
|
||||
".": {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
"oxlint": "1.15.0",
|
||||
"tsup": "8.4.0",
|
||||
"typescript": "5.5.4",
|
||||
"vitest": "3.2.4",
|
||||
"vitest": "4.0.4",
|
||||
"zod": "3.23.8"
|
||||
},
|
||||
"exports": {
|
||||
|
|
|
|||
3358
pnpm-lock.yaml
generated
3358
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue