diff --git a/src/env.ts b/src/config/env.ts similarity index 96% rename from src/env.ts rename to src/config/env.ts index f894693..cab8955 100644 --- a/src/env.ts +++ b/src/config/env.ts @@ -47,3 +47,5 @@ function checkEnv() { } export const env = checkEnv(); + +export const isLocal = env.VITE_APP_ENV === "local"; diff --git a/src/config/index.ts b/src/config/index.ts index 6af149a..562743a 100644 --- a/src/config/index.ts +++ b/src/config/index.ts @@ -1,6 +1,3 @@ -import { env } from "~/env"; - -export const isLocal = env.VITE_APP_ENV === "local"; - export * from "./common"; +export * from "./env"; export * from "./storybook"; diff --git a/src/main.tsx b/src/main.tsx index a5c905e..735d526 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -1,12 +1,13 @@ -import "~/config/providers/scripts/sentry"; +import "~/services/sentry/SentryInit"; import React, { StrictMode } from "react"; import { createRoot } from "react-dom/client"; import "./index.css"; -import { Providers } from "./providers"; -import { Router } from "./router"; +import { ReactQueryProvider } from "~/services/query"; +import { Router } from "~/services/router"; +import { SentryProvider } from "~/services/sentry"; const root = document.getElementById("root"); @@ -18,8 +19,10 @@ if (!root) { createRoot(root).render( - - - + + + + + , ); diff --git a/src/providers/Providers.tsx b/src/providers/Providers.tsx deleted file mode 100644 index ed683a8..0000000 --- a/src/providers/Providers.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import type { PropsWithChildren } from "react"; -import React from "react"; - -import { ReactQueryProvider } from "./ReactQueryProvider"; -import { SentryProvider } from "./sentry/SentryProvider"; - -export const Providers = ({ children }: PropsWithChildren) => { - return ( - - {children} - - ); -}; diff --git a/src/providers/index.ts b/src/providers/index.ts deleted file mode 100644 index 5dfd111..0000000 --- a/src/providers/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./Providers"; diff --git a/src/router/components/RouterWrapper/index.ts b/src/router/components/RouterWrapper/index.ts deleted file mode 100644 index 58dd800..0000000 --- a/src/router/components/RouterWrapper/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./RouterWrapper"; diff --git a/src/router/components/index.ts b/src/router/components/index.ts deleted file mode 100644 index 58dd800..0000000 --- a/src/router/components/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./RouterWrapper"; diff --git a/src/router/constants/index.ts b/src/router/constants/index.ts deleted file mode 100644 index 9bf9b1b..0000000 --- a/src/router/constants/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./routes"; diff --git a/src/router/index.ts b/src/router/index.ts deleted file mode 100644 index b6b4eeb..0000000 --- a/src/router/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -export * from "./router"; -export * from "./components"; -export * from "./constants"; -export * from "./layouts"; -export * from "./types"; diff --git a/src/router/layouts/MainLayout/index.ts b/src/router/layouts/MainLayout/index.ts deleted file mode 100644 index 1268cf9..0000000 --- a/src/router/layouts/MainLayout/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./MainLayout"; diff --git a/src/router/layouts/index.ts b/src/router/layouts/index.ts deleted file mode 100644 index 1268cf9..0000000 --- a/src/router/layouts/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./MainLayout"; diff --git a/src/router/router.tsx b/src/router/router.tsx deleted file mode 100644 index e335e3d..0000000 --- a/src/router/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import React from "react"; -import { BrowserRouter, Route, Routes } from "react-router-dom"; - -import { GuestRouter } from "~/domains"; -import { NotFound } from "~/sections"; - -export const Router = () => { - return ( - - - - } /> - - - ); -}; diff --git a/src/api/api.types.ts b/src/services/api/api.types.ts similarity index 100% rename from src/api/api.types.ts rename to src/services/api/api.types.ts diff --git a/src/api/axios.ts b/src/services/api/axios.ts similarity index 93% rename from src/api/axios.ts rename to src/services/api/axios.ts index c849f2b..ee4f727 100644 --- a/src/api/axios.ts +++ b/src/services/api/axios.ts @@ -1,6 +1,6 @@ import axios from "axios"; -import { env } from "~/env"; +import { env } from "~/config"; import { authHeaderInterceptor, errorResponseInterceptor, diff --git a/src/api/handleAxiosFieldErrors.ts b/src/services/api/handleAxiosFieldErrors.ts similarity index 100% rename from src/api/handleAxiosFieldErrors.ts rename to src/services/api/handleAxiosFieldErrors.ts diff --git a/src/api/index.ts b/src/services/api/index.ts similarity index 100% rename from src/api/index.ts rename to src/services/api/index.ts diff --git a/src/api/interceptors/authHeader.ts b/src/services/api/interceptors/authHeader.ts similarity index 100% rename from src/api/interceptors/authHeader.ts rename to src/services/api/interceptors/authHeader.ts diff --git a/src/api/interceptors/errorResponseInterceptors.ts b/src/services/api/interceptors/errorResponseInterceptors.ts similarity index 100% rename from src/api/interceptors/errorResponseInterceptors.ts rename to src/services/api/interceptors/errorResponseInterceptors.ts diff --git a/src/api/interceptors/index.ts b/src/services/api/interceptors/index.ts similarity index 100% rename from src/api/interceptors/index.ts rename to src/services/api/interceptors/index.ts diff --git a/src/api/interceptors/refreshToken.ts b/src/services/api/interceptors/refreshToken.ts similarity index 100% rename from src/api/interceptors/refreshToken.ts rename to src/services/api/interceptors/refreshToken.ts diff --git a/src/providers/ReactQueryProvider.tsx b/src/services/query/ReactQueryProvider.tsx similarity index 100% rename from src/providers/ReactQueryProvider.tsx rename to src/services/query/ReactQueryProvider.tsx diff --git a/src/services/query/index.ts b/src/services/query/index.ts new file mode 100644 index 0000000..5e9a785 --- /dev/null +++ b/src/services/query/index.ts @@ -0,0 +1 @@ +export * from "./ReactQueryProvider"; diff --git a/src/router/layouts/MainLayout/MainLayout.tsx b/src/services/router/MainLayout.tsx similarity index 100% rename from src/router/layouts/MainLayout/MainLayout.tsx rename to src/services/router/MainLayout.tsx diff --git a/src/router/components/RouterWrapper/RouterWrapper.tsx b/src/services/router/RouterWrapper.tsx similarity index 100% rename from src/router/components/RouterWrapper/RouterWrapper.tsx rename to src/services/router/RouterWrapper.tsx diff --git a/src/services/router/index.ts b/src/services/router/index.ts new file mode 100644 index 0000000..18a0067 --- /dev/null +++ b/src/services/router/index.ts @@ -0,0 +1,5 @@ +export * from "./router"; +export * from "./MainLayout"; +export * from "./RouterWrapper"; +export * from "./routes"; +export * from "./types"; diff --git a/src/services/router/router.tsx b/src/services/router/router.tsx new file mode 100644 index 0000000..a26f5eb --- /dev/null +++ b/src/services/router/router.tsx @@ -0,0 +1,12 @@ +import React from "react"; +import { BrowserRouter } from "react-router-dom"; + +import { GuestRouter } from "~/domains"; + +export const Router = () => { + return ( + + + + ); +}; diff --git a/src/router/constants/routes.ts b/src/services/router/routes.ts similarity index 100% rename from src/router/constants/routes.ts rename to src/services/router/routes.ts diff --git a/src/router/types/index.ts b/src/services/router/types.ts similarity index 100% rename from src/router/types/index.ts rename to src/services/router/types.ts diff --git a/src/providers/sentry/sentry.ts b/src/services/sentry/SentryInit.ts similarity index 91% rename from src/providers/sentry/sentry.ts rename to src/services/sentry/SentryInit.ts index 87ff5f9..6a47da6 100644 --- a/src/providers/sentry/sentry.ts +++ b/src/services/sentry/SentryInit.ts @@ -1,7 +1,6 @@ import * as Sentry from "@sentry/react"; -import { isLocal } from "~/config"; -import { env } from "~/env"; +import { env, isLocal } from "~/config"; if (!isLocal) { Sentry.init({ diff --git a/src/providers/sentry/SentryProvider.tsx b/src/services/sentry/SentryProvider.tsx similarity index 100% rename from src/providers/sentry/SentryProvider.tsx rename to src/services/sentry/SentryProvider.tsx diff --git a/src/services/sentry/index.ts b/src/services/sentry/index.ts new file mode 100644 index 0000000..d9fc189 --- /dev/null +++ b/src/services/sentry/index.ts @@ -0,0 +1 @@ +export * from "./SentryProvider"; diff --git a/src/stores/index.ts b/src/services/stores/index.ts similarity index 100% rename from src/stores/index.ts rename to src/services/stores/index.ts diff --git a/src/stores/useAuthStore.ts b/src/services/stores/useAuthStore.ts similarity index 100% rename from src/stores/useAuthStore.ts rename to src/services/stores/useAuthStore.ts diff --git a/src/stores/useExampleStore.ts b/src/services/stores/useExampleStore.ts similarity index 100% rename from src/stores/useExampleStore.ts rename to src/services/stores/useExampleStore.ts diff --git a/tsconfig.json b/tsconfig.json index fa56153..2ddf001 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -15,6 +15,11 @@ "~/icons": ["./shared/components/icons"], "~/sections": ["./shared/sections"], "~/utils": ["./shared/utils"], + "~/api": ["./services/api"], + "~/sentry": ["./services/sentry"], + "~/query": ["./services/query"], + "~/router": ["./services/router"], + "~/stores": ["./services/stores"], "~/*": ["*"] }, diff --git a/vite.config.ts b/vite.config.ts index c4938e2..5906ee4 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -59,6 +59,26 @@ const config = ({ mode }: ConfigEnv): UserConfigExport => { find: "~/utils", replacement: path.resolve(__dirname, "./src/shared/utils"), }, + { + find: "~/api", + replacement: path.resolve(__dirname, "./src/services/api"), + }, + { + find: "~/sentry", + replacement: path.resolve(__dirname, "./src/services/sentry"), + }, + { + find: "~/query", + replacement: path.resolve(__dirname, "./src/services/query"), + }, + { + find: "~/router", + replacement: path.resolve(__dirname, "./src/services/router"), + }, + { + find: "~/stores", + replacement: path.resolve(__dirname, "./src/services/stores"), + }, { find: "~", replacement: path.resolve(__dirname, "./src") }, ], },