Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add services to architecture #38

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/env.ts → src/config/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,5 @@ function checkEnv() {
}

export const env = checkEnv();

export const isLocal = env.VITE_APP_ENV === "local";
5 changes: 1 addition & 4 deletions src/config/index.ts
Original file line number Diff line number Diff line change
@@ -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";
15 changes: 9 additions & 6 deletions src/main.tsx
Original file line number Diff line number Diff line change
@@ -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");

Expand All @@ -18,8 +19,10 @@ if (!root) {

createRoot(root).render(
<StrictMode>
<Providers>
<Router />
</Providers>
<ReactQueryProvider>
<SentryProvider>
<Router />
</SentryProvider>
</ReactQueryProvider>
</StrictMode>,
);
13 changes: 0 additions & 13 deletions src/providers/Providers.tsx

This file was deleted.

1 change: 0 additions & 1 deletion src/providers/index.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/router/components/RouterWrapper/index.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/router/components/index.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/router/constants/index.ts

This file was deleted.

5 changes: 0 additions & 5 deletions src/router/index.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/router/layouts/MainLayout/index.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/router/layouts/index.ts

This file was deleted.

16 changes: 0 additions & 16 deletions src/router/router.tsx

This file was deleted.

File renamed without changes.
2 changes: 1 addition & 1 deletion src/api/axios.ts → src/services/api/axios.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import axios from "axios";

import { env } from "~/env";
import { env } from "~/config";
import {
authHeaderInterceptor,
errorResponseInterceptor,
Expand Down
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions src/services/query/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./ReactQueryProvider";
5 changes: 5 additions & 0 deletions src/services/router/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export * from "./router";
export * from "./MainLayout";
export * from "./RouterWrapper";
export * from "./routes";
export * from "./types";
12 changes: 12 additions & 0 deletions src/services/router/router.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from "react";
import { BrowserRouter } from "react-router-dom";

import { GuestRouter } from "~/domains";

export const Router = () => {
return (
<BrowserRouter>
<GuestRouter />
</BrowserRouter>
);
};
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -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({
Expand Down
1 change: 1 addition & 0 deletions src/services/sentry/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./SentryProvider";
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
"~/*": ["*"]
},

Expand Down
20 changes: 20 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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") },
],
},
Expand Down