Applique .gitattributes sur tous les fichiers existants. Élimine les différences fantômes entre WSL et Windows. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2.2 KiB
Executable File
2.2 KiB
Executable File
Migration electron-updater + Gitea — Design
Objectif
Remplacer le système de mise à jour custom (download HTTP manuel + script batch NSIS) par electron-updater, tout en conservant Gitea comme hébergeur de releases.
Contrainte Gitea
Gitea ne supporte pas l'URL /releases/latest/download/{filename} (issue #31408 ouverte). On utilise donc une approche hybride :
- Appel API Gitea pour découvrir la dernière version
electron-updater(generic provider) pour le cycle download → vérification sha512 → installation NSIS → restart
Workflow de release
npm run build→ génère.exe+latest.ymldansdist/- Créer le tag git, push
- Sur Gitea : créer la release, uploader le
.exeETlatest.yml
Architecture
Flux côté app
Démarrage (3s) → GET /api/v1/repos/mickael/dd-timer/releases/latest
→ Compare versions (tag_name vs app.getVersion())
→ Si update dispo :
autoUpdater.setFeedURL({
provider: "generic",
url: "https://gitea.mickael-pol.fr/mickael/dd-timer/releases/download/{tag}/"
})
autoUpdater.checkForUpdates()
→ electron-updater lit latest.yml
→ Télécharge le .exe (download-progress events)
→ update-downloaded → prêt à installer
→ quitAndInstall() au clic utilisateur
Changements par fichier
| Fichier | Action |
|---|---|
package.json |
Ajouter electron-updater dep + config publish generic |
main.ts |
Supprimer download HTTP, redirections, script batch. Garder appel API Gitea. Ajouter autoUpdater events. |
preload.ts |
Inchangé (mêmes IPC channels) |
UpdateBanner.ts |
Inchangé |
IPC channels (conservés)
update-available→ bannière disponibleupdate-downloading→ bannière téléchargementupdate-progress→ { percent }update-ready→ bouton "Installer et redémarrer"update-error→ message erreurinstall-update→ déclenche quitAndInstall()
Avantages
- Suppression du script batch hack (~80 lignes)
- Vérification d'intégrité sha512 automatique
- Gestion NSIS install + restart native
- Code main.ts simplifié (~40 lignes vs ~200)
- Zéro infra supplémentaire