@mtldev514/retro-portfolio-maker 1.0.0
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/LICENSE +21 -0
- package/README.md +409 -0
- package/bin/cli.js +103 -0
- package/engine/admin/admin_api.py +221 -0
- package/engine/admin/scripts/backup.sh +116 -0
- package/engine/admin/scripts/config_loader.py +180 -0
- package/engine/admin/scripts/init.sh +141 -0
- package/engine/admin/scripts/manager.py +308 -0
- package/engine/admin/scripts/restore.sh +121 -0
- package/engine/admin/scripts/server.py +41 -0
- package/engine/admin/scripts/update.sh +321 -0
- package/engine/admin/scripts/validate_json.py +62 -0
- package/engine/admin.css +720 -0
- package/engine/admin.html +801 -0
- package/engine/fonts.css +37 -0
- package/engine/index.html +186 -0
- package/engine/js/config-loader.js +370 -0
- package/engine/js/config.js +173 -0
- package/engine/js/counter.js +17 -0
- package/engine/js/effects.js +97 -0
- package/engine/js/i18n.js +68 -0
- package/engine/js/init.js +107 -0
- package/engine/js/media.js +264 -0
- package/engine/js/render.js +282 -0
- package/engine/js/router.js +133 -0
- package/engine/js/sparkle.js +123 -0
- package/engine/js/themes.js +607 -0
- package/engine/style.css +2037 -0
- package/index.js +35 -0
- package/package.json +48 -0
- package/scripts/admin.js +63 -0
- package/scripts/build.js +142 -0
- package/scripts/init.js +369 -0
- package/scripts/init.js.bak +331 -0
- package/scripts/init.js.bak2 +331 -0
- package/scripts/init.js.bak3 +331 -0
- package/scripts/post-install.js +16 -0
- package/scripts/serve.js +54 -0
- package/templates/.env.example +10 -0
- package/templates/user-portfolio/.github/workflows/deploy.yml +57 -0
- package/templates/user-portfolio/config/app.json +36 -0
- package/templates/user-portfolio/config/categories.json +241 -0
- package/templates/user-portfolio/config/languages.json +15 -0
- package/templates/user-portfolio/config/media-types.json +59 -0
- package/templates/user-portfolio/data/painting.json +3 -0
- package/templates/user-portfolio/data/projects.json +3 -0
- package/templates/user-portfolio/lang/en.json +114 -0
- package/templates/user-portfolio/lang/fr.json +114 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Alex
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
# @mtldev514/retro-portfolio-maker
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@mtldev514/retro-portfolio-maker)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
6
|
+
Hello!
|
|
7
|
+
**Site-as-a-Package** 🎨 Un moteur de portfolio rétro que vous installez via NPM. Vous fournissez vos données, le package fournit tout le reste.
|
|
8
|
+
|
|
9
|
+
## 🎯 Concept
|
|
10
|
+
|
|
11
|
+
Au lieu de cloner un repo complet, vous **installez un package NPM** qui contient tout le moteur (HTML, CSS, JS, admin). Vous gardez uniquement **vos données** dans votre repo.
|
|
12
|
+
|
|
13
|
+
### Avantages
|
|
14
|
+
|
|
15
|
+
✅ **Un seul repo** pour l'utilisateur (juste ses données)
|
|
16
|
+
✅ **Mises à jour faciles** via `npm update`
|
|
17
|
+
✅ **Pas de merge conflicts** pour récupérer les nouvelles features
|
|
18
|
+
✅ **Workflow simple** : `npm install` → `npm run build`
|
|
19
|
+
✅ **Admin inclus** pour gérer le contenu visuellement
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 🚀 Quick Start
|
|
24
|
+
|
|
25
|
+
### Pour créer votre portfolio
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# 1. Créer un nouveau portfolio
|
|
29
|
+
npx @mtldev514/retro-portfolio-maker init mon-portfolio
|
|
30
|
+
cd mon-portfolio
|
|
31
|
+
|
|
32
|
+
# 2. Installer les dépendances
|
|
33
|
+
npm install
|
|
34
|
+
|
|
35
|
+
# 3. Lancer le serveur de dev
|
|
36
|
+
npm run dev
|
|
37
|
+
|
|
38
|
+
# 4. Ouvrir http://localhost:8000
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
C'est tout ! 🎉
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## 📦 Installation dans un projet existant
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npm install @mtldev514/retro-portfolio-maker
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Puis ajoutez les scripts dans votre `package.json` :
|
|
52
|
+
|
|
53
|
+
```json
|
|
54
|
+
{
|
|
55
|
+
"scripts": {
|
|
56
|
+
"build": "retro-portfolio build",
|
|
57
|
+
"dev": "retro-portfolio dev",
|
|
58
|
+
"admin": "retro-portfolio admin"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## 📁 Structure de votre projet
|
|
66
|
+
|
|
67
|
+
Après `init`, votre projet contient **uniquement vos données** :
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
mon-portfolio/
|
|
71
|
+
├── package.json (dépendance: @mtldev514/retro-portfolio-maker)
|
|
72
|
+
├── config/ (VOS configurations)
|
|
73
|
+
│ ├── app.json
|
|
74
|
+
│ ├── languages.json
|
|
75
|
+
│ └── categories.json
|
|
76
|
+
├── data/ (VOTRE contenu)
|
|
77
|
+
│ ├── painting.json
|
|
78
|
+
│ └── projects.json
|
|
79
|
+
├── lang/ (VOS traductions)
|
|
80
|
+
│ ├── en.json
|
|
81
|
+
│ └── fr.json
|
|
82
|
+
└── assets/ (VOS images, etc.)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
**Pas de code du site** dans votre repo ! Tout vient du package NPM.
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## 🛠️ Commandes
|
|
90
|
+
|
|
91
|
+
### `retro-portfolio init [directory]`
|
|
92
|
+
|
|
93
|
+
Crée un nouveau portfolio avec les templates de données.
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
# Créer dans le dossier actuel
|
|
97
|
+
retro-portfolio init
|
|
98
|
+
|
|
99
|
+
# Créer dans un nouveau dossier
|
|
100
|
+
retro-portfolio init mon-portfolio
|
|
101
|
+
|
|
102
|
+
# Forcer l'écrasement
|
|
103
|
+
retro-portfolio init --force
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### `retro-portfolio build`
|
|
107
|
+
|
|
108
|
+
Génère le site statique en fusionnant le moteur avec vos données.
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
# Build standard
|
|
112
|
+
npm run build
|
|
113
|
+
|
|
114
|
+
# Spécifier le dossier de sortie
|
|
115
|
+
retro-portfolio build --output public
|
|
116
|
+
|
|
117
|
+
# Watch mode (rebuild automatique)
|
|
118
|
+
retro-portfolio build --watch
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
**Ce qui se passe** :
|
|
122
|
+
1. Le package copie ses fichiers engine (HTML, CSS, JS)
|
|
123
|
+
2. Il fusionne avec vos fichiers `config/`, `data/`, `lang/`
|
|
124
|
+
3. Génère un site complet dans `dist/`
|
|
125
|
+
|
|
126
|
+
### `retro-portfolio dev`
|
|
127
|
+
|
|
128
|
+
Lance un serveur de développement local.
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
npm run dev
|
|
132
|
+
|
|
133
|
+
# Port personnalisé
|
|
134
|
+
retro-portfolio dev --port 3000
|
|
135
|
+
|
|
136
|
+
# Ouvrir automatiquement le navigateur
|
|
137
|
+
retro-portfolio dev --open
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### `retro-portfolio admin`
|
|
141
|
+
|
|
142
|
+
Lance l'interface d'administration pour gérer votre contenu.
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
npm run admin
|
|
146
|
+
|
|
147
|
+
# Port personnalisé
|
|
148
|
+
retro-portfolio admin --port 5001
|
|
149
|
+
|
|
150
|
+
# Ouvrir automatiquement le navigateur
|
|
151
|
+
retro-portfolio admin --open
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
**Interface admin** : Ajoutez/modifiez votre contenu visuellement, uploadez des images, gérez les traductions.
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## 🔄 Workflow Complet
|
|
159
|
+
|
|
160
|
+
### 1️⃣ Setup initial
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
npx @mtldev514/retro-portfolio-maker init mon-portfolio
|
|
164
|
+
cd mon-portfolio
|
|
165
|
+
npm install
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### 2️⃣ Configuration
|
|
169
|
+
|
|
170
|
+
Éditez vos fichiers de config :
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
# Configurez votre site
|
|
174
|
+
nano config/app.json
|
|
175
|
+
|
|
176
|
+
# Ajoutez vos catégories
|
|
177
|
+
nano config/categories.json
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### 3️⃣ Ajout de contenu
|
|
181
|
+
|
|
182
|
+
**Option A** : Via l'admin (recommandé)
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
npm run admin
|
|
186
|
+
# Ouvrir http://localhost:8000/admin.html
|
|
187
|
+
# Upload images, ajouter descriptions, etc.
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
**Option B** : Édition manuelle JSON
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
nano data/painting.json
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### 4️⃣ Preview local
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
npm run dev
|
|
200
|
+
# Ouvrir http://localhost:8000
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### 5️⃣ Build pour production
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
npm run build
|
|
207
|
+
# → génère dist/
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### 6️⃣ Déploiement
|
|
211
|
+
|
|
212
|
+
**GitHub Pages** :
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
# Pusher le dossier dist/ sur la branche gh-pages
|
|
216
|
+
git add dist -f
|
|
217
|
+
git commit -m "Deploy"
|
|
218
|
+
git subtree push --prefix dist origin gh-pages
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Ou utilisez la GitHub Action fournie (voir section Déploiement).
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## 🎨 Personnalisation
|
|
226
|
+
|
|
227
|
+
### Ajouter un thème custom
|
|
228
|
+
|
|
229
|
+
Créez `assets/custom-theme.css` :
|
|
230
|
+
|
|
231
|
+
```css
|
|
232
|
+
:root {
|
|
233
|
+
--primary-color: #your-color;
|
|
234
|
+
--font-family: 'Your-Font', monospace;
|
|
235
|
+
}
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
Le build l'inclura automatiquement !
|
|
239
|
+
|
|
240
|
+
### Ajouter des pages custom
|
|
241
|
+
|
|
242
|
+
Créez `pages/about.html` dans votre projet. Le moteur le détectera au build.
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
246
|
+
## 🔄 Mettre à jour le moteur
|
|
247
|
+
|
|
248
|
+
Pour récupérer les dernières features du moteur :
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
npm update @mtldev514/retro-portfolio-maker
|
|
252
|
+
|
|
253
|
+
# Ou version spécifique
|
|
254
|
+
npm install @mtldev514/retro-portfolio-maker@latest
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
**Aucun conflit de merge** ! Vos données restent intactes.
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
## 🌐 Déploiement
|
|
262
|
+
|
|
263
|
+
### GitHub Pages (automatique)
|
|
264
|
+
|
|
265
|
+
Créez `.github/workflows/deploy.yml` :
|
|
266
|
+
|
|
267
|
+
```yaml
|
|
268
|
+
name: Deploy to GitHub Pages
|
|
269
|
+
|
|
270
|
+
on:
|
|
271
|
+
push:
|
|
272
|
+
branches: [main]
|
|
273
|
+
|
|
274
|
+
jobs:
|
|
275
|
+
deploy:
|
|
276
|
+
runs-on: ubuntu-latest
|
|
277
|
+
steps:
|
|
278
|
+
- uses: actions/checkout@v3
|
|
279
|
+
- uses: actions/setup-node@v3
|
|
280
|
+
with:
|
|
281
|
+
node-version: '18'
|
|
282
|
+
|
|
283
|
+
- run: npm install
|
|
284
|
+
- run: npm run build
|
|
285
|
+
|
|
286
|
+
- uses: peaceiris/actions-gh-pages@v3
|
|
287
|
+
with:
|
|
288
|
+
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
289
|
+
publish_dir: ./dist
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
Push sur `main` → Site déployé automatiquement ! ✨
|
|
293
|
+
|
|
294
|
+
### Netlify / Vercel
|
|
295
|
+
|
|
296
|
+
**Build command** : `npm run build`
|
|
297
|
+
**Publish directory** : `dist`
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
|
|
301
|
+
## 📚 Documentation Avancée
|
|
302
|
+
|
|
303
|
+
### Structure du package
|
|
304
|
+
|
|
305
|
+
```
|
|
306
|
+
@mtldev514/retro-portfolio-maker/
|
|
307
|
+
├── engine/ (Code du site - copié au build)
|
|
308
|
+
│ ├── index.html
|
|
309
|
+
│ ├── style.css
|
|
310
|
+
│ ├── js/
|
|
311
|
+
│ └── admin/
|
|
312
|
+
├── scripts/ (Scripts Node.js)
|
|
313
|
+
│ ├── build.js
|
|
314
|
+
│ ├── serve.js
|
|
315
|
+
│ └── admin.js
|
|
316
|
+
├── bin/
|
|
317
|
+
│ └── cli.js (CLI retro-portfolio)
|
|
318
|
+
└── templates/ (Templates pour init)
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
### API de données
|
|
322
|
+
|
|
323
|
+
Format des fichiers JSON :
|
|
324
|
+
|
|
325
|
+
**data/painting.json** :
|
|
326
|
+
```json
|
|
327
|
+
{
|
|
328
|
+
"items": [
|
|
329
|
+
{
|
|
330
|
+
"id": "unique-id",
|
|
331
|
+
"title": {
|
|
332
|
+
"en": "Sunset",
|
|
333
|
+
"fr": "Coucher de soleil"
|
|
334
|
+
},
|
|
335
|
+
"description": {
|
|
336
|
+
"en": "A beautiful sunset",
|
|
337
|
+
"fr": "Un magnifique coucher de soleil"
|
|
338
|
+
},
|
|
339
|
+
"image": "https://cloudinary.com/...",
|
|
340
|
+
"date": "2026-01-15"
|
|
341
|
+
}
|
|
342
|
+
]
|
|
343
|
+
}
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
**lang/en.json** :
|
|
347
|
+
```json
|
|
348
|
+
{
|
|
349
|
+
"header_title": "My Portfolio",
|
|
350
|
+
"nav_painting": "Paintings",
|
|
351
|
+
"footer_copy": "© 2026 Your Name"
|
|
352
|
+
}
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
---
|
|
356
|
+
|
|
357
|
+
## 🐛 Dépannage
|
|
358
|
+
|
|
359
|
+
### Le build échoue
|
|
360
|
+
|
|
361
|
+
```bash
|
|
362
|
+
# Vérifier que les dossiers requis existent
|
|
363
|
+
ls -la config/ data/ lang/
|
|
364
|
+
|
|
365
|
+
# Réinstaller le package
|
|
366
|
+
rm -rf node_modules
|
|
367
|
+
npm install
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
### L'admin ne démarre pas
|
|
371
|
+
|
|
372
|
+
L'admin nécessite Python 3 et Flask :
|
|
373
|
+
|
|
374
|
+
```bash
|
|
375
|
+
pip install flask flask-cors
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
### Les images ne s'affichent pas
|
|
379
|
+
|
|
380
|
+
Vérifiez que vos URLs d'images sont complètes (Cloudinary, etc.) ou placez-les dans `assets/`.
|
|
381
|
+
|
|
382
|
+
---
|
|
383
|
+
|
|
384
|
+
## 🤝 Contribution
|
|
385
|
+
|
|
386
|
+
Ce package est open source ! Pour contribuer :
|
|
387
|
+
|
|
388
|
+
1. Fork le repo [retro-portfolio-maker](https://github.com/YOUR_USERNAME/retro-portfolio-maker)
|
|
389
|
+
2. Créez une branche feature
|
|
390
|
+
3. Soumettez une Pull Request
|
|
391
|
+
|
|
392
|
+
---
|
|
393
|
+
|
|
394
|
+
## 📄 Licence
|
|
395
|
+
|
|
396
|
+
MIT © Alex
|
|
397
|
+
|
|
398
|
+
---
|
|
399
|
+
|
|
400
|
+
## 🔗 Liens
|
|
401
|
+
|
|
402
|
+
- [Documentation](https://github.com/YOUR_USERNAME/retro-portfolio-maker)
|
|
403
|
+
- [NPM Package](https://www.npmjs.com/package/@mtldev514/retro-portfolio-maker)
|
|
404
|
+
- [Issues](https://github.com/YOUR_USERNAME/retro-portfolio-maker/issues)
|
|
405
|
+
- [Exemples](https://github.com/YOUR_USERNAME/retro-portfolio-examples)
|
|
406
|
+
|
|
407
|
+
---
|
|
408
|
+
|
|
409
|
+
**Fait avec 💜 pour la communauté créative**
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Retro Portfolio CLI
|
|
5
|
+
* Main command-line interface for the package
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const { Command } = require('commander');
|
|
9
|
+
const chalk = require('chalk');
|
|
10
|
+
const path = require('path');
|
|
11
|
+
const fs = require('fs-extra');
|
|
12
|
+
|
|
13
|
+
const program = new Command();
|
|
14
|
+
|
|
15
|
+
// Import scripts
|
|
16
|
+
const build = require('../scripts/build');
|
|
17
|
+
const serve = require('../scripts/serve');
|
|
18
|
+
const admin = require('../scripts/admin');
|
|
19
|
+
const init = require('../scripts/init');
|
|
20
|
+
|
|
21
|
+
program
|
|
22
|
+
.name('retro-portfolio')
|
|
23
|
+
.description('Retro Portfolio Site Engine')
|
|
24
|
+
.version(require('../package.json').version);
|
|
25
|
+
|
|
26
|
+
// Init command - Create new portfolio
|
|
27
|
+
program
|
|
28
|
+
.command('init [directory]')
|
|
29
|
+
.description('Initialize a new portfolio with data templates')
|
|
30
|
+
.option('-f, --force', 'Overwrite existing files')
|
|
31
|
+
.action(async (directory, options) => {
|
|
32
|
+
try {
|
|
33
|
+
await init(directory || '.', options);
|
|
34
|
+
} catch (error) {
|
|
35
|
+
console.error(chalk.red('Error:'), error.message);
|
|
36
|
+
process.exit(1);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// Build command - Generate static site
|
|
41
|
+
program
|
|
42
|
+
.command('build')
|
|
43
|
+
.description('Build the static site from your data')
|
|
44
|
+
.option('-o, --output <dir>', 'Output directory', 'dist')
|
|
45
|
+
.option('-w, --watch', 'Watch for changes and rebuild')
|
|
46
|
+
.action(async (options) => {
|
|
47
|
+
try {
|
|
48
|
+
await build(options);
|
|
49
|
+
} catch (error) {
|
|
50
|
+
console.error(chalk.red('Error:'), error.message);
|
|
51
|
+
process.exit(1);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// Serve command - Local development server
|
|
56
|
+
program
|
|
57
|
+
.command('dev')
|
|
58
|
+
.alias('serve')
|
|
59
|
+
.description('Start local development server')
|
|
60
|
+
.option('-p, --port <number>', 'Port number', '8000')
|
|
61
|
+
.option('-o, --open', 'Open browser automatically')
|
|
62
|
+
.action(async (options) => {
|
|
63
|
+
try {
|
|
64
|
+
await serve(options);
|
|
65
|
+
} catch (error) {
|
|
66
|
+
console.error(chalk.red('Error:'), error.message);
|
|
67
|
+
process.exit(1);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
// Admin command - Launch admin interface
|
|
72
|
+
program
|
|
73
|
+
.command('admin')
|
|
74
|
+
.description('Start admin interface for managing content')
|
|
75
|
+
.option('-p, --port <number>', 'Port number', '5001')
|
|
76
|
+
.option('-o, --open', 'Open browser automatically')
|
|
77
|
+
.action(async (options) => {
|
|
78
|
+
try {
|
|
79
|
+
await admin(options);
|
|
80
|
+
} catch (error) {
|
|
81
|
+
console.error(chalk.red('Error:'), error.message);
|
|
82
|
+
process.exit(1);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
// Deploy command - Deploy to GitHub Pages
|
|
87
|
+
program
|
|
88
|
+
.command('deploy')
|
|
89
|
+
.description('Deploy site to GitHub Pages')
|
|
90
|
+
.option('-b, --branch <name>', 'Deployment branch', 'gh-pages')
|
|
91
|
+
.option('-d, --dir <path>', 'Build directory', 'dist')
|
|
92
|
+
.action(async (options) => {
|
|
93
|
+
console.log(chalk.yellow('Deploy command coming soon!'));
|
|
94
|
+
console.log('For now, use GitHub Actions or push dist/ manually.');
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
// Parse arguments
|
|
98
|
+
program.parse(process.argv);
|
|
99
|
+
|
|
100
|
+
// Show help if no command provided
|
|
101
|
+
if (!process.argv.slice(2).length) {
|
|
102
|
+
program.outputHelp();
|
|
103
|
+
}
|