@mtldev514/retro-portfolio-engine 1.0.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/build-and-deploy.yml +105 -0
- package/ADMIN_SETUP.md +306 -0
- package/README.md +193 -301
- package/USAGE.md +451 -0
- package/build.sh +326 -0
- package/index.html +85 -0
- package/js/manifest-loader.js +313 -0
- package/manifest.json +74 -0
- package/package.json +14 -38
- package/setup-admin.sh +134 -0
- package/sync-after-admin.sh +58 -0
- package/bin/cli.js +0 -103
- package/engine/admin/admin.css +0 -720
- package/engine/admin/admin.html +0 -801
- package/engine/admin/admin_api.py +0 -230
- package/engine/admin/scripts/backup.sh +0 -116
- package/engine/admin/scripts/config_loader.py +0 -180
- package/engine/admin/scripts/init.sh +0 -141
- package/engine/admin/scripts/manager.py +0 -308
- package/engine/admin/scripts/restore.sh +0 -121
- package/engine/admin/scripts/server.py +0 -41
- package/engine/admin/scripts/update.sh +0 -321
- package/engine/admin/scripts/validate_json.py +0 -62
- package/engine/fonts.css +0 -37
- package/engine/index.html +0 -190
- package/engine/js/config-loader.js +0 -370
- package/engine/js/config.js +0 -173
- package/engine/js/counter.js +0 -17
- package/engine/js/effects.js +0 -97
- package/engine/js/i18n.js +0 -68
- package/engine/js/init.js +0 -107
- package/engine/js/media.js +0 -264
- package/engine/js/render.js +0 -282
- package/engine/js/router.js +0 -133
- package/engine/js/sparkle.js +0 -123
- package/engine/js/themes.js +0 -607
- package/engine/style.css +0 -2037
- package/index.js +0 -35
- package/scripts/admin.js +0 -67
- package/scripts/build.js +0 -142
- package/scripts/init.js +0 -237
- package/scripts/post-install.js +0 -16
- package/scripts/serve.js +0 -54
- package/templates/user-portfolio/.github/workflows/deploy.yml +0 -57
- package/templates/user-portfolio/config/app.json +0 -36
- package/templates/user-portfolio/config/categories.json +0 -241
- package/templates/user-portfolio/config/languages.json +0 -15
- package/templates/user-portfolio/config/media-types.json +0 -59
- package/templates/user-portfolio/data/painting.json +0 -3
- package/templates/user-portfolio/data/projects.json +0 -3
- package/templates/user-portfolio/lang/en.json +0 -114
- package/templates/user-portfolio/lang/fr.json +0 -114
package/USAGE.md
ADDED
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
# 📖 Guide d'Utilisation - Site-as-a-Package
|
|
2
|
+
|
|
3
|
+
## 🎯 Workflow Complet
|
|
4
|
+
|
|
5
|
+
### Pour l'utilisateur final (qui veut son propre site)
|
|
6
|
+
|
|
7
|
+
#### Étape 1 : Fork les deux repos
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# 1. Fork retro-portfolio-engine (le moteur)
|
|
11
|
+
# 2. Fork retro-portfolio-data (vos données)
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
#### Étape 2 : Configurer vos données
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
git clone https://github.com/VOTRE_USERNAME/retro-portfolio-data.git
|
|
18
|
+
cd retro-portfolio-data
|
|
19
|
+
|
|
20
|
+
# Modifier les fichiers de données
|
|
21
|
+
nano data/painting.json
|
|
22
|
+
nano lang/fr.json
|
|
23
|
+
|
|
24
|
+
# Commit et push
|
|
25
|
+
git add .
|
|
26
|
+
git commit -m "Mon contenu personnalisé"
|
|
27
|
+
git push
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
#### Étape 3 : Connecter le moteur aux données
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
git clone https://github.com/VOTRE_USERNAME/retro-portfolio-engine.git
|
|
34
|
+
cd retro-portfolio-engine
|
|
35
|
+
|
|
36
|
+
# Éditer manifest.json
|
|
37
|
+
nano manifest.json
|
|
38
|
+
# Changer : "owner": "VOTRE_USERNAME"
|
|
39
|
+
# Changer : "repo": "retro-portfolio-data"
|
|
40
|
+
# Changer : "baseUrl": "https://raw.githubusercontent.com/VOTRE_USERNAME/retro-portfolio-data/main/"
|
|
41
|
+
|
|
42
|
+
git add manifest.json
|
|
43
|
+
git commit -m "Configuration du data repo"
|
|
44
|
+
git push
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
#### Étape 4 : Activer GitHub Pages
|
|
48
|
+
|
|
49
|
+
1. Aller dans **Settings** du repo `retro-portfolio-engine`
|
|
50
|
+
2. Section **Pages**
|
|
51
|
+
3. Source : **GitHub Actions**
|
|
52
|
+
4. Save
|
|
53
|
+
|
|
54
|
+
#### Étape 5 : Déclencher le premier build
|
|
55
|
+
|
|
56
|
+
1. Aller dans **Actions**
|
|
57
|
+
2. Cliquer sur **Build and Deploy Site**
|
|
58
|
+
3. **Run workflow** → **Run workflow**
|
|
59
|
+
|
|
60
|
+
✅ Votre site sera disponible à : `https://VOTRE_USERNAME.github.io/retro-portfolio-engine/`
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## 🔄 Workflow de Mise à Jour
|
|
65
|
+
|
|
66
|
+
### Scénario 1 : Modifier le contenu
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
# Dans retro-portfolio-data
|
|
70
|
+
cd retro-portfolio-data
|
|
71
|
+
|
|
72
|
+
# Modifier vos données
|
|
73
|
+
echo '{"items": [...]}' > data/painting.json
|
|
74
|
+
|
|
75
|
+
git add data/painting.json
|
|
76
|
+
git commit -m "Ajout nouvelles peintures"
|
|
77
|
+
git push
|
|
78
|
+
|
|
79
|
+
# Le site se rebuild automatiquement (si webhook configuré)
|
|
80
|
+
# Sinon, déclencher manuellement depuis Actions
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Scénario 2 : Ajouter une traduction
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
# Dans retro-portfolio-data
|
|
87
|
+
cd retro-portfolio-data
|
|
88
|
+
|
|
89
|
+
# Créer nouvelle langue
|
|
90
|
+
cp lang/en.json lang/es.json
|
|
91
|
+
nano lang/es.json # Traduire
|
|
92
|
+
|
|
93
|
+
# Mettre à jour le manifest
|
|
94
|
+
nano manifest.json
|
|
95
|
+
# Ajouter "es": "lang/es.json" dans structure.lang
|
|
96
|
+
|
|
97
|
+
git add .
|
|
98
|
+
git commit -m "Ajout traduction espagnole"
|
|
99
|
+
git push
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Scénario 3 : Modifier le design
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
# Dans retro-portfolio-engine
|
|
106
|
+
cd retro-portfolio-engine
|
|
107
|
+
|
|
108
|
+
# Modifier les styles
|
|
109
|
+
nano style.css
|
|
110
|
+
|
|
111
|
+
git add style.css
|
|
112
|
+
git commit -m "Nouveau thème"
|
|
113
|
+
git push
|
|
114
|
+
|
|
115
|
+
# Build automatique déclenché
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## 🔧 Commandes Utiles
|
|
121
|
+
|
|
122
|
+
### Build Local
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
# Build avec cache (rapide)
|
|
126
|
+
./build.sh
|
|
127
|
+
|
|
128
|
+
# Build complet (force download)
|
|
129
|
+
./build.sh --force
|
|
130
|
+
|
|
131
|
+
# Build avec manifest personnalisé
|
|
132
|
+
./build.sh --manifest https://autre-repo.com/manifest.json
|
|
133
|
+
|
|
134
|
+
# Spécifier répertoires
|
|
135
|
+
./build.sh --cache-dir .mon-cache --output ma-dist
|
|
136
|
+
|
|
137
|
+
# Aide
|
|
138
|
+
./build.sh --help
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Test Local
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
# Après build
|
|
145
|
+
cd dist
|
|
146
|
+
python3 -m http.server 8000
|
|
147
|
+
|
|
148
|
+
# Ou avec Node.js
|
|
149
|
+
npx http-server dist -p 8000
|
|
150
|
+
|
|
151
|
+
# Ou avec PHP
|
|
152
|
+
php -S localhost:8000 -t dist
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Debug
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
# Vérifier le manifest distant
|
|
159
|
+
curl https://raw.githubusercontent.com/VOTRE_USERNAME/retro-portfolio-data/main/manifest.json | jq
|
|
160
|
+
|
|
161
|
+
# Tester un fichier de données
|
|
162
|
+
curl https://raw.githubusercontent.com/VOTRE_USERNAME/retro-portfolio-data/main/data/painting.json | jq
|
|
163
|
+
|
|
164
|
+
# Vider le cache
|
|
165
|
+
rm -rf .cache
|
|
166
|
+
|
|
167
|
+
# Build en mode verbose
|
|
168
|
+
bash -x build.sh
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## 🚀 Automatisation Avancée
|
|
174
|
+
|
|
175
|
+
### Option 1 : Rebuild quotidien automatique
|
|
176
|
+
|
|
177
|
+
C'est déjà configuré dans `.github/workflows/build-and-deploy.yml` :
|
|
178
|
+
|
|
179
|
+
```yaml
|
|
180
|
+
schedule:
|
|
181
|
+
- cron: '0 0 * * *' # Tous les jours à minuit UTC
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Option 2 : Webhook depuis le repo de données
|
|
185
|
+
|
|
186
|
+
Créer `.github/workflows/notify-engine.yml` dans `retro-portfolio-data` :
|
|
187
|
+
|
|
188
|
+
```yaml
|
|
189
|
+
name: Notify Engine on Data Update
|
|
190
|
+
|
|
191
|
+
on:
|
|
192
|
+
push:
|
|
193
|
+
branches: [main]
|
|
194
|
+
|
|
195
|
+
jobs:
|
|
196
|
+
notify:
|
|
197
|
+
runs-on: ubuntu-latest
|
|
198
|
+
steps:
|
|
199
|
+
- name: Trigger Engine Rebuild
|
|
200
|
+
run: |
|
|
201
|
+
curl -X POST \
|
|
202
|
+
-H "Accept: application/vnd.github+json" \
|
|
203
|
+
-H "Authorization: Bearer ${{ secrets.ENGINE_PAT }}" \
|
|
204
|
+
https://api.github.com/repos/VOTRE_USERNAME/retro-portfolio-engine/dispatches \
|
|
205
|
+
-d '{"event_type":"data-updated"}'
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
**Configuration requise** :
|
|
209
|
+
1. Créer un Personal Access Token (PAT) avec scope `repo`
|
|
210
|
+
2. Ajouter dans Secrets du repo `retro-portfolio-data` : `ENGINE_PAT`
|
|
211
|
+
|
|
212
|
+
### Option 3 : Build manuel avec paramètres
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
# Via GitHub CLI
|
|
216
|
+
gh workflow run build-and-deploy.yml \
|
|
217
|
+
--repo VOTRE_USERNAME/retro-portfolio-engine \
|
|
218
|
+
-f force_rebuild=true
|
|
219
|
+
|
|
220
|
+
# Via API
|
|
221
|
+
curl -X POST \
|
|
222
|
+
-H "Authorization: token VOTRE_PAT" \
|
|
223
|
+
https://api.github.com/repos/VOTRE_USERNAME/retro-portfolio-engine/actions/workflows/build-and-deploy.yml/dispatches \
|
|
224
|
+
-d '{"ref":"main","inputs":{"force_rebuild":"true"}}'
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## 💡 Cas d'Usage
|
|
230
|
+
|
|
231
|
+
### Cas 1 : Blog personnel
|
|
232
|
+
|
|
233
|
+
```json
|
|
234
|
+
// data/blog.json
|
|
235
|
+
{
|
|
236
|
+
"posts": [
|
|
237
|
+
{
|
|
238
|
+
"id": "post-1",
|
|
239
|
+
"title": {"en": "My First Post", "fr": "Mon Premier Article"},
|
|
240
|
+
"content": {"en": "...", "fr": "..."},
|
|
241
|
+
"date": "2026-02-12"
|
|
242
|
+
}
|
|
243
|
+
]
|
|
244
|
+
}
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### Cas 2 : Portfolio d'artiste
|
|
248
|
+
|
|
249
|
+
```json
|
|
250
|
+
// data/gallery.json
|
|
251
|
+
{
|
|
252
|
+
"artworks": [
|
|
253
|
+
{
|
|
254
|
+
"id": "art-1",
|
|
255
|
+
"title": "Sunset",
|
|
256
|
+
"image": "https://cloudinary.com/...",
|
|
257
|
+
"description": {"en": "...", "fr": "..."}
|
|
258
|
+
}
|
|
259
|
+
]
|
|
260
|
+
}
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### Cas 3 : Site multilingue d'entreprise
|
|
264
|
+
|
|
265
|
+
```
|
|
266
|
+
retro-portfolio-data/
|
|
267
|
+
├── config/
|
|
268
|
+
│ ├── app.json (config générale)
|
|
269
|
+
│ └── languages.json (en, fr, es, de)
|
|
270
|
+
├── data/
|
|
271
|
+
│ ├── products.json
|
|
272
|
+
│ ├── services.json
|
|
273
|
+
│ └── team.json
|
|
274
|
+
└── lang/
|
|
275
|
+
├── en.json
|
|
276
|
+
├── fr.json
|
|
277
|
+
├── es.json
|
|
278
|
+
└── de.json
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
---
|
|
282
|
+
|
|
283
|
+
## 🛠️ Personnalisation Avancée
|
|
284
|
+
|
|
285
|
+
### Ajouter un nouveau type de contenu
|
|
286
|
+
|
|
287
|
+
1. **Dans `retro-portfolio-data`** :
|
|
288
|
+
|
|
289
|
+
```json
|
|
290
|
+
// config/categories.json
|
|
291
|
+
{
|
|
292
|
+
"contentTypes": [
|
|
293
|
+
{
|
|
294
|
+
"id": "videos",
|
|
295
|
+
"name": {"en": "Videos", "fr": "Vidéos"},
|
|
296
|
+
"mediaType": "video",
|
|
297
|
+
"dataFile": "data/videos.json"
|
|
298
|
+
}
|
|
299
|
+
]
|
|
300
|
+
}
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
```json
|
|
304
|
+
// data/videos.json
|
|
305
|
+
{
|
|
306
|
+
"items": [
|
|
307
|
+
{
|
|
308
|
+
"id": "video-1",
|
|
309
|
+
"title": "Mon premier film",
|
|
310
|
+
"url": "https://youtube.com/...",
|
|
311
|
+
"thumbnail": "..."
|
|
312
|
+
}
|
|
313
|
+
]
|
|
314
|
+
}
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
2. **Dans `retro-portfolio-engine`** :
|
|
318
|
+
|
|
319
|
+
```javascript
|
|
320
|
+
// js/render.js - Ajouter le renderer
|
|
321
|
+
renderVideo(item) {
|
|
322
|
+
return `
|
|
323
|
+
<div class="video-item">
|
|
324
|
+
<iframe src="${item.url}"></iframe>
|
|
325
|
+
<h3>${item.title}</h3>
|
|
326
|
+
</div>
|
|
327
|
+
`;
|
|
328
|
+
}
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
### Modifier le thème
|
|
332
|
+
|
|
333
|
+
```css
|
|
334
|
+
/* style.css */
|
|
335
|
+
:root {
|
|
336
|
+
--primary-color: #your-color;
|
|
337
|
+
--font-family: 'Your-Font', sans-serif;
|
|
338
|
+
}
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
### Ajouter des analytics
|
|
342
|
+
|
|
343
|
+
```html
|
|
344
|
+
<!-- index.html -->
|
|
345
|
+
<head>
|
|
346
|
+
...
|
|
347
|
+
<script async src="https://www.googletagmanager.com/gtag/js?id=GA_ID"></script>
|
|
348
|
+
<script>
|
|
349
|
+
window.dataLayer = window.dataLayer || [];
|
|
350
|
+
function gtag(){dataLayer.push(arguments);}
|
|
351
|
+
gtag('js', new Date());
|
|
352
|
+
gtag('config', 'GA_ID');
|
|
353
|
+
</script>
|
|
354
|
+
</head>
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
---
|
|
358
|
+
|
|
359
|
+
## 📊 Monitoring
|
|
360
|
+
|
|
361
|
+
### Vérifier le statut du build
|
|
362
|
+
|
|
363
|
+
```bash
|
|
364
|
+
# Via GitHub CLI
|
|
365
|
+
gh run list --repo VOTRE_USERNAME/retro-portfolio-engine
|
|
366
|
+
|
|
367
|
+
# Voir les détails du dernier run
|
|
368
|
+
gh run view --repo VOTRE_USERNAME/retro-portfolio-engine
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
### Voir les infos de build sur le site
|
|
372
|
+
|
|
373
|
+
Le fichier `build-info.json` est généré automatiquement :
|
|
374
|
+
|
|
375
|
+
```javascript
|
|
376
|
+
// Dans votre site
|
|
377
|
+
fetch('/build-info.json')
|
|
378
|
+
.then(r => r.json())
|
|
379
|
+
.then(info => {
|
|
380
|
+
console.log('Build date:', info.buildDate);
|
|
381
|
+
console.log('Version:', info.version);
|
|
382
|
+
console.log('Data source:', info.dataSource);
|
|
383
|
+
});
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
---
|
|
387
|
+
|
|
388
|
+
## 🐛 Résolution de Problèmes
|
|
389
|
+
|
|
390
|
+
### Problème : Le build échoue
|
|
391
|
+
|
|
392
|
+
**Solution 1** : Vérifier les dépendances
|
|
393
|
+
|
|
394
|
+
```bash
|
|
395
|
+
# Installer jq si manquant
|
|
396
|
+
sudo apt-get install jq
|
|
397
|
+
|
|
398
|
+
# Vérifier curl
|
|
399
|
+
curl --version
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
**Solution 2** : Vérifier le manifest
|
|
403
|
+
|
|
404
|
+
```bash
|
|
405
|
+
# Tester la validité JSON
|
|
406
|
+
curl YOUR_MANIFEST_URL | jq .
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
### Problème : Les données ne se mettent pas à jour
|
|
410
|
+
|
|
411
|
+
**Solution** : Forcer le rebuild
|
|
412
|
+
|
|
413
|
+
```bash
|
|
414
|
+
./build.sh --force
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
Ou via GitHub Actions → Run workflow → ☑️ Force rebuild
|
|
418
|
+
|
|
419
|
+
### Problème : CORS errors
|
|
420
|
+
|
|
421
|
+
**Solution** : GitHub raw URLs supportent CORS nativement. Vérifier que :
|
|
422
|
+
|
|
423
|
+
1. L'URL est bien `raw.githubusercontent.com`
|
|
424
|
+
2. Le repo de données est public
|
|
425
|
+
3. Le manifest pointe vers les bons chemins
|
|
426
|
+
|
|
427
|
+
### Problème : 404 sur les fichiers
|
|
428
|
+
|
|
429
|
+
**Solution** : Vérifier le manifest
|
|
430
|
+
|
|
431
|
+
```json
|
|
432
|
+
// Doit être relatif, pas absolu
|
|
433
|
+
"structure": {
|
|
434
|
+
"data": {
|
|
435
|
+
"painting": "data/painting.json" // ✅
|
|
436
|
+
// PAS: "/data/painting.json" // ❌
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
---
|
|
442
|
+
|
|
443
|
+
## 🎓 Ressources
|
|
444
|
+
|
|
445
|
+
- [Documentation GitHub Pages](https://docs.github.com/pages)
|
|
446
|
+
- [GitHub Actions](https://docs.github.com/actions)
|
|
447
|
+
- [jq Manual](https://stedolan.github.io/jq/manual/)
|
|
448
|
+
|
|
449
|
+
---
|
|
450
|
+
|
|
451
|
+
**Besoin d'aide ?** Ouvrez une issue sur GitHub ! 🙌
|