diff --git a/app/login/page.tsx b/app/login/page.tsx index 276cbbb..ff5dc6e 100644 --- a/app/login/page.tsx +++ b/app/login/page.tsx @@ -1,5 +1,6 @@ "use client"; import { useSession, signIn, signOut } from "next-auth/react"; +import Image from "next/image"; export default function LoginPage() { const { data: session } = useSession(); @@ -8,7 +9,7 @@ export default function LoginPage() { return ( <>

Welcome, {session?.user?.name}

- photo + photo

Signed in as {session?.user?.email}

diff --git a/components/svgs/codewars/index.tsx b/components/svgs/codewars/index.tsx index 2cddb8e..8e6e1eb 100644 --- a/components/svgs/codewars/index.tsx +++ b/components/svgs/codewars/index.tsx @@ -1,11 +1,11 @@ -import * as Icons from "@components/icons"; +import * as Icons from "@/components/icons"; import { Document, DocumentTitle, List, ListItem, -} from "@components/svgs/document"; -import { ObjectEntries } from "@utils"; +} from "@/components/svgs/document"; +import { ObjectEntries } from "@/utils"; export const getUser = (result: any, platform: any) => { const langs = ObjectEntries(result.ranks.languages).map(([key, value]) => ({ diff --git a/components/svgs/github/index.tsx b/components/svgs/github/index.tsx index 1e028aa..a40e43f 100644 --- a/components/svgs/github/index.tsx +++ b/components/svgs/github/index.tsx @@ -1,10 +1,10 @@ -import * as Icons from "@components/icons"; +import * as Icons from "@/components/icons"; import { Document, DocumentTitle, List, ListItem, -} from "@components/svgs/document"; +} from "@/components/svgs/document"; export const getCurrentYearContributions = (result: any, platform: any) => { const { totalContributions } = diff --git a/components/svgs/stackoverflow/index.tsx b/components/svgs/stackoverflow/index.tsx index 07bacc9..1e8f325 100644 --- a/components/svgs/stackoverflow/index.tsx +++ b/components/svgs/stackoverflow/index.tsx @@ -3,8 +3,8 @@ import { DocumentTitle, List, ListItem, -} from "@components/svgs/document"; -import * as Icons from "@components/icons"; +} from "@/components/svgs/document"; +import * as Icons from "@/components/icons"; export const getReputation = (result: any, platform: any) => { return ( diff --git a/components/svgs/wakatime/index.tsx b/components/svgs/wakatime/index.tsx index 16e8fc0..5e8ee91 100644 --- a/components/svgs/wakatime/index.tsx +++ b/components/svgs/wakatime/index.tsx @@ -3,8 +3,8 @@ import { DocumentTitle, List, ListItem, -} from "@components/svgs/document"; -import * as Icons from "@components/icons"; +} from "@/components/svgs/document"; +import * as Icons from "@/components/icons"; export const getAllTimeSinceToday = (result: any, platform: any) => { return ( diff --git a/pages/api/auth/[...nextauth].ts b/pages/api/auth/[...nextauth].ts index 15fa25e..5bdc716 100644 --- a/pages/api/auth/[...nextauth].ts +++ b/pages/api/auth/[...nextauth].ts @@ -1,7 +1,7 @@ import NextAuth from "next-auth"; import { PrismaAdapter } from "@next-auth/prisma-adapter"; -import prisma from "@services/prisma"; -import callbacks from "@services/nextauth/callbacks"; +import prisma from "@/services/prisma"; +import callbacks from "@/services/nextauth/callbacks"; import GithubProvider from "next-auth/providers/github"; const { GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET } = process.env; diff --git a/pages/api/data/[service].ts b/pages/api/data/[service].ts index b3e44aa..312dbc3 100644 --- a/pages/api/data/[service].ts +++ b/pages/api/data/[service].ts @@ -1,10 +1,10 @@ import { NextApiRequest, NextApiResponse } from "next"; import { Session, unstable_getServerSession } from "next-auth"; -import { authOptions } from "@pages/api/auth/[...nextauth]"; -import * as services from "@services/data"; +import { authOptions } from "@/pages/api/auth/[...nextauth]"; +import * as services from "@/services/data"; -import methods from "@services/data/methods"; -import type * as methodTypes from "@services/data"; +import methods from "@/services/data/methods"; +import type * as methodTypes from "@/services/data"; export default async function handler( req: NextApiRequest, diff --git a/pages/api/oauth/[...route].ts b/pages/api/oauth/[...route].ts index adce828..91453eb 100644 --- a/pages/api/oauth/[...route].ts +++ b/pages/api/oauth/[...route].ts @@ -1,10 +1,10 @@ import { NextApiRequest, NextApiResponse } from "next"; import { unstable_getServerSession } from "next-auth"; -import { generateRandomString } from "@utils"; -import { authOptions } from "@pages/api/auth/[...nextauth]"; +import { generateRandomString } from "@/utils"; +import { authOptions } from "@/pages/api/auth/[...nextauth]"; -import { providers } from "@services/oauth"; -import actions from "@services/oauth/actions"; +import { providers } from "@/services/oauth"; +import actions from "@/services/oauth/actions"; export default async function handler( req: NextApiRequest, diff --git a/pages/api/platform/codewars.ts b/pages/api/platform/codewars.ts index 8adab84..effb554 100644 --- a/pages/api/platform/codewars.ts +++ b/pages/api/platform/codewars.ts @@ -1,5 +1,5 @@ -import * as services from "@services/platform/codewars"; -import * as templates from "@components/svgs/codewars"; +import * as services from "@/services/platform/codewars"; +import * as templates from "@/components/svgs/codewars"; -import handlePlatformAPI from "@services/api/handler"; +import handlePlatformAPI from "@/services/api/handler"; export default handlePlatformAPI("codewars", services, templates); diff --git a/pages/api/platform/github.ts b/pages/api/platform/github.ts index 5db025e..40694da 100644 --- a/pages/api/platform/github.ts +++ b/pages/api/platform/github.ts @@ -1,5 +1,5 @@ -import * as services from "@services/platform/github"; -import * as templates from "@components/svgs/github"; +import * as services from "@/services/platform/github"; +import * as templates from "@/components/svgs/github"; -import handlePlatformAPI from "@services/api/handler"; +import handlePlatformAPI from "@/services/api/handler"; export default handlePlatformAPI("github", services, templates); diff --git a/pages/api/platform/stackoverflow.ts b/pages/api/platform/stackoverflow.ts index 2f5658c..e917aeb 100644 --- a/pages/api/platform/stackoverflow.ts +++ b/pages/api/platform/stackoverflow.ts @@ -1,5 +1,5 @@ -import * as services from "@services/platform/stackoverflow"; -import * as templates from "@components/svgs/stackoverflow"; +import * as services from "@/services/platform/stackoverflow"; +import * as templates from "@/components/svgs/stackoverflow"; -import handlePlatformAPI from "@services/api/handler"; +import handlePlatformAPI from "@/services/api/handler"; export default handlePlatformAPI("stackoverflow", services, templates); diff --git a/pages/api/platform/wakatime.ts b/pages/api/platform/wakatime.ts index b647892..f6af576 100644 --- a/pages/api/platform/wakatime.ts +++ b/pages/api/platform/wakatime.ts @@ -1,5 +1,5 @@ -import * as services from "@services/platform/wakatime"; -import * as templates from "@components/svgs/wakatime"; +import * as services from "@/services/platform/wakatime"; +import * as templates from "@/components/svgs/wakatime"; -import handlePlatformAPI from "@services/api/handler"; +import handlePlatformAPI from "@/services/api/handler"; export default handlePlatformAPI("wakatime", services, templates); diff --git a/scripts/migrates/platform.ts b/scripts/migrates/platform.ts index 928c8f1..9321f44 100644 --- a/scripts/migrates/platform.ts +++ b/scripts/migrates/platform.ts @@ -1,6 +1,6 @@ import * as ts from "typescript"; import fs from "fs"; -import prisma from "@services/prisma"; +import prisma from "@/services/prisma"; // @ts-ignore import jsdoc from "jsdoc-api"; diff --git a/services/api/handler.ts b/services/api/handler.ts index cd95a62..b7f59a6 100644 --- a/services/api/handler.ts +++ b/services/api/handler.ts @@ -1,6 +1,6 @@ import { NextApiHandler, NextApiRequest, NextApiResponse } from "next"; -import { getPlatformResponse } from "@services/platform/response"; -import prisma from "@services/prisma"; +import { getPlatformResponse } from "@/services/platform/response"; +import prisma from "@/services/prisma"; type PlatformAPIHandler = { (platformCode: string, services: any, templates: any): NextApiHandler; diff --git a/services/data/config/index.ts b/services/data/config/index.ts index 634c1a5..ddd1e65 100644 --- a/services/data/config/index.ts +++ b/services/data/config/index.ts @@ -1,5 +1,5 @@ -import prisma from "@services/prisma"; -import { DataAPIMethod } from "@services/data/types"; +import prisma from "@/services/prisma"; +import { DataAPIMethod } from "@/services/data/types"; export const getUserConfigs: DataAPIMethod = ({ session }) => { return prisma.config.findMany({ diff --git a/services/data/platform/index.ts b/services/data/platform/index.ts index 6eb5eab..8bc063b 100644 --- a/services/data/platform/index.ts +++ b/services/data/platform/index.ts @@ -1,5 +1,5 @@ -import prisma from "@services/prisma"; -import { DataAPIPayload } from "@services/data/types"; +import prisma from "@/services/prisma"; +import { DataAPIPayload } from "@/services/data/types"; export const getPlatforms = ({ payload, session }: DataAPIPayload) => { return prisma.platform.findMany(); diff --git a/services/data/user/index.ts b/services/data/user/index.ts index 77aed76..d016ab3 100644 --- a/services/data/user/index.ts +++ b/services/data/user/index.ts @@ -1,5 +1,5 @@ -import prisma from "@services/prisma"; -import { DataAPIPayload } from "@services/data/types"; +import prisma from "@/services/prisma"; +import { DataAPIPayload } from "@/services/data/types"; export const getUser = async ({ payload, session }: DataAPIPayload) => { const user = await prisma.user.findFirst({ where: { id: session.user.id } }); diff --git a/services/nextauth/callbacks.ts b/services/nextauth/callbacks.ts index 344ac57..db768c3 100644 --- a/services/nextauth/callbacks.ts +++ b/services/nextauth/callbacks.ts @@ -1,4 +1,4 @@ -import prisma from "@services/prisma"; +import prisma from "@/services/prisma"; import { CallbacksOptions } from "next-auth"; const session: CallbacksOptions["session"] = async ({ session }) => { diff --git a/services/oauth/actions.ts b/services/oauth/actions.ts index 1dc6a65..5c2ea74 100644 --- a/services/oauth/actions.ts +++ b/services/oauth/actions.ts @@ -1,4 +1,4 @@ -import prisma from "@services/prisma"; +import prisma from "@/services/prisma"; import { AccessToken } from "simple-oauth2"; import { Session } from "next-auth"; import { Provider, ConnectionProfile } from "."; diff --git a/services/oauth/providers/github.ts b/services/oauth/providers/github.ts index 24ded7d..47ec63d 100644 --- a/services/oauth/providers/github.ts +++ b/services/oauth/providers/github.ts @@ -1,5 +1,5 @@ import { AuthorizationCode } from "simple-oauth2"; -import { Provider } from "@services/oauth"; +import { Provider } from "@/services/oauth"; const config: Provider = { code: "github", diff --git a/services/oauth/providers/stackoverflow.ts b/services/oauth/providers/stackoverflow.ts index 7d6134d..6dd638d 100644 --- a/services/oauth/providers/stackoverflow.ts +++ b/services/oauth/providers/stackoverflow.ts @@ -1,5 +1,5 @@ import { AuthorizationCode } from "simple-oauth2"; -import { Provider } from "@services/oauth"; +import { Provider } from "@/services/oauth"; const config: Provider = { code: "stackoverflow", diff --git a/services/oauth/providers/wakatime.ts b/services/oauth/providers/wakatime.ts index f00d127..2db9c7f 100644 --- a/services/oauth/providers/wakatime.ts +++ b/services/oauth/providers/wakatime.ts @@ -1,5 +1,5 @@ import { AuthorizationCode } from "simple-oauth2"; -import { Provider } from "@services/oauth"; +import { Provider } from "@/services/oauth"; const config: Provider = { code: "wakatime", diff --git a/services/platform/codewars/index.ts b/services/platform/codewars/index.ts index fedcfc5..88b0f2b 100644 --- a/services/platform/codewars/index.ts +++ b/services/platform/codewars/index.ts @@ -1,6 +1,6 @@ -import { ServiceResponse } from "@services/platform/types"; -import request from "@services/platform/codewars/request"; -import { CodewarsUserConfig } from "@services/platform/types"; +import { ServiceResponse } from "@/services/platform/types"; +import request from "@/services/platform/codewars/request"; +import { CodewarsUserConfig } from "@/services/platform/types"; import { Connection } from "@prisma/client"; /** diff --git a/services/platform/github/index.ts b/services/platform/github/index.ts index a99430a..203b127 100644 --- a/services/platform/github/index.ts +++ b/services/platform/github/index.ts @@ -1,6 +1,6 @@ -import { ServiceResponse } from "@services/platform/types"; -import request from "@services/platform/github/request"; -import { GithubUserConfig } from "@services/platform/types"; +import { ServiceResponse } from "@/services/platform/types"; +import request from "@/services/platform/github/request"; +import { GithubUserConfig } from "@/services/platform/types"; import { Connection } from "@prisma/client"; /** diff --git a/services/platform/index.ts b/services/platform/index.ts index c96da5d..4d6008a 100644 --- a/services/platform/index.ts +++ b/services/platform/index.ts @@ -2,4 +2,4 @@ export type { getCurrentYearContributions, getPopularContributions, getContributionsSummary, -} from "@services/platform/github"; +} from "@/services/platform/github"; diff --git a/services/platform/response.ts b/services/platform/response.ts index c3c88c9..1c7ee53 100644 --- a/services/platform/response.ts +++ b/services/platform/response.ts @@ -1,5 +1,5 @@ -import JSXRender from "@utils/render"; -import { trimChars } from "@utils"; +import JSXRender from "@/utils/render"; +import { trimChars } from "@/utils"; import { Connection } from "@prisma/client"; export const getPlatformResponse = async ( diff --git a/services/platform/stackoverflow/index.ts b/services/platform/stackoverflow/index.ts index 578eeac..68c044f 100644 --- a/services/platform/stackoverflow/index.ts +++ b/services/platform/stackoverflow/index.ts @@ -1,5 +1,5 @@ -import { ServiceResponse } from "@services/platform/types"; -import request from "@services/platform/stackoverflow/request"; +import { ServiceResponse } from "@/services/platform/types"; +import request from "@/services/platform/stackoverflow/request"; import { Connection } from "@prisma/client"; /** diff --git a/services/platform/wakatime/index.ts b/services/platform/wakatime/index.ts index 292a783..5b7aabc 100644 --- a/services/platform/wakatime/index.ts +++ b/services/platform/wakatime/index.ts @@ -1,6 +1,6 @@ -import { ServiceResponse } from "@services/platform/types"; -import request from "@services/platform/wakatime/request"; -import { WakatimeUserConfig } from "@services/platform/types"; +import { ServiceResponse } from "@/services/platform/types"; +import request from "@/services/platform/wakatime/request"; +import { WakatimeUserConfig } from "@/services/platform/types"; import { Connection } from "@prisma/client"; /** diff --git a/tsconfig.json b/tsconfig.json index e5a7fcb..348bbb5 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,11 @@ { "compilerOptions": { "target": "es5", - "lib": ["dom", "dom.iterable", "esnext"], + "lib": [ + "dom", + "dom.iterable", + "esnext" + ], "allowJs": true, "skipLibCheck": true, "strict": true, @@ -21,7 +25,9 @@ ], "baseUrl": ".", "paths": { - "@*": ["*"] + "@/*": [ + "*" + ] } }, "include": [ @@ -30,16 +36,20 @@ "index.d.ts", "**/*.ts", "**/*.tsx", - ".next/types/**/*.ts", "pages/api/github", "services/prisma/schema.prisma", - ".lintstagedrc.js" + ".lintstagedrc.js", + "/Users/samet/Documents/GitHub/devstats/.next/types/**/*.ts" + ], + "exclude": [ + "node_modules" ], - "exclude": ["node_modules"], "ts-node": { "compilerOptions": { "module": "commonjs" }, - "typeRoots": ["./node_modules/@types"] + "typeRoots": [ + "./node_modules/@types" + ] } }