Initial commit
This commit is contained in:
12
.claude-plugin/plugin.json
Normal file
12
.claude-plugin/plugin.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"name": "leapmultix-skill-pwa-service-worker",
|
||||
"description": "Skill pwa-service-worker from LeapMultix",
|
||||
"version": "1.0.0",
|
||||
"author": {
|
||||
"name": "Julien LE SAUX",
|
||||
"email": "contact@jls42.org"
|
||||
},
|
||||
"skills": [
|
||||
"./skills"
|
||||
]
|
||||
}
|
||||
3
README.md
Normal file
3
README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# leapmultix-skill-pwa-service-worker
|
||||
|
||||
Skill pwa-service-worker from LeapMultix
|
||||
45
plugin.lock.json
Normal file
45
plugin.lock.json
Normal file
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"$schema": "internal://schemas/plugin.lock.v1.json",
|
||||
"pluginId": "gh:jls42/leapmultix:leapmultix-marketplace/skills/pwa-service-worker",
|
||||
"normalized": {
|
||||
"repo": null,
|
||||
"ref": "refs/tags/v20251128.0",
|
||||
"commit": "01b6b4d42303daa869f4418097eb494157c0a822",
|
||||
"treeHash": "cc5dfca11a29e793f594f01f60e7420e71aa8dd0764cdee6e7bfbf0ee416d16d",
|
||||
"generatedAt": "2025-11-28T10:19:14.340018Z",
|
||||
"toolVersion": "publish_plugins.py@0.2.0"
|
||||
},
|
||||
"origin": {
|
||||
"remote": "git@github.com:zhongweili/42plugin-data.git",
|
||||
"branch": "master",
|
||||
"commit": "aa1497ed0949fd50e99e70d6324a29c5b34f9390",
|
||||
"repoRoot": "/Users/zhongweili/projects/openmind/42plugin-data"
|
||||
},
|
||||
"manifest": {
|
||||
"name": "leapmultix-skill-pwa-service-worker",
|
||||
"description": "Skill pwa-service-worker from LeapMultix",
|
||||
"version": "1.0.0"
|
||||
},
|
||||
"content": {
|
||||
"files": [
|
||||
{
|
||||
"path": "README.md",
|
||||
"sha256": "b339a7191ff5c4e4526d25403ee170ee1bb1c810af9122f4ae94debee9a726fe"
|
||||
},
|
||||
{
|
||||
"path": ".claude-plugin/plugin.json",
|
||||
"sha256": "d93b5851b0fae45eda0e45b3ace2bdf3dad33066b32c8f0b39e908754ebfa2be"
|
||||
},
|
||||
{
|
||||
"path": "skills/pwa-service-worker/SKILL.md",
|
||||
"sha256": "4756ee8cbe4e310653218976ae893c38ecd2357e335c21c32e2f4d2b21a59a3b"
|
||||
}
|
||||
],
|
||||
"dirSha256": "cc5dfca11a29e793f594f01f60e7420e71aa8dd0764cdee6e7bfbf0ee416d16d"
|
||||
},
|
||||
"security": {
|
||||
"scannedAt": null,
|
||||
"scannerVersion": null,
|
||||
"flags": []
|
||||
}
|
||||
}
|
||||
94
skills/pwa-service-worker/SKILL.md
Normal file
94
skills/pwa-service-worker/SKILL.md
Normal file
@@ -0,0 +1,94 @@
|
||||
---
|
||||
name: managing-pwa-service-worker
|
||||
description: Manages Service Worker updates securely with cache versioning and offline tests. Use when modifying SW, adding resources, or changing cache strategy
|
||||
allowed-tools: Read, Write, Grep, Glob, Bash
|
||||
---
|
||||
|
||||
# PWA Service Worker Manager
|
||||
|
||||
Gère Service Worker pour offline play et cache versioning sécurisé.
|
||||
|
||||
## Quand utiliser
|
||||
|
||||
- Modification Service Worker
|
||||
- Ajout ressources à cacher
|
||||
- Changement stratégie cache
|
||||
- Tests offline
|
||||
- Correction bugs SW
|
||||
|
||||
## Scripts essentiels
|
||||
|
||||
```bash
|
||||
npm run test:pwa-offline # Tester offline (PRINCIPAL)
|
||||
npm run sw:disable # Désactiver SW
|
||||
npm run sw:fix # Réparer SW
|
||||
```
|
||||
|
||||
## Versioning et workflow
|
||||
|
||||
**SemVer (voir sw.js) :**
|
||||
|
||||
- Major : Changements cassants
|
||||
- Minor : Ressources ajoutées
|
||||
- Patch : Corrections
|
||||
|
||||
**Workflow :**
|
||||
|
||||
1. **Modifier :** sw.js (version, ressources, handlers)
|
||||
2. **Incrémenter :** Version (SemVer)
|
||||
3. **Tester :** `npm run test:pwa-offline`
|
||||
4. **Vérifier :** DevTools App tab (Offline mode)
|
||||
5. **Quality :** format:check, lint, test
|
||||
|
||||
## Stratégies de cache
|
||||
|
||||
- **Cache First :** Assets (HTML, CSS, JS, images)
|
||||
- **Network First :** APIs (données fraîches)
|
||||
- **Cache Only :** Assets immuables
|
||||
- **Network Only :** Analytics, auth
|
||||
|
||||
Trouve stratégie dans sw.js existant.
|
||||
|
||||
## Événements SW clés
|
||||
|
||||
- **Install :** Créer cache, skipWaiting()
|
||||
- **Activate :** Nettoyer anciens caches, clients.claim()
|
||||
- **Fetch :** Appliquer stratégie, gérer erreurs
|
||||
|
||||
## Debugging
|
||||
|
||||
**Chrome DevTools (F12) → Application → Service Workers :**
|
||||
|
||||
- Offline mode → Tester navigation
|
||||
- caches.keys() en console → Vérifier caches
|
||||
|
||||
**Problèmes courants :**
|
||||
|
||||
- SW ne s'update → Incrémenter version, skipWaiting() présent
|
||||
- Ressources manquantes → Ajouter à liste cache
|
||||
- Cache volumineux → Cacher uniquement ressources critiques
|
||||
|
||||
## Checklist
|
||||
|
||||
- [ ] Version incrémentée (SemVer)
|
||||
- [ ] skipWaiting() + clients.claim() présents
|
||||
- [ ] Nettoyage anciens caches
|
||||
- [ ] Offline test OK (`npm run test:pwa-offline`)
|
||||
- [ ] DevTools Offline mode OK
|
||||
- [ ] format:check, lint, test passent
|
||||
|
||||
## En cas de doute
|
||||
|
||||
**Règles absolues :**
|
||||
|
||||
1. Incrémenter version TOUJOURS
|
||||
2. Tester offline AVANT commit
|
||||
3. DevTools Application tab verification
|
||||
4. `npm run test:pwa-offline` doit passer
|
||||
5. skipWaiting() + clients.claim() essentiels
|
||||
|
||||
**Références :**
|
||||
|
||||
- `sw.js` - Service Worker principal
|
||||
- `manifest.json` - PWA manifest
|
||||
- Chrome DevTools Application tab
|
||||
Reference in New Issue
Block a user