diff --git a/.woodpecker.yml b/.woodpecker.yml new file mode 100644 index 0000000..22aeb3f --- /dev/null +++ b/.woodpecker.yml @@ -0,0 +1,22 @@ +steps: + build: + image: node:20 + commands: + - npm install -g pnpm + - pnpm install + - pnpm run build + + deploy: + image: alpine + environment: + BASE_URL: /ddr + commands: + - apk add rsync openssh + - echo "$${SSH_SECRET_KEY}" > SSH_SECRET_KEY + - chmod 600 SSH_SECRET_KEY + - mkdir -p ~/.ssh + - echo "mzhang.io ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO+RKFYjD8UjqhfOHFHNyijkbGzC4fJEIIhrBwHj+FsQ" >> ~/.ssh/known_hosts + - rsync -azrP -e "ssh -i SSH_SECRET_KEY" dist/ blogDeploy@mzhang.io:/home/blogDeploy/public/ddr + secrets: [SSH_SECRET_KEY] + when: + branch: master diff --git a/src/App.tsx b/src/App.tsx index 766137b..87e3349 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -19,18 +19,23 @@ import styles from "./App.module.scss"; import Scores from "./pages/Scores"; import Settings from "./pages/Settings"; -const router = createBrowserRouter([ +const router = createBrowserRouter( + [ + { + path: "/", + element: , + children: [ + { path: "", loader: () => redirect("/charts") }, + { path: "charts", element: , handle: { navId: 0 } }, + { path: "scores", element: , handle: { navId: 1 } }, + { path: "settings", element: , handle: { navId: 2 } }, + ], + }, + ], { - path: "/", - element: , - children: [ - { path: "", loader: () => redirect("/charts") }, - { path: "charts", element: , handle: { navId: 0 } }, - { path: "scores", element: , handle: { navId: 1 } }, - { path: "settings", element: , handle: { navId: 2 } }, - ], + basename: import.meta.env.BASE_URL, }, -]); +); export function AppWrapper() { const navigate = useNavigate(); diff --git a/tsconfig.json b/tsconfig.json index 232a9ff..9893779 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,3 +1,7 @@ { - "compilerOptions": { "jsx": "react-jsx" } + "compilerOptions": { + "jsx": "react-jsx", + "module": "ESNext", + "moduleResolution": "Node" + } } diff --git a/vite.config.ts b/vite.config.ts index 51f2a3b..0f58d65 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -4,6 +4,7 @@ import { VitePWA } from "vite-plugin-pwa"; import basicSsl from "@vitejs/plugin-basic-ssl"; export default defineConfig({ + base: process.env.BASE_URL ?? undefined, server: { https: {}, },