@roomi-fields/grillhouse 0.28.3 → 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 +128 -26
- package/cadre/templates/projet/.github/workflows/ci.yml +2 -13
- package/cadre/templates/projet/CLAUDE.md +5 -1
- package/cadre/templates/projet/README.md +11 -11
- package/cadre/templates/projet/_gitignore +2 -5
- package/cadre/templates/projet/docs/agents/issue-tracker.md +1 -1
- package/cadre/templates/projet/package.json +2 -2
- package/charte.md +37 -4
- 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 +813 -53
- package/docs/CADRE.md +17 -0
- package/docs/INTERFACE.md +161 -30
- 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 +328 -0
- package/scripts/avancement.mjs +159 -64
- package/scripts/bilan.mjs +37 -19
- package/scripts/cadre.mjs +11 -2
- package/scripts/circuit.mjs +888 -3654
- 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 +30 -11
- package/scripts/conformite.mjs +19 -10
- package/scripts/copies-finies.mjs +188 -42
- 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 +27 -32
- package/scripts/enveloppe/paquets-du-plan.mjs +2 -2
- package/scripts/enveloppe/travail-de-la-copie.mjs +99 -12
- package/scripts/etapes.mjs +6 -3
- 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/fusion-du-changelog.mjs +0 -1
- package/scripts/gardes-du-cadre.mjs +12 -2
- package/scripts/grillhouse-maj.mjs +16 -7
- package/scripts/integration/file.mjs +477 -422
- package/scripts/integration/integrer.mjs +20 -22
- package/scripts/integration/rejeu.mjs +19 -4
- package/scripts/jointure.d.ts +168 -28
- package/scripts/langages/cargo/commandes.mjs +426 -119
- package/scripts/langages/cargo/composants.mjs +187 -3
- package/scripts/langages/cargo/exemples.mjs +75 -17
- package/scripts/langages/cargo/index.mjs +32 -13
- package/scripts/langages/cargo/migrations/0.28.4-tailles-des-tests.mjs +35 -0
- package/scripts/langages/cargo/sccache.mjs +62 -16
- package/scripts/langages/cargo/squelette.mjs +72 -3
- package/scripts/langages/cargo/tailles-des-tests.mjs +195 -0
- package/scripts/langages/cargo/tests-de-head.mjs +159 -0
- package/scripts/langages/python/commandes.mjs +232 -79
- package/scripts/langages/python/composants.mjs +65 -3
- package/scripts/langages/python/exemples.mjs +21 -12
- package/scripts/langages/python/index.mjs +25 -5
- package/scripts/langages/python/lot.mjs +1 -36
- package/scripts/langages/python/squelette.mjs +119 -17
- package/scripts/langages/typescript/construire.mjs +6 -163
- package/scripts/langages/typescript/exemples.mjs +19 -11
- package/scripts/langages/typescript/frontieres.mjs +1 -1
- package/scripts/langages/typescript/index.mjs +48 -63
- 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/regle-des-tests.mjs +13 -0
- package/scripts/langages/typescript/squelette.mjs +18 -2
- package/scripts/langages/typescript/tailles-des-tests.mjs +40 -9
- package/scripts/langages/typescript/tests-de-nuit.mjs +44 -21
- 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 +110 -296
- package/scripts/langages/typescript/vitest-config/base.mjs +30 -10
- package/scripts/langages/typescript/vitest-config/bornes.mjs +13 -0
- package/scripts/langages/typescript/vitest-config/cibles.mjs +123 -62
- 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 +56 -64
- package/scripts/langages/typescript/vitest-config/machine.setup.mjs +7 -2
- package/scripts/langages/typescript/vitest-config/mesure.mjs +3 -2
- package/scripts/langages/typescript/vitest.nuit.config.mjs +22 -13
- package/scripts/lecture-unique.mjs +51 -0
- package/scripts/mesure/pression.mjs +11 -9
- 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 +29 -15
- package/scripts/outil.mjs +72 -0
- 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 +112 -14
- 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 +29 -14
- 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 +28 -11
- package/scripts/session-start.sh +10 -1
- package/scripts/sortie.mjs +23 -4
- package/scripts/sources.mjs +3 -3
- package/scripts/sous-commandes.mjs +39 -9
- package/scripts/style-a-l-ecriture.mjs +229 -0
- package/scripts/superviseur.mjs +382 -16
- package/scripts/tableau.mjs +329 -130
- 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 +322 -62
- package/skills/developpeur/SKILL.md +11 -3
- package/skills/explorateur/SKILL.md +2 -1
- package/skills/pitmaster/SKILL.md +62 -28
- package/skills/pitmaster/references/consigne-agent.md +5 -1
- package/skills/release/SKILL.md +3 -3
- package/skills/relecteur/SKILL.md +22 -8
- package/skills/testwriter/SKILL.md +47 -39
- package/scripts/demon.mjs +0 -138
- 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';
|