Guide Day 1 - Setup Local
Guide Day 1 - Setup Local
Documentation technique
Audience : Nouveaux développeurs rejoignant l’équipe
Durée estimée : 2-4 heures
Prérequis : Sprint 0 terminé
1. Prérequis
1.1. Outils requis
| Outil | Version minimale | Installation |
|---|---|---|
| Node.js | 20+ | https://nodejs.org/ |
| Git | 2.30+ | https://git-scm.com/ |
| VS Code | Dernière | https://code.visualstudio.com/ |
| Wrangler CLI | Dernière | npm install -g wrangler |
| Sanity CLI | Dernière | npm install -g @sanity/cli |
1.2. Comptes requis
- Compte GitHub avec accès au repository
- Compte Cloudflare avec accès au workspace
- Compte Sanity avec accès au projet
2. Clonage du repository
# Cloner le repositorygit clone git@github.com:votre-org/votre-repo.git
# Se déplacer dans le dossiercd votre-repo
# Installer les dépendancesnpm install3. Configuration des variables d’environnement
3.1. Création du fichier .env
# Copier le fichier d'exemplecp .env.example .env3.2. Remplir les variables1/2
SANITY_PROJECT_ID=your-project-idSANITY_DATASET=productionSANITY_API_READ_TOKEN=your-read-tokenSANITY_API_WRITE_TOKEN=your-write-tokenSANITY_PREVIEW_SECRET=your-preview-secret
CLOUDFLARE_ACCOUNT_ID=your-account-id3.2. Remplir les variables2/2
Où trouver ces valeurs :
SANITY_PROJECT_ID: Dashboard Sanity → Settings → APISANITY_DATASET:productionoustagingSANITY_API_READ_TOKEN: Dashboard Sanity → Settings → API → TokensSANITY_API_WRITE_TOKEN: Dashboard Sanity → Settings → API → TokensSANITY_PREVIEW_SECRET: Généré aléatoirement (ex:openssl rand -base64 32)CLOUDFLARE_ACCOUNT_ID: Dashboard Cloudflare → Workers & Pages → Account ID
4. Authentification
4.1. Cloudflare Wrangler
# Authentificationwrangler login
# Vérificationwrangler whoami4.2. Sanity CLI
# Authentificationsanity login
# Vérificationsanity manage whoami5. Configuration VS Code
5.1. Extensions recommandées
| Extension | Usage |
|---|---|
| Astro | Support Astro |
| Sanity | Support Sanity |
| Tailwind CSS IntelliSense | Support Tailwind |
| ESLint | Linting |
| Prettier | Formatting |
| GitLens | Git amélioré |
5.2. Configuration .vscode/settings.json
{ "editor.formatOnSave": true, "editor.defaultFormatter": "esbenp.prettier-vscode", "editor.codeActionsOnSave": { "source.fixAll.eslint": true }, "files.associations": { "*.astro": "astro" }}6. Lancement du serveur de développement
6.1. Build local
# Build du projetnpm run build
# Preview localnpm run preview6.2. Développement local
# Serveur de développementnpm run devLe site sera accessible sur http://localhost:4321.
7. Tests
7.1. Lancer les tests
# Tests unitairesnpm run test
# Tests E2Enpm run test:e2e7.2. Linting
# Lintingnpm run lint
# Type checkingnpm run typecheck8. Workflow Git
8.1. Créer une branche
# Se mettre sur developgit checkout develop
# Pull les dernières modificationsgit pull origin develop
# Créer une branche featuregit checkout -b feature/slice-X-tache8.2. Commiter les modifications
# Ajouter les fichiersgit add .
# Commitergit commit -m "feat: description de la modification"
# Pushergit push origin feature/slice-X-tache8.3. Créer une Pull Request
- Aller sur GitHub
- Cliquer sur “New Pull Request”
- Sélectionner la branche
feature/slice-X-tacheversdevelop - Remplir le template de PR
- Soumettre pour review
9. Déploiement local (Wrangler)
9.1. Déploiement staging
# Déploiement stagingwrangler pages deploy dist --project-name=votre-projet-staging9.2. Logs en temps réel
# Logs du workerwrangler tail10. Sanity Studio local
10.1. Lancer le Studio
# Lancer le Studionpm run sanity:devLe Studio sera accessible sur http://localhost:3333.
11. Dépannage
11.1. Problèmes courants
| Symptôme | Cause probable | Solution |
|---|---|---|
npm install échoue |
Version Node.js incompatible | Mettre à jour Node.js |
wrangler login échoue |
Permissions insuffisantes | Vérifier les permissions Cloudflare |
| Variables d’environnement non chargées | Fichier .env manquant |
Créer le fichier .env |
| Build échoue | Dépendances manquantes | npm install |
11.2. Ressources
- Documentation Astro : https://docs.astro.build/
- Documentation Sanity : https://www.sanity.io/docs
- Documentation Cloudflare : https://developers.cloudflare.com/
12. Checklist de validation1/2
Avant de commencer le développement, vérifier :
- Node.js 20+ installé
- Git installé
- VS Code installé
- Wrangler CLI installé
- Sanity CLI installé
- Repository cloné
- Dépendances installées
12. Checklist de validation2/2
- Variables d’environnement configurées
- Authentification Cloudflare réussie
- Authentification Sanity réussie
- Serveur de développement fonctionne
- Tests passent
- Linting passe
13. Prochaines étapes
Une fois le setup local terminé :
- Lire le guide de contribution (
CONTRIBUTING.md) - Lire la méthodologie de développement (
Standard-operating-procedure.md) - Consulter l’ordre des slices (
Phase0-Ordre-Slices.md) - Commencer par Slice 1 : Schéma Sanity “page”
14. Support
En cas de problème :
- Canal Slack : #dev
- Email : dev@votre-entreprise.com
- Documentation : Repository GitHub
15. Historique des modifications
| Date | Version | Description | Auteur |
|---|---|---|---|
| YYYY-MM-DD | 1.0 | Création initiale | [Nom] |