Compare commits
4 Commits
0247f6ed9d
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
29d6ab3d80
|
|||
|
429eb07291
|
|||
|
092d537180
|
|||
|
61c1f47409
|
@ -1,153 +0,0 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { writeFile, readFile, mkdir } from "fs/promises";
|
||||
import { existsSync } from "fs";
|
||||
import path from "path";
|
||||
import { Client, ClientInput } from "@/lib/types/client";
|
||||
|
||||
const ADMIN_PASSWORD = process.env.ADMIN_PASSWORD || "admin123";
|
||||
const DATA_DIR = path.join(process.cwd(), "data");
|
||||
const CLIENTS_FILE = path.join(DATA_DIR, "clients.json");
|
||||
|
||||
function verifyAuth(request: NextRequest): boolean {
|
||||
const authHeader = request.headers.get("authorization");
|
||||
if (!authHeader) return false;
|
||||
|
||||
const token = authHeader.replace("Bearer ", "");
|
||||
return token === ADMIN_PASSWORD;
|
||||
}
|
||||
|
||||
async function loadClients(): Promise<Client[]> {
|
||||
try {
|
||||
if (!existsSync(CLIENTS_FILE)) {
|
||||
if (!existsSync(DATA_DIR)) {
|
||||
await mkdir(DATA_DIR, { recursive: true });
|
||||
}
|
||||
await writeFile(CLIENTS_FILE, JSON.stringify([], null, 2));
|
||||
return [];
|
||||
}
|
||||
|
||||
const data = await readFile(CLIENTS_FILE, "utf-8");
|
||||
return JSON.parse(data);
|
||||
} catch (error) {
|
||||
console.error("Erreur lecture clients:", error);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
async function saveClients(clients: Client[]): Promise<void> {
|
||||
try {
|
||||
if (!existsSync(DATA_DIR)) {
|
||||
await mkdir(DATA_DIR, { recursive: true });
|
||||
}
|
||||
await writeFile(CLIENTS_FILE, JSON.stringify(clients, null, 2));
|
||||
} catch (error) {
|
||||
console.error("Erreur sauvegarde clients:", error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
// GET - Récupérer un client par ID
|
||||
export async function GET(
|
||||
request: NextRequest,
|
||||
{ params }: { params: { id: string } }
|
||||
) {
|
||||
if (!verifyAuth(request)) {
|
||||
return NextResponse.json({ error: "Non autorisé" }, { status: 401 });
|
||||
}
|
||||
|
||||
try {
|
||||
const clients = await loadClients();
|
||||
const client = clients.find(c => c.id === params.id);
|
||||
|
||||
if (!client) {
|
||||
return NextResponse.json(
|
||||
{ error: "Client non trouvé" },
|
||||
{ status: 404 }
|
||||
);
|
||||
}
|
||||
|
||||
return NextResponse.json(client);
|
||||
} catch (error) {
|
||||
console.error("Erreur GET client:", error);
|
||||
return NextResponse.json(
|
||||
{ error: "Erreur serveur" },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// PUT - Mettre à jour un client
|
||||
export async function PUT(
|
||||
request: NextRequest,
|
||||
{ params }: { params: { id: string } }
|
||||
) {
|
||||
if (!verifyAuth(request)) {
|
||||
return NextResponse.json({ error: "Non autorisé" }, { status: 401 });
|
||||
}
|
||||
|
||||
try {
|
||||
const input: ClientInput = await request.json();
|
||||
const clients = await loadClients();
|
||||
const clientIndex = clients.findIndex(c => c.id === params.id);
|
||||
|
||||
if (clientIndex === -1) {
|
||||
return NextResponse.json(
|
||||
{ error: "Client non trouvé" },
|
||||
{ status: 404 }
|
||||
);
|
||||
}
|
||||
|
||||
// Mettre à jour le client
|
||||
const updatedClient: Client = {
|
||||
...clients[clientIndex],
|
||||
email: input.email || clients[clientIndex].email,
|
||||
bungalowNumber: input.bungalowNumber || clients[clientIndex].bungalowNumber,
|
||||
wifiName: input.wifiName || clients[clientIndex].wifiName,
|
||||
wifiPassword: input.wifiPassword || clients[clientIndex].wifiPassword,
|
||||
gerantMessage: input.gerantMessage || clients[clientIndex].gerantMessage,
|
||||
};
|
||||
|
||||
clients[clientIndex] = updatedClient;
|
||||
await saveClients(clients);
|
||||
|
||||
return NextResponse.json(updatedClient);
|
||||
} catch (error) {
|
||||
console.error("Erreur PUT client:", error);
|
||||
return NextResponse.json(
|
||||
{ error: "Erreur serveur" },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// DELETE - Supprimer un client
|
||||
export async function DELETE(
|
||||
request: NextRequest,
|
||||
{ params }: { params: { id: string } }
|
||||
) {
|
||||
if (!verifyAuth(request)) {
|
||||
return NextResponse.json({ error: "Non autorisé" }, { status: 401 });
|
||||
}
|
||||
|
||||
try {
|
||||
const clients = await loadClients();
|
||||
const filteredClients = clients.filter(c => c.id !== params.id);
|
||||
|
||||
if (filteredClients.length === clients.length) {
|
||||
return NextResponse.json(
|
||||
{ error: "Client non trouvé" },
|
||||
{ status: 404 }
|
||||
);
|
||||
}
|
||||
|
||||
await saveClients(filteredClients);
|
||||
return NextResponse.json({ success: true });
|
||||
} catch (error) {
|
||||
console.error("Erreur DELETE client:", error);
|
||||
return NextResponse.json(
|
||||
{ error: "Erreur serveur" },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -108,6 +108,7 @@ export async function POST(request: NextRequest) {
|
||||
wifiPassword: input.wifiPassword || "",
|
||||
gerantMessage: input.gerantMessage || "Bienvenue dans notre pension de famille !",
|
||||
createdAt: new Date().toISOString(),
|
||||
updatedAt: new Date().toISOString(),
|
||||
};
|
||||
|
||||
clients.push(newClient);
|
||||
|
||||
@ -1,55 +0,0 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { readFile } from "fs/promises";
|
||||
import { existsSync } from "fs";
|
||||
import path from "path";
|
||||
import { Client } from "@/lib/types/client";
|
||||
|
||||
const DATA_DIR = path.join(process.cwd(), "data");
|
||||
const CLIENTS_FILE = path.join(DATA_DIR, "clients.json");
|
||||
|
||||
async function loadClients(): Promise<Client[]> {
|
||||
try {
|
||||
if (!existsSync(CLIENTS_FILE)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const data = await readFile(CLIENTS_FILE, "utf-8");
|
||||
return JSON.parse(data);
|
||||
} catch (error) {
|
||||
console.error("Erreur lecture clients:", error);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
// GET - Récupérer les données d'un client par son token
|
||||
export async function GET(
|
||||
request: NextRequest,
|
||||
{ params }: { params: { token: string } }
|
||||
) {
|
||||
try {
|
||||
const clients = await loadClients();
|
||||
const client = clients.find(c => c.token === params.token);
|
||||
|
||||
if (!client) {
|
||||
return NextResponse.json(
|
||||
{ error: "Client non trouvé" },
|
||||
{ status: 404 }
|
||||
);
|
||||
}
|
||||
|
||||
// Retourner uniquement les données nécessaires (pas le token ni l'ID)
|
||||
return NextResponse.json({
|
||||
bungalowNumber: client.bungalowNumber,
|
||||
wifiName: client.wifiName,
|
||||
wifiPassword: client.wifiPassword,
|
||||
gerantMessage: client.gerantMessage,
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Erreur GET client par token:", error);
|
||||
return NextResponse.json(
|
||||
{ error: "Erreur serveur" },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
69
app/page.tsx
69
app/page.tsx
@ -9,20 +9,63 @@ export default function Home() {
|
||||
|
||||
useEffect(() => {
|
||||
// Détecter si on est dans l'app admin
|
||||
// Méthode 1: Vérifier si Capacitor est disponible (APK)
|
||||
const isCapacitor = typeof window !== "undefined" && (window as any).Capacitor;
|
||||
let isAdminApp = false;
|
||||
|
||||
// Méthode 2: Vérifier le user agent ou l'URL
|
||||
const isAdminPath = typeof window !== "undefined" &&
|
||||
(window.location.pathname.startsWith("/admin") ||
|
||||
window.location.search.includes("admin=true"));
|
||||
|
||||
// Méthode 3: Vérifier si on a un mot de passe admin en localStorage
|
||||
const hasAdminPassword = typeof window !== "undefined" &&
|
||||
localStorage.getItem("adminPassword") !== null;
|
||||
|
||||
// Si on est dans Capacitor OU qu'on a un mot de passe admin, c'est l'app admin
|
||||
const isAdminApp = isCapacitor || isAdminPath || hasAdminPassword;
|
||||
if (typeof window !== "undefined") {
|
||||
const Capacitor = (window as any).Capacitor;
|
||||
|
||||
// Méthode 1: Vérifier l'appId de Capacitor via le package name Android
|
||||
if (Capacitor) {
|
||||
try {
|
||||
const platform = Capacitor.getPlatform();
|
||||
|
||||
if (platform === "android") {
|
||||
// En Android, on peut récupérer le package name via Capacitor.getApp()
|
||||
// APK admin: com.pensionmarama.admin
|
||||
// APK client: com.pensionmarama.app
|
||||
const App = Capacitor.Plugins?.App;
|
||||
if (App) {
|
||||
App.getInfo().then((info: any) => {
|
||||
// Le package name est dans info.id ou info.appId
|
||||
const appId = info.id || info.appId || "";
|
||||
if (appId.includes("admin")) {
|
||||
isAdminApp = true;
|
||||
}
|
||||
}).catch(() => {
|
||||
// Fallback si getInfo() échoue
|
||||
});
|
||||
}
|
||||
|
||||
// Fallback: Vérifier le localStorage (si adminPassword existe, c'est admin)
|
||||
const hasAdminPassword = localStorage.getItem("adminPassword") !== null;
|
||||
if (hasAdminPassword) {
|
||||
isAdminApp = true;
|
||||
}
|
||||
} else {
|
||||
// Pour web, vérifier le localStorage
|
||||
const hasAdminPassword = localStorage.getItem("adminPassword") !== null;
|
||||
if (hasAdminPassword) {
|
||||
isAdminApp = true;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
// En cas d'erreur, fallback sur les autres méthodes
|
||||
console.warn("Erreur lors de la détection Capacitor:", e);
|
||||
}
|
||||
}
|
||||
|
||||
// Méthode 2: Vérifier le path ou query string (pour web)
|
||||
if (!isAdminApp && (
|
||||
window.location.pathname.startsWith("/admin") ||
|
||||
window.location.search.includes("admin=true")
|
||||
)) {
|
||||
isAdminApp = true;
|
||||
}
|
||||
|
||||
// Méthode 3: Si on est dans Capacitor Android sans adminPassword,
|
||||
// on considère que c'est l'app client (redirige vers /accueil)
|
||||
// Sauf si le pathname commence par /admin
|
||||
}
|
||||
|
||||
if (isAdminApp) {
|
||||
// Vérifier si l'admin est connecté
|
||||
|
||||
@ -1,9 +1,12 @@
|
||||
"use client";
|
||||
|
||||
import { ThemeProvider as NextThemesProvider } from "next-themes";
|
||||
import { type ThemeProviderProps } from "next-themes/dist/types";
|
||||
import { type ComponentProps } from "react";
|
||||
|
||||
export function ThemeProvider({ children, ...props }: ThemeProviderProps) {
|
||||
export function ThemeProvider({
|
||||
children,
|
||||
...props
|
||||
}: ComponentProps<typeof NextThemesProvider>) {
|
||||
return <NextThemesProvider {...props}>{children}</NextThemesProvider>;
|
||||
}
|
||||
|
||||
|
||||
@ -17,8 +17,8 @@ export function ThemeToggle() {
|
||||
return (
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="h-9 w-9 rounded-full"
|
||||
size="sm"
|
||||
className="h-9 w-9 rounded-full p-0"
|
||||
aria-label="Changer de thème"
|
||||
>
|
||||
<Sun className="h-5 w-5" />
|
||||
@ -29,9 +29,9 @@ export function ThemeToggle() {
|
||||
return (
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
size="sm"
|
||||
onClick={() => setTheme(theme === "dark" ? "light" : "dark")}
|
||||
className="h-10 w-10 rounded-full hover:bg-secondary dark:hover:bg-gray-800"
|
||||
className="h-10 w-10 rounded-full hover:bg-secondary dark:hover:bg-gray-800 p-0"
|
||||
aria-label="Changer de thème"
|
||||
>
|
||||
{theme === "dark" ? (
|
||||
|
||||
BIN
dist/compagnon-admin-debug.apk
vendored
BIN
dist/compagnon-admin-debug.apk
vendored
Binary file not shown.
BIN
dist/compagnon-lagon-beta.apk
vendored
BIN
dist/compagnon-lagon-beta.apk
vendored
Binary file not shown.
@ -2,18 +2,12 @@
|
||||
const nextConfig = {
|
||||
reactStrictMode: true,
|
||||
swcMinify: true,
|
||||
// Mode serveur (pas d'export statique)
|
||||
// Les API routes fonctionnent normalement
|
||||
output: "export",
|
||||
compress: true,
|
||||
poweredByHeader: false,
|
||||
images: {
|
||||
formats: ["image/avif", "image/webp"],
|
||||
minimumCacheTTL: 60,
|
||||
},
|
||||
experimental: {
|
||||
optimizePackageImports: ["lucide-react"],
|
||||
unoptimized: true,
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = nextConfig;
|
||||
|
||||
|
||||
@ -1,13 +0,0 @@
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
reactStrictMode: true,
|
||||
swcMinify: true,
|
||||
output: "export",
|
||||
compress: true,
|
||||
poweredByHeader: false,
|
||||
images: {
|
||||
unoptimized: true,
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = nextConfig;
|
||||
209
scripts/build-apk-admin.sh
Executable file
209
scripts/build-apk-admin.sh
Executable file
@ -0,0 +1,209 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
echo "🚀 Build APK Admin - Compagnon du Lagon"
|
||||
echo "========================================"
|
||||
echo ""
|
||||
|
||||
# Couleurs pour les messages
|
||||
GREEN='\033[0;32m'
|
||||
BLUE='\033[0;34m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Vérifier qu'on est dans le bon répertoire
|
||||
if [ ! -f "package.json" ]; then
|
||||
echo "❌ Erreur: Exécutez ce script depuis la racine du projet"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Étape 1: Créer la configuration Next.js pour l'export statique
|
||||
echo -e "${BLUE}📦 Étape 1/6: Configuration Next.js pour export statique${NC}"
|
||||
cat > next.config.export.js << 'EOF'
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
reactStrictMode: true,
|
||||
swcMinify: true,
|
||||
output: "export",
|
||||
compress: true,
|
||||
poweredByHeader: false,
|
||||
images: {
|
||||
unoptimized: true,
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = nextConfig;
|
||||
EOF
|
||||
|
||||
# Copier la config pour le build
|
||||
cp next.config.export.js next.config.js
|
||||
|
||||
echo -e "${GREEN}✅ Configuration créée${NC}"
|
||||
echo ""
|
||||
|
||||
# Étape 2: Installer les dépendances si nécessaire
|
||||
echo -e "${BLUE}📦 Étape 2/6: Vérification des dépendances${NC}"
|
||||
|
||||
# Vérifier SDKMAN
|
||||
if [ ! -f "$HOME/.sdkman/bin/sdkman-init.sh" ]; then
|
||||
echo "Installation de SDKMAN..."
|
||||
curl -s "https://get.sdkman.io" | bash
|
||||
source "$HOME/.sdkman/bin/sdkman-init.sh"
|
||||
fi
|
||||
|
||||
source "$HOME/.sdkman/bin/sdkman-init.sh" 2>/dev/null || true
|
||||
|
||||
# Vérifier Java 21
|
||||
if ! java -version 2>&1 | grep -q "21"; then
|
||||
echo "Installation de Java 21..."
|
||||
sdk install java 21.0.1-tem
|
||||
sdk use java 21.0.1-tem
|
||||
fi
|
||||
|
||||
# Vérifier Android SDK
|
||||
if [ ! -d "$HOME/Android/Sdk" ]; then
|
||||
echo "Installation d'Android SDK..."
|
||||
mkdir -p "$HOME/Android/Sdk/cmdline-tools"
|
||||
cd "$HOME/Android/Sdk/cmdline-tools"
|
||||
wget -q https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip
|
||||
unzip -q commandlinetools-linux-9477386_latest.zip
|
||||
mv cmdline-tools latest
|
||||
rm commandlinetools-linux-9477386_latest.zip
|
||||
cd -
|
||||
|
||||
export ANDROID_HOME="$HOME/Android/Sdk"
|
||||
export PATH="$ANDROID_HOME/cmdline-tools/latest/bin:$PATH"
|
||||
yes | sdkmanager --licenses || true
|
||||
sdkmanager "platform-tools" "platforms;android-34" "build-tools;34.0.0"
|
||||
fi
|
||||
|
||||
if [ ! -d "node_modules" ]; then
|
||||
echo "Installation des dépendances Node.js..."
|
||||
npm install --include=dev
|
||||
else
|
||||
echo "Dépendances Node.js déjà installées"
|
||||
fi
|
||||
|
||||
# Installer Capacitor si nécessaire
|
||||
if ! npm list @capacitor/core > /dev/null 2>&1; then
|
||||
echo "Installation de Capacitor..."
|
||||
npm install @capacitor/core @capacitor/cli @capacitor/android
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}✅ Dépendances OK${NC}"
|
||||
echo ""
|
||||
|
||||
# Étape 3: Build Next.js
|
||||
echo -e "${BLUE}📦 Étape 3/6: Build Next.js (export statique)${NC}"
|
||||
rm -rf .next out
|
||||
|
||||
# Exclure temporairement les routes API pour l'export statique
|
||||
if [ -d "app/api" ]; then
|
||||
echo "Exclusion temporaire des routes API..."
|
||||
mv app/api /tmp/api-backup-$$
|
||||
echo -e "${GREEN}✅ Routes API déplacées temporairement${NC}"
|
||||
fi
|
||||
|
||||
if npm run build; then
|
||||
echo -e "${GREEN}✅ Build Next.js réussi${NC}"
|
||||
else
|
||||
echo -e "${YELLOW}⚠️ Build avec avertissements, continuation...${NC}"
|
||||
npm run build -- --no-lint || true
|
||||
fi
|
||||
|
||||
# Restaurer les routes API
|
||||
if [ -d "/tmp/api-backup-$$" ]; then
|
||||
mv /tmp/api-backup-$$ app/api
|
||||
echo -e "${GREEN}✅ Routes API restaurées${NC}"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
# Vérifier que le dossier out existe
|
||||
if [ ! -d "out" ]; then
|
||||
echo "❌ Erreur: Le dossier 'out' n'a pas été créé"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Étape 4: Initialiser/Configurer Capacitor
|
||||
echo -e "${BLUE}📦 Étape 4/6: Configuration Capacitor${NC}"
|
||||
|
||||
# Initialiser Capacitor si nécessaire
|
||||
if [ ! -f "capacitor.config.ts" ]; then
|
||||
echo "Initialisation de Capacitor..."
|
||||
npx cap init "Compagnon Admin" com.pensionmarama.admin --web-dir=out
|
||||
else
|
||||
echo "Capacitor déjà initialisé"
|
||||
# Mettre à jour la config pour pointer vers out
|
||||
cat > capacitor.config.ts << 'EOF'
|
||||
import { CapacitorConfig } from '@capacitor/cli';
|
||||
|
||||
const config: CapacitorConfig = {
|
||||
appId: 'com.pensionmarama.admin',
|
||||
appName: 'Compagnon Admin',
|
||||
webDir: 'out',
|
||||
server: {
|
||||
androidScheme: 'https'
|
||||
}
|
||||
};
|
||||
|
||||
export default config;
|
||||
EOF
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}✅ Capacitor configuré${NC}"
|
||||
echo ""
|
||||
|
||||
# Étape 5: Synchroniser avec Android
|
||||
echo -e "${BLUE}📦 Étape 5/6: Synchronisation Android${NC}"
|
||||
|
||||
# Ajouter Android si nécessaire
|
||||
if [ ! -d "android" ]; then
|
||||
echo "Ajout de la plateforme Android..."
|
||||
npx cap add android
|
||||
fi
|
||||
|
||||
# Synchroniser
|
||||
echo "Synchronisation Capacitor..."
|
||||
npx cap sync android
|
||||
|
||||
echo -e "${GREEN}✅ Android synchronisé${NC}"
|
||||
echo ""
|
||||
|
||||
# Étape 6: Générer l'APK
|
||||
echo -e "${BLUE}📦 Étape 6/6: Génération de l'APK${NC}"
|
||||
|
||||
export ANDROID_HOME="$HOME/Android/Sdk"
|
||||
export PATH="$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/platform-tools:$PATH"
|
||||
|
||||
cd android
|
||||
./gradlew assembleDebug
|
||||
cd ..
|
||||
|
||||
# Copier l'APK généré
|
||||
if [ -f "android/app/build/outputs/apk/debug/app-debug.apk" ]; then
|
||||
mkdir -p dist
|
||||
cp android/app/build/outputs/apk/debug/app-debug.apk dist/compagnon-admin-debug.apk
|
||||
echo ""
|
||||
echo -e "${GREEN}========================================${NC}"
|
||||
echo -e "${GREEN}✅ APK ADMIN GÉNÉRÉ AVEC SUCCÈS !${NC}"
|
||||
echo -e "${GREEN}========================================${NC}"
|
||||
echo ""
|
||||
echo -e "📱 Fichier: ${BLUE}dist/compagnon-admin-debug.apk${NC}"
|
||||
APK_SIZE=$(du -h dist/compagnon-admin-debug.apk | cut -f1)
|
||||
echo -e "📊 Taille: ${BLUE}${APK_SIZE}${NC}"
|
||||
echo ""
|
||||
echo -e "${YELLOW}📤 Pour distribuer aux administrateurs:${NC}"
|
||||
echo " 1. Envoyez le fichier dist/compagnon-admin-debug.apk"
|
||||
echo " 2. Demandez-leur d'activer 'Sources inconnues'"
|
||||
echo " 3. Installer l'APK sur leur téléphone"
|
||||
echo ""
|
||||
echo -e "${YELLOW}🔄 Pour mettre à jour:${NC}"
|
||||
echo " Relancez simplement ce script !"
|
||||
echo ""
|
||||
else
|
||||
echo "❌ L'APK n'a pas été généré. Vérifiez les erreurs ci-dessus."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -98,12 +98,26 @@ echo ""
|
||||
echo -e "${BLUE}📦 Étape 3/6: Build Next.js (export statique)${NC}"
|
||||
rm -rf .next out
|
||||
|
||||
# Exclure temporairement les routes API pour l'export statique
|
||||
if [ -d "app/api" ]; then
|
||||
echo "Exclusion temporaire des routes API..."
|
||||
mv app/api /tmp/api-backup-$$
|
||||
echo -e "${GREEN}✅ Routes API déplacées temporairement${NC}"
|
||||
fi
|
||||
|
||||
if npm run build; then
|
||||
echo -e "${GREEN}✅ Build Next.js réussi${NC}"
|
||||
else
|
||||
echo -e "${YELLOW}⚠️ Build avec avertissements, continuation...${NC}"
|
||||
npm run build -- --no-lint || true
|
||||
fi
|
||||
|
||||
# Restaurer les routes API
|
||||
if [ -d "/tmp/api-backup-$$" ]; then
|
||||
mv /tmp/api-backup-$$ app/api
|
||||
echo -e "${GREEN}✅ Routes API restaurées${NC}"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
# Vérifier que le dossier out existe
|
||||
|
||||
Reference in New Issue
Block a user