@roomi-fields/grillhouse 0.29.0 → 0.31.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 +769 -0
- package/agents/developpeur.md +0 -1
- package/agents/explorateur.md +0 -1
- package/agents/questionneur.md +0 -1
- package/agents/testwriter.md +0 -1
- 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 +30 -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 +94 -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 +120 -0
- package/dist/temporal/installation.js +386 -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 +646 -87
- package/docs/CADRE.md +27 -0
- package/docs/INTERFACE.md +139 -42
- package/hooks/crochet.mjs +19 -2
- package/hooks/hooks.json +11 -0
- package/package.json +16 -4
- package/scripts/activites.mjs +2255 -0
- package/scripts/aiguillage.d.mts +37 -0
- package/scripts/aiguillage.mjs +40 -14
- package/scripts/avancement.mjs +155 -26
- package/scripts/bilan.mjs +137 -43
- package/scripts/cadre.mjs +16 -4
- package/scripts/circuit.mjs +993 -4075
- 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/composants-affectes.mjs +64 -21
- package/scripts/composition-des-langages.mjs +18 -12
- package/scripts/conformite.mjs +56 -28
- 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 +121 -0
- package/scripts/dernier-vert.mjs +61 -34
- package/scripts/dette.mjs +32 -11
- package/scripts/donnees-cles.mjs +244 -0
- package/scripts/droits.mjs +51 -16
- package/scripts/effets.mjs +352 -0
- package/scripts/empreinte-d-etape.mjs +17 -0
- package/scripts/engendres.mjs +15 -5
- package/scripts/enveloppe/enveloppe.mjs +259 -55
- package/scripts/enveloppe/lancer.sh +14 -18
- package/scripts/enveloppe/paquets-du-plan.mjs +2 -2
- package/scripts/enveloppe/travail-de-la-copie.mjs +41 -13
- 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 +201 -0
- package/scripts/gardes-du-cadre.mjs +21 -5
- package/scripts/init.mjs +11 -4
- package/scripts/integration/file.mjs +544 -434
- package/scripts/integration/integrer.mjs +87 -43
- package/scripts/integration/rejeu.mjs +45 -13
- package/scripts/jointure.d.ts +151 -28
- package/scripts/langages/cargo/commandes.mjs +383 -124
- package/scripts/langages/cargo/composants.mjs +154 -42
- package/scripts/langages/cargo/exemples.mjs +12 -21
- package/scripts/langages/cargo/index.mjs +22 -8
- package/scripts/langages/cargo/sccache.mjs +8 -14
- package/scripts/langages/cargo/tests-de-head.mjs +25 -9
- package/scripts/langages/python/commandes.mjs +218 -100
- package/scripts/langages/python/composants.mjs +53 -21
- package/scripts/langages/python/exemples.mjs +6 -16
- package/scripts/langages/python/index.mjs +28 -8
- package/scripts/langages/python/lot.mjs +1 -36
- package/scripts/langages/typescript/chemins-des-tests.mjs +6 -2
- package/scripts/langages/typescript/composants.mjs +9 -3
- package/scripts/langages/typescript/consommateurs-arbitres.mjs +40 -14
- package/scripts/langages/typescript/consommateurs.mjs +39 -14
- package/scripts/langages/typescript/construire.mjs +6 -163
- package/scripts/langages/typescript/elements-du-lot.mjs +36 -12
- package/scripts/langages/typescript/exemples.mjs +3 -11
- package/scripts/langages/typescript/frontieres.mjs +66 -22
- package/scripts/langages/typescript/index-interfaces.mjs +36 -13
- package/scripts/langages/typescript/index.mjs +50 -61
- package/scripts/langages/typescript/interfaces-contre-code.mjs +113 -45
- package/scripts/langages/typescript/lecteurs.mjs +36 -11
- package/scripts/langages/typescript/migrations/0.23.0-config-vitest.mjs +15 -5
- package/scripts/langages/typescript/migrations/0.25.0-chemins-des-tests.mjs +6 -2
- package/scripts/langages/typescript/migrations/0.25.0-tailles-des-tests.mjs +6 -2
- 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 +33 -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/parcours.mjs +12 -4
- package/scripts/langages/typescript/regle-des-tests.mjs +9 -3
- package/scripts/langages/typescript/resumes.mjs +9 -3
- package/scripts/langages/typescript/tailles-des-tests.mjs +93 -20
- package/scripts/langages/typescript/tests-de-nuit.mjs +15 -10
- package/scripts/langages/typescript/tests.mjs +40 -15
- package/scripts/langages/typescript/titres-de-tests.mjs +320 -0
- package/scripts/langages/typescript/turbo-des-paquets.mjs +327 -81
- package/scripts/langages/typescript/verdict.mjs +4 -2
- package/scripts/langages/typescript/verifier.mjs +58 -20
- package/scripts/langages/typescript/vitest-config/avancement.reporter.mjs +15 -5
- package/scripts/langages/typescript/vitest-config/base.mjs +29 -3
- package/scripts/langages/typescript/vitest-config/bornes.mjs +13 -0
- package/scripts/langages/typescript/vitest-config/changements.mjs +21 -8
- package/scripts/langages/typescript/vitest-config/cibles.mjs +36 -14
- package/scripts/langages/typescript/vitest-config/delais.mjs +60 -0
- package/scripts/langages/typescript/vitest-config/delais.setup.mjs +11 -0
- package/scripts/langages/typescript/vitest-config/duree.classement.mjs +108 -0
- package/scripts/langages/typescript/vitest-config/duree.reporter.mjs +56 -59
- package/scripts/langages/typescript/vitest-config/lances.mjs +83 -27
- package/scripts/langages/typescript/vitest-config/machine.setup.mjs +10 -0
- package/scripts/langages/typescript/vitest-config/resultats.mjs +3 -1
- package/scripts/langages/typescript/vitest.nuit.config.mjs +4 -0
- package/scripts/lint-des-scripts.mjs +58 -0
- package/scripts/mesure/base-de-passe.mjs +117 -25
- package/scripts/mesure/pression.mjs +12 -6
- package/scripts/mesure-de-la-machine.d.mts +21 -0
- package/scripts/mesure-de-la-machine.mjs +76 -0
- package/scripts/migrations/0.23.0-charte-importee.mjs +6 -2
- package/scripts/migrations/0.23.0-crochets-de-seance.mjs +25 -8
- package/scripts/migrations/0.23.0-marche-du-projet.mjs +18 -6
- package/scripts/migrations/0.23.2-copies-du-cadre.mjs +56 -18
- package/scripts/migrations/0.24.12-tri-des-decouvertes.mjs +6 -2
- package/scripts/migrations/0.25.0-script-des-tests.mjs +15 -5
- package/scripts/migrations/0.30.0-ci-appelle-la-verification.mjs +124 -0
- package/scripts/migrations/0.31.0-paquets-dans-le-graphe.mjs +81 -0
- package/scripts/migrations.mjs +5 -0
- package/scripts/nuit.sh +25 -3
- package/scripts/outil.mjs +3 -1
- package/scripts/outils-cles.d.mts +24 -0
- package/scripts/outils-cles.mjs +18 -8
- package/scripts/paquet-npm.mjs +157 -0
- package/scripts/paquet.mjs +73 -4
- package/scripts/paquets.mjs +46 -10
- package/scripts/passe-de-la-machine.mjs +71 -0
- package/scripts/places-de-la-machine.mjs +414 -0
- package/scripts/places-du-serveur.mjs +170 -0
- package/scripts/prefixe-des-tickets.mjs +68 -0
- package/scripts/preparation.mjs +25 -8
- package/scripts/registre.mjs +9 -4
- 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/reprise.mjs +66 -0
- package/scripts/resultats.mjs +112 -46
- 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 +936 -0
- package/scripts/services-du-noyau.mjs +27 -8
- package/scripts/session-start.sh +2 -2
- package/scripts/sortie.mjs +3 -3
- package/scripts/sous-commandes.mjs +41 -10
- package/scripts/style-a-l-ecriture.mjs +260 -0
- package/scripts/superviseur.mjs +122 -111
- package/scripts/tableau.mjs +180 -117
- package/scripts/taches-du-graphe.mjs +348 -0
- package/scripts/ticket-du-circuit.mjs +216 -0
- package/scripts/transitions.d.mts +148 -0
- package/scripts/transitions.mjs +1018 -0
- package/scripts/verrou-de-fichier.mjs +8 -4
- package/scripts/verrou-de-machine.mjs +150 -51
- package/scripts/verrous/commande.mjs +50 -17
- package/scripts/verrous/ticket-du-sous-agent.mjs +9 -3
- package/scripts/verrous/verrou.mjs +42 -14
- package/skills/explorateur/SKILL.md +9 -2
- package/skills/grill/SKILL.md +1 -1
- package/skills/mesure/SKILL.md +3 -0
- 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 +5 -3
- package/skills/testwriter/SKILL.md +49 -31
- 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,105 @@ 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) {
|
|
221
|
+
return [];
|
|
222
|
+
}
|
|
223
|
+
const liste = paquets(racine);
|
|
224
|
+
const prefixe = liste.length ? '//#' : '';
|
|
225
|
+
// Format and lint play per package (Turborepo's advice: each red carries its package, the cache
|
|
226
|
+
// replays the changed packages only): the task of a package's script, none for the root's.
|
|
227
|
+
const deLaRacine = controlesDeRacine(racine).map(c => `${prefixe}${c}`);
|
|
228
|
+
const desPaquets = CONTROLES.filter(c =>
|
|
229
|
+
liste.some(({ pkg, hors }) => !hors && typeof pkg.scripts?.[c] === 'string')
|
|
230
|
+
);
|
|
231
|
+
return [...deLaRacine, ...desPaquets]
|
|
232
|
+
.filter(cle => !r.conf.tasks?.[cle])
|
|
233
|
+
.map(cle => ({ f: r.f, cle }));
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
// The tokens of a root script that name a file or a folder: the arguments that are no flag nor the
|
|
237
|
+
// value of one.
|
|
238
|
+
function cheminsDuScript(script) {
|
|
239
|
+
const mots = (String(script).match(/"[^"]*"|'[^']*'|\S+/g) ?? []).map(m =>
|
|
240
|
+
m.replace(/^(["'])(.*)\1$/, '$2')
|
|
241
|
+
);
|
|
242
|
+
const chemins = [];
|
|
243
|
+
for (let i = 1; i < mots.length; i++) {
|
|
244
|
+
const m = mots[i];
|
|
245
|
+
if (['--cache-location', '--ext', '--config', '--ignore-path', '-c'].includes(m)) {
|
|
246
|
+
i++;
|
|
247
|
+
} else if (!m.startsWith('-') && !['&&', '||', ';', '|'].includes(m)) {
|
|
248
|
+
chemins.push(m);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
return chemins.map(m => m.replace(/^\.\//, ''));
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// The refusals of the root's format and lint scripts at <racine> that name a file a package holds:
|
|
255
|
+
// the root keeps its own files (grillhouse-44b.9), a package plays its own.
|
|
256
|
+
function controlesDeRacineRefuses(racine) {
|
|
257
|
+
const dossiers = paquets(racine)
|
|
258
|
+
.filter(p => !p.hors)
|
|
259
|
+
.map(p => p.dossier);
|
|
260
|
+
/** @type {string[]} */
|
|
261
|
+
const refus = [];
|
|
262
|
+
if (dossiers.length === 0) {
|
|
263
|
+
return refus;
|
|
264
|
+
}
|
|
265
|
+
let scripts;
|
|
266
|
+
try {
|
|
267
|
+
scripts = JSON.parse(readFileSync(path.join(racine, 'package.json'), 'utf8')).scripts;
|
|
268
|
+
} catch {
|
|
269
|
+
return refus;
|
|
270
|
+
}
|
|
271
|
+
for (const c of CONTROLES) {
|
|
272
|
+
for (const chemin of cheminsDuScript(scripts?.[c] ?? '')) {
|
|
273
|
+
const { fixe, glob } = partieFixe(chemin);
|
|
274
|
+
// A glob at the root's top (`*.mjs`) names the root's files; `**` reaches the packages.
|
|
275
|
+
const vise =
|
|
276
|
+
fixe === ''
|
|
277
|
+
? chemin.split('/')[0] === '**'
|
|
278
|
+
: dossiers.some(d => sous(fixe, d) || (glob && sous(d, fixe)));
|
|
279
|
+
if (vise) {
|
|
280
|
+
refus.push(
|
|
281
|
+
`⛔ 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.`
|
|
282
|
+
);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
return refus;
|
|
287
|
+
}
|
|
183
288
|
// The layout of what the generator writes in the root's turbo.json.
|
|
184
289
|
const MISE_EN_FORME = { formattingOptions: { insertSpaces: true, tabSize: 2, eol: '\n' } };
|
|
185
290
|
// The builds the typing of a package waits for in <racine>: its own, whose built entry its tests
|
|
@@ -199,8 +304,45 @@ const POURQUOI = {
|
|
|
199
304
|
[TEMPORAIRE]:
|
|
200
305
|
'la base de la passe, où chaque tâche écrit ses fichiers temporaires, effacée à sa fin',
|
|
201
306
|
};
|
|
307
|
+
// The variables of the tools of the project at <racine> (`grillhouse.outils` of its package.json,
|
|
308
|
+
// scripts/outils-cles.mjs), in the order it declares them: the paths of tools outside the
|
|
309
|
+
// repository its tests demand, which the run passes to every task without hashing them. A key
|
|
310
|
+
// that is no variable name is the guard of the tools' (`grillhouse outil`), not this one's.
|
|
311
|
+
function variablesDOutils(racine) {
|
|
312
|
+
try {
|
|
313
|
+
const o = JSON.parse(readFileSync(path.join(racine, 'package.json'), 'utf8')).grillhouse
|
|
314
|
+
?.outils;
|
|
315
|
+
return o && typeof o === 'object' && !Array.isArray(o)
|
|
316
|
+
? Object.keys(o).filter(n => /^[A-Za-z_][A-Za-z0-9_]*$/.test(n))
|
|
317
|
+
: [];
|
|
318
|
+
} catch {
|
|
319
|
+
return [];
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
// The variables of the data of the packages of the project at <racine> (`grillhouse.donnees` of
|
|
323
|
+
// the package.json of the root and of each package, scripts/donnees-cles.mjs), each once, in the
|
|
324
|
+
// order the packages declare them: the paths of the outputs of a provider that a consumer's tests
|
|
325
|
+
// run, which the run passes to every task without hashing them (the provider's build is awaited by
|
|
326
|
+
// `^build`, which hashes its sources). A faulty key is the reader's refusal, not this guard's.
|
|
327
|
+
function variablesDeDonnees(racine) {
|
|
328
|
+
const noms = [];
|
|
329
|
+
const lire = f => {
|
|
330
|
+
try {
|
|
331
|
+
const o = JSON.parse(readFileSync(f, 'utf8')).grillhouse?.donnees;
|
|
332
|
+
if (o && typeof o === 'object' && !Array.isArray(o)) {
|
|
333
|
+
noms.push(...Object.keys(o).filter(n => /^[A-Za-z_][A-Za-z0-9_]*$/.test(n)));
|
|
334
|
+
}
|
|
335
|
+
} catch {
|
|
336
|
+
// No readable package.json declares nothing.
|
|
337
|
+
}
|
|
338
|
+
};
|
|
339
|
+
lire(path.join(racine, 'package.json'));
|
|
340
|
+
for (const p of paquets(racine)) {
|
|
341
|
+
lire(path.join(racine, p.dossier, 'package.json'));
|
|
342
|
+
}
|
|
343
|
+
return [...new Set(noms)];
|
|
344
|
+
}
|
|
202
345
|
// The prefix of a trace task.
|
|
203
|
-
const TRACE = 'trace:';
|
|
204
346
|
// The files a build compiles: TypeScript's sources and declarations (tsc's default `include`
|
|
205
347
|
// takes a `.d.ts` into the program, whose types the build checks) and JavaScript (`allowJs`).
|
|
206
348
|
const CODE = /\.(?:[cm]?[jt]s|[jt]sx)$/;
|
|
@@ -233,7 +375,9 @@ function confRacine(racine) {
|
|
|
233
375
|
function tachesRacine(racine) {
|
|
234
376
|
const taches = new Map();
|
|
235
377
|
for (const [nom, t] of Object.entries(confRacine(racine)?.conf.tasks ?? {})) {
|
|
236
|
-
if (nom.includes('#'))
|
|
378
|
+
if (nom.includes('#')) {
|
|
379
|
+
continue;
|
|
380
|
+
}
|
|
237
381
|
taches.set(nom, {
|
|
238
382
|
dependsOn: Array.isArray(t?.dependsOn) ? t.dependsOn : [],
|
|
239
383
|
inputs: Array.isArray(t?.inputs) ? t.inputs : null,
|
|
@@ -242,14 +386,6 @@ function tachesRacine(racine) {
|
|
|
242
386
|
return taches;
|
|
243
387
|
}
|
|
244
388
|
|
|
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
389
|
/**
|
|
254
390
|
* Before a run of Turborepo of <args> in <racine> under <env>, while <dossier> is a progress
|
|
255
391
|
* directory (scripts/avancement.mjs): the plan of the run (`turbo run … --dry=json`), its tasks of
|
|
@@ -259,7 +395,9 @@ export const tracesDuPlan = (plan, garder = () => true) =>
|
|
|
259
395
|
* @param {{ racine: string, args: string[], env?: Record<string, string | undefined> }} o
|
|
260
396
|
*/
|
|
261
397
|
export function planifier(dossier, { racine, args, env = process.env }) {
|
|
262
|
-
if (!dossier)
|
|
398
|
+
if (!dossier) {
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
263
401
|
const r = spawnSync('turbo', ['run', ...args.filter(a => a !== '--summarize'), '--dry=json'], {
|
|
264
402
|
cwd: racine,
|
|
265
403
|
env,
|
|
@@ -279,26 +417,6 @@ export function planifier(dossier, { racine, args, env = process.env }) {
|
|
|
279
417
|
});
|
|
280
418
|
}
|
|
281
419
|
|
|
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
420
|
// A path from the root, without its trailing slashes.
|
|
303
421
|
const net = d => String(d ?? '').replace(/\/+$/, '');
|
|
304
422
|
// The fixed part of the pattern <motif>, its segments before the first holding a glob character,
|
|
@@ -315,7 +433,9 @@ const recouvre = (a, b) => sous(a, b) || sous(b, a);
|
|
|
315
433
|
|
|
316
434
|
// The paths of the submodules the .gitmodules of <racine> declares, sorted; none without one.
|
|
317
435
|
function sousModules(racine) {
|
|
318
|
-
if (!existsSync(path.join(racine, '.gitmodules')))
|
|
436
|
+
if (!existsSync(path.join(racine, '.gitmodules'))) {
|
|
437
|
+
return [];
|
|
438
|
+
}
|
|
319
439
|
const r = gitSort(racine, [
|
|
320
440
|
'config',
|
|
321
441
|
'-f',
|
|
@@ -362,21 +482,35 @@ function baseTs(base, dir) {
|
|
|
362
482
|
// last base that sets them, `dir` the directory of the file that writes them), undefined when no
|
|
363
483
|
// file sets them; null when one of them cannot be read.
|
|
364
484
|
function configTs(f, vus = []) {
|
|
365
|
-
if (vus.includes(f) || !existsSync(f))
|
|
485
|
+
if (vus.includes(f) || !existsSync(f)) {
|
|
486
|
+
return null;
|
|
487
|
+
}
|
|
366
488
|
const conf = lireJsonc(readFileSync(f, 'utf8'));
|
|
367
|
-
if (conf === null || typeof conf !== 'object' || Array.isArray(conf))
|
|
489
|
+
if (conf === null || typeof conf !== 'object' || Array.isArray(conf)) {
|
|
490
|
+
return null;
|
|
491
|
+
}
|
|
368
492
|
const dir = path.dirname(f);
|
|
369
493
|
const lu = { configs: [f], files: undefined, include: undefined };
|
|
370
494
|
for (const base of conf.extends === undefined ? [] : [conf.extends].flat()) {
|
|
371
495
|
const fb = typeof base === 'string' ? baseTs(base, dir) : null;
|
|
372
496
|
const r = fb === null ? null : configTs(fb, [...vus, f]);
|
|
373
|
-
if (r === null)
|
|
497
|
+
if (r === null) {
|
|
498
|
+
return null;
|
|
499
|
+
}
|
|
374
500
|
lu.configs.push(...r.configs);
|
|
375
|
-
for (const cle of ['files', 'include'])
|
|
501
|
+
for (const cle of ['files', 'include']) {
|
|
502
|
+
if (r[cle] !== undefined) {
|
|
503
|
+
lu[cle] = r[cle];
|
|
504
|
+
}
|
|
505
|
+
}
|
|
376
506
|
}
|
|
377
507
|
for (const cle of ['files', 'include']) {
|
|
378
|
-
if (conf[cle] === undefined)
|
|
379
|
-
|
|
508
|
+
if (conf[cle] === undefined) {
|
|
509
|
+
continue;
|
|
510
|
+
}
|
|
511
|
+
if (!Array.isArray(conf[cle])) {
|
|
512
|
+
return null;
|
|
513
|
+
}
|
|
380
514
|
lu[cle] = conf[cle].map(chemin => ({ chemin: String(chemin), dir }));
|
|
381
515
|
}
|
|
382
516
|
return lu;
|
|
@@ -390,7 +524,9 @@ function configTs(f, vus = []) {
|
|
|
390
524
|
// neighbours most often.
|
|
391
525
|
function luParTsc(abs, projet) {
|
|
392
526
|
const lu = configTs(projet);
|
|
393
|
-
if (lu === null || (lu.files === undefined && lu.include === undefined))
|
|
527
|
+
if (lu === null || (lu.files === undefined && lu.include === undefined)) {
|
|
528
|
+
return null;
|
|
529
|
+
}
|
|
394
530
|
const dedans = p => {
|
|
395
531
|
const r = path.relative(abs, p).split(path.sep).join('/');
|
|
396
532
|
return r === '' || r === '..' || r.startsWith('../') || path.isAbsolute(r) ? null : r;
|
|
@@ -406,11 +542,15 @@ function luParTsc(abs, projet) {
|
|
|
406
542
|
? path.join(path.dirname(projet), chemin.slice(CONFIG_DIR.length))
|
|
407
543
|
: path.resolve(dir, chemin);
|
|
408
544
|
const r = dedans(f);
|
|
409
|
-
if (r === null)
|
|
545
|
+
if (r === null) {
|
|
546
|
+
return null;
|
|
547
|
+
}
|
|
410
548
|
const { fixe, glob } = partieFixe(r);
|
|
411
549
|
const fichier = cle === 'files' || (existsSync(f) && statSync(f).isFile());
|
|
412
550
|
const d = glob ? fixe : fichier ? path.posix.dirname(r) : r;
|
|
413
|
-
if (d === '' || d === '.')
|
|
551
|
+
if (d === '' || d === '.') {
|
|
552
|
+
return null;
|
|
553
|
+
}
|
|
414
554
|
dossiers.push(d);
|
|
415
555
|
}
|
|
416
556
|
}
|
|
@@ -431,7 +571,9 @@ function luParTsc(abs, projet) {
|
|
|
431
571
|
function entreesBuild(racine, dossier, pkg, sm) {
|
|
432
572
|
const abs = path.join(racine, dossier);
|
|
433
573
|
const projets = [path.join(abs, TSCONFIG_BUILD)];
|
|
434
|
-
if (!existsSync(projets[0]))
|
|
574
|
+
if (!existsSync(projets[0])) {
|
|
575
|
+
return null;
|
|
576
|
+
}
|
|
435
577
|
const fichiers = new Set(['package.json']);
|
|
436
578
|
const versProjet = m => {
|
|
437
579
|
const f = path.resolve(abs, m);
|
|
@@ -443,9 +585,13 @@ function entreesBuild(racine, dossier, pkg, sm) {
|
|
|
443
585
|
.split(/\s+/)
|
|
444
586
|
.filter(Boolean)
|
|
445
587
|
.map(m => m.replace(/^['"]|['"]$/g, ''));
|
|
446
|
-
if (mots.length === 0)
|
|
588
|
+
if (mots.length === 0) {
|
|
589
|
+
continue;
|
|
590
|
+
}
|
|
447
591
|
const tsc = mots[0] === 'npx' ? 1 : 0;
|
|
448
|
-
if (mots[tsc] !== 'tsc')
|
|
592
|
+
if (mots[tsc] !== 'tsc') {
|
|
593
|
+
return null;
|
|
594
|
+
}
|
|
449
595
|
const options = mots.slice(tsc + 1);
|
|
450
596
|
const p = options.findIndex(m => m === '-p' || m === '--project');
|
|
451
597
|
const b = options.findIndex(m => m === '-b' || m === '--build');
|
|
@@ -463,9 +609,15 @@ function entreesBuild(racine, dossier, pkg, sm) {
|
|
|
463
609
|
const dossiers = new Set();
|
|
464
610
|
for (const projet of new Set(projets)) {
|
|
465
611
|
const lu = luParTsc(abs, projet);
|
|
466
|
-
if (lu === null)
|
|
467
|
-
|
|
468
|
-
|
|
612
|
+
if (lu === null) {
|
|
613
|
+
return null;
|
|
614
|
+
}
|
|
615
|
+
for (const f of lu.fichiers) {
|
|
616
|
+
fichiers.add(f);
|
|
617
|
+
}
|
|
618
|
+
for (const d of lu.dossiers) {
|
|
619
|
+
dossiers.add(d);
|
|
620
|
+
}
|
|
469
621
|
}
|
|
470
622
|
const lus = [...dossiers];
|
|
471
623
|
return [
|
|
@@ -479,6 +631,23 @@ function entreesBuild(racine, dossier, pkg, sm) {
|
|
|
479
631
|
];
|
|
480
632
|
}
|
|
481
633
|
|
|
634
|
+
// The inputs of the build of a package of the language <langageNom> that has no package.json of
|
|
635
|
+
// its own (a crate, a project of Python) in <dossier>: what its build reads, as Turborepo's
|
|
636
|
+
// example of Rust names them (rust.mdx § Caching behavior), none of TypeScript's. A crate: its
|
|
637
|
+
// folder (Turborepo's default), then the Cargo.lock and the Cargo.toml of the root, the lock and
|
|
638
|
+
// the manifest of its workspace. A project of Python: its folder, which holds its own uv.lock and
|
|
639
|
+
// pyproject.toml, then the ones of the root when it has them (a workspace of uv).
|
|
640
|
+
function entreesDeBuildHorsJs(racine, langageNom) {
|
|
641
|
+
const racineDe = f => `$TURBO_ROOT$/${f}`;
|
|
642
|
+
if (langageNom === 'cargo') {
|
|
643
|
+
return ['$TURBO_DEFAULT$', racineDe('Cargo.lock'), racineDe('Cargo.toml')];
|
|
644
|
+
}
|
|
645
|
+
return [
|
|
646
|
+
'$TURBO_DEFAULT$',
|
|
647
|
+
...['pyproject.toml', 'uv.lock'].filter(f => existsSync(path.join(racine, f))).map(racineDe),
|
|
648
|
+
];
|
|
649
|
+
}
|
|
650
|
+
|
|
482
651
|
// The data and traces each package of the frame declares in its package.json:
|
|
483
652
|
// [{ dossier, pkg, lit, traces: [{ tache, id, lit, ecrit }] }], each path from the root.
|
|
484
653
|
function declarations(liste) {
|
|
@@ -529,6 +698,7 @@ export function attendus(racine) {
|
|
|
529
698
|
.filter(({ pkg, hors }) => !hors && typeof pkg.scripts?.build === 'string')
|
|
530
699
|
.map(({ pkg }) => pkg.name)
|
|
531
700
|
);
|
|
701
|
+
const horsJs = new Map(paquetsSansPackageJson(racine).map(p => [p.chemin, p.langage]));
|
|
532
702
|
const decls = new Map(declarations(liste).map(d => [d.dossier, d]));
|
|
533
703
|
const traces = [...decls.values()].flatMap(d => d.traces);
|
|
534
704
|
// The trace tasks whose output one of <lit> overlaps, <soi> left out, sorted.
|
|
@@ -554,12 +724,17 @@ export function attendus(racine) {
|
|
|
554
724
|
for (const { dossier, pkg, hors: exclu } of liste) {
|
|
555
725
|
const taches = {};
|
|
556
726
|
if (exclu) {
|
|
557
|
-
for (const [nom] of racineTaches)
|
|
727
|
+
for (const [nom] of racineTaches) {
|
|
728
|
+
taches[nom] = { extends: false };
|
|
729
|
+
}
|
|
558
730
|
} else {
|
|
559
731
|
taches.build = {
|
|
560
732
|
dependsOn: internes(pkg, EXECUTION, construits).map(n => `${n}#build`),
|
|
561
733
|
};
|
|
562
|
-
const
|
|
734
|
+
const langageDuPaquet = horsJs.get(dossier);
|
|
735
|
+
const propres = langageDuPaquet
|
|
736
|
+
? entreesDeBuildHorsJs(racine, langageDuPaquet)
|
|
737
|
+
: entreesBuild(racine, dossier, pkg, sm);
|
|
563
738
|
// The files the build reads by name stay its inputs, a reader's declaration never changing
|
|
564
739
|
// them (Bazel: a file is `srcs` of one target and `data` of another): the ones its inputs
|
|
565
740
|
// name, else its package.json and tsconfig*.json.
|
|
@@ -572,8 +747,13 @@ export function attendus(racine) {
|
|
|
572
747
|
.filter(d => !lusParBuild(d))
|
|
573
748
|
.sort();
|
|
574
749
|
const sansDonnees = dedans.map(d => `!${d}/**`);
|
|
575
|
-
if (
|
|
576
|
-
|
|
750
|
+
if (langageDuPaquet) {
|
|
751
|
+
taches.build.inputs = [...propres, ...sansDonnees];
|
|
752
|
+
} else if (propres) {
|
|
753
|
+
taches.build.inputs = [...racineBuild, ...propres, ...sansDonnees];
|
|
754
|
+
} else if (dedans.length) {
|
|
755
|
+
taches.build.inputs = [base('build'), ...sansDonnees];
|
|
756
|
+
}
|
|
577
757
|
const horsVoisin = TOPOLOGIE.some(c => Object.keys(pkg[c] ?? {}).some(n => hors.has(n)));
|
|
578
758
|
const voisins = internes(pkg, TOPOLOGIE, duCadre);
|
|
579
759
|
// <dependances> with each `^<task>` written out when a neighbour is out of the frame.
|
|
@@ -589,7 +769,9 @@ export function attendus(racine) {
|
|
|
589
769
|
: dependances;
|
|
590
770
|
if (horsVoisin) {
|
|
591
771
|
for (const [nom, { dependsOn }] of racineTaches) {
|
|
592
|
-
if (nom === 'build' || !dependsOn.some(d => d.startsWith('^')))
|
|
772
|
+
if (nom === 'build' || !dependsOn.some(d => d.startsWith('^'))) {
|
|
773
|
+
continue;
|
|
774
|
+
}
|
|
593
775
|
taches[nom] = { dependsOn: deplier(dependsOn) };
|
|
594
776
|
}
|
|
595
777
|
}
|
|
@@ -626,7 +808,9 @@ export function attendus(racine) {
|
|
|
626
808
|
// The `dependsOn` each guard task of the root of <racine> must hold: Map<task key, dependsOn>.
|
|
627
809
|
export function gardesAttendues(racine) {
|
|
628
810
|
const liste = paquets(racine);
|
|
629
|
-
if (liste.length === 0)
|
|
811
|
+
if (liste.length === 0) {
|
|
812
|
+
return new Map(GARDES.map(g => [g, ['build']]));
|
|
813
|
+
}
|
|
630
814
|
const builds = liste
|
|
631
815
|
.filter(({ pkg, hors }) => !hors && typeof pkg.scripts?.build === 'string')
|
|
632
816
|
.map(({ pkg }) => `${pkg.name}#build`)
|
|
@@ -639,10 +823,14 @@ export function gardesAttendues(racine) {
|
|
|
639
823
|
// null without a root configuration, or when it is no JSON.
|
|
640
824
|
function gardesEcartees(racine) {
|
|
641
825
|
const f = fichierRacine(racine);
|
|
642
|
-
if (f === null)
|
|
826
|
+
if (f === null) {
|
|
827
|
+
return null;
|
|
828
|
+
}
|
|
643
829
|
const texte = readFileSync(path.join(racine, f), 'utf8');
|
|
644
830
|
const conf = lireJsonc(texte);
|
|
645
|
-
if (conf === null)
|
|
831
|
+
if (conf === null) {
|
|
832
|
+
return null;
|
|
833
|
+
}
|
|
646
834
|
const ecarts = [];
|
|
647
835
|
for (const [cle, attendu] of gardesAttendues(racine)) {
|
|
648
836
|
const tache = conf.tasks?.[cle];
|
|
@@ -661,7 +849,9 @@ function gardesEcartees(racine) {
|
|
|
661
849
|
// task absent; null when it holds them, without a root configuration, and when it is no JSON.
|
|
662
850
|
function typageEcarte(racine) {
|
|
663
851
|
const r = confRacine(racine);
|
|
664
|
-
if (!r)
|
|
852
|
+
if (!r) {
|
|
853
|
+
return null;
|
|
854
|
+
}
|
|
665
855
|
const attendu = attenteDuTypage(racine);
|
|
666
856
|
const tache = r.conf.tasks?.[TYPAGE];
|
|
667
857
|
if (!tache || typeof tache !== 'object') {
|
|
@@ -670,7 +860,9 @@ function typageEcarte(racine) {
|
|
|
670
860
|
}
|
|
671
861
|
const actuel = Array.isArray(tache.dependsOn) ? tache.dependsOn : [];
|
|
672
862
|
const manques = attendu.filter(d => !actuel.includes(d));
|
|
673
|
-
if (!manques.length)
|
|
863
|
+
if (!manques.length) {
|
|
864
|
+
return null;
|
|
865
|
+
}
|
|
674
866
|
const chemin = ['tasks', TYPAGE, 'dependsOn'];
|
|
675
867
|
return { f: r.f, chemin, valeur: [...actuel, ...manques], manques };
|
|
676
868
|
}
|
|
@@ -681,7 +873,9 @@ function typageEcarte(racine) {
|
|
|
681
873
|
function testsSansVariable(racine) {
|
|
682
874
|
const r = confRacine(racine);
|
|
683
875
|
const tache = r?.conf.tasks?.[TESTS];
|
|
684
|
-
if (!tache || typeof tache !== 'object')
|
|
876
|
+
if (!tache || typeof tache !== 'object') {
|
|
877
|
+
return null;
|
|
878
|
+
}
|
|
685
879
|
const actuel = Array.isArray(tache.env) ? tache.env : [];
|
|
686
880
|
return actuel.includes(TESTS_CIBLES) ? null : { f: r.f, attendu: [...actuel, TESTS_CIBLES] };
|
|
687
881
|
}
|
|
@@ -691,9 +885,13 @@ function testsSansVariable(racine) {
|
|
|
691
885
|
// configuration, and when it is no JSON.
|
|
692
886
|
function passagesManquants(racine) {
|
|
693
887
|
const r = confRacine(racine);
|
|
694
|
-
if (!r)
|
|
888
|
+
if (!r) {
|
|
889
|
+
return null;
|
|
890
|
+
}
|
|
695
891
|
const actuel = Array.isArray(r.conf.globalPassThroughEnv) ? r.conf.globalPassThroughEnv : [];
|
|
696
|
-
const manques =
|
|
892
|
+
const manques = [
|
|
893
|
+
...new Set([...PASSAGES, ...variablesDOutils(racine), ...variablesDeDonnees(racine)]),
|
|
894
|
+
].filter(v => !actuel.includes(v));
|
|
697
895
|
return manques.length ? { f: r.f, attendu: [...actuel, ...manques], manques } : null;
|
|
698
896
|
}
|
|
699
897
|
|
|
@@ -706,23 +904,33 @@ function passagesManquants(racine) {
|
|
|
706
904
|
function gitsAbsents(racine) {
|
|
707
905
|
const r = confRacine(racine);
|
|
708
906
|
const sm = r === null ? [] : sousModules(racine);
|
|
709
|
-
if (sm.length === 0)
|
|
907
|
+
if (sm.length === 0) {
|
|
908
|
+
return null;
|
|
909
|
+
}
|
|
710
910
|
const listes = [];
|
|
711
911
|
const examiner = (chemin, entrees, prefixe, ou) => {
|
|
712
|
-
if (!Array.isArray(entrees))
|
|
912
|
+
if (!Array.isArray(entrees)) {
|
|
913
|
+
return;
|
|
914
|
+
}
|
|
713
915
|
const attendu = entrees.map(String);
|
|
714
916
|
const manques = [];
|
|
715
917
|
for (const e of entrees.map(String)) {
|
|
716
|
-
if (e.startsWith('!') || !e.startsWith(prefixe))
|
|
918
|
+
if (e.startsWith('!') || !e.startsWith(prefixe)) {
|
|
919
|
+
continue;
|
|
920
|
+
}
|
|
717
921
|
const { fixe, glob } = partieFixe(e.slice(prefixe.length));
|
|
718
922
|
for (const m of sm) {
|
|
719
923
|
const ligne = `!${prefixe}${m}/.git`;
|
|
720
|
-
if (!glob || !(fixe === '' || sous(m, fixe)) || attendu.includes(ligne))
|
|
924
|
+
if (!glob || !(fixe === '' || sous(m, fixe)) || attendu.includes(ligne)) {
|
|
925
|
+
continue;
|
|
926
|
+
}
|
|
721
927
|
attendu.splice(attendu.indexOf(e) + 1, 0, ligne);
|
|
722
928
|
manques.push({ ou, e, m, ligne });
|
|
723
929
|
}
|
|
724
930
|
}
|
|
725
|
-
if (manques.length)
|
|
931
|
+
if (manques.length) {
|
|
932
|
+
listes.push({ chemin, attendu, manques });
|
|
933
|
+
}
|
|
726
934
|
};
|
|
727
935
|
for (const [nom, t] of Object.entries(r.conf.tasks ?? {})) {
|
|
728
936
|
examiner(['tasks', nom, 'inputs'], t?.inputs, '$TURBO_ROOT$/', `l'entrée de \`${nom}\``);
|
|
@@ -757,7 +965,21 @@ export function ecrire(racine) {
|
|
|
757
965
|
abs,
|
|
758
966
|
applyEdits(texte, modify(texte, typage.chemin, typage.valeur, MISE_EN_FORME))
|
|
759
967
|
);
|
|
760
|
-
if (!ecrits.includes(typage.f))
|
|
968
|
+
if (!ecrits.includes(typage.f)) {
|
|
969
|
+
ecrits.push(typage.f);
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
const controles = controlesAbsents(racine);
|
|
973
|
+
if (controles.length) {
|
|
974
|
+
const abs = path.join(racine, controles[0].f);
|
|
975
|
+
let texte = readFileSync(abs, 'utf8');
|
|
976
|
+
for (const { cle } of controles) {
|
|
977
|
+
texte = applyEdits(texte, modify(texte, ['tasks', cle], { outputs: [] }, MISE_EN_FORME));
|
|
978
|
+
}
|
|
979
|
+
writeFileSync(abs, texte);
|
|
980
|
+
if (!ecrits.includes(controles[0].f)) {
|
|
981
|
+
ecrits.push(controles[0].f);
|
|
982
|
+
}
|
|
761
983
|
}
|
|
762
984
|
const tests = testsSansVariable(racine);
|
|
763
985
|
if (tests) {
|
|
@@ -765,7 +987,9 @@ export function ecrire(racine) {
|
|
|
765
987
|
const texte = readFileSync(abs, 'utf8');
|
|
766
988
|
const chemin = ['tasks', TESTS, 'env'];
|
|
767
989
|
writeFileSync(abs, applyEdits(texte, modify(texte, chemin, tests.attendu, MISE_EN_FORME)));
|
|
768
|
-
if (!ecrits.includes(tests.f))
|
|
990
|
+
if (!ecrits.includes(tests.f)) {
|
|
991
|
+
ecrits.push(tests.f);
|
|
992
|
+
}
|
|
769
993
|
}
|
|
770
994
|
const passage = passagesManquants(racine);
|
|
771
995
|
if (passage) {
|
|
@@ -773,7 +997,9 @@ export function ecrire(racine) {
|
|
|
773
997
|
const texte = readFileSync(abs, 'utf8');
|
|
774
998
|
const chemin = ['globalPassThroughEnv'];
|
|
775
999
|
writeFileSync(abs, applyEdits(texte, modify(texte, chemin, passage.attendu, MISE_EN_FORME)));
|
|
776
|
-
if (!ecrits.includes(passage.f))
|
|
1000
|
+
if (!ecrits.includes(passage.f)) {
|
|
1001
|
+
ecrits.push(passage.f);
|
|
1002
|
+
}
|
|
777
1003
|
}
|
|
778
1004
|
const gits = gitsAbsents(racine);
|
|
779
1005
|
if (gits) {
|
|
@@ -783,11 +1009,15 @@ export function ecrire(racine) {
|
|
|
783
1009
|
texte = applyEdits(texte, modify(texte, chemin, attendu, MISE_EN_FORME));
|
|
784
1010
|
}
|
|
785
1011
|
writeFileSync(abs, texte);
|
|
786
|
-
if (!ecrits.includes(gits.f))
|
|
1012
|
+
if (!ecrits.includes(gits.f)) {
|
|
1013
|
+
ecrits.push(gits.f);
|
|
1014
|
+
}
|
|
787
1015
|
}
|
|
788
1016
|
for (const [f, t] of attendus(racine)) {
|
|
789
1017
|
const abs = path.join(racine, f);
|
|
790
|
-
if (existsSync(abs) && readFileSync(abs, 'utf8') === t)
|
|
1018
|
+
if (existsSync(abs) && readFileSync(abs, 'utf8') === t) {
|
|
1019
|
+
continue;
|
|
1020
|
+
}
|
|
791
1021
|
writeFileSync(abs, t);
|
|
792
1022
|
ecrits.push(f);
|
|
793
1023
|
}
|
|
@@ -797,7 +1027,9 @@ export function ecrire(racine) {
|
|
|
797
1027
|
// Whether <chemin> of <racine> (a directory, or a file, from the root) holds a file of code; what
|
|
798
1028
|
// lies under one of <exclus> left out, as `parcourir` walks it.
|
|
799
1029
|
function contientCode(racine, chemin, exclus) {
|
|
800
|
-
if (exclus.some(e => sous(chemin, e)))
|
|
1030
|
+
if (exclus.some(e => sous(chemin, e))) {
|
|
1031
|
+
return false;
|
|
1032
|
+
}
|
|
801
1033
|
const rel = p => path.relative(racine, p).split(path.sep).join('/');
|
|
802
1034
|
return parcourir(path.join(racine, chemin), p => exclus.some(e => sous(rel(p), e))).some(f =>
|
|
803
1035
|
CODE.test(f)
|
|
@@ -867,7 +1099,9 @@ function configsMatiereRefusees(racine) {
|
|
|
867
1099
|
const { type } = JSON.parse(readFileSync(path.join(dir, 'package.json'), 'utf8'));
|
|
868
1100
|
for (const ext of ['mjs', 'mts', ...(type === 'module' ? ['js', 'ts'] : [])]) {
|
|
869
1101
|
const f = path.relative(racine, path.join(dir, `vitest.config.${ext}`));
|
|
870
|
-
if (!existsSync(path.join(racine, f)))
|
|
1102
|
+
if (!existsSync(path.join(racine, f))) {
|
|
1103
|
+
continue;
|
|
1104
|
+
}
|
|
871
1105
|
refus.push(
|
|
872
1106
|
`⛔ ${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.`
|
|
873
1107
|
);
|
|
@@ -888,7 +1122,9 @@ function visePaquet(motif, dossiers) {
|
|
|
888
1122
|
// package directory.
|
|
889
1123
|
function racineRefusee(racine) {
|
|
890
1124
|
const r = confRacine(racine);
|
|
891
|
-
if (r === null)
|
|
1125
|
+
if (r === null) {
|
|
1126
|
+
return [];
|
|
1127
|
+
}
|
|
892
1128
|
const { f, conf } = r;
|
|
893
1129
|
const dossiers = paquets(racine).map(p => p.dossier);
|
|
894
1130
|
const refus = [];
|
|
@@ -915,7 +1151,9 @@ function racineRefusee(racine) {
|
|
|
915
1151
|
}
|
|
916
1152
|
}
|
|
917
1153
|
for (const e of Array.isArray(conf.globalDependencies) ? conf.globalDependencies : []) {
|
|
918
|
-
if (visePaquet(String(e).replace(/^!/, ''), dossiers))
|
|
1154
|
+
if (visePaquet(String(e).replace(/^!/, ''), dossiers)) {
|
|
1155
|
+
entree(e, 'la dépendance globale');
|
|
1156
|
+
}
|
|
919
1157
|
}
|
|
920
1158
|
return refus;
|
|
921
1159
|
}
|
|
@@ -929,6 +1167,7 @@ function racineRefusee(racine) {
|
|
|
929
1167
|
export function verifier(racine) {
|
|
930
1168
|
const refus = [
|
|
931
1169
|
...racineRefusee(racine),
|
|
1170
|
+
...controlesDeRacineRefuses(racine),
|
|
932
1171
|
...declarationsRefusees(racine),
|
|
933
1172
|
...configsMatiereRefusees(racine),
|
|
934
1173
|
];
|
|
@@ -946,6 +1185,11 @@ export function verifier(racine) {
|
|
|
946
1185
|
: `⛔ ${typage.f} : la tâche \`${TYPAGE}\` manque, le typage de chaque paquet que \`npm run verifier\` joue ; \`${COMMANDE}\` l'ajoute.`
|
|
947
1186
|
);
|
|
948
1187
|
}
|
|
1188
|
+
for (const { f, cle } of controlesAbsents(racine)) {
|
|
1189
|
+
refus.push(
|
|
1190
|
+
`⛔ ${f} : la tâche \`${cle}\` manque, le contrôle de la racine que \`npm run verifier\` joue ; \`${COMMANDE}\` l'ajoute.`
|
|
1191
|
+
);
|
|
1192
|
+
}
|
|
949
1193
|
const tests = testsSansVariable(racine);
|
|
950
1194
|
if (tests) {
|
|
951
1195
|
refus.push(
|
|
@@ -955,7 +1199,7 @@ export function verifier(racine) {
|
|
|
955
1199
|
const passage = passagesManquants(racine);
|
|
956
1200
|
for (const v of passage?.manques ?? []) {
|
|
957
1201
|
refus.push(
|
|
958
|
-
`⛔ ${passage.f} : \`globalPassThroughEnv\` doit nommer ${v}, ${POURQUOI[v]} ; \`${COMMANDE}\` l'ajoute.`
|
|
1202
|
+
`⛔ ${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
1203
|
);
|
|
960
1204
|
}
|
|
961
1205
|
for (const { cle, attendu, present } of gardesEcartees(racine)?.ecarts ?? []) {
|
|
@@ -995,7 +1239,9 @@ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
|
|
|
995
1239
|
ecrire(racine);
|
|
996
1240
|
} else {
|
|
997
1241
|
const refus = verifier(racine);
|
|
998
|
-
for (const l of refus)
|
|
1242
|
+
for (const l of refus) {
|
|
1243
|
+
process.stderr.write(`${l}\n`);
|
|
1244
|
+
}
|
|
999
1245
|
// Each refusal judges the root's configuration: a finding without a file of a component.
|
|
1000
1246
|
ecrireSarif({
|
|
1001
1247
|
garde: 'turbo-des-paquets',
|