@roomi-fields/grillhouse 0.52.0 → 0.54.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/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +96 -0
- package/agents/direct.md +1 -1
- package/cadre/templates/projet/docs/agents/issue-tracker.md +2 -2
- package/cadre/templates/projet/vitest.config.cjs +45 -0
- package/charte/superviseur.md +36 -37
- package/charte.md +13 -1
- package/dist/temporal/circuit/appel.d.ts +2 -0
- package/dist/temporal/circuit/appel.js +24 -2
- package/dist/temporal/circuit/appel.js.map +1 -1
- package/dist/temporal/circuit/client.d.ts +14 -5
- package/dist/temporal/circuit/client.js +41 -9
- package/dist/temporal/circuit/client.js.map +1 -1
- package/dist/temporal/circuit/commande.js +17 -6
- package/dist/temporal/circuit/commande.js.map +1 -1
- package/dist/temporal/circuit/contrat.d.ts +9 -0
- package/dist/temporal/circuit/contrat.js +6 -0
- package/dist/temporal/circuit/contrat.js.map +1 -1
- package/dist/temporal/circuit/deroule.js +29 -12
- package/dist/temporal/circuit/deroule.js.map +1 -1
- package/dist/temporal/client.d.ts +35 -1
- package/dist/temporal/client.js +144 -1
- package/dist/temporal/client.js.map +1 -1
- package/dist/temporal/commande.js +31 -13
- package/dist/temporal/commande.js.map +1 -1
- package/dist/temporal/etat.d.ts +3 -1
- package/dist/temporal/etat.js +31 -17
- package/dist/temporal/etat.js.map +1 -1
- package/dist/temporal/file/activites.js +1 -1
- package/dist/temporal/file/activites.js.map +1 -1
- package/dist/temporal/file/contrat.d.ts +4 -5
- package/dist/temporal/file/contrat.js +2 -2
- package/dist/temporal/file/contrat.js.map +1 -1
- package/dist/temporal/file/deroule.js +7 -5
- package/dist/temporal/file/deroule.js.map +1 -1
- package/dist/temporal/installation.d.ts +116 -53
- package/dist/temporal/installation.js +898 -241
- package/dist/temporal/installation.js.map +1 -1
- package/dist/temporal/nuits/deroule.js +3 -1
- package/dist/temporal/nuits/deroule.js.map +1 -1
- package/dist/temporal/places/deroule.js +2 -1
- package/dist/temporal/places/deroule.js.map +1 -1
- package/dist/temporal/sonde/deroule.js +2 -1
- package/dist/temporal/sonde/deroule.js.map +1 -1
- package/dist/temporal/tickets/deroule.js +4 -3
- package/dist/temporal/tickets/deroule.js.map +1 -1
- package/dist/temporal/travailleur.d.ts +7 -1
- package/dist/temporal/travailleur.js +49 -25
- package/dist/temporal/travailleur.js.map +1 -1
- package/docs/INTERFACE.md +37 -12
- package/docs/architecture/circuit.md +21 -18
- package/docs/architecture/entree.md +10 -11
- package/docs/architecture/greffon.md +45 -27
- package/docs/architecture/installation.md +92 -59
- package/docs/architecture/machine.md +2 -2
- package/docs/architecture/tests.md +15 -6
- package/docs/lexique.md +2 -2
- package/hooks/hooks.json +10 -0
- package/hooks/register.tsx +59 -39
- package/package.json +3 -2
- package/scripts/activites.mjs +5 -4
- package/scripts/aiguillage.mjs +5 -2
- package/scripts/bd-garde.mjs +69 -0
- package/scripts/ci-de-main.mjs +259 -56
- package/scripts/circuit.mjs +274 -47
- package/scripts/circuits-du-serveur.mjs +3 -2
- package/scripts/circuits-tenus.d.mts +7 -0
- package/scripts/circuits-tenus.mjs +17 -0
- package/scripts/commandes-composees.mjs +1 -1
- package/scripts/copie-de-montee.mjs +354 -0
- package/scripts/copies-du-depot.d.mts +13 -0
- package/scripts/copies-du-depot.mjs +66 -0
- package/scripts/copies-finies.mjs +6 -40
- package/scripts/crochets.mjs +16 -2
- package/scripts/direct.mjs +2 -2
- package/scripts/droits.mjs +13 -6
- package/scripts/engendres.mjs +5 -3
- package/scripts/enveloppe/travail-de-la-copie.mjs +77 -0
- package/scripts/etapes.mjs +11 -3
- package/scripts/faits-du-circuit.mjs +12 -5
- package/scripts/file-des-tickets.d.mts +13 -2
- package/scripts/file-des-tickets.mjs +71 -21
- package/scripts/greffons.mjs +42 -27
- package/scripts/grillhouse-maj.mjs +105 -85
- package/scripts/init.mjs +1 -1
- package/scripts/integration/file.mjs +5 -2
- package/scripts/integration/integrer.mjs +14 -4
- package/scripts/jointure.d.ts +16 -0
- package/scripts/langages/c/commandes.mjs +18 -8
- package/scripts/langages/cargo/commandes.mjs +88 -35
- package/scripts/langages/cargo/index.mjs +6 -3
- package/scripts/langages/cargo/sccache.mjs +15 -12
- package/scripts/langages/cargo/tailles-des-tests.mjs +115 -6
- package/scripts/langages/python/commandes.mjs +19 -9
- package/scripts/langages/python/squelette.mjs +2 -2
- package/scripts/langages/typescript/code-mort.mjs +36 -3
- package/scripts/langages/typescript/configurations-de-vitest.mjs +118 -0
- package/scripts/langages/typescript/index.mjs +2 -0
- package/scripts/langages/typescript/migrations/configurations-en-commonjs.mjs +370 -0
- package/scripts/langages/typescript/mise-a-jour.mjs +49 -12
- package/scripts/langages/typescript/parcours.mjs +5 -1
- package/scripts/langages/typescript/squelette.mjs +20 -17
- package/scripts/langages/typescript/tests-de-nuit.mjs +3 -3
- package/scripts/langages/typescript/turbo-des-paquets.mjs +24 -37
- package/scripts/langages/typescript/vitest-config/base.mjs +1 -1
- package/scripts/langages/typescript/vitest-config/bornes.mjs +1 -1
- package/scripts/langages/typescript/vitest-config/cibles.mjs +2 -2
- package/scripts/langages/typescript/{vitest.nuit.config.mjs → vitest.nuit.config.cjs} +61 -50
- package/scripts/langages.d.mts +6 -0
- package/scripts/langages.mjs +6 -0
- package/scripts/lire.mjs +236 -0
- package/scripts/mesure/pression.mjs +5 -3
- package/scripts/migrations/cout-des-jetons-au-registre.mjs +136 -0
- package/scripts/migrations/lire-un-ticket.mjs +46 -0
- package/scripts/migrations.mjs +4 -0
- package/scripts/montee.mjs +588 -0
- package/scripts/nuit.sh +21 -12
- package/scripts/outil.mjs +5 -3
- package/scripts/paquet-npm.mjs +22 -0
- package/scripts/paquet.mjs +5 -5
- package/scripts/pre-compact.mjs +25 -0
- package/scripts/registre.d.mts +7 -1
- package/scripts/registre.mjs +114 -102
- package/scripts/reponses-du-circuit.d.mts +17 -2
- package/scripts/reponses-du-circuit.mjs +78 -20
- package/scripts/resultats.mjs +55 -17
- package/scripts/retirer-les-copies-finies.mjs +4 -7
- package/scripts/seances.mjs +28 -3
- package/scripts/services-du-noyau.mjs +7 -2
- package/scripts/session-start.sh +18 -11
- package/scripts/sortie.mjs +4 -7
- package/scripts/sous-commandes.mjs +2 -0
- package/scripts/suiveur.mjs +12 -4
- package/scripts/superviseur.mjs +135 -84
- package/scripts/tableau.mjs +651 -224
- package/scripts/tarifs.mjs +67 -0
- package/scripts/ticket-du-circuit.mjs +25 -4
- package/scripts/transitions.d.mts +6 -14
- package/scripts/transitions.mjs +126 -49
- package/scripts/verdict-de-la-nuit.mjs +2 -2
- package/scripts/verrou-de-fichier.d.mts +11 -0
- package/skills/direct/SKILL.md +21 -11
- package/skills/explorateur/SKILL.md +16 -6
- package/skills/grill/SKILL.md +9 -7
- package/skills/grill/references/paquets.md +4 -4
- package/skills/mesure/SKILL.md +4 -3
- package/skills/pitmaster/SKILL.md +56 -35
- package/skills/pitmaster/references/consigne-agent.md +1 -1
- package/skills/pitmaster/references/erreurs.md +4 -2
- package/skills/pitmaster/references/tour.md +11 -4
- package/skills/relecteur/SKILL.md +8 -1
- package/skills/testwriter/SKILL.md +1 -1
- package/types/index.d.ts +3 -1
- package/cadre/templates/projet/vitest.config.ts +0 -44
- package/scripts/base-des-workflows.mjs +0 -58
|
@@ -29,16 +29,18 @@
|
|
|
29
29
|
// - A package of the frame whose code imports the frame's package (a file of its `src/` out of the
|
|
30
30
|
// tests, its imports read by TypeScript's `preProcessFile`) declares it in its `dependencies`, as
|
|
31
31
|
// npm puts there what the published code imports: a declaration in its `devDependencies` moves
|
|
32
|
-
// there with its range, else the range the root declares (else `^<version>`).
|
|
32
|
+
// there with its range, else the range the root declares (else `^<version>`). The frame's package
|
|
33
|
+
// declares itself nowhere.
|
|
33
34
|
// - The frame's base configuration of Vitest is the package's (`@roomi-fields/grillhouse/vitest-config`),
|
|
34
35
|
// which each Vitest configuration imports by its name: in a project with `workspaces`, each
|
|
35
|
-
// package of the frame that plays tests (`joueDesTests`: its script `test:unit`)
|
|
36
|
-
//
|
|
36
|
+
// package of the frame that plays tests (`joueDesTests`: its script `test:unit`) by Vitest (that
|
|
37
|
+
// script calls `vitest`, or the package holds a `vitest.config.*`), the frame's own left out,
|
|
38
|
+
// declares the frame's package in its `devDependencies`, at the range the root declares (else `^<version>`),
|
|
37
39
|
// a declaration it holds kept (at its range, brought up as above). The update writes no Vitest configuration.
|
|
38
40
|
// - The typing: each package of TypeScript (a `tsconfig.json`) that has no `typecheck` script
|
|
39
41
|
// receives the template's, `tsc -p tsconfig.json --noEmit`: each package of the frame in a
|
|
40
42
|
// project with `workspaces` (the root's `typecheck` stays the project's), the root in a project
|
|
41
|
-
// without.
|
|
43
|
+
// without. A `tsconfig.json` that extends a relative file the copy does not hold receives none.
|
|
42
44
|
// - `turbo.json` is the project's own file. A project with no `turbo.json` receives the frame's
|
|
43
45
|
// template of its form: `templates/turbo/paquets.json` when its package.json declares
|
|
44
46
|
// `workspaces`, else `templates/turbo/sans-paquets.json`. A `turbo.json` present is never written
|
|
@@ -46,7 +48,7 @@
|
|
|
46
48
|
// - The generators: the boundaries' configuration (`.dependency-cruiser.cjs`), the index of the
|
|
47
49
|
// interfaces, and the turbo.json of each package in a repository with `workspaces`.
|
|
48
50
|
import { spawnSync } from 'node:child_process';
|
|
49
|
-
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
51
|
+
import { existsSync, readFileSync, statSync, writeFileSync } from 'node:fs';
|
|
50
52
|
import { createRequire } from 'node:module';
|
|
51
53
|
import path from 'node:path';
|
|
52
54
|
import { CODE, paquets, TYPAGE } from '../../paquets.mjs';
|
|
@@ -59,6 +61,9 @@ const CONFIG_VITEST = `${PAQUET_DU_CADRE}/vitest-config`;
|
|
|
59
61
|
// The root scripts of the tests, written together from the template.
|
|
60
62
|
const SCRIPTS_DES_TESTS = ['test', SCRIPT_DES_TESTS, 'test:forcer', 'verifier'];
|
|
61
63
|
const CHAMPS_INSTALLES = ['dependencies', 'devDependencies', 'optionalDependencies'];
|
|
64
|
+
const CONFIGURATIONS_DE_VITEST = ['ts', 'mts', 'cts', 'js', 'mjs', 'cjs'].map(
|
|
65
|
+
e => `vitest.config.${e}`
|
|
66
|
+
);
|
|
62
67
|
// The frame's templates of `turbo.json`, one per form of repository, read in the source.
|
|
63
68
|
const TURBO = {
|
|
64
69
|
fichier: 'turbo.json',
|
|
@@ -198,7 +203,8 @@ function declarerDependanceDuCadre(projet, p, version) {
|
|
|
198
203
|
const declare = ['dependencies', 'optionalDependencies'].some(
|
|
199
204
|
c => pkg[c]?.[PAQUET_DU_CADRE] !== undefined
|
|
200
205
|
);
|
|
201
|
-
|
|
206
|
+
const soi = pkg.name === PAQUET_DU_CADRE;
|
|
207
|
+
if (hors || soi || declare || !codeImporteLeCadre(projet, dossier)) {
|
|
202
208
|
continue;
|
|
203
209
|
}
|
|
204
210
|
const { [PAQUET_DU_CADRE]: dev, ...autres } = pkg.devDependencies ?? {};
|
|
@@ -215,9 +221,15 @@ function declarerDependanceDuCadre(projet, p, version) {
|
|
|
215
221
|
return declarants.length > 0 ? { nom: PAQUET_DU_CADRE, paquets: declarants } : null;
|
|
216
222
|
}
|
|
217
223
|
|
|
224
|
+
// Whether the tests of the package.json <pkg>, read at <dossier>, run by Vitest: its `test:unit`
|
|
225
|
+
// calls it, or the directory holds a configuration of it.
|
|
226
|
+
const testeParVitest = (dossier, pkg) =>
|
|
227
|
+
/\bvitest\b/.test(pkg.scripts?.[SCRIPT_DES_TESTS] ?? '') ||
|
|
228
|
+
CONFIGURATIONS_DE_VITEST.some(f => existsSync(path.join(dossier, f)));
|
|
229
|
+
|
|
218
230
|
// Declares the frame's package, whose base configuration of Vitest each Vitest configuration
|
|
219
|
-
// imports, in the devDependencies of each package of the frame that plays tests (see
|
|
220
|
-
// { nom, paquets }, or null when nothing changes.
|
|
231
|
+
// imports, in the devDependencies of each package of the frame that plays its tests by Vitest (see
|
|
232
|
+
// the header): { nom, paquets }, or null when nothing changes.
|
|
221
233
|
function poserConfigVitest(projet, p, version, joueDesTests) {
|
|
222
234
|
if (p.workspaces === undefined) {
|
|
223
235
|
return null;
|
|
@@ -225,6 +237,8 @@ function poserConfigVitest(projet, p, version, joueDesTests) {
|
|
|
225
237
|
const testes = paquets(projet).filter(
|
|
226
238
|
({ dossier, pkg, hors }) =>
|
|
227
239
|
!hors &&
|
|
240
|
+
pkg.name !== PAQUET_DU_CADRE &&
|
|
241
|
+
testeParVitest(path.join(projet, dossier), pkg) &&
|
|
228
242
|
joueDesTests(projet, {
|
|
229
243
|
dossier: path.join(projet, dossier),
|
|
230
244
|
nom: path.basename(dossier),
|
|
@@ -247,13 +261,34 @@ function poserConfigVitest(projet, p, version, joueDesTests) {
|
|
|
247
261
|
return declarants.length > 0 ? { nom: PAQUET_DU_CADRE, paquets: declarants } : null;
|
|
248
262
|
}
|
|
249
263
|
|
|
264
|
+
const estUnFichier = f => statSync(f, { throwIfNoEntry: false })?.isFile() === true;
|
|
265
|
+
|
|
266
|
+
// Whether each relative file the tsconfig.json at <fichier> extends is there, as TypeScript resolves
|
|
267
|
+
// it (the path, else the path with `.json`); a base named by a package counts as there. Read by
|
|
268
|
+
// TypeScript, which accepts comments.
|
|
269
|
+
function basesPresentes(fichier) {
|
|
270
|
+
const texte = readFileSync(fichier, 'utf8');
|
|
271
|
+
if (!texte.includes('"extends"')) {
|
|
272
|
+
return true;
|
|
273
|
+
}
|
|
274
|
+
const ts = createRequire(import.meta.url)('typescript');
|
|
275
|
+
const bases = [ts.parseConfigFileTextToJson(fichier, texte).config?.extends ?? []].flat();
|
|
276
|
+
return bases
|
|
277
|
+
.filter(b => typeof b === 'string' && (b.startsWith('.') || path.isAbsolute(b)))
|
|
278
|
+
.map(b => path.resolve(path.dirname(fichier), b))
|
|
279
|
+
.every(b => estUnFichier(b) || estUnFichier(`${b}.json`));
|
|
280
|
+
}
|
|
281
|
+
|
|
250
282
|
// Gives the typing script of the template, <script>, to each package of TypeScript that has none
|
|
251
283
|
// (see the header): { script, paquets } (`.` for the root), or null when nothing changes.
|
|
252
284
|
function poserTypage(projet, p, script) {
|
|
253
285
|
if (typeof script !== 'string') {
|
|
254
286
|
return null;
|
|
255
287
|
}
|
|
256
|
-
const types = dossier =>
|
|
288
|
+
const types = dossier => {
|
|
289
|
+
const f = path.join(projet, dossier, 'tsconfig.json');
|
|
290
|
+
return existsSync(f) && basesPresentes(f);
|
|
291
|
+
};
|
|
257
292
|
const sans = pkg => typeof pkg.scripts?.[TYPAGE] !== 'string';
|
|
258
293
|
const declarants = [];
|
|
259
294
|
if (p.workspaces === undefined) {
|
|
@@ -333,6 +368,10 @@ function appliquer(projet, { p, modele, source, version }, joueDesTests) {
|
|
|
333
368
|
typage: poserTypage(projet, p, modele.scripts?.[TYPAGE]),
|
|
334
369
|
turbo: poserLeGabaritAbsent(projet, source, p, TURBO),
|
|
335
370
|
};
|
|
371
|
+
const sansVerifier = () =>
|
|
372
|
+
bilan.vitest
|
|
373
|
+
? '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.'
|
|
374
|
+
: 'La mise à jour l’écrit dans un projet testé par Vitest ; sinon, écris-le pour ses tests.';
|
|
336
375
|
return {
|
|
337
376
|
bilan,
|
|
338
377
|
lignes: rapport(bilan),
|
|
@@ -341,9 +380,7 @@ function appliquer(projet, { p, modele, source, version }, joueDesTests) {
|
|
|
341
380
|
bilan.plageDuCadre !== null ||
|
|
342
381
|
bilan.configVitest !== null ||
|
|
343
382
|
bilan.dependanceDuCadre !== null,
|
|
344
|
-
sansVerifier:
|
|
345
|
-
? '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.'
|
|
346
|
-
: 'La mise à jour l’écrit dans un projet testé par Vitest ; sinon, écris-le pour ses tests.',
|
|
383
|
+
sansVerifier: typeof p.scripts.verifier === 'string' ? null : sansVerifier(),
|
|
347
384
|
};
|
|
348
385
|
}
|
|
349
386
|
|
|
@@ -23,6 +23,10 @@ function siPresent(lire, f, absent) {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
/** Whether the path <f> is one of Vite's temporary files, for a listing `parcourir` did not
|
|
27
|
+
* make. */
|
|
28
|
+
export const estTemporaireDeVite = f => TEMPORAIRE_DE_VITE.test(f);
|
|
29
|
+
|
|
26
30
|
/**
|
|
27
31
|
* The files under <chemin> (a directory, or a file), each its absolute path: an entry below it
|
|
28
32
|
* whose path <sauter> keeps out is neither entered nor listed, and Vite's temporary files are
|
|
@@ -35,7 +39,7 @@ export function parcourir(chemin, sauter = () => false) {
|
|
|
35
39
|
const out = [];
|
|
36
40
|
const walk = (p, dossier) => {
|
|
37
41
|
if (!dossier) {
|
|
38
|
-
if (!
|
|
42
|
+
if (!estTemporaireDeVite(p)) {
|
|
39
43
|
out.push(p);
|
|
40
44
|
}
|
|
41
45
|
return;
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
// name has one, as Nx names a library after the workspace's scope; private; an ES module; its
|
|
10
10
|
// script `test:unit`, which makes it a package that plays tests, and the tools of its tests and
|
|
11
11
|
// of its typing the root does not declare, TypeScript, Vitest and Node's types, at the versions of
|
|
12
|
-
// the module's template); its tsconfig.json, which types its sources
|
|
13
|
-
//
|
|
12
|
+
// the module's template); its tsconfig.json, which types its sources and its tests, nothing
|
|
13
|
+
// emitted; its vitest.config.cjs, the frame's base configuration by its
|
|
14
14
|
// name, which passes while the package has no test yet, as the configuration of a library that
|
|
15
15
|
// Nx generates (`passWithNoTests`); `src/index.ts`, an empty module; `tests/.gitkeep`, its folder
|
|
16
16
|
// of tests. The update gives it its script `typecheck` and the frame's package in its
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
// when the root has none), unless a pattern there covers it already.
|
|
20
20
|
// - The lock of the versions: `npm install`, at the root.
|
|
21
21
|
// - A folder that already holds code is taken as it is when its code lies under `src/` and
|
|
22
|
-
// `tests/`, which its tsconfig.json and its vitest.config.
|
|
22
|
+
// `tests/`, which its tsconfig.json and its vitest.config.cjs cover, each file present kept; a
|
|
23
23
|
// file of code out of them (`.ts`, `.tsx`, `.mts`, `.cts`, `.js`, `.jsx`, `.mjs`, `.cjs`), which
|
|
24
24
|
// neither its typing nor its tests would reach, is refused by its name, nothing written, the
|
|
25
25
|
// layout named, in place of a skeleton beside it.
|
|
@@ -59,21 +59,24 @@ const TSCONFIG = {
|
|
|
59
59
|
exclude: ['node_modules', 'dist'],
|
|
60
60
|
};
|
|
61
61
|
|
|
62
|
-
const VITEST =
|
|
63
|
-
import base from '@roomi-fields/grillhouse/vitest-config';
|
|
64
|
-
|
|
65
|
-
// The tests of the package: the frame's base configuration, by its name, extended with what is the
|
|
62
|
+
const VITEST = `// The tests of the package: the frame's base configuration, by its name, extended with what is the
|
|
66
63
|
// package's own. It passes while the package has no test yet, as the configuration of a library
|
|
67
64
|
// that Nx generates; its first test plays as any other.
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
65
|
+
// CommonJS: Vite writes a file beside an ESM configuration to load it, and the envelope shows a
|
|
66
|
+
// package out of a plan read-only.
|
|
67
|
+
module.exports = (async () => {
|
|
68
|
+
const { defineConfig, mergeConfig } = await import('vitest/config');
|
|
69
|
+
const { default: base } = await import('@roomi-fields/grillhouse/vitest-config');
|
|
70
|
+
return mergeConfig(
|
|
71
|
+
base,
|
|
72
|
+
defineConfig({
|
|
73
|
+
test: {
|
|
74
|
+
include: ['src/**/*.{test,spec}.{ts,js,mjs}', 'tests/**/*.{test,spec}.{ts,js,mjs}'],
|
|
75
|
+
passWithNoTests: true,
|
|
76
|
+
},
|
|
77
|
+
})
|
|
78
|
+
);
|
|
79
|
+
})();
|
|
77
80
|
`;
|
|
78
81
|
|
|
79
82
|
/** @type {import('../../jointure.js').Langage['squelette']} */
|
|
@@ -113,7 +116,7 @@ export function squelette(racine, { chemin, modele, existants }) {
|
|
|
113
116
|
const fichiers = {
|
|
114
117
|
[`${chemin}/package.json`]: json(pkg),
|
|
115
118
|
[`${chemin}/tsconfig.json`]: json(TSCONFIG),
|
|
116
|
-
[`${chemin}/vitest.config.
|
|
119
|
+
[`${chemin}/vitest.config.cjs`]: VITEST,
|
|
117
120
|
[`${chemin}/src/index.ts`]: `// The entry of the package ${nom}: its interface, docs/INTERFACE.md, says what it exports.\nexport {};\n`,
|
|
118
121
|
[`${chemin}/tests/.gitkeep`]: '',
|
|
119
122
|
};
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
// `*.budget.spec.*`) and the time witnesses (a test file that imports `mesurerAuRepos`,
|
|
18
18
|
// `fichiersTemoins` of ./vitest-config/cibles.mjs): what `npm test` and the integration leave
|
|
19
19
|
// out (./vitest-config/cibles.mjs). A copy with none plays nothing, and the exit code is 0.
|
|
20
|
-
// - Vitest plays them with the frame's configuration (./vitest.nuit.config.
|
|
20
|
+
// - Vitest plays them with the frame's configuration (./vitest.nuit.config.cjs), from the root of
|
|
21
21
|
// the copy: `npx --no-install vitest run --root <copie> --config <configuration>`, once for the
|
|
22
22
|
// night tests (GRILLHOUSE_TESTS_DE_NUIT=nuit), then once for the measures alone, one file at a
|
|
23
23
|
// time (GRILLHOUSE_TESTS_DE_NUIT=mesures), as Bazel plays a test tagged `exclusive` after the
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
// - Each run plays one Vitest per unit: the root under the frame's configuration alone, and each
|
|
27
27
|
// directory below it that holds a Vitest configuration (`vitest.config.*`, else `vite.config.*`)
|
|
28
28
|
// with `--root` at that directory, under that configuration merged with the frame's, what the
|
|
29
|
-
// night sets winning (./vitest.nuit.config.
|
|
29
|
+
// night sets winning (./vitest.nuit.config.cjs, `unitesDeLaNuit`).
|
|
30
30
|
// - With `--hors-du-poste`, the night of a shared machine: the night tests alone, but those that
|
|
31
31
|
// bear the tag `@poste` (`porteLEtiquetteDuPoste` of ./vitest-config/cibles.mjs, which the guard
|
|
32
32
|
// ./tests-du-poste.mjs asks of a night test that depends on the poste), in one run
|
|
@@ -116,7 +116,7 @@ export function lireLesArguments(args) {
|
|
|
116
116
|
return { horsDuPoste, sansEquipement, duPoste, mesuresSeules, tranche };
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
const CONFIGURATION = fileURLToPath(new URL('./vitest.nuit.config.
|
|
119
|
+
const CONFIGURATION = fileURLToPath(new URL('./vitest.nuit.config.cjs', import.meta.url));
|
|
120
120
|
const HORS = new Set(['node_modules', 'dist', '.git']);
|
|
121
121
|
|
|
122
122
|
// Whether a file that <est> (the rules of ./vitest-config/cibles.mjs) lies under <dossier>.
|
|
@@ -78,11 +78,9 @@
|
|
|
78
78
|
// writes its exclusion, `!$TURBO_ROOT$/<path>/.git` (`!<path>/.git` for a global dependency), in
|
|
79
79
|
// the root's turbo.json and in the inputs of a package's; the check refuses a root input lacking it.
|
|
80
80
|
//
|
|
81
|
-
// The configuration of Vitest
|
|
82
|
-
//
|
|
83
|
-
//
|
|
84
|
-
// beside it (`vitest.config.mjs.timestamp-<n>.mjs`). The check refuses a `vitest.config.mjs` or
|
|
85
|
-
// `.mts` of that package, and a `.js` or `.ts` when its `type` is `module`.
|
|
81
|
+
// The check refuses a configuration of Vitest that Vite would write beside to load, in the root
|
|
82
|
+
// and in each package: a configuration of Vitest is CommonJS (`vitest.config.cjs`,
|
|
83
|
+
// ./configurations-de-vitest.mjs), the known debt aside.
|
|
86
84
|
//
|
|
87
85
|
// The root's tasks, in its turbo.json or turbo.jsonc (the rest of the file is the project's,
|
|
88
86
|
// its comments and layout kept by jsonc-parser; a repository without one has nothing written or
|
|
@@ -121,7 +119,7 @@ import {
|
|
|
121
119
|
TRACE,
|
|
122
120
|
VARIABLE_TRAVAILLEURS as TRAVAILLEURS,
|
|
123
121
|
} from '../../services-du-noyau.mjs';
|
|
124
|
-
import {
|
|
122
|
+
import { configurationsRefusees, GARDE, trancherLaGarde } from './configurations-de-vitest.mjs';
|
|
125
123
|
import { lecturesDesTests } from './vitest-config/lances.mjs';
|
|
126
124
|
import { parcourir } from './parcours.mjs';
|
|
127
125
|
import {
|
|
@@ -132,7 +130,8 @@ import {
|
|
|
132
130
|
recouvreLaLecture,
|
|
133
131
|
TYPAGE,
|
|
134
132
|
} from '../../paquets.mjs';
|
|
135
|
-
import {
|
|
133
|
+
import { juger, lire as lireLaDette } from '../../dette.mjs';
|
|
134
|
+
import { RESULTATS } from '../../resultats.mjs';
|
|
136
135
|
import {
|
|
137
136
|
SCRIPT_DES_TESTS as TESTS,
|
|
138
137
|
SCRIPTS_DE_GARDES,
|
|
@@ -1243,26 +1242,6 @@ function declarationsRefusees(racine) {
|
|
|
1243
1242
|
return refus;
|
|
1244
1243
|
}
|
|
1245
1244
|
|
|
1246
|
-
// The refusals of the configurations of Vitest that Vite loads as ESM in a package of the shared
|
|
1247
|
-
// test material of <racine>: one line per such file, as Vite judges it (`.mjs`, `.mts`, or `.js`,
|
|
1248
|
-
// `.ts` in a package of `"type": "module"`).
|
|
1249
|
-
function configsMatiereRefusees(racine) {
|
|
1250
|
-
const refus = [];
|
|
1251
|
-
for (const { dir } of matieres(racine)) {
|
|
1252
|
-
const { type } = JSON.parse(readFileSync(path.join(dir, 'package.json'), 'utf8'));
|
|
1253
|
-
for (const ext of ['mjs', 'mts', ...(type === 'module' ? ['js', 'ts'] : [])]) {
|
|
1254
|
-
const f = path.relative(racine, path.join(dir, `vitest.config.${ext}`));
|
|
1255
|
-
if (!existsSync(path.join(racine, f))) {
|
|
1256
|
-
continue;
|
|
1257
|
-
}
|
|
1258
|
-
refus.push(
|
|
1259
|
-
`⛔ ${f} : la configuration de Vitest du paquet de la matière s'écrit en CommonJS, \`vitest.config.cjs\` ; Vite écrit un fichier à côté d'une configuration ESM pour la charger, et la matière est en lecture seule chez tout rôle autre que le testwriter.`
|
|
1260
|
-
);
|
|
1261
|
-
}
|
|
1262
|
-
}
|
|
1263
|
-
return refus;
|
|
1264
|
-
}
|
|
1265
|
-
|
|
1266
1245
|
// Whether the pattern <motif> (from the root) can name a file of one of the <dossiers>: its fixed
|
|
1267
1246
|
// part, before the first glob character, lies in one, or holds one under a glob.
|
|
1268
1247
|
function visePaquet(motif, dossiers) {
|
|
@@ -1316,13 +1295,22 @@ function racineRefusee(racine) {
|
|
|
1316
1295
|
// or that does not wait for the build of its package and of its dependencies, for a root `test:unit` whose `env`
|
|
1317
1296
|
// lacks TESTS_CIBLES, per variable of PASSAGES the root's `globalPassThroughEnv` lacks, per configuration
|
|
1318
1297
|
// of a package written by hand in the root's turbo.json, and per declaration of data or trace
|
|
1319
|
-
// refused.
|
|
1298
|
+
// refused, and per configuration of Vitest refused that the known debt does not hold.
|
|
1299
|
+
/**
|
|
1300
|
+
* @param {string} racine
|
|
1301
|
+
* @returns {string[]}
|
|
1302
|
+
*/
|
|
1320
1303
|
export function verifier(racine) {
|
|
1304
|
+
const configurations = juger(lireLaDette(racine), GARDE, configurationsRefusees(racine)).refus;
|
|
1305
|
+
return [...refusDuGraphe(racine), ...configurations.map(c => c.message)];
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
// The refusals of <racine> but those of the configurations of Vitest, none of which a debt holds.
|
|
1309
|
+
function refusDuGraphe(racine) {
|
|
1321
1310
|
const refus = [
|
|
1322
1311
|
...racineRefusee(racine),
|
|
1323
1312
|
...controlesDeRacineRefuses(racine),
|
|
1324
1313
|
...declarationsRefusees(racine),
|
|
1325
|
-
...configsMatiereRefusees(racine),
|
|
1326
1314
|
];
|
|
1327
1315
|
const gits = gitsAbsents(racine);
|
|
1328
1316
|
for (const { ou, e, m, ligne } of (gits?.listes ?? []).flatMap(l => l.manques)) {
|
|
@@ -1402,16 +1390,15 @@ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
|
|
|
1402
1390
|
if (args.includes('--ecrire')) {
|
|
1403
1391
|
ecrire(racine);
|
|
1404
1392
|
} else {
|
|
1405
|
-
|
|
1406
|
-
|
|
1393
|
+
// A refusal of the graph judges the root's configuration: a finding without a file of a
|
|
1394
|
+
// component, that no debt holds.
|
|
1395
|
+
const { refus, lignes } = trancherLaGarde(racine, [
|
|
1396
|
+
...refusDuGraphe(racine).map(message => ({ message })),
|
|
1397
|
+
...configurationsRefusees(racine),
|
|
1398
|
+
]);
|
|
1399
|
+
for (const l of [...refus.map(r => r.message), ...lignes]) {
|
|
1407
1400
|
process.stderr.write(`${l}\n`);
|
|
1408
1401
|
}
|
|
1409
|
-
// Each refusal judges the root's configuration: a finding without a file of a component.
|
|
1410
|
-
ecrireSarif({
|
|
1411
|
-
garde: 'turbo-des-paquets',
|
|
1412
|
-
racine,
|
|
1413
|
-
constats: refus.map(l => ({ message: l })),
|
|
1414
|
-
});
|
|
1415
1402
|
process.exitCode = refus.length ? 1 : 0;
|
|
1416
1403
|
}
|
|
1417
1404
|
} catch (e) {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
// day, and every measure of time, a time budget bench (`*.budget.test.*`, `*.budget.spec.*`) or
|
|
17
17
|
// a time witness (a test file that imports `mesurerAuRepos`), moves with the load of the day:
|
|
18
18
|
// `npm test`, `npm run verifier` and the integration leave them out, and the night plays them
|
|
19
|
-
// (scripts/nuit.sh, scripts/langages/typescript/vitest.nuit.config.
|
|
19
|
+
// (scripts/nuit.sh, scripts/langages/typescript/vitest.nuit.config.cjs); a targeted run that
|
|
20
20
|
// names the file of one itself plays it, under the measure of time below (./cibles.mjs, where
|
|
21
21
|
// the patterns live, and whose plugin leaves the witnesses out). `mergeConfig` adds the
|
|
22
22
|
// exclusions of a configuration that extends this one to these.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// The delays of the sizes of test, in ms, on the model of Bazel's test-encyclopedia: small, medium,
|
|
2
2
|
// large. A module of its own, with no import: the configurations of Vitest (./base.mjs,
|
|
3
|
-
// ../vitest.nuit.config.
|
|
3
|
+
// ../vitest.nuit.config.cjs) are bundled by Vite and read only these numbers, while the
|
|
4
4
|
// classification that deduces a file's size (./delais.mjs) reads the guard of the sizes, a script.
|
|
5
5
|
// Mechanism: packages/grillhouse/docs/architecture/tests.md, §3.4 (the guard of the sizes).
|
|
6
6
|
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
// named leaves them out, as the day does.
|
|
37
37
|
// - A run whose paths name no test file plays none, and fails: the base configuration keeps
|
|
38
38
|
// Vitest's `passWithNoTests: false`.
|
|
39
|
-
// - The night's configuration (scripts/langages/typescript/vitest.nuit.config.
|
|
39
|
+
// - The night's configuration (scripts/langages/typescript/vitest.nuit.config.cjs) plays what the
|
|
40
40
|
// day leaves out, through the plugin `nuit`: the night tests, the benches and the witnesses; the
|
|
41
41
|
// variable `GRILLHOUSE_TESTS_DE_NUIT` (NUIT_VARIABLE) chooses `nuit`, the night tests alone,
|
|
42
42
|
// `hors-poste`, the night tests but those that bear the tag `@poste` at their head (the night of
|
|
@@ -61,7 +61,7 @@ import { lireChangements, restreindre } from './changements.mjs';
|
|
|
61
61
|
// The name of the variable is the core's (`TESTS_CIBLES`); this module reads it under its own name.
|
|
62
62
|
export const VARIABLE = TESTS_CIBLES;
|
|
63
63
|
// The day's exclusions, which the base configuration (./base.mjs) sets and the night plays
|
|
64
|
-
// (scripts/langages/typescript/vitest.nuit.config.
|
|
64
|
+
// (scripts/langages/typescript/vitest.nuit.config.cjs): the night tests, too long for the day, and the time budget
|
|
65
65
|
// benches, whose measures move with the load of the day.
|
|
66
66
|
export const NUIT = '**/*.nuit.{test,spec}.?(c|m)[jt]s?(x)';
|
|
67
67
|
export const BUDGET = '**/*.budget.{test,spec}.?(c|m)[jt]s?(x)';
|
|
@@ -28,59 +28,70 @@
|
|
|
28
28
|
// it leaves out; this configuration takes it out of the environment once read, as the plugin of
|
|
29
29
|
// the night does its choice and its tranche: the unit is the run's own, and a Vitest that a night
|
|
30
30
|
// test starts itself, in another package, plays under no configuration but its own. Node (>= 26)
|
|
31
|
-
// reads the package's configuration itself, TypeScript included
|
|
32
|
-
// function is called
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
// reads the package's configuration itself, TypeScript included, and takes what it exports as Vite
|
|
32
|
+
// does: a function is called for a test run, and a promise, exported or returned, is awaited.
|
|
33
|
+
//
|
|
34
|
+
// CommonJS, exporting a promise: Vite loads it without writing beside it, and the frame's package
|
|
35
|
+
// is read-only where its tests load it (./turbo-des-paquets.mjs asks the same of a project). No
|
|
36
|
+
// `require`: a configuration in ESM that imports this one has it bundled as ESM, where Node gives
|
|
37
|
+
// none.
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
async function charger() {
|
|
40
|
+
const { pathToFileURL } = await import('node:url');
|
|
41
|
+
const { mergeConfig } = await import('vitest/config');
|
|
42
|
+
const { default: base } = await import('./vitest-config/base.mjs');
|
|
43
|
+
const { HORS_DU_JOUR, nuit, NUIT_PAQUET } = await import('./vitest-config/cibles.mjs');
|
|
44
|
+
const { DELAI_NUIT_MS } = await import('./vitest-config/bornes.mjs');
|
|
43
45
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
config(config) {
|
|
49
|
-
const test = (config.test ??= {});
|
|
50
|
-
test.exclude = ['**/node_modules/**', '**/dist/**', '**/.git/**', ...exclus];
|
|
51
|
-
test.reporters = base.test.reporters;
|
|
52
|
-
test.setupFiles = [...new Set([...(test.setupFiles ?? []), ...base.test.setupFiles])];
|
|
53
|
-
},
|
|
54
|
-
};
|
|
46
|
+
const { config: fichier, exclus = [] } = process.env[NUIT_PAQUET]
|
|
47
|
+
? JSON.parse(process.env[NUIT_PAQUET])
|
|
48
|
+
: {};
|
|
49
|
+
delete process.env[NUIT_PAQUET];
|
|
55
50
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
passWithNoTests: true,
|
|
68
|
-
// The large delay of Bazel for a night test: 900 s (./vitest-config/delais.mjs).
|
|
69
|
-
testTimeout: DELAI_NUIT_MS,
|
|
70
|
-
hookTimeout: DELAI_NUIT_MS,
|
|
71
|
-
watch: false,
|
|
72
|
-
},
|
|
73
|
-
};
|
|
51
|
+
// What the night sets wins over the configuration of a package, whose plugins have run first: the
|
|
52
|
+
// exclusions of its unit, the reporters, and the setup files, the package's before the base's.
|
|
53
|
+
const nuitGagne = {
|
|
54
|
+
name: 'grillhouse:nuit-gagne',
|
|
55
|
+
config(config) {
|
|
56
|
+
const test = (config.test ??= {});
|
|
57
|
+
test.exclude = ['**/node_modules/**', '**/dist/**', '**/.git/**', ...exclus];
|
|
58
|
+
test.reporters = base.test.reporters;
|
|
59
|
+
test.setupFiles = [...new Set([...(test.setupFiles ?? []), ...base.test.setupFiles])];
|
|
60
|
+
},
|
|
61
|
+
};
|
|
74
62
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
63
|
+
const cadre = {
|
|
64
|
+
plugins: [nuitGagne, nuit()],
|
|
65
|
+
cacheDir: base.cacheDir,
|
|
66
|
+
test: {
|
|
67
|
+
env: base.test.env,
|
|
68
|
+
environment: base.test.environment,
|
|
69
|
+
reporters: base.test.reporters,
|
|
70
|
+
setupFiles: base.test.setupFiles,
|
|
71
|
+
include: HORS_DU_JOUR,
|
|
72
|
+
exclude: ['**/node_modules/**', '**/dist/**', '**/.git/**'],
|
|
73
|
+
// A unit may hold none of the files the run chooses.
|
|
74
|
+
passWithNoTests: true,
|
|
75
|
+
// The large delay of Bazel for a night test: 900 s (./vitest-config/delais.mjs).
|
|
76
|
+
testTimeout: DELAI_NUIT_MS,
|
|
77
|
+
hookTimeout: DELAI_NUIT_MS,
|
|
78
|
+
watch: false,
|
|
79
|
+
},
|
|
80
|
+
};
|
|
82
81
|
|
|
83
|
-
|
|
84
|
-
const
|
|
82
|
+
async function dePaquet(f) {
|
|
83
|
+
const { default: exporte } = await import(pathToFileURL(f).href);
|
|
84
|
+
// Awaited before the test: the promise a CommonJS configuration exports may give a function.
|
|
85
|
+
const attendu = await exporte;
|
|
86
|
+
const paquet = await (typeof attendu === 'function'
|
|
87
|
+
? attendu({ command: 'serve', mode: 'test' })
|
|
88
|
+
: attendu);
|
|
89
|
+
// The environment and the setup files of the package are its own to set.
|
|
90
|
+
const { environment: _e, setupFiles: _s, ...test } = cadre.test;
|
|
91
|
+
return mergeConfig(paquet ?? {}, { ...cadre, test });
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return fichier ? await dePaquet(fichier) : cadre;
|
|
95
|
+
}
|
|
85
96
|
|
|
86
|
-
|
|
97
|
+
module.exports = charger();
|
package/scripts/langages.d.mts
CHANGED
|
@@ -20,3 +20,9 @@ export function langagesDe(racine: string): Langage[];
|
|
|
20
20
|
export function langageDe(racine: string): Composition;
|
|
21
21
|
/** The join of the copy <copie>, its readings played in the main tree when they throw in it. */
|
|
22
22
|
export function langageDeLaCopie(copie: string, principal?: () => string | null): Composition;
|
|
23
|
+
|
|
24
|
+
/** The components of the repository at <racine>, read by `langageDeLaCopie`, and the packages out
|
|
25
|
+
* of the frame a plan may name, each `dossier` relative to it. */
|
|
26
|
+
export function composantsLisibles(
|
|
27
|
+
racine: string
|
|
28
|
+
): { dossier: string; pkg: { name: string }; hors: boolean }[];
|
package/scripts/langages.mjs
CHANGED
|
@@ -38,6 +38,7 @@ import { spawnSync } from 'node:child_process';
|
|
|
38
38
|
import { createRequire } from 'node:module';
|
|
39
39
|
import path from 'node:path';
|
|
40
40
|
import { composer } from './composition-des-langages.mjs';
|
|
41
|
+
import { paquetsDuLangage } from './enveloppe/paquets-du-plan.mjs';
|
|
41
42
|
import { matieresDeclarees, sousUneMatiere } from './matieres-lues.mjs';
|
|
42
43
|
import { paquets } from './paquets.mjs';
|
|
43
44
|
import {
|
|
@@ -256,3 +257,8 @@ export function langageDeLaCopie(copie, principal = () => arbrePrincipal(copie))
|
|
|
256
257
|
manifestes: { ...langage.manifestes, horsDesTests: tolerer(langage.manifestes.horsDesTests) },
|
|
257
258
|
});
|
|
258
259
|
}
|
|
260
|
+
|
|
261
|
+
// The components of the repository at <racine>, as `paquetsDuLangage` gives them, still read in a
|
|
262
|
+
// copy its tool no longer loads (`langageDeLaCopie`): what an act of the circuit reads to open on
|
|
263
|
+
// its ticket, so that it writes its stop and resumes, and what the title of a defect of main names.
|
|
264
|
+
export const composantsLisibles = racine => paquetsDuLangage(langageDeLaCopie(racine), racine);
|