fix ci
continuous-integration/drone/push Build is passing Details

maxime 1 year ago
parent 3beff7e972
commit 98aef3fd3a

@ -1,6 +1,6 @@
module.exports = {
root: true,
env: { browser: true, es2023: true },
env: { browser: true, es2021: true },
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",

@ -3,45 +3,41 @@ type: docker
name: "CI and Deploy on maxou.dev"
volumes:
- name: server
temp: {}
- name: server
temp: { }
trigger:
event:
- push
event:
- push
steps:
- image: node:latest
name: "front CI"
commands:
- npm install
- npm run tsc
# - image: node:latest
# name: "build node"
# volumes: &outputs
# - name: server
# path: /outputs
# depends_on:
# - "front CI"
# commands:
# - curl -L moshell.dev/setup.sh > /tmp/moshell_setup.sh
# - chmod +x /tmp/moshell_setup.sh
# - echo n | /tmp/moshell_setup.sh
# - echo "VITE_API_ENDPOINT=/IQBall/$DRONE_BRANCH/public/api" >> .env.PROD
# - echo "VITE_BASE=/IQBall/$DRONE_BRANCH/public" >> .env.PROD
# - apt update && apt install jq -y
# -
# - BASE="/IQBall/$DRONE_BRANCH/public" OUTPUT=/outputs /root/.local/bin/moshell ci/build_react.msh
##
# - image: eeacms/rsync:latest
# name: Deliver on staging server branch
# depends_on:
# - "prepare php"
# - "build node"
# volumes: *outputs
# environment:
# SERVER_PRIVATE_KEY:
# from_secret: SERVER_PRIVATE_KEY
# commands:
# - chmod +x ci/deploy.sh
# - ci/deploy.sh
- image: node:latest
name: "front CI"
commands:
- npm install
- npm run tsc
- image: node:latest
name: "build react"
volumes: &outputs
- name: server
path: /outputs
depends_on:
- "front CI"
commands:
- sed -Ei "s/VITE_BASE=/VITE_BASE=\\/${DRONE_BRANCH}/g" .env
- npm run build -- --base=/$DRONE_BRANCH
- mv dist/* /outputs
- image: eeacms/rsync:latest
name: Deliver on staging server branch
depends_on:
- "build react"
volumes: *outputs
environment:
SERVER_PRIVATE_KEY:
from_secret: SERVER_PRIVATE_KEY
commands:
- chmod +x ci/deploy.sh
- ci/deploy.sh

@ -1,8 +1,9 @@
set -e
export OUTPUT=$1
export BASE=$2
rm -rf $OUTPUT/*
rm -rf "$OUTPUT"/*
echo "VITE_API_ENDPOINT=$BASE/api" >> .env.PROD
echo "VITE_BASE=$BASE" >> .env.PROD

@ -5,7 +5,7 @@ echo "$SERVER_PRIVATE_KEY" > ~/.ssh/id_rsa
chmod 0600 ~/.ssh
chmod 0500 ~/.ssh/id_rsa*
SERVER_ROOT=/srv/www/IQBall
SERVER_ROOT=/srv/www/iqball
ssh -p 80 -o 'StrictHostKeyChecking=no' iqball@maxou.dev mkdir -p $SERVER_ROOT/$DRONE_BRANCH
rsync -avz -e "ssh -p 80 -o 'StrictHostKeyChecking=no'" --delete /outputs/* iqball@maxou.dev:$SERVER_ROOT/$DRONE_BRANCH

@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/src/assets/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
<title>IQBall</title>
</head>
<body>
<div id="root"></div>

@ -3,6 +3,7 @@ import { BrowserRouter, Outlet, Route, Routes } from "react-router-dom"
import { Header } from "./pages/template/Header.tsx"
import "./style/app.css"
import { lazy } from "react"
import { BASE } from "./Constants.ts"
const HomePage = lazy(() => import("./pages/HomePage.tsx"))
const LoginPage = lazy(() => import("./pages/LoginPage.tsx"))
@ -18,38 +19,41 @@ export default function App() {
<div id="app">
<BrowserRouter>
<Outlet />
<Routes>
<Route path={"/login"} element={<LoginPage />} />
<Route path={"/register"} element={<RegisterPage />} />
<Route path={BASE}>
<Route path={"login"} element={<LoginPage />} />
<Route path={"register"} element={<RegisterPage />} />
<Route path={"/"} element={<AppLayout />}>
<Route path={"/"} element={<HomePage />} />
<Route path={"/home"} element={<HomePage />} />
<Route path={""} element={<AppLayout />}>
<Route path={""} element={<HomePage />} />
<Route path={"home"} element={<HomePage />} />
<Route
path={"/team/new"}
element={<CreateTeamPage />}
/>
<Route
path={"/team/:teamId"}
element={<TeamPanelPage />}
/>
<Route
path={"/tactic/new"}
element={<NewTacticPage />}
/>
<Route
path={"/tactic/:tacticId/edit"}
element={<Editor guestMode={false} />}
/>
<Route
path={"/tactic/edit-guest"}
element={<Editor guestMode={true} />}
/>
<Route
path={"team/new"}
element={<CreateTeamPage />}
/>
<Route
path={"team/:teamId"}
element={<TeamPanelPage />}
/>
<Route
path={"tactic/new"}
element={<NewTacticPage />}
/>
<Route
path={"tactic/:tacticId/edit"}
element={<Editor guestMode={false} />}
/>
<Route
path={"tactic/edit-guest"}
element={<Editor guestMode={true} />}
/>
<Route path={"*"} element={<NotFoundPage />} />
<Route path={"*"} element={<NotFoundPage />} />
</Route>
</Route>
</Routes>
</BrowserRouter>
</div>

@ -27,7 +27,7 @@ export default function LoginApp() {
if (response.ok) {
const session = getSession()
const { token, expirationDate } = await response.json()
saveSession({ ...session, auth: { token, expirationDate } })
saveSession({ ...session, auth: { token, expirationDate }, urlTarget: undefined })
redirect(session.urlTarget ?? "/")
return
}

@ -43,7 +43,7 @@ export default function RegisterPage() {
if (response.ok) {
const { token, expirationDate } = await response.json()
const session = getSession()
saveSession({ ...session, auth: { token, expirationDate } })
saveSession({ ...session, auth: { token, expirationDate }, urlTarget: undefined })
redirect(session.urlTarget ?? "/")
return
}

@ -6,7 +6,7 @@ import svgr from "vite-plugin-svgr"
// https://vitejs.dev/config/
export default defineConfig({
build: {
target: "es2023",
target: "es2021",
},
plugins: [
react(),

Loading…
Cancel
Save