From c924fd24f4e7d77f946b8b87a343dc415ca62728 Mon Sep 17 00:00:00 2001 From: Yarre Date: Fri, 29 Dec 2023 22:22:49 +0100 Subject: [PATCH] feat: deploy --- .github/workflows/deploy.yml | 51 +++++++++++++++++ index.html | 5 +- package.json | 2 +- src/App.tsx | 56 ++++++++++--------- src/assets/react.svg | 1 - src/main.tsx | 5 +- .../components/SidebarContainer/index.tsx | 0 .../components/SidebarContainer/styles.ts | 0 .../{Layout => layout}/components/index.ts | 0 .../containers/LayoutContainer/index.tsx | 0 .../containers/LayoutContainer/styles.ts | 0 .../{Layout => layout}/containers/index.ts | 0 src/modules/{Layout => layout}/index.ts | 0 tsconfig.json | 3 +- vite.config.ts | 1 + 15 files changed, 92 insertions(+), 32 deletions(-) create mode 100644 .github/workflows/deploy.yml delete mode 100644 src/assets/react.svg rename src/modules/{Layout => layout}/components/SidebarContainer/index.tsx (100%) rename src/modules/{Layout => layout}/components/SidebarContainer/styles.ts (100%) rename src/modules/{Layout => layout}/components/index.ts (100%) rename src/modules/{Layout => layout}/containers/LayoutContainer/index.tsx (100%) rename src/modules/{Layout => layout}/containers/LayoutContainer/styles.ts (100%) rename src/modules/{Layout => layout}/containers/index.ts (100%) rename src/modules/{Layout => layout}/index.ts (100%) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..2a6f500 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,51 @@ +# Simple workflow for deploying static content to GitHub Pages +name: Deploy static content to Pages + +on: + # Runs on pushes targeting the default branch + push: + branches: ['main'] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets the GITHUB_TOKEN permissions to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow one concurrent deployment +concurrency: + group: 'pages' + cancel-in-progress: true + +jobs: + # Single deploy job since we're just deploying + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up Node + uses: actions/setup-node@v3 + with: + node-version: 18 + cache: 'npm' + - name: Install dependencies + run: npm install + - name: Build + run: npm run build + - name: Setup Pages + uses: actions/configure-pages@v3 + - name: Upload artifact + uses: actions/upload-pages-artifact@v2 + with: + # Upload dist repository + path: './dist' + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v2 \ No newline at end of file diff --git a/index.html b/index.html index 7a09b03..6d42f6a 100644 --- a/index.html +++ b/index.html @@ -4,14 +4,15 @@ - + - + + Manga Hub diff --git a/package.json b/package.json index 54ddc6e..ee93702 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "type": "module", "scripts": { "dev": "vite", - "build": "tsc && vite build", + "build": "vite build", "preview": "vite preview", "lint": "eslint --ext .js,.jsx,.ts,.tsx", "lint:fix": "eslint --ext .js,.jsx,.ts,.tsx --fix", diff --git a/src/App.tsx b/src/App.tsx index d525b47..e8f7917 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,40 +1,44 @@ -import { BrowserRouter, Route, Routes } from 'react-router-dom'; +import { useEffect } from 'react'; +import { Route, Routes, useNavigate } from 'react-router-dom'; -import { ROUTE } from './constants'; +import { ROUTE } from '@/constants'; +import GlobalStyles from '@/globals'; import { ChangePasswordContainer, ForgotPasswordContainer, SignInContainer, SignUpContainer, -} from './modules/auth'; -import { HomeContainer } from './modules/home'; -import { LayoutContainer } from './modules/layout'; -import { NotFoundContainer } from './modules/notFound'; - -import GlobalStyles from '@/globals'; +} from '@/modules/auth'; +import { HomeContainer } from '@/modules/home'; +// import { LayoutContainer } from '@/modules/layout'; +import { NotFoundContainer } from '@/modules/notFound'; const App = () => { + const navigate = useNavigate(); + + useEffect(() => { + navigate(ROUTE.HOME); + }, []); + return ( <> - - - }> - } /> - } /> - } /> - } - /> - } - /> - } /> - - - + + {/* }> */} + } /> + } /> + } /> + } + /> + } + /> + } /> + {/* */} + ); }; diff --git a/src/assets/react.svg b/src/assets/react.svg deleted file mode 100644 index 6c87de9..0000000 --- a/src/assets/react.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/main.tsx b/src/main.tsx index 5e9eaca..7eec4b0 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -1,8 +1,11 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; +import { HashRouter } from 'react-router-dom'; import App from './App'; ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render( - , + + + , ); diff --git a/src/modules/Layout/components/SidebarContainer/index.tsx b/src/modules/layout/components/SidebarContainer/index.tsx similarity index 100% rename from src/modules/Layout/components/SidebarContainer/index.tsx rename to src/modules/layout/components/SidebarContainer/index.tsx diff --git a/src/modules/Layout/components/SidebarContainer/styles.ts b/src/modules/layout/components/SidebarContainer/styles.ts similarity index 100% rename from src/modules/Layout/components/SidebarContainer/styles.ts rename to src/modules/layout/components/SidebarContainer/styles.ts diff --git a/src/modules/Layout/components/index.ts b/src/modules/layout/components/index.ts similarity index 100% rename from src/modules/Layout/components/index.ts rename to src/modules/layout/components/index.ts diff --git a/src/modules/Layout/containers/LayoutContainer/index.tsx b/src/modules/layout/containers/LayoutContainer/index.tsx similarity index 100% rename from src/modules/Layout/containers/LayoutContainer/index.tsx rename to src/modules/layout/containers/LayoutContainer/index.tsx diff --git a/src/modules/Layout/containers/LayoutContainer/styles.ts b/src/modules/layout/containers/LayoutContainer/styles.ts similarity index 100% rename from src/modules/Layout/containers/LayoutContainer/styles.ts rename to src/modules/layout/containers/LayoutContainer/styles.ts diff --git a/src/modules/Layout/containers/index.ts b/src/modules/layout/containers/index.ts similarity index 100% rename from src/modules/Layout/containers/index.ts rename to src/modules/layout/containers/index.ts diff --git a/src/modules/Layout/index.ts b/src/modules/layout/index.ts similarity index 100% rename from src/modules/Layout/index.ts rename to src/modules/layout/index.ts diff --git a/tsconfig.json b/tsconfig.json index d3e183e..c402710 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -17,8 +17,9 @@ "noUnusedLocals": true, "noUnusedParameters": true, "noFallthroughCasesInSwitch": true, + "baseUrl": ".", "paths": { - "@/*": ["./src/*"] + "@/*": ["src/*"] }, "allowJs": true, "incremental": true, diff --git a/vite.config.ts b/vite.config.ts index 7356b7a..595f8b5 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -5,4 +5,5 @@ import tsconfigPaths from 'vite-tsconfig-paths'; // https://vitejs.dev/config/ export default defineConfig({ plugins: [react(), tsconfigPaths()], + base: '/manga-hub/', });