ci(github): workflow typecheck/test/audit + README projet
This commit is contained in:
parent
57a8b1847a
commit
ede03d01c1
2 changed files with 74 additions and 61 deletions
23
.github/workflows/ci.yml
vendored
Normal file
23
.github/workflows/ci.yml
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
pull_request:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
quality:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: '22'
|
||||||
|
cache: 'npm'
|
||||||
|
- run: npm ci
|
||||||
|
- run: npm run lint
|
||||||
|
- run: npm run format:check
|
||||||
|
- run: npm run typecheck
|
||||||
|
- run: npm run test
|
||||||
|
- run: npm audit --audit-level=high
|
||||||
112
README.md
112
README.md
|
|
@ -1,73 +1,63 @@
|
||||||
# React + TypeScript + Vite
|
# Expria Frontend
|
||||||
|
|
||||||
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
Frontend SaaS pour la préparation au TCF Canada. SPA React + Vite, déploiement Cloudflare Pages.
|
||||||
|
|
||||||
Currently, two official plugins are available:
|
## Stack
|
||||||
|
|
||||||
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Oxc](https://oxc.rs)
|
React 19 · Vite 8 · TypeScript 6 · Tailwind 4 · React Router 7 · TanStack Query 5 · Supabase Auth · Vitest.
|
||||||
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/)
|
|
||||||
|
|
||||||
## React Compiler
|
Détails et versions : [`docs/adr/006-stack-versions-2026.md`](docs/adr/006-stack-versions-2026.md).
|
||||||
|
|
||||||
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
|
## Prérequis
|
||||||
|
|
||||||
## Expanding the ESLint configuration
|
- Node.js 22 LTS
|
||||||
|
- npm 10+
|
||||||
|
|
||||||
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
|
## Installation
|
||||||
|
|
||||||
```js
|
```bash
|
||||||
export default defineConfig([
|
npm install
|
||||||
globalIgnores(['dist']),
|
cp .env.example .env
|
||||||
{
|
# Remplir .env avec tes valeurs Supabase + URL backend
|
||||||
files: ['**/*.{ts,tsx}'],
|
|
||||||
extends: [
|
|
||||||
// Other configs...
|
|
||||||
|
|
||||||
// Remove tseslint.configs.recommended and replace with this
|
|
||||||
tseslint.configs.recommendedTypeChecked,
|
|
||||||
// Alternatively, use this for stricter rules
|
|
||||||
tseslint.configs.strictTypeChecked,
|
|
||||||
// Optionally, add this for stylistic rules
|
|
||||||
tseslint.configs.stylisticTypeChecked,
|
|
||||||
|
|
||||||
// Other configs...
|
|
||||||
],
|
|
||||||
languageOptions: {
|
|
||||||
parserOptions: {
|
|
||||||
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
||||||
tsconfigRootDir: import.meta.dirname,
|
|
||||||
},
|
|
||||||
// other options...
|
|
||||||
},
|
|
||||||
},
|
|
||||||
])
|
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
|
## Commandes
|
||||||
|
|
||||||
```js
|
| Commande | Rôle |
|
||||||
// eslint.config.js
|
|---|---|
|
||||||
import reactX from 'eslint-plugin-react-x'
|
| `npm run dev` | Lance le serveur de dev Vite (HMR) |
|
||||||
import reactDom from 'eslint-plugin-react-dom'
|
| `npm run build` | Build de production |
|
||||||
|
| `npm run typecheck` | `tsc --noEmit` |
|
||||||
|
| `npm run lint` | ESLint |
|
||||||
|
| `npm run test` | Vitest (run unique) |
|
||||||
|
| `npm run test:watch` | Vitest (watch mode) |
|
||||||
|
| `npm run format` | Formate tout via Prettier |
|
||||||
|
| `npm run format:check` | Vérifie le formatage sans écrire |
|
||||||
|
|
||||||
export default defineConfig([
|
## Variables d'environnement
|
||||||
globalIgnores(['dist']),
|
|
||||||
{
|
Voir [`.env.example`](.env.example). Le démarrage échoue avec un message clair si une variable requise manque (validation Zod dans `src/shared/config/env.ts`).
|
||||||
files: ['**/*.{ts,tsx}'],
|
|
||||||
extends: [
|
## Structure du code
|
||||||
// Other configs...
|
|
||||||
// Enable lint rules for React
|
Voir [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md) §3.
|
||||||
reactX.configs['recommended-typescript'],
|
|
||||||
// Enable lint rules for React DOM
|
Architecture FSD : `app/` (entry) · `entities/` (métier) · `features/` (UI) · `shared/` (code réutilisable).
|
||||||
reactDom.configs.recommended,
|
|
||||||
],
|
## Documentation
|
||||||
languageOptions: {
|
|
||||||
parserOptions: {
|
| Document | Contenu |
|
||||||
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|---|---|
|
||||||
tsconfigRootDir: import.meta.dirname,
|
| [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md) | Architecture complète, flux, codes d'erreur |
|
||||||
},
|
| [`docs/DEVELOPMENT_PRINCIPLES.md`](docs/DEVELOPMENT_PRINCIPLES.md) | Règles de dev, conventions, workflow |
|
||||||
// other options...
|
| [`docs/ONBOARDING.md`](docs/ONBOARDING.md) | Guide dev (démarrage, outils) |
|
||||||
},
|
| [`docs/SECURITY.md`](docs/SECURITY.md) | Patterns sécurité + trous identifiés |
|
||||||
},
|
| [`docs/adr/`](docs/adr/) | Architecture Decision Records |
|
||||||
])
|
|
||||||
```
|
## CI
|
||||||
|
|
||||||
|
GitHub Actions : `lint`, `format:check`, `typecheck`, `test`, `npm audit --audit-level=high`. Voir [`.github/workflows/ci.yml`](.github/workflows/ci.yml).
|
||||||
|
|
||||||
|
## Licence
|
||||||
|
|
||||||
|
Propriétaire — Expria.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue