diff --git a/bun.lockb b/bun.lockb --- a/bun.lockb +++ b/bun.lockb diff --git a/package.json b/package.json --- a/package.json +++ b/package.json @@ -17,20 +17,21 @@ "dependencies": { "chart.js": "^4.4.6", "mongodb": "^6.10.0", - "nuxt": "^3.13.2", + "nuxt": "^3.14.159", "vue": "^3.5.12", - "vue-chartjs": "^5.3.1", + "vue-chartjs": "^5.3.2", "vue-router": "^4.4.5" }, "devDependencies": { "@biomejs/biome": "1.9.4", "@iconify-json/akar-icons": "^1.2.1", + "@iconify-json/ep": "^1.2.1", "@iconify-json/ic": "^1.2.1", "@iconify-json/mdi": "^1.2.1", "@iconify-json/ph": "^1.2.1", "@nuxt/icon": "^1.6.1", "@nuxtjs/tailwindcss": "^6.12.2", - "@vueuse/nuxt": "^11.1.0", + "@vueuse/nuxt": "^11.2.0", "nuxt-posthog": "^1.5.4" } } diff --git a/utils/date.ts b/utils/date.ts deleted file mode 100644 --- a/utils/date.ts +++ /dev/null @@ -1,12 +0,0 @@ -export function dateToKey(date: Date): string { - return `${date.getUTCFullYear()}-${date.getUTCMonth() + 1}-${date.getUTCDate()}`; -} - -export function dateToFormatted(date: Date): string { - return `${date.getUTCFullYear()} ${date.getUTCMonth() + 1} ${date.getUTCDate()}`; -} - -export function keyToDate(key: string): Date { - const [year, month, day] = key.split("-").map(Number); - return new Date(Date.UTC(year as number, (month as number) - 1, day)); -} diff --git a/utils/modrinthFetch.ts b/utils/modrinthFetch.ts deleted file mode 100644 --- a/utils/modrinthFetch.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { ofetch } from "ofetch"; - -export const $modrinthFetch = ofetch.create({ - headers: { "User-Agent": "ToBinio/modrinth-statistics" }, - baseURL: "https://api.modrinth.com/v2/", -}); - -export const $modrinthV3Fetch = ofetch.create({ - headers: { "User-Agent": "ToBinio/modrinth-statistics" }, - baseURL: "https://api.modrinth.com/v3/", -}); diff --git a/utils/project.ts b/utils/project.ts deleted file mode 100644 --- a/utils/project.ts +++ /dev/null @@ -1,15 +0,0 @@ -export type ProjectTypes = - | "mod" - | "plugin" - | "datapack" - | "shader" - | "resourcepack" - | "modpack"; -export const projectTypeList: ProjectTypes[] = [ - "mod", - "plugin", - "datapack", - "shader", - "resourcepack", - "modpack", -]; diff --git a/utils/text.ts b/utils/text.ts deleted file mode 100644 --- a/utils/text.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function firstLetterUpperCase(text: string): string { - return text.charAt(0).toUpperCase() + text.slice(1); -} diff --git a/shared/utils/date.ts b/shared/utils/date.ts new file mode 100644 --- /dev/null +++ b/shared/utils/date.ts @@ -0,0 +1,12 @@ +export function dateToKey(date: Date): string { + return `${date.getUTCFullYear()}-${date.getUTCMonth() + 1}-${date.getUTCDate()}`; +} + +export function dateToFormatted(date: Date): string { + return `${date.getUTCFullYear()} ${date.getUTCMonth() + 1} ${date.getUTCDate()}`; +} + +export function keyToDate(key: string): Date { + const [year, month, day] = key.split("-").map(Number); + return new Date(Date.UTC(year as number, (month as number) - 1, day)); +} diff --git a/shared/utils/modrinthFetch.ts b/shared/utils/modrinthFetch.ts new file mode 100644 --- /dev/null +++ b/shared/utils/modrinthFetch.ts @@ -0,0 +1,11 @@ +import {ofetch} from "ofetch"; + +export const $modrinthFetch = ofetch.create({ + headers: { "User-Agent": "ToBinio/modrinth-statistics" }, + baseURL: "https://api.modrinth.com/v2/", +}); + +export const $modrinthV3Fetch = ofetch.create({ + headers: { "User-Agent": "ToBinio/modrinth-statistics" }, + baseURL: "https://api.modrinth.com/v3/", +}); diff --git a/shared/utils/project.ts b/shared/utils/project.ts new file mode 100644 --- /dev/null +++ b/shared/utils/project.ts @@ -0,0 +1,15 @@ +export type ProjectTypes = + | "mod" + | "plugin" + | "datapack" + | "shader" + | "resourcepack" + | "modpack"; +export const projectTypeList: ProjectTypes[] = [ + "mod", + "plugin", + "datapack", + "shader", + "resourcepack", + "modpack", +]; diff --git a/shared/utils/text.ts b/shared/utils/text.ts new file mode 100644 --- /dev/null +++ b/shared/utils/text.ts @@ -0,0 +1,3 @@ +export function firstLetterUpperCase(text: string): string { + return text.charAt(0).toUpperCase() + text.slice(1); +} diff --git a/server/utils/export/globalStats.ts b/server/utils/export/globalStats.ts --- a/server/utils/export/globalStats.ts +++ b/server/utils/export/globalStats.ts @@ -1,6 +1,5 @@ import type { GlobalStats } from "~~/server/utils/processing/global/types"; import { getGlobalStats } from "~~/server/utils/storage"; -import { dateToFormatted, keyToDate } from "~~/utils/date"; export async function exportGlobalStatsOverTime( firstDateKey: string, diff --git a/server/utils/export/projectStats.ts b/server/utils/export/projectStats.ts --- a/server/utils/export/projectStats.ts +++ b/server/utils/export/projectStats.ts @@ -8,7 +8,6 @@ getLatestProjectStats, getProjectStats, } from "~~/server/utils/storage"; -import { dateToFormatted } from "~~/utils/date"; // maps database data to a format usable by the frontend function mapStats( diff --git a/server/utils/export/revenue.ts b/server/utils/export/revenue.ts --- a/server/utils/export/revenue.ts +++ b/server/utils/export/revenue.ts @@ -1,7 +1,4 @@ -import type { GlobalStats } from "~~/server/utils/processing/global/types"; import { getRevenue } from "~~/server/utils/processing/revenue"; -import { getGlobalStats } from "~~/server/utils/storage"; -import { dateToFormatted, keyToDate } from "~~/utils/date"; export async function exportRevenueStatsOverTime(): Promise { const statsOverTime: StatExport = { diff --git a/server/utils/processing/revenue.ts b/server/utils/processing/revenue.ts --- a/server/utils/processing/revenue.ts +++ b/server/utils/processing/revenue.ts @@ -1,6 +1,3 @@ -import revenue from "~~/server/api/stats/time/revenue"; -import { $modrinthV3Fetch } from "~~/utils/modrinthFetch"; - export async function getRevenue(): Promise { type RawRevenue = { time: number;