@fraza/start 0.0.0-stage → 0.3.5
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/CHANGELOG.md +186 -0
- package/LICENSE +21 -0
- package/README.md +97 -2
- package/THIRD-PARTY-NOTICES.md +11 -0
- package/bin/agents-block.md +61 -0
- package/bin/cli.js +197 -0
- package/bin/project.js +281 -0
- package/bin/version.js +2 -0
- package/changelog.json +602 -0
- package/package.json +42 -4
- package/templates/app/(admin)/admin/[...admin]/layout.js +3 -0
- package/templates/app/(admin)/admin/[...admin]/loading.js +3 -0
- package/templates/app/(admin)/admin/[...admin]/page.js +1 -0
- package/templates/app/(admin)/admin/error.js +4 -0
- package/templates/app/(admin)/admin/layout.js +17 -0
- package/templates/app/(admin)/admin/not-found.js +2 -0
- package/templates/app/(admin)/admin/page.js +5 -0
- package/templates/app/(auth)/auth/[...auth]/page.js +1 -0
- package/templates/app/(auth)/auth/page.js +5 -0
- package/templates/app/(public)/[...slug]/page.js +29 -0
- package/templates/app/(public)/error.js +6 -0
- package/templates/app/(public)/layout.js +17 -0
- package/templates/app/(public)/not-found.js +20 -0
- package/templates/app/(public)/page.js +248 -0
- package/templates/app/.fraza/blocks.client.js +8 -0
- package/templates/app/.fraza/blocks.server.js +4 -0
- package/templates/app/.fraza/modules.client.js +6 -0
- package/templates/app/.fraza/modules.generated.js +3 -0
- package/templates/app/.fraza/public-pages.server.js +4 -0
- package/templates/app/.fraza/sources.css +2 -0
- package/templates/app/.fraza/templates.server.js +5 -0
- package/templates/app/global-error.js +5 -0
- package/templates/app/icon.svg +1 -0
- package/templates/app/layout.js +31 -0
- package/templates/app/za/[...path]/not-found.js +6 -0
- package/templates/app/za/[...path]/page.js +8 -0
- package/templates/app/za/api/[...path]/route.js +1 -0
- package/templates/app/za/media/[filename]/route.js +1 -0
- package/templates/components/fraza/blocks/README.md +207 -0
- package/templates/components/fraza/blocks/accordion/fields.js +19 -0
- package/templates/components/fraza/blocks/accordion/render.js +47 -0
- package/templates/components/fraza/blocks/accordion/template.js +28 -0
- package/templates/components/fraza/blocks/callout/fields.js +15 -0
- package/templates/components/fraza/blocks/callout/render.js +28 -0
- package/templates/components/fraza/blocks/callout/template.js +37 -0
- package/templates/components/fraza/blocks/icon-list/fields.js +20 -0
- package/templates/components/fraza/blocks/icon-list/render.js +44 -0
- package/templates/components/fraza/blocks/icon-list/template.js +89 -0
- package/templates/components/fraza/blocks/three-cards/fields.js +19 -0
- package/templates/components/fraza/blocks/three-cards/render.js +33 -0
- package/templates/components/fraza/blocks/three-cards/template.js +57 -0
- package/templates/components/fraza/templates/README.md +293 -0
- package/templates/components/fraza/templates/content.js +271 -0
- package/templates/components/fraza/templates/default.js +18 -0
- package/templates/components/fraza/templates/post-blogue.js +97 -0
- package/templates/instrumentation.js +21 -0
- package/templates/jsconfig.json +9 -0
- package/templates/styles/globals.css +25 -0
- package/templates/theme.js +25 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
# Journal des versions
|
|
2
|
+
|
|
3
|
+
Historique des versions publiées de `@fraza/start`.
|
|
4
|
+
|
|
5
|
+
Ce fichier est généré par `fraza-module changelog` à partir des messages de commit. Ne pas le modifier à la main.
|
|
6
|
+
|
|
7
|
+
## 0.3.5 (2026-10-25)
|
|
8
|
+
|
|
9
|
+
### Ajouts
|
|
10
|
+
|
|
11
|
+
- **README** : overhaul documentation and add installation instructions (e1f31df)
|
|
12
|
+
|
|
13
|
+
## 0.3.4 (2026-10-24)
|
|
14
|
+
|
|
15
|
+
### Documentation
|
|
16
|
+
|
|
17
|
+
- update README and CLI configuration (7fecf81)
|
|
18
|
+
|
|
19
|
+
## 0.3.3 (2026-10-24)
|
|
20
|
+
|
|
21
|
+
### Action requise
|
|
22
|
+
|
|
23
|
+
- `npx fraza-doctor --fix`
|
|
24
|
+
|
|
25
|
+
### Refontes
|
|
26
|
+
|
|
27
|
+
- **templates/components/fraza/blocks/icon-list** : update icon resolution (d5ad8f2)
|
|
28
|
+
- **components** : remove unused icon module (5fb8291)
|
|
29
|
+
|
|
30
|
+
## 0.3.2 (2026-10-24)
|
|
31
|
+
|
|
32
|
+
### Action requise
|
|
33
|
+
|
|
34
|
+
- `npx fraza-doctor --fix`
|
|
35
|
+
|
|
36
|
+
### Refontes
|
|
37
|
+
|
|
38
|
+
- **components/frazaicons** : group imports and update descriptions (9fba523)
|
|
39
|
+
|
|
40
|
+
## 0.3.1 (2026-10-24)
|
|
41
|
+
|
|
42
|
+
### Action requise
|
|
43
|
+
|
|
44
|
+
- `npx fraza-doctor --fix`
|
|
45
|
+
|
|
46
|
+
### Corrections
|
|
47
|
+
|
|
48
|
+
- **package.json, package-lock.json** : bump version to 0.3.0 (1a1aa74)
|
|
49
|
+
|
|
50
|
+
### Refontes
|
|
51
|
+
|
|
52
|
+
- **cli** : ensure exact package versions for Fraza projects (70fa0a3)
|
|
53
|
+
- **fraza** : update icon names and descriptions (08cdcfe)
|
|
54
|
+
|
|
55
|
+
### Autres
|
|
56
|
+
|
|
57
|
+
- fix(fraza(blocks)): update icon imports and labels (863eeab)
|
|
58
|
+
|
|
59
|
+
## 0.2.6 (2026-10-23)
|
|
60
|
+
|
|
61
|
+
### Action requise
|
|
62
|
+
|
|
63
|
+
- `npx fraza-doctor --fix`
|
|
64
|
+
|
|
65
|
+
### Refontes
|
|
66
|
+
|
|
67
|
+
- **bin/cli.js, templates/components/fraza/blocks/**/*.render.js, templates/components/fraza/blocks/icon-list/template.js, test/templates.test.js** : update dependencies and imports to use @fraza/icons (8a1bc61)
|
|
68
|
+
|
|
69
|
+
## 0.2.5 (2026-10-22)
|
|
70
|
+
|
|
71
|
+
### Action requise
|
|
72
|
+
|
|
73
|
+
- `npx fraza-doctor --fix`
|
|
74
|
+
|
|
75
|
+
### Refontes
|
|
76
|
+
|
|
77
|
+
- **fraza/icons** : update icon descriptions and paths (12490c5)
|
|
78
|
+
|
|
79
|
+
## 0.2.4 (2026-10-21)
|
|
80
|
+
|
|
81
|
+
### Action requise
|
|
82
|
+
|
|
83
|
+
- `npx fraza-doctor --fix`
|
|
84
|
+
|
|
85
|
+
Maintenance interne, aucun changement de comportement.
|
|
86
|
+
|
|
87
|
+
## 0.2.3 (2026-10-21)
|
|
88
|
+
|
|
89
|
+
### Action requise
|
|
90
|
+
|
|
91
|
+
- `npx fraza-doctor --fix`
|
|
92
|
+
|
|
93
|
+
### Corrections
|
|
94
|
+
|
|
95
|
+
- **components/fraza** : update API endpoint URLs (a6839a7)
|
|
96
|
+
|
|
97
|
+
### Refontes
|
|
98
|
+
|
|
99
|
+
- rename files from fraza to za (da3f362)
|
|
100
|
+
|
|
101
|
+
## 0.2.2 (2026-10-20)
|
|
102
|
+
|
|
103
|
+
### Corrections
|
|
104
|
+
|
|
105
|
+
- **package.json** : correct bin path (ef61e32)
|
|
106
|
+
|
|
107
|
+
## 0.2.1 (2026-10-20)
|
|
108
|
+
|
|
109
|
+
### Ruptures
|
|
110
|
+
|
|
111
|
+
- decide the admin 404 in the layout of [...admin], render it in the shell
|
|
112
|
+
- boot from @fraza/core/init, import Button by its own entry on the public pages
|
|
113
|
+
- drop app/(public)/loading.js, which made every unknown URL answer 200
|
|
114
|
+
- pin create-next-app to the tested Next, check the prerequisites first
|
|
115
|
+
- track .env.example, keep .env.local and every other .env out of git
|
|
116
|
+
- never copy the registry token into the project .npmrc
|
|
117
|
+
- drop fs-extra, require Node 20.12, test the generation steps
|
|
118
|
+
|
|
119
|
+
### Action requise
|
|
120
|
+
|
|
121
|
+
- `npx fraza-doctor --fix`
|
|
122
|
+
|
|
123
|
+
### Ajouts
|
|
124
|
+
|
|
125
|
+
- **release** : bump the version in npm run release, patch by default (6a87a26)
|
|
126
|
+
- **release** : check, publish, then tag and push, with changelog and version module (ce8f04a)
|
|
127
|
+
- **templates** : add error, loading and global-error boundaries (8a38c39)
|
|
128
|
+
- **cli** : write every message in French, like the rest of the product (d9b776f)
|
|
129
|
+
- **cli** : pin create-next-app to the tested Next, check the prerequisites first (63d338c)
|
|
130
|
+
- **cli** : track .env.example, keep .env.local and every other .env out of git (f7252c8)
|
|
131
|
+
|
|
132
|
+
### Corrections
|
|
133
|
+
|
|
134
|
+
- **templates** : pass the links of an image and an icon list through sanitizeUrl (d268cc2)
|
|
135
|
+
- **templates** : decide the admin 404 in the layout of [...admin], render it in the shell (69c8bca)
|
|
136
|
+
- **templates** : render a linked image from the filename the Medias module resolves (8cfc288)
|
|
137
|
+
- **templates** : boot from @fraza/core/init, import Button by its own entry on the public pages (c62e26c)
|
|
138
|
+
- **templates** : drop app/(public)/loading.js, which made every unknown URL answer 200 (32fd83f)
|
|
139
|
+
- **cli** : give .env.local a header written for it, not the one of .env.example (382a376)
|
|
140
|
+
- **cli** : install the latest patch of the tested Next minor, 16.3.8 (83dea71)
|
|
141
|
+
- **templates** : use the core Button on the home page, drop its hard-coded title (7805ebc)
|
|
142
|
+
- **templates** : clip horizontal overflow without breaking sticky elements (b775491)
|
|
143
|
+
- **templates** : keep the @/* alias of create-next-app in jsconfig.json (2a5edf6)
|
|
144
|
+
- **templates** : title the public pages with FRAZA_NAME instead of an empty string (84fa798)
|
|
145
|
+
- **cli** : never copy the registry token into the project .npmrc (fc9160e)
|
|
146
|
+
|
|
147
|
+
### Refontes
|
|
148
|
+
|
|
149
|
+
- **templates** : drop the dead branches of the public catch-all (27e9cb1)
|
|
150
|
+
- **cli** : drop fs-extra, require Node 20.12, test the generation steps (bd10684)
|
|
151
|
+
|
|
152
|
+
### Documentation
|
|
153
|
+
|
|
154
|
+
- **readme** : npm run release warns about breaking changes in a patch, it no longer refuses (e913df9)
|
|
155
|
+
- **readme** : say npm run release refuses patch while breaking changes wait (ed209d8)
|
|
156
|
+
- **cli** : say the core now declares Next 16.3.8 as tested (9ddec07)
|
|
157
|
+
- **blocks** : say that two blocks under one id stop the startup (b3ed4ff)
|
|
158
|
+
|
|
159
|
+
## 0.1.2 (2026-10-19)
|
|
160
|
+
|
|
161
|
+
### Action requise
|
|
162
|
+
|
|
163
|
+
- `npx fraza-doctor --fix`
|
|
164
|
+
|
|
165
|
+
### Ajouts
|
|
166
|
+
|
|
167
|
+
- write the @fraza-pro scope in .npmrc, no token needed for free packages (3279869)
|
|
168
|
+
|
|
169
|
+
### Refontes
|
|
170
|
+
|
|
171
|
+
- **fraza** : update icon list to use local icon import (a0aa439)
|
|
172
|
+
- **api** : remove unused Icons component (ae72fcd)
|
|
173
|
+
|
|
174
|
+
## 0.1.1 (2026-10-19)
|
|
175
|
+
|
|
176
|
+
### Action requise
|
|
177
|
+
|
|
178
|
+
- `npx fraza-doctor --fix`
|
|
179
|
+
|
|
180
|
+
### Ajouts
|
|
181
|
+
|
|
182
|
+
- initial Fraza 0.1.0 codebase (85f1053)
|
|
183
|
+
|
|
184
|
+
### Autres
|
|
185
|
+
|
|
186
|
+
- Initial commit (402f173)
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 HYKO
|
|
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
CHANGED
|
@@ -1,3 +1,98 @@
|
|
|
1
|
-
|
|
1
|
+
<img src="https://docs.fraza.ca/readme/start.png" alt="Fraza, un projet en une commande" width="100%">
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Le CLI crée un projet Next.js avec `@fraza/core` déjà branché : administration, comptes, site public et variables d'environnement prêtes à remplir.
|
|
4
|
+
|
|
5
|
+
[Documentation](https://docs.fraza.ca/docs) · [Installation](https://docs.fraza.ca/docs/demarrage/installation) · [Structure du projet](https://docs.fraza.ca/docs/demarrage/structure-du-projet)
|
|
6
|
+
|
|
7
|
+
> [!WARNING]
|
|
8
|
+
> Fraza est en version `0.x`. La structure des projets générés peut encore changer d'une version mineure à l'autre.
|
|
9
|
+
|
|
10
|
+
## Points forts
|
|
11
|
+
|
|
12
|
+
- **Aucune question.** Le CLI lance `create-next-app` avec toutes ses options : JavaScript, Tailwind CSS, ESLint, App Router, alias `@/*`.
|
|
13
|
+
- **Rien à configurer pour commencer.** `@fraza/core` vient de npmjs, sans compte, et `.env.local` sort avec sa clé de chiffrement déjà générée.
|
|
14
|
+
- **Sans dégât.** Les prérequis sont vérifiés avant toute écriture : un échec laisse le dossier tel qu'il était.
|
|
15
|
+
- **Un projet qui reste le vôtre.** Pages publiques, pages d'erreur, thème et blocs sont des gabarits copiés dans le projet, à modifier librement.
|
|
16
|
+
|
|
17
|
+
## Prérequis
|
|
18
|
+
|
|
19
|
+
- Node.js 20.12 ou plus.
|
|
20
|
+
- Une base PostgreSQL 14 ou plus.
|
|
21
|
+
- Un dossier vide. Seules les métadonnées d'éditeur ou de git y sont tolérées : `.git`, `.vscode`, `.idea`, `.DS_Store`, `LICENSE`.
|
|
22
|
+
|
|
23
|
+
## Utilisation
|
|
24
|
+
|
|
25
|
+
Dans le dossier du nouveau projet :
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npx @fraza/start
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Renseignez au moins `FRAZA_DATABASE_URL` dans `.env.local`. `npx fraza-doctor` liste les variables qui manquent vraiment. Créez ensuite les tables et démarrez :
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npx fraza-db init
|
|
35
|
+
npm run dev
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Ouvrez `http://localhost:3000/auth` pour créer le premier compte, qui reçoit le rôle `admin`.
|
|
39
|
+
|
|
40
|
+
## Ce que fait le CLI
|
|
41
|
+
|
|
42
|
+
1. Crée le projet avec `create-next-app` 16.3.8, la version de Next contre laquelle le core est validé.
|
|
43
|
+
2. Remplace le dossier `app/` de Next par les gabarits Fraza : administration, authentification, API, page d'accueil, pages d'erreur, gabarits de page, exemples de blocs, `theme.js`, `instrumentation.js` et `jsconfig.json`.
|
|
44
|
+
3. Ajoute les scripts `dev`, `build` et `postinstall`, qui lancent `fraza-modules sync`.
|
|
45
|
+
4. Masque l'indicateur de développement de Next dans `next.config.mjs`.
|
|
46
|
+
5. Ajoute `!.env.example` et `app/.fraza/` au `.gitignore`, en gardant la règle `.env*` de Next.
|
|
47
|
+
6. Ajoute un bloc Fraza à l'`AGENTS.md`, qui renvoie un agent à la documentation livrée dans `node_modules/@fraza/core/dist/docs/`.
|
|
48
|
+
7. Écrit le `.npmrc` du projet, sans jeton.
|
|
49
|
+
8. Installe `@fraza/core`.
|
|
50
|
+
9. Crée `.env.example`, suivi par git, et `.env.local`, ignoré par git, avec `FRAZA_ENCRYPTION_KEY` générée et `NEXT_PUBLIC_URL` locale.
|
|
51
|
+
|
|
52
|
+
## Variables d'environnement
|
|
53
|
+
|
|
54
|
+
| Fichier | Contenu | Suivi par git |
|
|
55
|
+
|---|---|---|
|
|
56
|
+
| `.env.example` | La liste des variables, sans aucune valeur secrète. Une variable ajoutée par le projet y entre aussi. | Oui |
|
|
57
|
+
| `.env.local` | Les valeurs de cette machine : base de données, stockage, courriel, clés. | Non |
|
|
58
|
+
|
|
59
|
+
En production, les variables se saisissent dans la plateforme d'hébergement, jamais dans un fichier suivi par git. Partez de `.env.example` pour la liste.
|
|
60
|
+
|
|
61
|
+
**Copiez `FRAZA_ENCRYPTION_KEY` telle quelle depuis `.env.local`, et ne la changez jamais.** Tout ce que le site chiffre en base l'est avec cette clé : une nouvelle clé rend ces données illisibles. Gardez-en une copie hors du serveur.
|
|
62
|
+
|
|
63
|
+
La liste complète est dans [Variables d'environnement](https://docs.fraza.ca/docs/reference/configuration/variables-d-environnement).
|
|
64
|
+
|
|
65
|
+
## Modules Pro
|
|
66
|
+
|
|
67
|
+
Le `.npmrc` écrit par le CLI ne contient qu'une ligne :
|
|
68
|
+
|
|
69
|
+
```ini
|
|
70
|
+
@fraza-pro:registry=https://registry.fraza.ca/
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Sans secret, il reste suivi par git, et la machine de build sait où chercher les modules Pro. Pour en installer un, connectez-vous au registre puis lancez `fraza-key`, qui ajoute le jeton au `.npmrc` :
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
npm login --registry=https://registry.fraza.ca/
|
|
77
|
+
npx fraza-key
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Le jeton est alors en clair dans un fichier suivi par git : traitez-le comme une clé de licence propre au projet. Voir [fraza-key](https://docs.fraza.ca/docs/reference/cli/fraza-key).
|
|
81
|
+
|
|
82
|
+
## Pages d'erreur et de chargement
|
|
83
|
+
|
|
84
|
+
Les pages d'erreur et de chargement réexportent chacune un composant du core. Celles de l'administration suivent le core et n'ont pas à changer. Celles du site public (`app/(public)/error.js`, la page 404) sont des gabarits : remplacez le réexport par un composant du projet.
|
|
85
|
+
|
|
86
|
+
Le site public n'a pas de `loading.js`, et ne doit pas en recevoir. Son `Suspense` enverrait la réponse avec le statut 200 avant que la page sache si le contenu existe : toute URL inconnue répondrait 200 au lieu de 404. Une page qui veut un état de chargement pose son propre `Suspense`, après l'appel éventuel à `notFound()`.
|
|
87
|
+
|
|
88
|
+
Un projet généré par une version plus ancienne remet ces fichiers à jour avec `npx fraza-doctor --fix`.
|
|
89
|
+
|
|
90
|
+
## Contribuer
|
|
91
|
+
|
|
92
|
+
Les tests, l'installation d'un core local et la publication sont décrits dans [CONTRIBUTING.md](./CONTRIBUTING.md).
|
|
93
|
+
|
|
94
|
+
## Licence
|
|
95
|
+
|
|
96
|
+
MIT. Copyright (c) 2026 HYKO. Voir [LICENSE](./LICENSE). Les dépendances tierces sont listées dans [THIRD-PARTY-NOTICES.md](./THIRD-PARTY-NOTICES.md).
|
|
97
|
+
|
|
98
|
+
Ce paquet fait partie de Fraza Libre.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Avis relatifs aux composants tiers
|
|
2
|
+
|
|
3
|
+
Ce document inventorie les dépendances de production de `@fraza/start` et leurs licences.
|
|
4
|
+
|
|
5
|
+
Il est généré par `npm run build:notices` à partir de l'arbre réellement installé. Ne pas le modifier à la main.
|
|
6
|
+
|
|
7
|
+
`@fraza/start` ne bundle aucun code tiers : les dépendances ci-dessous sont installées séparément par le gestionnaire de paquets, depuis leurs sources respectives. Elles ne sont ni distribuées ni couvertes par la [licence MIT](./LICENSE) de ce paquet. Cet inventaire sert à vérifier qu'aucune licence copyleft ne contamine l'application qui installe le paquet, et à fournir la liste nécessaire aux obligations d'attribution du projet consommateur, dont le build, lui, bundle ces dépendances.
|
|
8
|
+
|
|
9
|
+
## Résumé
|
|
10
|
+
|
|
11
|
+
Aucune. `@fraza/start` n'a pas de dépendance de production : tout ce dont il a besoin à l'exécution est déclaré en `peerDependencies` et fourni par le projet consommateur. Il n'y a donc aucun composant tiers à inventorier ici.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<!-- BEGIN:fraza-agent-rules -->
|
|
2
|
+
|
|
3
|
+
# This is a Fraza project
|
|
4
|
+
|
|
5
|
+
The project was generated by `npx @fraza/start`, and most of the behaviour comes
|
|
6
|
+
from `@fraza/core`: authentication, database, storage, emails, payments, PDF,
|
|
7
|
+
scheduled tasks, administration. Before writing anything, check whether the core
|
|
8
|
+
or an official module already does the job.
|
|
9
|
+
|
|
10
|
+
## Where the documentation is
|
|
11
|
+
|
|
12
|
+
It ships inside the package, in French, matching the exact version installed
|
|
13
|
+
here, and readable offline:
|
|
14
|
+
|
|
15
|
+
`node_modules/@fraza/core/dist/docs/`
|
|
16
|
+
|
|
17
|
+
The documentation of the official modules lives there too, one folder per
|
|
18
|
+
module, under `node_modules/@fraza/core/dist/docs/06-modules/`. The module
|
|
19
|
+
packages themselves ship no docs folder. Each module's `README.md` covers its
|
|
20
|
+
installation.
|
|
21
|
+
|
|
22
|
+
## Working rules
|
|
23
|
+
|
|
24
|
+
Read the relevant page before writing code. Fraza conventions take precedence
|
|
25
|
+
over Next.js habits, and the core often exposes a dedicated API where Next.js
|
|
26
|
+
offers a generic one.
|
|
27
|
+
|
|
28
|
+
To follow the project theme, light and dark modes included, style with the
|
|
29
|
+
role utilities (`bg-surface`, `text-fg`, `border-line`, `bg-primary`,
|
|
30
|
+
`text-accent`...) rather than Tailwind palette classes or hex values. The
|
|
31
|
+
appearance is set in `theme.js`. See `04-architecture/06-design-system.md` in
|
|
32
|
+
the docs.
|
|
33
|
+
|
|
34
|
+
Never edit anything in `app/.fraza/`. The directory is regenerated by
|
|
35
|
+
`fraza-modules sync`, which runs on every `npm run dev`, `npm run build` and
|
|
36
|
+
`npm install`.
|
|
37
|
+
|
|
38
|
+
## The development server
|
|
39
|
+
|
|
40
|
+
The developer often already has `npm run dev` running, so check
|
|
41
|
+
`http://localhost:3000` before starting one. If it answers, use that server
|
|
42
|
+
rather than a second instance. You may kill and restart it when a change
|
|
43
|
+
requires it.
|
|
44
|
+
|
|
45
|
+
Leave a server running only if it is the one the developer opened. Always close
|
|
46
|
+
the ones you opened yourself: start them in background, keep track of their
|
|
47
|
+
process, and always kill them before you hand the work back.
|
|
48
|
+
|
|
49
|
+
`.env.local` holds the values of this machine (database, storage, keys) and is
|
|
50
|
+
never tracked by git. `.env.example` is the tracked template and must stay free
|
|
51
|
+
of any secret: a variable the project adds goes there empty or with a sample
|
|
52
|
+
value. In production, variables are set in the hosting platform, never in a
|
|
53
|
+
tracked file. Never change `FRAZA_ENCRYPTION_KEY`: data already encrypted with
|
|
54
|
+
it would become unreadable.
|
|
55
|
+
|
|
56
|
+
Environment variables are read at boot only, hot reload never picks up
|
|
57
|
+
`.env.local`. After changing one, restart the server before you trust what you
|
|
58
|
+
see.
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
<!-- END:fraza-agent-rules -->
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { execSync } from 'node:child_process';
|
|
4
|
+
import fs from 'node:fs';
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
import { fileURLToPath } from 'node:url';
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
CREATE_NEXT_APP_VERSION,
|
|
10
|
+
MIN_NODE,
|
|
11
|
+
REGISTRY_URL,
|
|
12
|
+
findConflictingEntries,
|
|
13
|
+
hideDevIndicators,
|
|
14
|
+
isSupportedNode,
|
|
15
|
+
withFrazaGitignore,
|
|
16
|
+
withFrazaScripts,
|
|
17
|
+
writeAgentsBlock,
|
|
18
|
+
writeEnvFiles,
|
|
19
|
+
writeProjectNpmrc,
|
|
20
|
+
} from './project.js';
|
|
21
|
+
import { STARTER_VERSION } from './version.js';
|
|
22
|
+
|
|
23
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
24
|
+
|
|
25
|
+
const c = {
|
|
26
|
+
reset: '\x1b[0m',
|
|
27
|
+
dim: '\x1b[2m',
|
|
28
|
+
green: '\x1b[32m',
|
|
29
|
+
cyan: '\x1b[36m',
|
|
30
|
+
red: '\x1b[31m',
|
|
31
|
+
bold: '\x1b[1m',
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// Source de vérité unique des `overrides` de l'écosystème Fraza.
|
|
35
|
+
//
|
|
36
|
+
// npm n'honore `overrides` que depuis le package.json racine du projet installé.
|
|
37
|
+
// Un `overrides` déclaré dans @fraza/core ou dans un module Fraza est ignoré au
|
|
38
|
+
// moment où le site les installe : il n'agit que sur le node_modules du dépôt de
|
|
39
|
+
// la librairie. Le seul endroit qui protège vraiment un site, c'est ici.
|
|
40
|
+
//
|
|
41
|
+
// Le bloc est vide, et c'est l'état normal. Une entrée ne s'ajoute que pour une
|
|
42
|
+
// faille qu'aucune mise à jour amont ne peut corriger, typiquement une version
|
|
43
|
+
// épinglée exactement par une dépendance directe. Elle se retire dès que l'amont
|
|
44
|
+
// est à jour de lui-même : un override laissé en place fige une version pour rien
|
|
45
|
+
// et donne une fausse impression de correctif.
|
|
46
|
+
//
|
|
47
|
+
// Format : { 'nom-du-paquet': '^1.2.3' }
|
|
48
|
+
//
|
|
49
|
+
// Attention, npm refuse un override qui porte sur un paquet déclaré en
|
|
50
|
+
// dependencies du site (erreur EOVERRIDE). Dans ce cas, corriger la dépendance
|
|
51
|
+
// directe plutôt que d'ajouter une entrée ici.
|
|
52
|
+
const SITE_OVERRIDES = {};
|
|
53
|
+
|
|
54
|
+
// Contributor-only override: the npm spec used to install the core. Defaults to
|
|
55
|
+
// the published package; the e2e test points it at a local tarball.
|
|
56
|
+
const CORE_SPEC = process.env.FRAZA_START_CORE_SPEC || '@fraza/core';
|
|
57
|
+
|
|
58
|
+
// Every create-next-app question answered on the command line, so the run never
|
|
59
|
+
// stops on a prompt and never depends on preferences saved on this machine.
|
|
60
|
+
// `--no-cache-components` is ignored by 16.3, which does not enable Cache
|
|
61
|
+
// Components, but keeps a later bump of the pin from turning them on: the
|
|
62
|
+
// admin and auth layouts read cookies outside <Suspense>, which fails
|
|
63
|
+
// `next build` under that mode.
|
|
64
|
+
const CREATE_NEXT_APP_ARGS = [
|
|
65
|
+
'./',
|
|
66
|
+
'--js',
|
|
67
|
+
'--tailwind',
|
|
68
|
+
'--eslint',
|
|
69
|
+
'--app',
|
|
70
|
+
'--no-src-dir',
|
|
71
|
+
'--import-alias "@/*"',
|
|
72
|
+
'--empty',
|
|
73
|
+
'--agents-md',
|
|
74
|
+
'--no-react-compiler',
|
|
75
|
+
'--no-cache-components',
|
|
76
|
+
'--use-npm',
|
|
77
|
+
'--yes',
|
|
78
|
+
];
|
|
79
|
+
|
|
80
|
+
const step = (msg) => process.stdout.write(` ${c.dim}◆${c.reset} ${msg}...\n`);
|
|
81
|
+
const done = (msg) => process.stdout.write(` ${c.green}✓${c.reset} ${msg}\n`);
|
|
82
|
+
const fail = (msg) => process.stdout.write(` ${c.red}✗${c.reset} ${msg}\n`);
|
|
83
|
+
|
|
84
|
+
// Vérifications faites avant d'écrire quoi que ce soit : un échec laisse le
|
|
85
|
+
// dossier tel qu'il était.
|
|
86
|
+
function checkPrerequisites(cwd) {
|
|
87
|
+
if (!isSupportedNode(process.versions.node)) {
|
|
88
|
+
throw new Error(`Node.js ${process.versions.node} détecté : @fraza/start demande Node.js ${MIN_NODE.join('.')} ou plus.`);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const conflicts = findConflictingEntries(cwd);
|
|
92
|
+
if (conflicts.length > 0) {
|
|
93
|
+
throw new Error(`Le dossier courant n'est pas vide (${conflicts.join(', ')}). Lancer @fraza/start dans un dossier vide.`);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Un core local (FRAZA_START_CORE_SPEC) ne passe pas par le registre.
|
|
97
|
+
// `@fraza/core` vient du registre que npm choisit pour `@fraza` : npmjs par
|
|
98
|
+
// défaut, registry.fraza.ca si la configuration de l'utilisateur l'y envoie.
|
|
99
|
+
if (CORE_SPEC !== '@fraza/core') return;
|
|
100
|
+
try {
|
|
101
|
+
execSync('npm view @fraza/core version', { stdio: 'pipe', timeout: 30_000 });
|
|
102
|
+
} catch {
|
|
103
|
+
throw new Error('Le registre npm ne répond pas : @fraza/core n\'a pas pu être lu. Vérifier la connexion, puis relancer.');
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
async function initProject() {
|
|
108
|
+
const cwd = process.cwd();
|
|
109
|
+
try {
|
|
110
|
+
console.log(`\n ${c.bold}${c.cyan}fraza-start${c.reset} ${c.dim}${STARTER_VERSION}${c.reset}\n`);
|
|
111
|
+
|
|
112
|
+
checkPrerequisites(cwd);
|
|
113
|
+
done('Prérequis vérifiés');
|
|
114
|
+
|
|
115
|
+
step(`Création du projet Next.js (create-next-app ${CREATE_NEXT_APP_VERSION})`);
|
|
116
|
+
execSync(`npx --yes create-next-app@${CREATE_NEXT_APP_VERSION} ${CREATE_NEXT_APP_ARGS.join(' ')}`, { stdio: 'inherit' });
|
|
117
|
+
done('Projet Next.js créé');
|
|
118
|
+
|
|
119
|
+
fs.rmSync(path.join(cwd, 'app'), { recursive: true, force: true });
|
|
120
|
+
done('Dossier app/ de Next supprimé');
|
|
121
|
+
|
|
122
|
+
const packageJsonPath = path.join(cwd, 'package.json');
|
|
123
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
|
|
124
|
+
const projectName = packageJson.name || 'project';
|
|
125
|
+
fs.writeFileSync(path.join(cwd, 'README.md'), `# ${projectName}\n\nConstruit avec Next.js, Tailwind CSS et @fraza/core.\n`);
|
|
126
|
+
fs.writeFileSync(packageJsonPath, `${JSON.stringify(withFrazaScripts(packageJson, SITE_OVERRIDES), null, 2)}\n`);
|
|
127
|
+
done('README.md et package.json mis à jour');
|
|
128
|
+
|
|
129
|
+
const templatesPath = path.join(__dirname, '..', 'templates');
|
|
130
|
+
if (!fs.existsSync(templatesPath)) {
|
|
131
|
+
throw new Error('Dossier des gabarits introuvable dans @fraza/start.');
|
|
132
|
+
}
|
|
133
|
+
fs.cpSync(templatesPath, cwd, { recursive: true, force: true });
|
|
134
|
+
done('Gabarits copiés');
|
|
135
|
+
|
|
136
|
+
if (hideDevIndicators(path.join(cwd, 'next.config.mjs'))) {
|
|
137
|
+
done('Indicateur de développement de Next masqué dans next.config.mjs');
|
|
138
|
+
} else {
|
|
139
|
+
fail('next.config.mjs non reconnu : ajouter `devIndicators: false` à la main');
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const gitignorePath = path.join(cwd, '.gitignore');
|
|
143
|
+
const gitignore = fs.existsSync(gitignorePath) ? fs.readFileSync(gitignorePath, 'utf-8') : '';
|
|
144
|
+
fs.writeFileSync(gitignorePath, withFrazaGitignore(gitignore));
|
|
145
|
+
done('.gitignore mis à jour');
|
|
146
|
+
|
|
147
|
+
const agentsBlockPath = path.join(__dirname, 'agents-block.md');
|
|
148
|
+
if (fs.existsSync(agentsBlockPath)) {
|
|
149
|
+
const block = fs.readFileSync(agentsBlockPath, 'utf-8').trim();
|
|
150
|
+
writeAgentsBlock(path.join(cwd, 'AGENTS.md'), block);
|
|
151
|
+
done('Bloc Fraza ajouté à AGENTS.md');
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
writeProjectNpmrc(path.join(cwd, '.npmrc'));
|
|
155
|
+
done('.npmrc créé (scope @fraza-pro, sans jeton)');
|
|
156
|
+
|
|
157
|
+
// Les gabarits importent leurs icônes de @fraza/icons : le projet le déclare
|
|
158
|
+
// lui-même, même s'il arrive aussi avec le core. Les dernières versions de
|
|
159
|
+
// tous les paquets Fraza vont ensemble ; elles sont écrites exactes, et
|
|
160
|
+
// `npx fraza-update` les fait avancer toutes à la fois.
|
|
161
|
+
step('Installation de @fraza/core et @fraza/icons');
|
|
162
|
+
execSync(`npm install --save-exact "${CORE_SPEC}" @fraza/icons`, { stdio: 'inherit' });
|
|
163
|
+
done('@fraza/core et @fraza/icons installés');
|
|
164
|
+
|
|
165
|
+
const envTemplate = path.join(cwd, 'node_modules', '@fraza', 'core', '.env.example');
|
|
166
|
+
if (!fs.existsSync(envTemplate)) {
|
|
167
|
+
throw new Error('Modèle .env.example introuvable dans @fraza/core.');
|
|
168
|
+
}
|
|
169
|
+
const env = writeEnvFiles(envTemplate, cwd);
|
|
170
|
+
if (env.example) done('.env.example créé à partir du modèle de @fraza/core');
|
|
171
|
+
if (env.local) done('.env.local créé, FRAZA_ENCRYPTION_KEY générée');
|
|
172
|
+
|
|
173
|
+
const file = (name) => `${c.cyan}${name}${c.reset}`;
|
|
174
|
+
const dim = (text) => `${c.dim}${text}${c.reset}`;
|
|
175
|
+
|
|
176
|
+
console.log(`\n ${c.green}${c.bold}Projet prêt.${c.reset} Étapes suivantes :\n`);
|
|
177
|
+
console.log(` ${dim('1.')} Remplir les variables de ${file('.env.local')}, à commencer par ${file('FRAZA_DATABASE_URL')}`);
|
|
178
|
+
console.log(` ${dim('Ce fichier reste sur cette machine. Le modèle sans secret,')} ${file('.env.example')}${dim(', est suivi par git.')}`);
|
|
179
|
+
console.log(` ${dim('2.')} Initialiser la base de données`);
|
|
180
|
+
console.log(` ${dim('npx fraza-db init')}`);
|
|
181
|
+
console.log(` ${dim('3.')} Démarrer le site`);
|
|
182
|
+
console.log(` ${dim('npm run dev')}\n`);
|
|
183
|
+
|
|
184
|
+
console.log(` ${c.bold}En production :${c.reset} les variables se saisissent dans la plateforme d'hébergement (Coolify, par exemple),`);
|
|
185
|
+
console.log(` ${dim('jamais dans un fichier suivi par git.')} ${file('FRAZA_ENCRYPTION_KEY')} ${dim('se copie telle quelle depuis')} ${file('.env.local')}${dim(' :')}`);
|
|
186
|
+
console.log(` ${dim('elle ne doit jamais changer, sinon les données chiffrées avec elle deviennent illisibles.')}\n`);
|
|
187
|
+
|
|
188
|
+
console.log(` ${c.bold}Modules Pro :${c.reset} se connecter au registre, puis écrire le jeton dans ${file('.npmrc')} avec ${file('npx fraza-key')}`);
|
|
189
|
+
console.log(` ${dim(`npm login --registry=${REGISTRY_URL}`)}`);
|
|
190
|
+
console.log(` ${dim('npx fraza-key')}\n`);
|
|
191
|
+
} catch (error) {
|
|
192
|
+
fail(error.message);
|
|
193
|
+
process.exit(1);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
initProject();
|