@roomi-fields/grillhouse 0.25.0 → 0.25.2
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/.claude-plugin/plugin.json +1 -1
- package/cadre/templates/cargo/deny.toml +5 -0
- package/docs/ARCHITECTURE.md +10 -4
- package/docs/CADRE.md +1 -1
- package/docs/INTERFACE.md +8 -0
- package/package.json +5 -1
- package/scripts/langages/typescript/mise-a-jour.mjs +60 -3
- package/scripts/langages/typescript/vitest-config/duree.reporter.d.ts +10 -0
- package/scripts/langages/typescript/vitest-config/duree.reporter.mjs +4 -2
|
@@ -25,6 +25,11 @@ allow = [
|
|
|
25
25
|
]
|
|
26
26
|
confidence-threshold = 0.8
|
|
27
27
|
|
|
28
|
+
[licenses.private]
|
|
29
|
+
# The project's own crates that are not published (`publish = false`) are left out of the check:
|
|
30
|
+
# the list above is the licences of the dependencies, not the project's.
|
|
31
|
+
ignore = true
|
|
32
|
+
|
|
28
33
|
[bans]
|
|
29
34
|
# Two versions of a crate are named, not refused.
|
|
30
35
|
multiple-versions = "warn"
|
package/docs/ARCHITECTURE.md
CHANGED
|
@@ -409,7 +409,12 @@ npm vaut pour les deux : `npx grillhouse maj` met à jour le greffon resté derr
|
|
|
409
409
|
(`claude plugin update`), comme `npm install` aligne ce qui est installé sur ce qui est déclaré,
|
|
410
410
|
et finit non nulle, avec la commande à taper, quand les deux restent en désaccord ; l'ouverture
|
|
411
411
|
de séance nomme un greffon chargé à une autre version que le paquet du projet, avec la commande
|
|
412
|
-
qui les remet d'accord.
|
|
412
|
+
qui les remet d'accord. Dans un projet de TypeScript, `npx grillhouse maj` monte à `^<version>` la
|
|
413
|
+
plage du paquet dans chaque manifeste qui la déclare plus basse (la racine et chaque paquet,
|
|
414
|
+
`dependencies` ou `devDependencies`), comme `npm install <paquet>@<version> --workspaces` ou
|
|
415
|
+
syncpack alignent les déclarations d'une dépendance : un paquet resté sur l'ancienne plage
|
|
416
|
+
garderait sous lui une copie de l'ancienne version ; une plage qui couvre déjà la version reste.
|
|
417
|
+
Un projet n'en garde aucune copie
|
|
413
418
|
(`npx grillhouse maj` retire, à leur empreinte, celles que posait la 0.22) ; sans le paquet installé, l'ouverture de séance dit « lance `npm install` », et les autres crochets
|
|
414
419
|
sortent sans effet. Les crochets git du cadre suivent le modèle de Husky : le `prepare` du
|
|
415
420
|
projet lance `grillhouse hooks`, qui les pose à côté des sections de Beads, et chacun appelle
|
|
@@ -427,8 +432,9 @@ partagée), `@roomi-fields/grillhouse/paquets` (`horsCadre`, les paquets hors ca
|
|
|
427
432
|
SARIF), `@roomi-fields/grillhouse/jointure` (`langageDe`, le module de langage d'un projet, et les
|
|
428
433
|
types de la jointure, `scripts/jointure.d.ts`), `@roomi-fields/grillhouse/conformite` (`cas` et
|
|
429
434
|
`echecs`, la suite de conformité d'un module de langage), et la
|
|
430
|
-
configuration de base de Vitest, `@roomi-fields/grillhouse/vitest-config
|
|
431
|
-
`@roomi-fields/grillhouse/vitest-config/mesure
|
|
435
|
+
configuration de base de Vitest, `@roomi-fields/grillhouse/vitest-config`,
|
|
436
|
+
`@roomi-fields/grillhouse/vitest-config/mesure` et son rapporteur de durée,
|
|
437
|
+
`@roomi-fields/grillhouse/vitest-config/duree`, que Vitest charge par son nom, et la base TSDoc,
|
|
432
438
|
`@roomi-fields/grillhouse/tsdoc-base.json`, dont hérite le `tsdoc.json` d'un projet : elle hérite
|
|
433
439
|
de celle d'API Extractor, que le paquet déclare, comme un rig de Rushstack porte la configuration
|
|
434
440
|
de base à côté de la dépendance qu'elle nomme ; TSDoc lit un `extends` par son chemin sous le
|
|
@@ -511,7 +517,7 @@ permise du manifeste de l'espace de travail, `[workspace.metadata.grillhouse.fro
|
|
|
511
517
|
les `depConstraints` de Nx, et l'index des interfaces, qu'il engendre, chacune aussi une
|
|
512
518
|
commande de son nom, que la ligne d'une garde rouge nomme), ses
|
|
513
519
|
tests sous `tests/unit/langages/cargo/`, contre un faux cargo en tête du PATH, le vrai à la nuit ; les entrées publiées (`./consommateurs`,
|
|
514
|
-
`./vitest-config`, `./vitest-config/mesure`, `./tsdoc-base.json`)
|
|
520
|
+
`./vitest-config`, `./vitest-config/mesure`, `./vitest-config/duree`, `./tsdoc-base.json`) mènent au module. Comme un
|
|
515
521
|
greffon de Nx n'importe que `@nx/devkit`, le module n'importe du noyau que ses entrées publiées :
|
|
516
522
|
`./jointure` (`scripts/services-du-noyau.mjs`) lui donne les services du noyau qu'il emploie (le plan d'une
|
|
517
523
|
enveloppe, l'avancement et la mesure d'une passe, la pression et le verrou de la machine, le
|
package/docs/CADRE.md
CHANGED
|
@@ -26,7 +26,7 @@ langage du projet, il le demande au module de ce langage, par la jointure
|
|
|
26
26
|
tickets.
|
|
27
27
|
- **R2.** Aux projets, les entrées publiées du noyau : `./jointure`, `./conformite`, `./paquets`,
|
|
28
28
|
`./dette`, `./resultats`. Les entrées `./consommateurs`, `./vitest-config`,
|
|
29
|
-
`./vitest-config/mesure` et `./tsdoc-base.json`
|
|
29
|
+
`./vitest-config/mesure`, `./vitest-config/duree` et `./tsdoc-base.json` mènent au module
|
|
30
30
|
typescript.
|
|
31
31
|
|
|
32
32
|
## Ce qu'il refuse
|
package/docs/INTERFACE.md
CHANGED
|
@@ -160,6 +160,14 @@ Le test du noyau joue la suite sur le module typescript et sur seize modules dé
|
|
|
160
160
|
chacun ; chacun manque son seul cas. Ainsi la suite attrape un vrai défaut. Le module cargo la
|
|
161
161
|
passe contre un faux cargo en tête du PATH, et contre le vrai à la nuit.
|
|
162
162
|
|
|
163
|
+
## Les entrées du module typescript
|
|
164
|
+
|
|
165
|
+
Un projet en TypeScript lit le module typescript par ces entrées publiées, chacune typée :
|
|
166
|
+
`./consommateurs` ; `./vitest-config`, la configuration de base de Vitest ;
|
|
167
|
+
`./vitest-config/mesure`, `mesurerAuRepos` ; `./vitest-config/duree`, le rapporteur de durée, que
|
|
168
|
+
Vitest charge par son nom (`--reporter=@roomi-fields/grillhouse/vitest-config/duree`, ou
|
|
169
|
+
`reporters` dans une configuration) ; `./tsdoc-base.json`, la base TSDoc.
|
|
170
|
+
|
|
163
171
|
## Consommateurs
|
|
164
172
|
|
|
165
173
|
Les paquets de Grillhouse qui importent le cadre par son nom ; un projet le lit par ses entrées
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@roomi-fields/grillhouse",
|
|
3
|
-
"version": "0.25.
|
|
3
|
+
"version": "0.25.2",
|
|
4
4
|
"description": "Roomi's Grillhouse: the frame's scripts, called by one command, grillhouse <sous-commande>",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -63,6 +63,10 @@
|
|
|
63
63
|
"types": "./scripts/langages/typescript/vitest-config/mesure.d.ts",
|
|
64
64
|
"default": "./scripts/langages/typescript/vitest-config/mesure.mjs"
|
|
65
65
|
},
|
|
66
|
+
"./vitest-config/duree": {
|
|
67
|
+
"types": "./scripts/langages/typescript/vitest-config/duree.reporter.d.ts",
|
|
68
|
+
"default": "./scripts/langages/typescript/vitest-config/duree.reporter.mjs"
|
|
69
|
+
},
|
|
66
70
|
"./tsdoc-base.json": "./tsdoc-base.json"
|
|
67
71
|
},
|
|
68
72
|
"scripts": {
|
|
@@ -17,6 +17,15 @@
|
|
|
17
17
|
// version, the project's scripts stay (the frame's included) and the report names the version
|
|
18
18
|
// found and the range required. A `test` that runs anything else stays. A repository of packages
|
|
19
19
|
// keeps its tests in its packages: its root gets no `test:unit`, and the frame's own leaves.
|
|
20
|
+
// - The frame's range: each manifest of the project (the root's, and each package's the workspaces
|
|
21
|
+
// select, out of the frame included) that declares the frame's package in its `dependencies` or
|
|
22
|
+
// `devDependencies` at a range lower than the version installed (no version it covers reaches
|
|
23
|
+
// it) passes to `^<version>`, as `npm install <pkg>@<version> --workspaces`, Renovate and syncpack
|
|
24
|
+
// align every declaration of a dependency of the workspace; a range that covers the version, one
|
|
25
|
+
// above it, or one that is no range of versions (`file:`, `workspace:`) stays. The report names
|
|
26
|
+
// each manifest brought up. Witness: BPScript at 0.25.1 (bp-mono-vbwf.322.15), whose packages kept
|
|
27
|
+
// `^0.24.0`: npm left a copy 0.24.15 under each `packages/*/node_modules`, where the entry
|
|
28
|
+
// `./vitest-config/duree` does not resolve.
|
|
20
29
|
// - A package of the frame whose code imports the frame's package (a file of its `src/` out of the
|
|
21
30
|
// tests, its imports read by TypeScript's `preProcessFile`) declares it in its `dependencies`, as
|
|
22
31
|
// npm puts there what the published code imports: a declaration in its `devDependencies` moves
|
|
@@ -25,7 +34,7 @@
|
|
|
25
34
|
// which each Vitest configuration imports by its name: in a project with `workspaces`, each
|
|
26
35
|
// package of the frame that plays tests (`joueDesTests`: its script `test:unit`) declares the
|
|
27
36
|
// frame's package in its `devDependencies`, at the range the root declares (else `^<version>`),
|
|
28
|
-
// a declaration it holds kept. The update writes no Vitest configuration.
|
|
37
|
+
// a declaration it holds kept (at its range, brought up as above). The update writes no Vitest configuration.
|
|
29
38
|
// - The typing: each package of TypeScript (a `tsconfig.json`) that has no `typecheck` script
|
|
30
39
|
// receives the template's, `tsc -p tsconfig.json --noEmit`: each package of the frame in a
|
|
31
40
|
// project with `workspaces` (the root's `typecheck` stays the project's), the root in a project
|
|
@@ -63,6 +72,42 @@ const trie = deps =>
|
|
|
63
72
|
const plageDeLaRacine = p =>
|
|
64
73
|
CHAMPS_INSTALLES.map(c => p[c]?.[PAQUET_DU_CADRE]).find(v => v !== undefined);
|
|
65
74
|
|
|
75
|
+
// Brings the frame's range up to `^<version>` in each manifest of the project at <projet> that
|
|
76
|
+
// declares it lower (see the header): the root's in <p>, which the core writes, each package's on
|
|
77
|
+
// disk. { plage, manifestes } (each manifest's path from the root), or null when nothing changes.
|
|
78
|
+
export function alignerLaPlageDuCadre(projet, p, version) {
|
|
79
|
+
// semver, required when the update runs, not when the module loads (see poserLesTests).
|
|
80
|
+
const semver = createRequire(import.meta.url)('semver');
|
|
81
|
+
const plage = `^${version}`;
|
|
82
|
+
const basse = v =>
|
|
83
|
+
typeof v === 'string' &&
|
|
84
|
+
semver.validRange(v) !== null &&
|
|
85
|
+
!semver.satisfies(version, v) &&
|
|
86
|
+
semver.lt(semver.minVersion(v), version);
|
|
87
|
+
const monter = pkg => {
|
|
88
|
+
let monte = false;
|
|
89
|
+
for (const c of ['dependencies', 'devDependencies']) {
|
|
90
|
+
if (basse(pkg[c]?.[PAQUET_DU_CADRE])) {
|
|
91
|
+
pkg[c][PAQUET_DU_CADRE] = plage;
|
|
92
|
+
monte = true;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return monte;
|
|
96
|
+
};
|
|
97
|
+
const manifestes = [];
|
|
98
|
+
if (monter(p)) {
|
|
99
|
+
manifestes.push('package.json');
|
|
100
|
+
}
|
|
101
|
+
// A project without workspaces has no package (paquets).
|
|
102
|
+
for (const { dossier, pkg } of paquets(projet)) {
|
|
103
|
+
if (monter(pkg)) {
|
|
104
|
+
ecrireJson(path.join(projet, dossier, 'package.json'), pkg);
|
|
105
|
+
manifestes.push(path.join(dossier, 'package.json'));
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return manifestes.length > 0 ? { plage, manifestes } : null;
|
|
109
|
+
}
|
|
110
|
+
|
|
66
111
|
// Whether `vitest` is declared in the dependencies of the package.json <p> (read at <dossier>) or of
|
|
67
112
|
// one of its packages of the frame.
|
|
68
113
|
const declareVitest = (dossier, p) => {
|
|
@@ -243,8 +288,14 @@ function poserTurbo(projet, p, source) {
|
|
|
243
288
|
}
|
|
244
289
|
|
|
245
290
|
// The lines of the report of the share <b>.
|
|
246
|
-
function rapport(b) {
|
|
291
|
+
export function rapport(b) {
|
|
247
292
|
const lignes = [];
|
|
293
|
+
if (b.plageDuCadre) {
|
|
294
|
+
const { plage, manifestes } = b.plageDuCadre;
|
|
295
|
+
lignes.push(
|
|
296
|
+
`Plage du cadre : ${PAQUET_DU_CADRE} monté à ${plage} dans ${manifestes.join(', ')}, qui déclaraient une plage plus basse. \`npm install\` relie cette version dans chaque paquet.`
|
|
297
|
+
);
|
|
298
|
+
}
|
|
248
299
|
if (b.configVitest) {
|
|
249
300
|
const { nom, paquets: declarants } = b.configVitest;
|
|
250
301
|
lignes.push(
|
|
@@ -284,9 +335,12 @@ function rapport(b) {
|
|
|
284
335
|
function appliquer(projet, { p, modele, source, version }, joueDesTests) {
|
|
285
336
|
p.scripts ??= {};
|
|
286
337
|
const { test, vitest } = poserLesTests(projet, p, modele);
|
|
338
|
+
// First: the declarations written after take the root's range, brought up.
|
|
339
|
+
const plageDuCadre = alignerLaPlageDuCadre(projet, p, version);
|
|
287
340
|
const bilan = {
|
|
288
341
|
test,
|
|
289
342
|
vitest,
|
|
343
|
+
plageDuCadre,
|
|
290
344
|
dependanceDuCadre: declarerDependanceDuCadre(projet, p, version),
|
|
291
345
|
configVitest: poserConfigVitest(projet, p, version, joueDesTests),
|
|
292
346
|
typage: poserTypage(projet, p, modele.scripts?.[TYPAGE]),
|
|
@@ -295,7 +349,10 @@ function appliquer(projet, { p, modele, source, version }, joueDesTests) {
|
|
|
295
349
|
return {
|
|
296
350
|
bilan,
|
|
297
351
|
lignes: rapport(bilan),
|
|
298
|
-
installer:
|
|
352
|
+
installer:
|
|
353
|
+
bilan.plageDuCadre !== null ||
|
|
354
|
+
bilan.configVitest !== null ||
|
|
355
|
+
bilan.dependanceDuCadre !== null,
|
|
299
356
|
sansVerifier: bilan.vitest
|
|
300
357
|
? 'La ligne « Vitest : » ci-dessus dit pourquoi : installe à la racine le Vitest que le cadre exige, puis relance `npx grillhouse maj`, qui écrit le script.'
|
|
301
358
|
: 'La mise à jour l’écrit dans un projet testé par Vitest ; sinon, écris-le pour ses tests.',
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// The types of ./duree.reporter.mjs, for a strict TypeScript Vitest configuration that names
|
|
2
|
+
// `@roomi-fields/grillhouse/vitest-config/duree` in its reporters.
|
|
3
|
+
import type { Reporter } from 'vitest/reporters';
|
|
4
|
+
|
|
5
|
+
// The duration reporter: Vitest's exit code becomes 75 when every failure depends on a duration and
|
|
6
|
+
// one took place under load.
|
|
7
|
+
export default class DureeReporter implements Reporter {
|
|
8
|
+
onInit: Reporter['onInit'];
|
|
9
|
+
onFinished: Reporter['onFinished'];
|
|
10
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
// The duration reporter of the base configuration, beside Vitest's default reporter
|
|
2
|
-
//
|
|
1
|
+
// The duration reporter of the base configuration, beside Vitest's default reporter; a project
|
|
2
|
+
// names it by its published entry, `@roomi-fields/grillhouse/vitest-config/duree`
|
|
3
|
+
// (`--reporter=<entry>`, or `reporters` in a configuration; types ./duree.reporter.d.ts). At the end
|
|
4
|
+
// of a run with failures, it reads each one:
|
|
3
5
|
//
|
|
4
6
|
// - a failure depends on a duration when it is a delay past (an error « Test timed out in <n>ms. »
|
|
5
7
|
// or « Hook timed out in <n>ms. », Vitest's own message), a failure of a time budget bench (a
|