nexu-app 2.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/README.md +149 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1192 -0
- package/package.json +43 -0
- package/templates/default/.changeset/config.json +11 -0
- package/templates/default/.eslintignore +16 -0
- package/templates/default/.eslintrc.js +67 -0
- package/templates/default/.github/actions/build/action.yml +35 -0
- package/templates/default/.github/actions/quality/action.yml +53 -0
- package/templates/default/.github/dependabot.yml +51 -0
- package/templates/default/.github/workflows/deploy-dev.yml +83 -0
- package/templates/default/.github/workflows/deploy-prod.yml +83 -0
- package/templates/default/.github/workflows/deploy-rec.yml +83 -0
- package/templates/default/.husky/commit-msg +1 -0
- package/templates/default/.husky/pre-commit +1 -0
- package/templates/default/.nexu-version +1 -0
- package/templates/default/.prettierignore +7 -0
- package/templates/default/.prettierrc +19 -0
- package/templates/default/.vscode/extensions.json +14 -0
- package/templates/default/.vscode/settings.json +36 -0
- package/templates/default/apps/gitkeep +0 -0
- package/templates/default/commitlint.config.js +26 -0
- package/templates/default/docker/docker-compose.dev.yml +49 -0
- package/templates/default/docker/docker-compose.prod.yml +64 -0
- package/templates/default/docker/docker-compose.yml +6 -0
- package/templates/default/docs/architecture.md +452 -0
- package/templates/default/docs/cli.md +330 -0
- package/templates/default/docs/contributing.md +462 -0
- package/templates/default/docs/scripts.md +460 -0
- package/templates/default/gitignore +44 -0
- package/templates/default/lintstagedrc.cjs +4 -0
- package/templates/default/package.json +51 -0
- package/templates/default/packages/auth/package.json +61 -0
- package/templates/default/packages/auth/src/components/ProtectedRoute.tsx +75 -0
- package/templates/default/packages/auth/src/components/SignInForm.tsx +153 -0
- package/templates/default/packages/auth/src/components/SignUpForm.tsx +179 -0
- package/templates/default/packages/auth/src/components/SocialButtons.tsx +147 -0
- package/templates/default/packages/auth/src/components/index.ts +4 -0
- package/templates/default/packages/auth/src/hooks/index.ts +4 -0
- package/templates/default/packages/auth/src/hooks/useAuth.ts +51 -0
- package/templates/default/packages/auth/src/hooks/useRequireAuth.ts +54 -0
- package/templates/default/packages/auth/src/hooks/useSession.ts +48 -0
- package/templates/default/packages/auth/src/hooks/useUser.ts +48 -0
- package/templates/default/packages/auth/src/index.ts +45 -0
- package/templates/default/packages/auth/src/next/index.ts +18 -0
- package/templates/default/packages/auth/src/next/middleware.ts +183 -0
- package/templates/default/packages/auth/src/next/server.ts +219 -0
- package/templates/default/packages/auth/src/providers/AuthContext.tsx +435 -0
- package/templates/default/packages/auth/src/providers/index.ts +1 -0
- package/templates/default/packages/auth/src/types/index.ts +284 -0
- package/templates/default/packages/auth/src/utils/api.ts +228 -0
- package/templates/default/packages/auth/src/utils/index.ts +3 -0
- package/templates/default/packages/auth/src/utils/oauth.ts +230 -0
- package/templates/default/packages/auth/src/utils/token.ts +204 -0
- package/templates/default/packages/auth/tsconfig.json +14 -0
- package/templates/default/packages/auth/tsup.config.ts +18 -0
- package/templates/default/packages/cache/package.json +26 -0
- package/templates/default/packages/cache/src/index.ts +137 -0
- package/templates/default/packages/cache/tsconfig.json +9 -0
- package/templates/default/packages/cache/tsup.config.ts +9 -0
- package/templates/default/packages/config/eslint/index.js +20 -0
- package/templates/default/packages/config/package.json +9 -0
- package/templates/default/packages/config/typescript/base.json +26 -0
- package/templates/default/packages/constants/package.json +26 -0
- package/templates/default/packages/constants/src/index.ts +121 -0
- package/templates/default/packages/constants/tsconfig.json +9 -0
- package/templates/default/packages/constants/tsup.config.ts +9 -0
- package/templates/default/packages/logger/package.json +27 -0
- package/templates/default/packages/logger/src/index.ts +197 -0
- package/templates/default/packages/logger/tsconfig.json +11 -0
- package/templates/default/packages/logger/tsup.config.ts +9 -0
- package/templates/default/packages/result/package.json +26 -0
- package/templates/default/packages/result/src/index.ts +142 -0
- package/templates/default/packages/result/tsconfig.json +9 -0
- package/templates/default/packages/result/tsup.config.ts +9 -0
- package/templates/default/packages/types/package.json +26 -0
- package/templates/default/packages/types/src/index.ts +78 -0
- package/templates/default/packages/types/tsconfig.json +9 -0
- package/templates/default/packages/types/tsup.config.ts +10 -0
- package/templates/default/packages/ui/package.json +38 -0
- package/templates/default/packages/ui/src/components/Button.tsx +58 -0
- package/templates/default/packages/ui/src/components/Card.tsx +85 -0
- package/templates/default/packages/ui/src/components/Input.tsx +45 -0
- package/templates/default/packages/ui/src/index.ts +15 -0
- package/templates/default/packages/ui/tsconfig.json +11 -0
- package/templates/default/packages/ui/tsup.config.ts +11 -0
- package/templates/default/packages/utils/package.json +30 -0
- package/templates/default/packages/utils/src/index.test.ts +130 -0
- package/templates/default/packages/utils/src/index.ts +154 -0
- package/templates/default/packages/utils/tsconfig.json +10 -0
- package/templates/default/packages/utils/tsup.config.ts +10 -0
- package/templates/default/pnpm-workspace.yaml +3 -0
- package/templates/default/scripts/audit.mjs +700 -0
- package/templates/default/scripts/deploy.mjs +40 -0
- package/templates/default/scripts/generate-app.mjs +808 -0
- package/templates/default/scripts/lib/package-manager.mjs +186 -0
- package/templates/default/scripts/setup.mjs +102 -0
- package/templates/default/services/.env.example +16 -0
- package/templates/default/services/docker-compose.yml +207 -0
- package/templates/default/services/grafana/provisioning/dashboards/dashboards.yml +11 -0
- package/templates/default/services/grafana/provisioning/datasources/datasources.yml +9 -0
- package/templates/default/services/postgres/init/gitkeep +2 -0
- package/templates/default/services/prometheus/prometheus.yml +13 -0
- package/templates/default/tsconfig.json +27 -0
- package/templates/default/turbo.json +40 -0
- package/templates/default/vitest.config.ts +15 -0
package/README.md
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# nexu-app
|
|
2
|
+
|
|
3
|
+
CLI pour créer et mettre à jour des projets Nexu monorepo.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Pas besoin d'installer, utiliser directement avec npx
|
|
9
|
+
npx nexu-app init my-project
|
|
10
|
+
|
|
11
|
+
# Ou installer globalement
|
|
12
|
+
npm install -g nexu-app
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Commandes
|
|
16
|
+
|
|
17
|
+
### `nexu-app init [project-name]`
|
|
18
|
+
|
|
19
|
+
Crée un nouveau projet Nexu monorepo.
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# Interactif
|
|
23
|
+
npx nexu-app init
|
|
24
|
+
|
|
25
|
+
# Avec nom de projet
|
|
26
|
+
npx nexu-app init my-app
|
|
27
|
+
|
|
28
|
+
# Options
|
|
29
|
+
npx nexu-app init my-app --skip-install # Ne pas installer les dépendances
|
|
30
|
+
npx nexu-app init my-app --skip-git # Ne pas initialiser git
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Le wizard interactif permet de:
|
|
34
|
+
|
|
35
|
+
- Choisir les packages à inclure
|
|
36
|
+
- Sélectionner les fonctionnalités (services Docker, workflows, etc.)
|
|
37
|
+
|
|
38
|
+
### `nexu-app update`
|
|
39
|
+
|
|
40
|
+
Met à jour un projet existant avec les dernières fonctionnalités.
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# Mettre à jour tout
|
|
44
|
+
npx nexu-app update
|
|
45
|
+
|
|
46
|
+
# Mettre à jour seulement les packages
|
|
47
|
+
npx nexu-app update --packages
|
|
48
|
+
|
|
49
|
+
# Mettre à jour seulement les configs
|
|
50
|
+
npx nexu-app update --config
|
|
51
|
+
|
|
52
|
+
# Mettre à jour seulement les workflows
|
|
53
|
+
npx nexu-app update --workflows
|
|
54
|
+
|
|
55
|
+
# Mettre à jour seulement les services Docker
|
|
56
|
+
npx nexu-app update --services
|
|
57
|
+
|
|
58
|
+
# Voir ce qui serait mis à jour sans faire de changements
|
|
59
|
+
npx nexu-app update --dry-run
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### `nexu-app add <component>`
|
|
63
|
+
|
|
64
|
+
Ajoute un composant à un projet existant.
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# Ajouter un package
|
|
68
|
+
npx nexu-app add package
|
|
69
|
+
npx nexu-app add package --name logger
|
|
70
|
+
|
|
71
|
+
# Ajouter les services Docker
|
|
72
|
+
npx nexu-app add service
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Workflow typique
|
|
76
|
+
|
|
77
|
+
### Nouveau projet
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
# 1. Créer le projet
|
|
81
|
+
npx nexu-app init my-app
|
|
82
|
+
cd my-app
|
|
83
|
+
|
|
84
|
+
# 2. Créer une application
|
|
85
|
+
pnpm generate:app api 4000
|
|
86
|
+
pnpm generate:app web 3000
|
|
87
|
+
|
|
88
|
+
# 3. Développer
|
|
89
|
+
pnpm dev
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Mise à jour d'un projet existant
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
# 1. Depuis la racine du projet
|
|
96
|
+
cd my-existing-project
|
|
97
|
+
|
|
98
|
+
# 2. Mettre à jour
|
|
99
|
+
npx nexu-app update
|
|
100
|
+
|
|
101
|
+
# 3. Installer les nouvelles dépendances
|
|
102
|
+
pnpm install
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Ajouter des fonctionnalités
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
# Ajouter un nouveau package partagé
|
|
109
|
+
npx nexu-app add package
|
|
110
|
+
|
|
111
|
+
# Ajouter les services Docker
|
|
112
|
+
npx nexu-app add service
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Packages disponibles
|
|
116
|
+
|
|
117
|
+
| Package | Description |
|
|
118
|
+
| ----------- | -------------------------------- |
|
|
119
|
+
| `cache` | Cache in-memory avec TTL |
|
|
120
|
+
| `config` | Configurations ESLint/TypeScript |
|
|
121
|
+
| `constants` | Constantes partagées |
|
|
122
|
+
| `logger` | Logger avec niveaux et couleurs |
|
|
123
|
+
| `result` | Try/catch fonctionnel |
|
|
124
|
+
| `types` | Types TypeScript partagés |
|
|
125
|
+
| `ui` | Composants React |
|
|
126
|
+
| `utils` | Fonctions utilitaires |
|
|
127
|
+
|
|
128
|
+
## Services Docker disponibles
|
|
129
|
+
|
|
130
|
+
| Service | Profile | Description |
|
|
131
|
+
| ------------- | ---------- | ----------------------------- |
|
|
132
|
+
| PostgreSQL | database | Base de données relationnelle |
|
|
133
|
+
| Redis | database | Cache et store clé-valeur |
|
|
134
|
+
| RabbitMQ | messaging | Message broker (AMQP) |
|
|
135
|
+
| Kafka | messaging | Event streaming |
|
|
136
|
+
| Prometheus | monitoring | Métriques et alerting |
|
|
137
|
+
| Grafana | monitoring | Visualisation des métriques |
|
|
138
|
+
| MinIO | storage | Stockage S3-compatible |
|
|
139
|
+
| Elasticsearch | search | Moteur de recherche |
|
|
140
|
+
|
|
141
|
+
## Publication
|
|
142
|
+
|
|
143
|
+
Pour publier une nouvelle version:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
cd packages/nexu-app
|
|
147
|
+
pnpm build
|
|
148
|
+
npm publish
|
|
149
|
+
```
|
package/dist/index.d.ts
ADDED