Skip to content

Commit 8a1c3c6

Browse files
authored
Merge pull request #22 from TEAM-COMFIT/init/#17/api-initial-setting
[Init] swagger-typescript-api ๋ฐ axios ์ดˆ๊ธฐ ์„ธํŒ…
2 parents 3e2af3c + 7edd120 commit 8a1c3c6

26 files changed

Lines changed: 1728 additions & 158 deletions

โ€Ž.prettierignoreโ€Ž

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,9 @@ package-lock.json
3737
# OS
3838
.DS_Store
3939
Thumbs.db
40+
41+
# swagger-typescript-api templates
42+
src/shared/api/generate/templates/**
43+
*.ejs
44+
4045
README.md

โ€Žeslint.config.jsโ€Ž

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,16 @@ import eslintConfigPrettier from "eslint-config-prettier";
1212
import react from "eslint-plugin-react";
1313

1414
export default defineConfig([
15-
{ ignores: ["dist", "node_modules", "build", "*.config.js", "*.config.ts"] },
15+
{
16+
ignores: [
17+
"dist",
18+
"node_modules",
19+
"build",
20+
"*.config.js",
21+
"*.config.ts",
22+
"**/*.ejs",
23+
],
24+
},
1625

1726
importPlugin.flatConfigs.recommended,
1827
importPlugin.flatConfigs.typescript,

โ€Žpackage.jsonโ€Ž

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"preview": "vite preview",
1111
"prepare": "husky",
1212
"storybook": "storybook dev -p 6006",
13-
"build-storybook": "storybook build"
13+
"build-storybook": "storybook build",
14+
"gen:swagger-ts-api": "dotenv -f .env cross-var -- swagger-typescript-api generate -p %SWAGGER_URL% -o ./src/shared/api/generate -n http-client.ts --extract-request-body --extract-response-body --axios -t ./src/shared/api/generate/templates --module-name-index 2"
1415
},
1516
"lint-staged": {
1617
"*.{ts,tsx,js,jsx}": [
@@ -22,6 +23,7 @@
2223
]
2324
},
2425
"dependencies": {
26+
"axios": "^1.13.2",
2527
"@tanstack/react-query": "^5.90.16",
2628
"@vanilla-extract/css": "^1.18.0",
2729
"@vanilla-extract/vite-plugin": "^5.1.4",
@@ -44,6 +46,8 @@
4446
"@typescript-eslint/eslint-plugin": "^8.51.0",
4547
"@typescript-eslint/parser": "^8.51.0",
4648
"@vitejs/plugin-react-swc": "^4.2.2",
49+
"cross-var": "^1.1.0",
50+
"dotenv-cli": "^11.0.0",
4751
"eslint": "^9.39.1",
4852
"eslint-config-prettier": "^10.1.8",
4953
"eslint-plugin-import": "^2.32.0",
@@ -57,7 +61,6 @@
5761
"lint-staged": "^16.2.7",
5862
"storybook": "^10.1.11",
5963
"prettier": "3.7.4",
60-
"storybook": "^10.1.11",
6164
"typescript": "~5.9.3",
6265
"typescript-eslint": "^8.46.4",
6366
"vite": "^7.2.4",

โ€Žpnpm-lock.yamlโ€Ž

Lines changed: 1292 additions & 94 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

โ€Žsrc/app/App.tsxโ€Ž

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
import { RouterProvider } from "react-router-dom";
22

3-
import ThemeProvider from "./providers";
43
import { router } from "./routes/app-router";
54

65
const App = () => {
7-
return (
8-
<ThemeProvider>
9-
<RouterProvider router={router} />
10-
</ThemeProvider>
11-
);
6+
return <RouterProvider router={router} />;
127
};
138

149
export default App;

โ€Žsrc/app/main.tsxโ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { StrictMode } from "react";
22
import { createRoot } from "react-dom/client";
33

44
import App from "@app/App";
5-
import AppProviders from "@app/providers";
5+
import { AppProviders } from "@app/providers";
66

77
import "@app/styles/global.css";
88

โ€Žsrc/app/providers/index.tsโ€Ž

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,22 @@
1-
import type { PropsWithChildren } from "react";
1+
import { QueryProvider } from "./query-provider";
2+
import ThemeProvider from "./theme-provider";
23

3-
import QueryProvider from "./query-provider";
4+
import type { ReactNode } from "react";
45

5-
export default function AppProviders({ children }: PropsWithChildren) {
6-
return <QueryProvider>{children}</QueryProvider>;
7-
}
6+
export const AppProviders = ({
7+
theme,
8+
className,
9+
children,
10+
}: {
11+
children: ReactNode;
12+
theme?: string;
13+
className?: string;
14+
}) => {
15+
return (
16+
<QueryProvider>
17+
<ThemeProvider theme={theme} className={className}>
18+
{children}
19+
</ThemeProvider>
20+
</QueryProvider>
21+
);
22+
};
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
1-
import type { PropsWithChildren } from "react";
2-
import { Suspense, lazy } from "react";
31
import { QueryClientProvider } from "@tanstack/react-query";
2+
import { Suspense, lazy } from "react";
43

54
import { queryClient } from "@/shared/api";
65

6+
import type { PropsWithChildren } from "react";
7+
78
const ReactQueryDevtools = import.meta.env.DEV
89
? lazy(async () => {
910
const mod = await import("@tanstack/react-query-devtools");
1011
return { default: mod.ReactQueryDevtools };
1112
})
1213
: null;
1314

14-
export default function QueryProvider({ children }: PropsWithChildren) {
15+
export const QueryProvider = ({ children }: PropsWithChildren) => {
1516
return (
1617
<QueryClientProvider client={queryClient}>
1718
{children}
@@ -23,4 +24,4 @@ export default function QueryProvider({ children }: PropsWithChildren) {
2324
) : null}
2425
</QueryClientProvider>
2526
);
26-
}
27+
};

โ€Žsrc/app/store/index.tsโ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export { useAuthStore } from '@shared/model/auth';
1+
export { useAuthStore } from "@shared/model/auth";

0 commit comments

Comments
ย (0)