@roomi-fields/grillhouse 0.29.0 → 0.30.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 +739 -0
- package/bin/grillhouse.mjs +79 -18
- package/cadre/templates/projet/.github/workflows/ci.yml +2 -13
- package/cadre/templates/projet/CLAUDE.md +5 -1
- package/cadre/templates/projet/docs/agents/issue-tracker.md +1 -1
- package/cadre/templates/projet/package.json +2 -2
- package/charte.md +24 -0
- package/dist/temporal/acte.d.ts +24 -0
- package/dist/temporal/acte.js +139 -0
- package/dist/temporal/acte.js.map +1 -0
- package/dist/temporal/attributs.d.ts +6 -0
- package/dist/temporal/attributs.js +15 -0
- package/dist/temporal/attributs.js.map +1 -0
- package/dist/temporal/circuit/activites.d.ts +13 -0
- package/dist/temporal/circuit/activites.js +33 -0
- package/dist/temporal/circuit/activites.js.map +1 -0
- package/dist/temporal/circuit/client.d.ts +72 -0
- package/dist/temporal/circuit/client.js +247 -0
- package/dist/temporal/circuit/client.js.map +1 -0
- package/dist/temporal/circuit/commande.d.ts +2 -0
- package/dist/temporal/circuit/commande.js +238 -0
- package/dist/temporal/circuit/commande.js.map +1 -0
- package/dist/temporal/circuit/contrat.d.ts +305 -0
- package/dist/temporal/circuit/contrat.js +24 -0
- package/dist/temporal/circuit/contrat.js.map +1 -0
- package/dist/temporal/circuit/deroule.d.ts +3 -0
- package/dist/temporal/circuit/deroule.js +540 -0
- package/dist/temporal/circuit/deroule.js.map +1 -0
- package/dist/temporal/client.d.ts +47 -0
- package/dist/temporal/client.js +69 -0
- package/dist/temporal/client.js.map +1 -0
- package/dist/temporal/commande.d.ts +2 -0
- package/dist/temporal/commande.js +95 -0
- package/dist/temporal/commande.js.map +1 -0
- package/dist/temporal/deroules.d.ts +5 -0
- package/dist/temporal/deroules.js +10 -0
- package/dist/temporal/deroules.js.map +1 -0
- package/dist/temporal/etat.d.ts +33 -0
- package/dist/temporal/etat.js +59 -0
- package/dist/temporal/etat.js.map +1 -0
- package/dist/temporal/file/activites.d.ts +10 -0
- package/dist/temporal/file/activites.js +25 -0
- package/dist/temporal/file/activites.js.map +1 -0
- package/dist/temporal/file/client.d.ts +4 -0
- package/dist/temporal/file/client.js +6 -0
- package/dist/temporal/file/client.js.map +1 -0
- package/dist/temporal/file/contrat.d.ts +158 -0
- package/dist/temporal/file/contrat.js +14 -0
- package/dist/temporal/file/contrat.js.map +1 -0
- package/dist/temporal/file/deroule.d.ts +15 -0
- package/dist/temporal/file/deroule.js +235 -0
- package/dist/temporal/file/deroule.js.map +1 -0
- package/dist/temporal/installation.d.ts +124 -0
- package/dist/temporal/installation.js +408 -0
- package/dist/temporal/installation.js.map +1 -0
- package/dist/temporal/places/activites.d.ts +8 -0
- package/dist/temporal/places/activites.js +13 -0
- package/dist/temporal/places/activites.js.map +1 -0
- package/dist/temporal/places/client.d.ts +28 -0
- package/dist/temporal/places/client.js +64 -0
- package/dist/temporal/places/client.js.map +1 -0
- package/dist/temporal/places/contrat.d.ts +106 -0
- package/dist/temporal/places/contrat.js +21 -0
- package/dist/temporal/places/contrat.js.map +1 -0
- package/dist/temporal/places/deroule.d.ts +3 -0
- package/dist/temporal/places/deroule.js +198 -0
- package/dist/temporal/places/deroule.js.map +1 -0
- package/dist/temporal/sonde/activites.d.ts +6 -0
- package/dist/temporal/sonde/activites.js +52 -0
- package/dist/temporal/sonde/activites.js.map +1 -0
- package/dist/temporal/sonde/contrat.d.ts +35 -0
- package/dist/temporal/sonde/contrat.js +10 -0
- package/dist/temporal/sonde/contrat.js.map +1 -0
- package/dist/temporal/sonde/deroule.d.ts +3 -0
- package/dist/temporal/sonde/deroule.js +39 -0
- package/dist/temporal/sonde/deroule.js.map +1 -0
- package/dist/temporal/tickets/activites.d.ts +7 -0
- package/dist/temporal/tickets/activites.js +81 -0
- package/dist/temporal/tickets/activites.js.map +1 -0
- package/dist/temporal/tickets/client.d.ts +10 -0
- package/dist/temporal/tickets/client.js +31 -0
- package/dist/temporal/tickets/client.js.map +1 -0
- package/dist/temporal/tickets/contrat.d.ts +56 -0
- package/dist/temporal/tickets/contrat.js +13 -0
- package/dist/temporal/tickets/contrat.js.map +1 -0
- package/dist/temporal/tickets/deroule.d.ts +3 -0
- package/dist/temporal/tickets/deroule.js +94 -0
- package/dist/temporal/tickets/deroule.js.map +1 -0
- package/dist/temporal/travailleur.d.ts +2 -0
- package/dist/temporal/travailleur.js +69 -0
- package/dist/temporal/travailleur.js.map +1 -0
- package/docs/ARCHITECTURE.md +609 -80
- package/docs/CADRE.md +17 -0
- package/docs/INTERFACE.md +134 -42
- package/hooks/crochet.mjs +19 -2
- package/hooks/hooks.json +11 -0
- package/package.json +16 -4
- package/scripts/activites.mjs +2182 -0
- package/scripts/aiguillage.d.mts +37 -0
- package/scripts/aiguillage.mjs +7 -3
- package/scripts/avancement.mjs +128 -16
- package/scripts/bilan.mjs +37 -19
- package/scripts/cadre.mjs +11 -2
- package/scripts/circuit.mjs +881 -4059
- package/scripts/circuits-cles.d.mts +4 -0
- package/scripts/circuits-cles.mjs +21 -0
- package/scripts/circuits-du-serveur.mjs +105 -0
- package/scripts/codes-de-sortie.mjs +9 -0
- package/scripts/commandes-composees.mjs +45 -41
- package/scripts/commandes-du-path.d.mts +7 -0
- package/scripts/commandes-du-path.mjs +25 -0
- package/scripts/composition-des-langages.mjs +16 -12
- package/scripts/conformite.mjs +6 -13
- package/scripts/copies-finies.mjs +52 -47
- package/scripts/depart-du-ticket.d.mts +53 -0
- package/scripts/depart-du-ticket.mjs +124 -0
- package/scripts/dependances-internes.mjs +115 -0
- package/scripts/dernier-vert.mjs +7 -15
- package/scripts/donnees-cles.mjs +228 -0
- package/scripts/droits.mjs +11 -1
- package/scripts/effets.mjs +352 -0
- package/scripts/enveloppe/enveloppe.mjs +119 -8
- package/scripts/enveloppe/lancer.sh +14 -18
- package/scripts/enveloppe/paquets-du-plan.mjs +2 -2
- package/scripts/enveloppe/travail-de-la-copie.mjs +5 -1
- package/scripts/etapes.mjs +5 -2
- package/scripts/faits-du-circuit.mjs +493 -0
- package/scripts/file-des-tickets.d.mts +21 -0
- package/scripts/file-des-tickets.mjs +58 -0
- package/scripts/flux-des-paquets.mjs +187 -0
- package/scripts/gardes-du-cadre.mjs +12 -2
- package/scripts/integration/file.mjs +475 -420
- package/scripts/integration/integrer.mjs +17 -19
- package/scripts/integration/rejeu.mjs +19 -4
- package/scripts/jointure.d.ts +145 -27
- package/scripts/langages/cargo/commandes.mjs +289 -109
- package/scripts/langages/cargo/composants.mjs +130 -34
- package/scripts/langages/cargo/exemples.mjs +12 -21
- package/scripts/langages/cargo/index.mjs +18 -8
- package/scripts/langages/cargo/sccache.mjs +8 -14
- package/scripts/langages/python/commandes.mjs +216 -100
- package/scripts/langages/python/composants.mjs +53 -21
- package/scripts/langages/python/exemples.mjs +6 -16
- package/scripts/langages/python/index.mjs +24 -8
- package/scripts/langages/python/lot.mjs +1 -36
- package/scripts/langages/typescript/construire.mjs +6 -163
- package/scripts/langages/typescript/exemples.mjs +3 -11
- package/scripts/langages/typescript/frontieres.mjs +1 -1
- package/scripts/langages/typescript/index.mjs +43 -61
- package/scripts/langages/typescript/interfaces-contre-code.mjs +4 -4
- package/scripts/langages/typescript/migrations/0.30.0-prefixe-des-tickets.mjs +63 -0
- package/scripts/langages/typescript/migrations/0.30.0-tailles-des-outils-lourds.mjs +31 -0
- package/scripts/langages/typescript/migrations/0.30.0-titres-nommant-un-ticket.mjs +40 -0
- package/scripts/langages/typescript/mise-a-jour.mjs +1 -2
- package/scripts/langages/typescript/tailles-des-tests.mjs +40 -9
- package/scripts/langages/typescript/tests-de-nuit.mjs +12 -9
- package/scripts/langages/typescript/tests.mjs +17 -8
- package/scripts/langages/typescript/titres-de-tests.mjs +297 -0
- package/scripts/langages/typescript/turbo-des-paquets.mjs +183 -38
- package/scripts/langages/typescript/verdict.mjs +1 -1
- package/scripts/langages/typescript/verifier.mjs +31 -11
- package/scripts/langages/typescript/vitest-config/base.mjs +22 -1
- package/scripts/langages/typescript/vitest-config/bornes.mjs +13 -0
- package/scripts/langages/typescript/vitest-config/cibles.mjs +36 -14
- package/scripts/langages/typescript/vitest-config/delais.mjs +54 -0
- package/scripts/langages/typescript/vitest-config/delais.setup.mjs +11 -0
- package/scripts/langages/typescript/vitest-config/duree.classement.mjs +100 -0
- package/scripts/langages/typescript/vitest-config/duree.reporter.mjs +49 -63
- package/scripts/langages/typescript/vitest-config/machine.setup.mjs +3 -0
- package/scripts/langages/typescript/vitest.nuit.config.mjs +4 -0
- package/scripts/mesure/pression.mjs +3 -3
- package/scripts/mesure-de-la-machine.d.mts +21 -0
- package/scripts/mesure-de-la-machine.mjs +76 -0
- package/scripts/migrations/0.23.2-copies-du-cadre.mjs +8 -2
- package/scripts/migrations/0.30.0-ci-appelle-la-verification.mjs +120 -0
- package/scripts/migrations/0.31.0-paquets-dans-le-graphe.mjs +81 -0
- package/scripts/migrations.mjs +5 -0
- package/scripts/nuit.sh +10 -3
- package/scripts/outils-cles.d.mts +24 -0
- package/scripts/outils-cles.mjs +0 -1
- package/scripts/paquet-npm.mjs +147 -0
- package/scripts/paquet.mjs +73 -4
- package/scripts/paquets.mjs +34 -6
- package/scripts/passe-de-la-machine.mjs +66 -0
- package/scripts/places-de-la-machine.mjs +360 -0
- package/scripts/places-du-serveur.mjs +170 -0
- package/scripts/prefixe-des-tickets.mjs +68 -0
- package/scripts/preparation.mjs +10 -3
- package/scripts/registre.mjs +3 -2
- package/scripts/regles-des-places.d.mts +36 -0
- package/scripts/regles-des-places.mjs +70 -0
- package/scripts/reponses-du-circuit.d.mts +6 -0
- package/scripts/reponses-du-circuit.mjs +28 -0
- package/scripts/resultats.mjs +7 -9
- package/scripts/retirer-les-copies-finies.mjs +25 -0
- package/scripts/sans-reponse.d.mts +4 -0
- package/scripts/sans-reponse.mjs +13 -0
- package/scripts/seances.mjs +918 -0
- package/scripts/services-du-noyau.mjs +26 -8
- package/scripts/session-start.sh +2 -2
- package/scripts/sortie.mjs +3 -3
- package/scripts/sous-commandes.mjs +38 -9
- package/scripts/style-a-l-ecriture.mjs +229 -0
- package/scripts/superviseur.mjs +122 -111
- package/scripts/tableau.mjs +148 -110
- package/scripts/taches-du-graphe.mjs +328 -0
- package/scripts/ticket-du-circuit.mjs +206 -0
- package/scripts/transitions.d.mts +148 -0
- package/scripts/transitions.mjs +901 -0
- package/scripts/verrou-de-fichier.mjs +2 -2
- package/scripts/verrou-de-machine.mjs +28 -13
- package/skills/explorateur/SKILL.md +2 -1
- package/skills/pitmaster/SKILL.md +17 -18
- package/skills/pitmaster/references/consigne-agent.md +5 -1
- package/skills/release/SKILL.md +3 -3
- package/skills/relecteur/SKILL.md +4 -2
- package/skills/testwriter/SKILL.md +36 -24
- package/scripts/demon.mjs +0 -251
- package/scripts/integration/file-attente.mjs +0 -61
- package/scripts/langages/cargo/touches.mjs +0 -93
- package/scripts/langages/typescript/script-des-tests.mjs +0 -6
|
@@ -73,8 +73,9 @@
|
|
|
73
73
|
// output, `ecrit`, a directory inside the package that git ignores. A restore from the cache
|
|
74
74
|
// adds files and removes none: the command empties its directory before writing it.
|
|
75
75
|
// The traces a package's tests wait for are read in Turborepo's plan of its tests
|
|
76
|
-
// (`tracesDuPlan`
|
|
77
|
-
//
|
|
76
|
+
// (`tracesDuPlan` of scripts/taches-du-graphe.mjs), by the targeted run
|
|
77
|
+
// (scripts/langages/typescript/tests.mjs) and the build of an agent's copy
|
|
78
|
+
// (scripts/taches-du-graphe.mjs, every language's), which produce them before the tests; the envelope shows the
|
|
78
79
|
// directory of a neighbour's trace read-only (scripts/enveloppe/enveloppe.mjs), and the targeted
|
|
79
80
|
// run inside it plays the traces of the agent's package only.
|
|
80
81
|
// - The package holding a declared path of data alone (the shared test material) has its `build`
|
|
@@ -162,13 +163,18 @@ import { createRequire } from 'node:module';
|
|
|
162
163
|
import path from 'node:path';
|
|
163
164
|
import { pathToFileURL } from 'node:url';
|
|
164
165
|
import { applyEdits, modify, parse } from 'jsonc-parser';
|
|
165
|
-
import {
|
|
166
|
+
import {
|
|
167
|
+
AVANCEMENT,
|
|
168
|
+
CHANGEMENTS,
|
|
169
|
+
inscrireLePlan,
|
|
170
|
+
paquetsSansPackageJson,
|
|
171
|
+
TRACE,
|
|
172
|
+
} from '../../services-du-noyau.mjs';
|
|
166
173
|
import { matieres } from './consommateurs.mjs';
|
|
167
174
|
import { parcourir } from './parcours.mjs';
|
|
168
175
|
import { paquets, TYPAGE } from '../../paquets.mjs';
|
|
169
176
|
import { ecrireSarif, RESULTATS } from '../../resultats.mjs';
|
|
170
|
-
import { SCRIPT_DES_TESTS as TESTS } from '
|
|
171
|
-
import { VARIABLE as TESTS_CIBLES } from './vitest-config/cibles.mjs';
|
|
177
|
+
import { SCRIPT_DES_TESTS as TESTS, TESTS_CIBLES } from '../../services-du-noyau.mjs';
|
|
172
178
|
|
|
173
179
|
export const TURBO = 'turbo.json';
|
|
174
180
|
export const COMMANDE = 'npx grillhouse turbo-des-paquets --ecrire';
|
|
@@ -180,6 +186,98 @@ const TOPOLOGIE = ['dependencies', 'devDependencies', 'optionalDependencies'];
|
|
|
180
186
|
const RACINES = ['turbo.json', 'turbo.jsonc'];
|
|
181
187
|
// The guard tasks of the root: the frame's controls, and the project's own guards.
|
|
182
188
|
export const GARDES = ['grillhouse:gardes', 'gardes'];
|
|
189
|
+
// The controls of the root the CI used to play beside the verification: the format check and the
|
|
190
|
+
// lint (grillhouse-61z). A root plays those its package.json holds a script for, none demanded.
|
|
191
|
+
export const CONTROLES = ['format:check', 'lint'];
|
|
192
|
+
// The controls the root package.json of <racine> holds a script for.
|
|
193
|
+
export function controlesDeRacine(racine) {
|
|
194
|
+
try {
|
|
195
|
+
const scripts = JSON.parse(readFileSync(path.join(racine, 'package.json'), 'utf8')).scripts;
|
|
196
|
+
return CONTROLES.filter(c => typeof scripts?.[c] === 'string');
|
|
197
|
+
} catch {
|
|
198
|
+
return [];
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
// The filters that leave out of a run of Turborepo the packages of another language than TypeScript
|
|
202
|
+
// of <racine> (`--filter=!<name>`): they hold the tasks `test:unit` and `typecheck` for the graph
|
|
203
|
+
// and the order of the builds, while the pass of their own module plays their tests and typing.
|
|
204
|
+
export const horsTypescript = racine =>
|
|
205
|
+
paquetsSansPackageJson(racine).map(p => `--filter=!${p.nom}`);
|
|
206
|
+
// The controls <racine> plays: those its root package.json or one of its packages (out of the
|
|
207
|
+
// frame's list left out) holds a script for. `turbo run <control>` plays the task of each package
|
|
208
|
+
// that holds it, beside the root's `//#<control>`.
|
|
209
|
+
export function controlesDuDepot(racine) {
|
|
210
|
+
const deLaRacine = controlesDeRacine(racine);
|
|
211
|
+
return CONTROLES.filter(
|
|
212
|
+
c =>
|
|
213
|
+
deLaRacine.includes(c) ||
|
|
214
|
+
paquets(racine).some(({ pkg, hors }) => !hors && typeof pkg.scripts?.[c] === 'string')
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
// The tasks of the controls of the root at <racine> its root turbo.json lacks: [{ cle }].
|
|
218
|
+
function controlesAbsents(racine) {
|
|
219
|
+
const r = confRacine(racine);
|
|
220
|
+
if (!r) return [];
|
|
221
|
+
const liste = paquets(racine);
|
|
222
|
+
const prefixe = liste.length ? '//#' : '';
|
|
223
|
+
// Format and lint play per package (Turborepo's advice: each red carries its package, the cache
|
|
224
|
+
// replays the changed packages only): the task of a package's script, none for the root's.
|
|
225
|
+
const deLaRacine = controlesDeRacine(racine).map(c => `${prefixe}${c}`);
|
|
226
|
+
const desPaquets = CONTROLES.filter(c =>
|
|
227
|
+
liste.some(({ pkg, hors }) => !hors && typeof pkg.scripts?.[c] === 'string')
|
|
228
|
+
);
|
|
229
|
+
return [...deLaRacine, ...desPaquets]
|
|
230
|
+
.filter(cle => !r.conf.tasks?.[cle])
|
|
231
|
+
.map(cle => ({ f: r.f, cle }));
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// The tokens of a root script that name a file or a folder: the arguments that are no flag nor the
|
|
235
|
+
// value of one.
|
|
236
|
+
function cheminsDuScript(script) {
|
|
237
|
+
const mots = (String(script).match(/"[^"]*"|'[^']*'|\S+/g) ?? []).map(m =>
|
|
238
|
+
m.replace(/^(["'])(.*)\1$/, '$2')
|
|
239
|
+
);
|
|
240
|
+
const chemins = [];
|
|
241
|
+
for (let i = 1; i < mots.length; i++) {
|
|
242
|
+
const m = mots[i];
|
|
243
|
+
if (['--cache-location', '--ext', '--config', '--ignore-path', '-c'].includes(m)) i++;
|
|
244
|
+
else if (!m.startsWith('-') && !['&&', '||', ';', '|'].includes(m)) chemins.push(m);
|
|
245
|
+
}
|
|
246
|
+
return chemins.map(m => m.replace(/^\.\//, ''));
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// The refusals of the root's format and lint scripts at <racine> that name a file a package holds:
|
|
250
|
+
// the root keeps its own files (grillhouse-44b.9), a package plays its own.
|
|
251
|
+
function controlesDeRacineRefuses(racine) {
|
|
252
|
+
const dossiers = paquets(racine)
|
|
253
|
+
.filter(p => !p.hors)
|
|
254
|
+
.map(p => p.dossier);
|
|
255
|
+
/** @type {string[]} */
|
|
256
|
+
const refus = [];
|
|
257
|
+
if (dossiers.length === 0) return refus;
|
|
258
|
+
let scripts;
|
|
259
|
+
try {
|
|
260
|
+
scripts = JSON.parse(readFileSync(path.join(racine, 'package.json'), 'utf8')).scripts;
|
|
261
|
+
} catch {
|
|
262
|
+
return refus;
|
|
263
|
+
}
|
|
264
|
+
for (const c of CONTROLES) {
|
|
265
|
+
for (const chemin of cheminsDuScript(scripts?.[c] ?? '')) {
|
|
266
|
+
const { fixe, glob } = partieFixe(chemin);
|
|
267
|
+
// A glob at the root's top (`*.mjs`) names the root's files; `**` reaches the packages.
|
|
268
|
+
const vise =
|
|
269
|
+
fixe === ''
|
|
270
|
+
? chemin.split('/')[0] === '**'
|
|
271
|
+
: dossiers.some(d => sous(fixe, d) || (glob && sous(d, fixe)));
|
|
272
|
+
if (vise) {
|
|
273
|
+
refus.push(
|
|
274
|
+
`⛔ package.json : le script \`${c}\` de la racine (tâche \`//#${c}\`) nomme \`${chemin}\`, un fichier qu'un paquet porte (${dossiers.find(d => sous(fixe, d) || sous(d, fixe)) ?? 'un paquet'}) ; le script \`${c}\` de ce paquet le joue, la racine ne garde que ses propres fichiers.`
|
|
275
|
+
);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
return refus;
|
|
280
|
+
}
|
|
183
281
|
// The layout of what the generator writes in the root's turbo.json.
|
|
184
282
|
const MISE_EN_FORME = { formattingOptions: { insertSpaces: true, tabSize: 2, eol: '\n' } };
|
|
185
283
|
// The builds the typing of a package waits for in <racine>: its own, whose built entry its tests
|
|
@@ -199,8 +297,43 @@ const POURQUOI = {
|
|
|
199
297
|
[TEMPORAIRE]:
|
|
200
298
|
'la base de la passe, où chaque tâche écrit ses fichiers temporaires, effacée à sa fin',
|
|
201
299
|
};
|
|
300
|
+
// The variables of the tools of the project at <racine> (`grillhouse.outils` of its package.json,
|
|
301
|
+
// scripts/outils-cles.mjs), in the order it declares them: the paths of tools outside the
|
|
302
|
+
// repository its tests demand, which the run passes to every task without hashing them. A key
|
|
303
|
+
// that is no variable name is the guard of the tools' (`grillhouse outil`), not this one's.
|
|
304
|
+
function variablesDOutils(racine) {
|
|
305
|
+
try {
|
|
306
|
+
const o = JSON.parse(readFileSync(path.join(racine, 'package.json'), 'utf8')).grillhouse
|
|
307
|
+
?.outils;
|
|
308
|
+
return o && typeof o === 'object' && !Array.isArray(o)
|
|
309
|
+
? Object.keys(o).filter(n => /^[A-Za-z_][A-Za-z0-9_]*$/.test(n))
|
|
310
|
+
: [];
|
|
311
|
+
} catch {
|
|
312
|
+
return [];
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
// The variables of the data of the packages of the project at <racine> (`grillhouse.donnees` of
|
|
316
|
+
// the package.json of the root and of each package, scripts/donnees-cles.mjs), each once, in the
|
|
317
|
+
// order the packages declare them: the paths of the outputs of a provider that a consumer's tests
|
|
318
|
+
// run, which the run passes to every task without hashing them (the provider's build is awaited by
|
|
319
|
+
// `^build`, which hashes its sources). A faulty key is the reader's refusal, not this guard's.
|
|
320
|
+
function variablesDeDonnees(racine) {
|
|
321
|
+
const noms = [];
|
|
322
|
+
const lire = f => {
|
|
323
|
+
try {
|
|
324
|
+
const o = JSON.parse(readFileSync(f, 'utf8')).grillhouse?.donnees;
|
|
325
|
+
if (o && typeof o === 'object' && !Array.isArray(o)) {
|
|
326
|
+
noms.push(...Object.keys(o).filter(n => /^[A-Za-z_][A-Za-z0-9_]*$/.test(n)));
|
|
327
|
+
}
|
|
328
|
+
} catch {
|
|
329
|
+
// No readable package.json declares nothing.
|
|
330
|
+
}
|
|
331
|
+
};
|
|
332
|
+
lire(path.join(racine, 'package.json'));
|
|
333
|
+
for (const p of paquets(racine)) lire(path.join(racine, p.dossier, 'package.json'));
|
|
334
|
+
return [...new Set(noms)];
|
|
335
|
+
}
|
|
202
336
|
// The prefix of a trace task.
|
|
203
|
-
const TRACE = 'trace:';
|
|
204
337
|
// The files a build compiles: TypeScript's sources and declarations (tsc's default `include`
|
|
205
338
|
// takes a `.d.ts` into the program, whose types the build checks) and JavaScript (`allowJs`).
|
|
206
339
|
const CODE = /\.(?:[cm]?[jt]s|[jt]sx)$/;
|
|
@@ -242,14 +375,6 @@ function tachesRacine(racine) {
|
|
|
242
375
|
return taches;
|
|
243
376
|
}
|
|
244
377
|
|
|
245
|
-
// The trace tasks of a plan of Turborepo (`turbo run … --dry=json`, parsed), its tasks that
|
|
246
|
-
// <garder> keeps: their task ids (`<producer>#trace:<name>`), sorted.
|
|
247
|
-
export const tracesDuPlan = (plan, garder = () => true) =>
|
|
248
|
-
plan.tasks
|
|
249
|
-
.filter(t => t.task.startsWith(TRACE) && garder(t))
|
|
250
|
-
.map(t => t.taskId)
|
|
251
|
-
.sort();
|
|
252
|
-
|
|
253
378
|
/**
|
|
254
379
|
* Before a run of Turborepo of <args> in <racine> under <env>, while <dossier> is a progress
|
|
255
380
|
* directory (scripts/avancement.mjs): the plan of the run (`turbo run … --dry=json`), its tasks of
|
|
@@ -279,26 +404,6 @@ export function planifier(dossier, { racine, args, env = process.env }) {
|
|
|
279
404
|
});
|
|
280
405
|
}
|
|
281
406
|
|
|
282
|
-
// The tasks of a plan of Turborepo (`turbo run … --dry=json`, parsed) that wait, directly or not,
|
|
283
|
-
// for a task of one of the packages <paquets>, those tasks included: their task ids. As Bazel
|
|
284
|
-
// under --keep_going, a task that waits for a target of the plan goes with the plan, whose failure
|
|
285
|
-
// is the session's work; the others are the plan's providers.
|
|
286
|
-
export function attendentLePlan(plan, paquets) {
|
|
287
|
-
const parId = new Map(plan.tasks.map(t => [t.taskId, t]));
|
|
288
|
-
const verdicts = new Map();
|
|
289
|
-
const attend = id => {
|
|
290
|
-
if (verdicts.has(id)) return verdicts.get(id);
|
|
291
|
-
// A cycle of tasks is no wait on the plan by itself; Turborepo refuses it anyway.
|
|
292
|
-
verdicts.set(id, false);
|
|
293
|
-
const t = parId.get(id);
|
|
294
|
-
const v =
|
|
295
|
-
t !== undefined && (paquets.includes(t.package) || (t.dependencies ?? []).some(attend));
|
|
296
|
-
verdicts.set(id, v);
|
|
297
|
-
return v;
|
|
298
|
-
};
|
|
299
|
-
return new Set(plan.tasks.map(t => t.taskId).filter(attend));
|
|
300
|
-
}
|
|
301
|
-
|
|
302
407
|
// A path from the root, without its trailing slashes.
|
|
303
408
|
const net = d => String(d ?? '').replace(/\/+$/, '');
|
|
304
409
|
// The fixed part of the pattern <motif>, its segments before the first holding a glob character,
|
|
@@ -479,6 +584,23 @@ function entreesBuild(racine, dossier, pkg, sm) {
|
|
|
479
584
|
];
|
|
480
585
|
}
|
|
481
586
|
|
|
587
|
+
// The inputs of the build of a package of the language <langageNom> that has no package.json of
|
|
588
|
+
// its own (a crate, a project of Python) in <dossier>: what its build reads, as Turborepo's
|
|
589
|
+
// example of Rust names them (rust.mdx § Caching behavior), none of TypeScript's. A crate: its
|
|
590
|
+
// folder (Turborepo's default), then the Cargo.lock and the Cargo.toml of the root, the lock and
|
|
591
|
+
// the manifest of its workspace. A project of Python: its folder, which holds its own uv.lock and
|
|
592
|
+
// pyproject.toml, then the ones of the root when it has them (a workspace of uv).
|
|
593
|
+
function entreesDeBuildHorsJs(racine, langageNom) {
|
|
594
|
+
const racineDe = f => `$TURBO_ROOT$/${f}`;
|
|
595
|
+
if (langageNom === 'cargo') {
|
|
596
|
+
return ['$TURBO_DEFAULT$', racineDe('Cargo.lock'), racineDe('Cargo.toml')];
|
|
597
|
+
}
|
|
598
|
+
return [
|
|
599
|
+
'$TURBO_DEFAULT$',
|
|
600
|
+
...['pyproject.toml', 'uv.lock'].filter(f => existsSync(path.join(racine, f))).map(racineDe),
|
|
601
|
+
];
|
|
602
|
+
}
|
|
603
|
+
|
|
482
604
|
// The data and traces each package of the frame declares in its package.json:
|
|
483
605
|
// [{ dossier, pkg, lit, traces: [{ tache, id, lit, ecrit }] }], each path from the root.
|
|
484
606
|
function declarations(liste) {
|
|
@@ -529,6 +651,7 @@ export function attendus(racine) {
|
|
|
529
651
|
.filter(({ pkg, hors }) => !hors && typeof pkg.scripts?.build === 'string')
|
|
530
652
|
.map(({ pkg }) => pkg.name)
|
|
531
653
|
);
|
|
654
|
+
const horsJs = new Map(paquetsSansPackageJson(racine).map(p => [p.chemin, p.langage]));
|
|
532
655
|
const decls = new Map(declarations(liste).map(d => [d.dossier, d]));
|
|
533
656
|
const traces = [...decls.values()].flatMap(d => d.traces);
|
|
534
657
|
// The trace tasks whose output one of <lit> overlaps, <soi> left out, sorted.
|
|
@@ -559,7 +682,10 @@ export function attendus(racine) {
|
|
|
559
682
|
taches.build = {
|
|
560
683
|
dependsOn: internes(pkg, EXECUTION, construits).map(n => `${n}#build`),
|
|
561
684
|
};
|
|
562
|
-
const
|
|
685
|
+
const langageDuPaquet = horsJs.get(dossier);
|
|
686
|
+
const propres = langageDuPaquet
|
|
687
|
+
? entreesDeBuildHorsJs(racine, langageDuPaquet)
|
|
688
|
+
: entreesBuild(racine, dossier, pkg, sm);
|
|
563
689
|
// The files the build reads by name stay its inputs, a reader's declaration never changing
|
|
564
690
|
// them (Bazel: a file is `srcs` of one target and `data` of another): the ones its inputs
|
|
565
691
|
// name, else its package.json and tsconfig*.json.
|
|
@@ -572,7 +698,8 @@ export function attendus(racine) {
|
|
|
572
698
|
.filter(d => !lusParBuild(d))
|
|
573
699
|
.sort();
|
|
574
700
|
const sansDonnees = dedans.map(d => `!${d}/**`);
|
|
575
|
-
if (
|
|
701
|
+
if (langageDuPaquet) taches.build.inputs = [...propres, ...sansDonnees];
|
|
702
|
+
else if (propres) taches.build.inputs = [...racineBuild, ...propres, ...sansDonnees];
|
|
576
703
|
else if (dedans.length) taches.build.inputs = [base('build'), ...sansDonnees];
|
|
577
704
|
const horsVoisin = TOPOLOGIE.some(c => Object.keys(pkg[c] ?? {}).some(n => hors.has(n)));
|
|
578
705
|
const voisins = internes(pkg, TOPOLOGIE, duCadre);
|
|
@@ -693,7 +820,9 @@ function passagesManquants(racine) {
|
|
|
693
820
|
const r = confRacine(racine);
|
|
694
821
|
if (!r) return null;
|
|
695
822
|
const actuel = Array.isArray(r.conf.globalPassThroughEnv) ? r.conf.globalPassThroughEnv : [];
|
|
696
|
-
const manques =
|
|
823
|
+
const manques = [
|
|
824
|
+
...new Set([...PASSAGES, ...variablesDOutils(racine), ...variablesDeDonnees(racine)]),
|
|
825
|
+
].filter(v => !actuel.includes(v));
|
|
697
826
|
return manques.length ? { f: r.f, attendu: [...actuel, ...manques], manques } : null;
|
|
698
827
|
}
|
|
699
828
|
|
|
@@ -759,6 +888,16 @@ export function ecrire(racine) {
|
|
|
759
888
|
);
|
|
760
889
|
if (!ecrits.includes(typage.f)) ecrits.push(typage.f);
|
|
761
890
|
}
|
|
891
|
+
const controles = controlesAbsents(racine);
|
|
892
|
+
if (controles.length) {
|
|
893
|
+
const abs = path.join(racine, controles[0].f);
|
|
894
|
+
let texte = readFileSync(abs, 'utf8');
|
|
895
|
+
for (const { cle } of controles) {
|
|
896
|
+
texte = applyEdits(texte, modify(texte, ['tasks', cle], { outputs: [] }, MISE_EN_FORME));
|
|
897
|
+
}
|
|
898
|
+
writeFileSync(abs, texte);
|
|
899
|
+
if (!ecrits.includes(controles[0].f)) ecrits.push(controles[0].f);
|
|
900
|
+
}
|
|
762
901
|
const tests = testsSansVariable(racine);
|
|
763
902
|
if (tests) {
|
|
764
903
|
const abs = path.join(racine, tests.f);
|
|
@@ -929,6 +1068,7 @@ function racineRefusee(racine) {
|
|
|
929
1068
|
export function verifier(racine) {
|
|
930
1069
|
const refus = [
|
|
931
1070
|
...racineRefusee(racine),
|
|
1071
|
+
...controlesDeRacineRefuses(racine),
|
|
932
1072
|
...declarationsRefusees(racine),
|
|
933
1073
|
...configsMatiereRefusees(racine),
|
|
934
1074
|
];
|
|
@@ -946,6 +1086,11 @@ export function verifier(racine) {
|
|
|
946
1086
|
: `⛔ ${typage.f} : la tâche \`${TYPAGE}\` manque, le typage de chaque paquet que \`npm run verifier\` joue ; \`${COMMANDE}\` l'ajoute.`
|
|
947
1087
|
);
|
|
948
1088
|
}
|
|
1089
|
+
for (const { f, cle } of controlesAbsents(racine)) {
|
|
1090
|
+
refus.push(
|
|
1091
|
+
`⛔ ${f} : la tâche \`${cle}\` manque, le contrôle de la racine que \`npm run verifier\` joue ; \`${COMMANDE}\` l'ajoute.`
|
|
1092
|
+
);
|
|
1093
|
+
}
|
|
949
1094
|
const tests = testsSansVariable(racine);
|
|
950
1095
|
if (tests) {
|
|
951
1096
|
refus.push(
|
|
@@ -955,7 +1100,7 @@ export function verifier(racine) {
|
|
|
955
1100
|
const passage = passagesManquants(racine);
|
|
956
1101
|
for (const v of passage?.manques ?? []) {
|
|
957
1102
|
refus.push(
|
|
958
|
-
`⛔ ${passage.f} : \`globalPassThroughEnv\` doit nommer ${v}, ${POURQUOI[v]} ; \`${COMMANDE}\` l'ajoute.`
|
|
1103
|
+
`⛔ ${passage.f} : \`globalPassThroughEnv\` doit nommer ${v}, ${POURQUOI[v] ?? (variablesDeDonnees(racine).includes(v) ? "la donnée d'un paquet (`grillhouse.donnees`) que ses tests exigent" : "l'outil du projet (`grillhouse.outils`) que ses tests exigent")} ; \`${COMMANDE}\` l'ajoute.`
|
|
959
1104
|
);
|
|
960
1105
|
}
|
|
961
1106
|
for (const { cle, attendu, present } of gardesEcartees(racine)?.ecarts ?? []) {
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
} from 'node:fs';
|
|
22
22
|
import path from 'node:path';
|
|
23
23
|
import { RESULTATS } from '../../resultats.mjs';
|
|
24
|
-
import { SCRIPT_DES_TESTS } from '
|
|
24
|
+
import { SCRIPT_DES_TESTS } from '../../services-du-noyau.mjs';
|
|
25
25
|
import { VITEST } from './vitest-config/resultats.mjs';
|
|
26
26
|
|
|
27
27
|
const TURBO = 'turbo';
|
|
@@ -16,7 +16,11 @@
|
|
|
16
16
|
// and so do the builds. The changes reach Vitest in a variable no hash counts
|
|
17
17
|
// (`GRILLHOUSE_CHANGEMENTS`). Without a last green that counts, the pass is complete. The
|
|
18
18
|
// line `↳` says which. A pass green, restricted by no filter, keeps its tree as the last green;
|
|
19
|
-
// a red one keeps the last green as it was.
|
|
19
|
+
// a red one keeps the last green as it was. The pass is the one that keeps it, for every language
|
|
20
|
+
// of the project: it plays the tasks of every package of the graph, a crate's and a Python
|
|
21
|
+
// project's beside a TypeScript package's (their `test:unit` and `typecheck`, scripts of their
|
|
22
|
+
// package.json), so it is green only when every task of every language is, and no module of
|
|
23
|
+
// language keeps a green of its own (scripts/dernier-vert.mjs).
|
|
20
24
|
// - `--tout`, and `--force` (the night, scripts/nuit.sh), play the complete pass: no measure
|
|
21
25
|
// against the last green, and each task of tests played for real (the variable of the tests
|
|
22
26
|
// carries the moment of the pass, `rejouer`, which no cached run holds).
|
|
@@ -43,8 +47,15 @@
|
|
|
43
47
|
// its patterns and the benchmarks of Chromium and rustc-perf leave the CI of each commit for a
|
|
44
48
|
// machine at rest. The day waits for no rest: a delay past is a red (the duration reporter
|
|
45
49
|
// classifies a delay of a day test as a real red), and so is a task at 75.
|
|
46
|
-
// -
|
|
47
|
-
//
|
|
50
|
+
// - The pass plays too the format check and the lint (grillhouse-61z, grillhouse-44b.9), per
|
|
51
|
+
// package: the scripts `format:check` and `lint` of each package that holds them, as its tasks
|
|
52
|
+
// (`<package>#format:check`, `<package>#lint`), and the root's for its own files only, as root
|
|
53
|
+
// tasks (`//#format:check`, `//#lint`), under the same `--continue`: a red lint hides no red
|
|
54
|
+
// test, each red is named with its package. The CI calls the pass alone.
|
|
55
|
+
// - `--gardes` plays the tasks of guards and these two controls alone, `turbo run grillhouse:gardes
|
|
56
|
+
// gardes format:check lint …`, the repository whole (ESLint and Prettier have no notion of a lot;
|
|
57
|
+
// their cache reads again what changed), with the same verdict: what the reviewer plays on the
|
|
58
|
+
// ticket's copy, the tests aside.
|
|
48
59
|
// - The verdict reads the exit code of each task in the summary of each run
|
|
49
60
|
// (`.turbo/runs/<id>.json`), since Turborepo exits with the greatest code of its tasks (a 75
|
|
50
61
|
// would hide a 1). The summary each run writes is removed, and `.turbo/runs` with it when the
|
|
@@ -80,7 +91,7 @@ import { pathToFileURL } from 'node:url';
|
|
|
80
91
|
import {
|
|
81
92
|
AttenteDeLaMachine,
|
|
82
93
|
AVANCEMENT,
|
|
83
|
-
|
|
94
|
+
avecLaMachineEtUnePlace,
|
|
84
95
|
CHANGEMENTS,
|
|
85
96
|
garderLeTotal,
|
|
86
97
|
garderLeVert,
|
|
@@ -88,13 +99,15 @@ import {
|
|
|
88
99
|
nommerLAvancement,
|
|
89
100
|
ouvrirAvancement,
|
|
90
101
|
ouvrirBase,
|
|
102
|
+
PASSE_ROUGE,
|
|
91
103
|
retirerALInterruption,
|
|
104
|
+
SCRIPT_DES_TESTS,
|
|
105
|
+
TESTS_CIBLES,
|
|
106
|
+
testsCibles,
|
|
92
107
|
} from '../../services-du-noyau.mjs';
|
|
93
108
|
import { paquets, TYPAGE } from '../../paquets.mjs';
|
|
94
|
-
import { planifier } from './turbo-des-paquets.mjs';
|
|
95
|
-
import { SCRIPT_DES_TESTS } from './script-des-tests.mjs';
|
|
109
|
+
import { controlesDuDepot, planifier } from './turbo-des-paquets.mjs';
|
|
96
110
|
import { garderLesResumes } from './verdict.mjs';
|
|
97
|
-
import { VARIABLE as TESTS_CIBLES } from './vitest-config/cibles.mjs';
|
|
98
111
|
|
|
99
112
|
const GARDES = ['grillhouse:gardes', 'gardes'];
|
|
100
113
|
const TACHES = [...GARDES, TYPAGE, SCRIPT_DES_TESTS];
|
|
@@ -128,7 +141,7 @@ export function verifier({
|
|
|
128
141
|
const base = ouvrirBase('verification', { dans: env.TMPDIR || tmpdir() });
|
|
129
142
|
const lacher = retirerALInterruption(base.fermer);
|
|
130
143
|
try {
|
|
131
|
-
return
|
|
144
|
+
return avecLaMachineEtUnePlace(
|
|
132
145
|
envMachine => {
|
|
133
146
|
// The progress of the pass: the directory its caller names (the circuit's), else its own,
|
|
134
147
|
// named beside the lock of the machine, which it holds, while it plays.
|
|
@@ -147,7 +160,7 @@ export function verifier({
|
|
|
147
160
|
} finally {
|
|
148
161
|
effacer();
|
|
149
162
|
if (propre) {
|
|
150
|
-
garderLeTotal(dossier
|
|
163
|
+
garderLeTotal(dossier);
|
|
151
164
|
rmSync(dossier, { recursive: true, force: true });
|
|
152
165
|
}
|
|
153
166
|
}
|
|
@@ -184,6 +197,12 @@ function depotAvecTests(racine) {
|
|
|
184
197
|
// Whether <args> hold a filter of Turborepo (`--filter=<f>`, `--filter <f>`, `-F <f>`).
|
|
185
198
|
const filtre = args => args.some(a => a.startsWith('--filter=') || a === '--filter' || a === '-F');
|
|
186
199
|
|
|
200
|
+
// A pass green on every package keeps its tree as the last green (`garder`): not when it is
|
|
201
|
+
// restricted by a filter, measured against nothing, or run after a red module (PASSE_ROUGE).
|
|
202
|
+
export function poserLeVert({ code, etat, args, env, garder }) {
|
|
203
|
+
if (code === 0 && etat && !filtre(args) && !env[PASSE_ROUGE]) garder(etat);
|
|
204
|
+
}
|
|
205
|
+
|
|
187
206
|
function passe({ racine, demandes, env, dire, coeurs }) {
|
|
188
207
|
const gardesSeules = demandes.includes('--gardes');
|
|
189
208
|
const tout = demandes.includes('--tout') || demandes.includes('--force');
|
|
@@ -207,7 +226,7 @@ function passe({ racine, demandes, env, dire, coeurs }) {
|
|
|
207
226
|
if (env[ROUGES])
|
|
208
227
|
writeFileSync(env[ROUGES], [...taches].map(t => `${t}\t${rejeu(t)}\n`).join(''));
|
|
209
228
|
// A pass green on every package keeps its tree as the last green.
|
|
210
|
-
|
|
229
|
+
poserLeVert({ code, etat: m?.etat, args, env, garder: garderLeVert });
|
|
211
230
|
return code;
|
|
212
231
|
} finally {
|
|
213
232
|
m?.retirer();
|
|
@@ -224,12 +243,13 @@ function jouerLaPasse({ racine, gardesSeules, args, tout, ajouts, env, dire, coe
|
|
|
224
243
|
...propre,
|
|
225
244
|
...ajouts,
|
|
226
245
|
...(tout
|
|
227
|
-
? { [TESTS_CIBLES]: JSON.stringify({ arguments: [],
|
|
246
|
+
? { [TESTS_CIBLES]: JSON.stringify(testsCibles({ arguments: [], force: true })) }
|
|
228
247
|
: {}),
|
|
229
248
|
};
|
|
230
249
|
const borne = args.some(a => CONCURRENCE.test(a)) ? [] : [`--concurrency=${concurrence(coeurs)}`];
|
|
231
250
|
const a = [
|
|
232
251
|
...(gardesSeules ? GARDES : TACHES),
|
|
252
|
+
...controlesDuDepot(racine),
|
|
233
253
|
'--continue=dependencies-successful',
|
|
234
254
|
...borne,
|
|
235
255
|
...args,
|
|
@@ -27,6 +27,10 @@
|
|
|
27
27
|
// tests Vitest relates to the files changed since it (`GRILLHOUSE_CHANGEMENTS`,
|
|
28
28
|
// ./changements.mjs). `mergeConfig` adds the plugins of a configuration that extends this one to
|
|
29
29
|
// it.
|
|
30
|
+
// - A test has the delay of its size, as in Bazel (the delays are in ./bornes.mjs), the size read
|
|
31
|
+
// by the classification of the guard of the sizes, one address (./delais.mjs, applied to each
|
|
32
|
+
// test file by ./delais.setup.mjs). `slowTestThreshold` marks the slow tests, and the duration
|
|
33
|
+
// reporter names the 20 slowest files and their share of the time.
|
|
30
34
|
// - The common environment: Node, no watch, and git's settings for the tests by the environment
|
|
31
35
|
// (GIT_CONFIG_COUNT/KEY/VALUE, git-config(1)), the automatic maintenance and garbage collection
|
|
32
36
|
// off (maintenance.auto=false, gc.auto=0). This file is the one address of these settings; the
|
|
@@ -62,7 +66,12 @@
|
|
|
62
66
|
// task at each test file done, which the board reads (scripts/avancement.mjs,
|
|
63
67
|
// scripts/tableau.mjs).
|
|
64
68
|
import { fileURLToPath } from 'node:url';
|
|
65
|
-
import {
|
|
69
|
+
import {
|
|
70
|
+
ligneDesRestes,
|
|
71
|
+
ouvrirBase,
|
|
72
|
+
retirerALInterruption,
|
|
73
|
+
travailleursDeLaSeance,
|
|
74
|
+
} from '../../../services-du-noyau.mjs';
|
|
66
75
|
import { ciblage, HORS_DU_JOUR } from './cibles.mjs';
|
|
67
76
|
import { rapportAvancement } from './avancement.reporter.mjs';
|
|
68
77
|
import { rapportJson } from './resultats.mjs';
|
|
@@ -130,11 +139,23 @@ export default {
|
|
|
130
139
|
},
|
|
131
140
|
exclude: ['**/node_modules/**', '**/dist/**', ...HORS_DU_JOUR],
|
|
132
141
|
reporters: ['default', ici('./duree.reporter.mjs'), ...rapportJson(), ...rapportAvancement()],
|
|
142
|
+
// The slow-test mark of the report, in ms: Vitest's default, fixed, apart from the delays.
|
|
143
|
+
slowTestThreshold: 300,
|
|
133
144
|
setupFiles: [
|
|
145
|
+
ici('./delais.setup.mjs'),
|
|
134
146
|
ici('./mesure.setup.mjs'),
|
|
135
147
|
ici('./machine.setup.mjs'),
|
|
136
148
|
ici('./resultats.setup.mjs'),
|
|
137
149
|
],
|
|
138
150
|
watch: false,
|
|
151
|
+
...travailleurs(),
|
|
139
152
|
},
|
|
140
153
|
};
|
|
154
|
+
|
|
155
|
+
// The workers of a session of an agent: `maxWorkers` of Vitest is GRILLHOUSE_TRAVAILLEURS
|
|
156
|
+
// (max(1, cores ÷ places), scripts/places-de-la-machine.mjs); without it (a heavy pass), Vitest's
|
|
157
|
+
// own default stands: every core.
|
|
158
|
+
function travailleurs() {
|
|
159
|
+
const n = travailleursDeLaSeance(process.env);
|
|
160
|
+
return n === null ? {} : { maxWorkers: n };
|
|
161
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// The delays of the sizes of test, in ms, on the model of Bazel's test-encyclopedia: small, medium,
|
|
2
|
+
// large. A module of its own, with no import: the configurations of Vitest (./base.mjs,
|
|
3
|
+
// ../vitest.nuit.config.mjs) are bundled by Vite and read only these numbers, while the
|
|
4
|
+
// classification that deduces a file's size (./delais.mjs) reads the guard of the sizes, a script.
|
|
5
|
+
|
|
6
|
+
/** The delay of each size, in ms (Bazel: small 60 s, medium 300 s, large 900 s). */
|
|
7
|
+
export const DELAIS_MS = { petit: 60000, moyen: 300000, grand: 900000 };
|
|
8
|
+
|
|
9
|
+
/** The delay of a night test, in ms: the large delay. */
|
|
10
|
+
export const DELAI_NUIT_MS = DELAIS_MS.grand;
|
|
11
|
+
|
|
12
|
+
/** The delay of a size as a line writes it: « petit, 60 s ». */
|
|
13
|
+
export const libelleDuDelai = taille => `${taille}, ${DELAIS_MS[taille] / 1000} s`;
|
|
@@ -27,7 +27,9 @@
|
|
|
27
27
|
// the plugin excludes the witnesses found under the configuration's directory
|
|
28
28
|
// (`fichiersTemoins`, node_modules, dist, .git, .turbo and .claude left out), with or without
|
|
29
29
|
// the variable.
|
|
30
|
-
// - A night test
|
|
30
|
+
// - A night test named is refused, named, and nothing plays: the night alone plays it
|
|
31
|
+
// (./tests-de-nuit.mjs).
|
|
32
|
+
// - A bench or a witness plays when its own file is named, as Bazel's target tagged
|
|
31
33
|
// `manual` builds when named: the day's exclusions lift for that file, the include of the
|
|
32
34
|
// configuration notwithstanding, and the measure of time of the base configuration applies, its
|
|
33
35
|
// duration reporter giving 75, « à repasser », to a measure that fails under load. A directory
|
|
@@ -43,13 +45,13 @@
|
|
|
43
45
|
// files played to those Vitest relates to them, the files named themselves kept, or leave every
|
|
44
46
|
// test when a change lies out of Vitest's graph.
|
|
45
47
|
//
|
|
46
|
-
// This module's top level uses Node alone: scripts/langages/typescript/tests.mjs reads its VARIABLE.
|
|
47
48
|
import { globSync, readdirSync, readFileSync, statSync } from 'node:fs';
|
|
48
49
|
import path from 'node:path';
|
|
49
|
-
import { CHANGEMENTS } from '../../../services-du-noyau.mjs';
|
|
50
|
+
import { CHANGEMENTS, TESTS_CIBLES } from '../../../services-du-noyau.mjs';
|
|
50
51
|
import { lireChangements, restreindre } from './changements.mjs';
|
|
51
52
|
|
|
52
|
-
|
|
53
|
+
// The name of the variable is the core's (`TESTS_CIBLES`); this module reads it under its own name.
|
|
54
|
+
export const VARIABLE = TESTS_CIBLES;
|
|
53
55
|
// The day's exclusions, which the base configuration (./base.mjs) sets and the night plays
|
|
54
56
|
// (scripts/langages/typescript/vitest.nuit.config.mjs): the night tests, too long for the day, and the time budget
|
|
55
57
|
// benches, whose measures move with the load of the day.
|
|
@@ -58,8 +60,17 @@ export const BUDGET = '**/*.budget.{test,spec}.?(c|m)[jt]s?(x)';
|
|
|
58
60
|
export const HORS_DU_JOUR = [NUIT, BUDGET];
|
|
59
61
|
/** The variable that chooses the tests of a run of the night's configuration: `nuit` or `mesures`. */
|
|
60
62
|
export const NUIT_VARIABLE = 'GRILLHOUSE_TESTS_DE_NUIT';
|
|
61
|
-
// Whether
|
|
62
|
-
|
|
63
|
+
// Whether the file at <fichier> bears the name of <motif>, a globstar then a name: by the name of
|
|
64
|
+
// the file, since a globstar passes no directory whose name starts with a dot, and a ticket's copy
|
|
65
|
+
// lives under `.claude/worktrees/`.
|
|
66
|
+
const parSonNom = (fichier, motif) =>
|
|
67
|
+
path.matchesGlob(path.basename(fichier), motif.replace(/^\*\*\//, ''));
|
|
68
|
+
/** Whether the file at <fichier> is a night test, by its name: the one rule of the frame. */
|
|
69
|
+
export const estUnTestDeNuit = fichier => parSonNom(fichier, NUIT);
|
|
70
|
+
/** Whether the file at <fichier> is a time budget bench, by its name. */
|
|
71
|
+
export const estUnBanc = fichier => parSonNom(fichier, BUDGET);
|
|
72
|
+
/** Whether the file at <fichier> is a night test or a time budget bench, by its name. */
|
|
73
|
+
export const deNuitOuBanc = fichier => HORS_DU_JOUR.some(p => parSonNom(fichier, p));
|
|
63
74
|
// Vitest's default `include` (its configDefaults).
|
|
64
75
|
const INCLUDE = ['**/*.{test,spec}.?(c|m)[jt]s?(x)'];
|
|
65
76
|
// The mark of a time witness: the import of `mesurerAuRepos`, on a line of its own, from the
|
|
@@ -78,11 +89,10 @@ const lireTexte = f => {
|
|
|
78
89
|
|
|
79
90
|
/**
|
|
80
91
|
* Whether the test file at <fichier> is out of the day: a night test, a time budget bench or a
|
|
81
|
-
* time witness.
|
|
92
|
+
* time witness; the night and the bench by its name (`deNuitOuBanc`).
|
|
82
93
|
* @param {string} fichier the path of the file
|
|
83
94
|
*/
|
|
84
|
-
export const estHorsDuJour = fichier =>
|
|
85
|
-
HORS_DU_JOUR.some(p => path.matchesGlob(fichier, p)) || estTemoin(lireTexte(fichier));
|
|
95
|
+
export const estHorsDuJour = fichier => deNuitOuBanc(fichier) || estTemoin(lireTexte(fichier));
|
|
86
96
|
// The directories a search of the witnesses leaves out.
|
|
87
97
|
const HORS_TEMOINS = new Set(['node_modules', 'dist', '.git', '.turbo', '.claude']);
|
|
88
98
|
|
|
@@ -97,7 +107,7 @@ export function fichiersTemoins(dir, include = INCLUDE) {
|
|
|
97
107
|
)
|
|
98
108
|
),
|
|
99
109
|
]
|
|
100
|
-
.filter(f => !
|
|
110
|
+
.filter(f => !deNuitOuBanc(f) && estTemoin(lire(f)))
|
|
101
111
|
.sort();
|
|
102
112
|
}
|
|
103
113
|
// The directories a walk under a named directory leaves out, whose files no test configuration
|
|
@@ -182,25 +192,37 @@ async function cibler(config, test, valeur, temoins) {
|
|
|
182
192
|
const dir = path.resolve(config.root ?? process.cwd(), test.dir ?? '');
|
|
183
193
|
const include = test.include ?? INCLUDE;
|
|
184
194
|
const chemins = filter.map(f => path.resolve(f.replace(/[\\/]+$/, '')));
|
|
195
|
+
const relatif = f => path.relative(dir, f).split(path.sep).join('/');
|
|
185
196
|
// The files named themselves, not through a directory.
|
|
186
197
|
const seuls = new Set(chemins.filter(f => fichiers(f)[0] === f));
|
|
198
|
+
// A night test plays at night alone (./tests-de-nuit.mjs): a targeted run refuses it, named.
|
|
199
|
+
const deNuit = [...seuls].filter(estUnTestDeNuit);
|
|
200
|
+
if (deNuit.length) {
|
|
201
|
+
throw new Error(
|
|
202
|
+
deNuit
|
|
203
|
+
.map(
|
|
204
|
+
f =>
|
|
205
|
+
`⛔ ${relatif(f)} : un test de nuit se joue la nuit seulement (npx grillhouse nuit le joue)`
|
|
206
|
+
)
|
|
207
|
+
.join('\n')
|
|
208
|
+
);
|
|
209
|
+
}
|
|
187
210
|
nommes = [...seuls];
|
|
188
|
-
const relatif = f => path.relative(dir, f).split(path.sep).join('/');
|
|
189
211
|
const joues = [...new Set(chemins.flatMap(fichiers))]
|
|
190
212
|
.filter(f => {
|
|
191
213
|
const r = relatif(f);
|
|
192
214
|
if (r.startsWith('../')) {
|
|
193
215
|
return false;
|
|
194
216
|
}
|
|
195
|
-
return
|
|
217
|
+
return deNuitOuBanc(r) || temoins.has(r.replace(SPECIAUX, '\\$&'))
|
|
196
218
|
? seuls.has(f)
|
|
197
219
|
: include.some(p => path.matchesGlob(r, p));
|
|
198
220
|
})
|
|
199
221
|
.map(relatif)
|
|
200
222
|
.sort();
|
|
201
|
-
// A bench
|
|
223
|
+
// A bench named itself plays: the day's exclusions lift, and the
|
|
202
224
|
// files under a directory named stay out by the filter above (a witness, by the plugin).
|
|
203
|
-
if (joues.some(
|
|
225
|
+
if (joues.some(deNuitOuBanc) && Array.isArray(test.exclude)) {
|
|
204
226
|
test.exclude = test.exclude.filter(p => !HORS_DU_JOUR.includes(p));
|
|
205
227
|
}
|
|
206
228
|
// No file named: a pattern that matches none, Vitest's « No test files found ».
|