@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
|
@@ -12,12 +12,6 @@
|
|
|
12
12
|
// shared test material, the components whose package exports `./test-fixtures` (`matieres`); a
|
|
13
13
|
// component plays tests when its package.json holds the script `test:unit` (`joueDesTests`),
|
|
14
14
|
// which Turborepo runs in it (./tests.mjs).
|
|
15
|
-
// - The components touched since a commit: the files git sees changed since it, the working tree
|
|
16
|
-
// and the untracked files included (`git diff --name-only <depuis>`, `git ls-files -o
|
|
17
|
-
// --exclude-standard`), each in its component, and the components that depend on them by their
|
|
18
|
-
// package.json (its `dependencies`, `devDependencies`, `optionalDependencies` and
|
|
19
|
-
// `peerDependencies` that name another component), transitively, as Turborepo's
|
|
20
|
-
// `--filter=...[<depuis>]`; a file out of every component is out of the graph.
|
|
21
15
|
// - The elements of a lot (./elements-du-lot.mjs).
|
|
22
16
|
// - Where its tools write, which the envelope opens to a session (`sorties`), and the rules that
|
|
23
17
|
// refuse a role that writes the test tool run directly (`droits`).
|
|
@@ -32,8 +26,8 @@
|
|
|
32
26
|
// (./vitest-config/base.mjs).
|
|
33
27
|
// - The verdict: the summaries of Turborepo and the reports of Vitest of a results directory
|
|
34
28
|
// (./verdict.mjs).
|
|
35
|
-
// - The rule of a test file
|
|
36
|
-
// (./regle-des-tests.mjs).
|
|
29
|
+
// - The rule of a test file, the sibling of HEAD's version of a test file and what the testwriter
|
|
30
|
+
// writes of the manifests (./regle-des-tests.mjs).
|
|
37
31
|
// - The generated files, each its command, the guard that checks it and the names its findings
|
|
38
32
|
// carry: the index of the interfaces, the turbo.json of the packages, the reports of API.
|
|
39
33
|
// - The entries of the index of each interface (`entreesDeLIndex`, ./index-interfaces.mjs), which
|
|
@@ -56,24 +50,27 @@ import { composants as lesComposants, matieres } from './consommateurs.mjs';
|
|
|
56
50
|
import { elementsDuLot } from './elements-du-lot.mjs';
|
|
57
51
|
import { A_ELAGUER, lireSarif, RESULTATS } from '../../resultats.mjs';
|
|
58
52
|
import { lecteurs } from './lecteurs.mjs';
|
|
59
|
-
import { estUnTest, manifestes } from './regle-des-tests.mjs';
|
|
60
|
-
import { SCRIPT_DES_TESTS } from '
|
|
53
|
+
import { estUnTest, manifestes, soeurDAvant } from './regle-des-tests.mjs';
|
|
54
|
+
import { SCRIPT_DES_TESTS } from '../../services-du-noyau.mjs';
|
|
61
55
|
import { verdict } from './verdict.mjs';
|
|
62
56
|
import { miseAJour } from './mise-a-jour.mjs';
|
|
63
57
|
import { squelette } from './squelette.mjs';
|
|
58
|
+
import { estHorsDuJour } from './vitest-config/cibles.mjs';
|
|
64
59
|
import * as configVitest from './migrations/0.23.0-config-vitest.mjs';
|
|
65
60
|
import * as nomsDeclaresInutilises from './migrations/0.24.4-noms-declares-inutilises.mjs';
|
|
66
61
|
import * as lignesMalFormees from './migrations/0.24.6-lignes-mal-formees.mjs';
|
|
67
62
|
import * as matiereDansLesTests from './migrations/0.24.7-matiere-dans-les-tests.mjs';
|
|
68
63
|
import * as taillesDesTests from './migrations/0.25.0-tailles-des-tests.mjs';
|
|
69
64
|
import * as cheminsDesTests from './migrations/0.25.0-chemins-des-tests.mjs';
|
|
65
|
+
import * as taillesDesOutilsLourds from './migrations/0.30.0-tailles-des-outils-lourds.mjs';
|
|
66
|
+
import * as prefixeDesTickets from './migrations/0.30.0-prefixe-des-tickets.mjs';
|
|
67
|
+
import * as titresNommantUnTicket from './migrations/0.30.0-titres-nommant-un-ticket.mjs';
|
|
70
68
|
|
|
71
69
|
// The scripts of this module, beside this file.
|
|
72
70
|
const SCRIPTS = path.dirname(fileURLToPath(import.meta.url));
|
|
73
71
|
const requis = createRequire(import.meta.url);
|
|
74
72
|
const ici = nom => path.join(SCRIPTS, nom);
|
|
75
73
|
const generateur = (script, ...args) => [`node ${JSON.stringify(ici(script))}`, ...args].join(' ');
|
|
76
|
-
const CHAMPS = ['dependencies', 'devDependencies', 'optionalDependencies', 'peerDependencies'];
|
|
77
74
|
|
|
78
75
|
const composants = racine =>
|
|
79
76
|
lesComposants(racine).map(({ nom, dir, paquet }) => ({ nom, dossier: dir, paquet }));
|
|
@@ -88,6 +85,7 @@ const OUTILS = [
|
|
|
88
85
|
'interfaces-contre-code',
|
|
89
86
|
'resumes',
|
|
90
87
|
'tailles-des-tests',
|
|
88
|
+
'titres-de-tests',
|
|
91
89
|
'turbo-des-paquets',
|
|
92
90
|
];
|
|
93
91
|
|
|
@@ -106,57 +104,6 @@ const lireJson = f => {
|
|
|
106
104
|
}
|
|
107
105
|
};
|
|
108
106
|
|
|
109
|
-
const lignesDeGit = (racine, args) => {
|
|
110
|
-
const r = spawnSync('git', ['-C', racine, ...args, '-z'], {
|
|
111
|
-
encoding: 'utf8',
|
|
112
|
-
maxBuffer: 256 * 1024 * 1024,
|
|
113
|
-
});
|
|
114
|
-
if (r.status !== 0) throw new Error(`⛔ git ${args.join(' ')} : ${r.stderr.trim()}`);
|
|
115
|
-
return r.stdout.split('\0').filter(Boolean);
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
// The components touched in <racine> since the commit <depuis>, their dependents, and the files
|
|
119
|
-
// out of every component.
|
|
120
|
-
function touches(racine, { depuis }) {
|
|
121
|
-
const liste = composants(racine);
|
|
122
|
-
const fichiers = new Set([
|
|
123
|
-
...lignesDeGit(racine, ['diff', '--name-only', '--no-renames', depuis]),
|
|
124
|
-
...lignesDeGit(racine, ['ls-files', '-o', '--exclude-standard']),
|
|
125
|
-
]);
|
|
126
|
-
const touches = new Set();
|
|
127
|
-
const horsGraphe = [];
|
|
128
|
-
for (const f of fichiers) {
|
|
129
|
-
const c = composantDans(liste, racine, f);
|
|
130
|
-
if (c) touches.add(c);
|
|
131
|
-
else horsGraphe.push(f);
|
|
132
|
-
}
|
|
133
|
-
// The components that read each one, by the packages their package.json names.
|
|
134
|
-
const parPaquet = new Map(liste.filter(c => c.paquet).map(c => [c.paquet, c]));
|
|
135
|
-
const lecteursDe = new Map(liste.map(c => [c, new Set()]));
|
|
136
|
-
for (const c of liste) {
|
|
137
|
-
const pkg = lireJson(path.join(c.dossier, 'package.json')) ?? {};
|
|
138
|
-
for (const nom of new Set(CHAMPS.flatMap(ch => Object.keys(pkg[ch] ?? {})))) {
|
|
139
|
-
const lu = parPaquet.get(nom);
|
|
140
|
-
if (lu && lu !== c) lecteursDe.get(lu).add(c);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
const dependants = new Set();
|
|
144
|
-
const suivre = c => {
|
|
145
|
-
for (const l of lecteursDe.get(c)) {
|
|
146
|
-
if (touches.has(l) || dependants.has(l)) continue;
|
|
147
|
-
dependants.add(l);
|
|
148
|
-
suivre(l);
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
|
-
for (const c of touches) suivre(c);
|
|
152
|
-
const parNom = (a, b) => a.nom.localeCompare(b.nom);
|
|
153
|
-
return {
|
|
154
|
-
touches: [...touches].sort(parNom),
|
|
155
|
-
dependants: [...dependants].sort(parNom),
|
|
156
|
-
horsGraphe: horsGraphe.sort(),
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
|
|
160
107
|
// TypeScript's compiler, the project's at <racine>, else the frame's.
|
|
161
108
|
function compilateur(racine) {
|
|
162
109
|
for (const depuis of [path.join(racine, 'package.json'), import.meta.url]) {
|
|
@@ -202,6 +149,33 @@ const joueDesTests = (_racine, composant) =>
|
|
|
202
149
|
export default {
|
|
203
150
|
nom: 'typescript',
|
|
204
151
|
manifeste: 'package.json',
|
|
152
|
+
// The name a package.json gives its package; its internal dependencies are the package.json's
|
|
153
|
+
// own, so no other manifest holds any.
|
|
154
|
+
nomDuManifeste: texte => {
|
|
155
|
+
try {
|
|
156
|
+
const nom = JSON.parse(texte)?.name;
|
|
157
|
+
return typeof nom === 'string' ? nom : null;
|
|
158
|
+
} catch {
|
|
159
|
+
return null;
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
liensDuManifeste: () => ({ noms: [], table: 'dependencies', outil: 'npm' }),
|
|
163
|
+
// Builds the packages <noms> (by their package.json name) of the project in the working
|
|
164
|
+
// directory, through the graph of the project's packages, the cache reading what did not move;
|
|
165
|
+
// inside the graph's own run (`TURBO_HASH`) the providers are built already, nothing plays.
|
|
166
|
+
construireLesPaquets: noms => {
|
|
167
|
+
if (process.env.TURBO_HASH) return;
|
|
168
|
+
for (const nom of noms) {
|
|
169
|
+
const r = spawnSync('npx', ['--no-install', 'turbo', 'run', 'build', `--filter=${nom}`], {
|
|
170
|
+
stdio: 'inherit',
|
|
171
|
+
});
|
|
172
|
+
if (r.status !== 0) throw new Error(`la construction du fournisseur ${nom} échoue.`);
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
// No output of a package of TypeScript is a datum of another package's tests.
|
|
176
|
+
sortieDuPaquet: () => {
|
|
177
|
+
throw new Error('sortie non prise en charge pour typescript');
|
|
178
|
+
},
|
|
205
179
|
// The tools a project of TypeScript installs, optional peers of the package: what this module
|
|
206
180
|
// runs as commands (Turborepo, knip, dependency-cruiser) and what its scripts import (API
|
|
207
181
|
// Extractor, its model, TSDoc's configuration, jsonc-parser); the project's own TypeScript and
|
|
@@ -252,7 +226,6 @@ export default {
|
|
|
252
226
|
matieres(racine).map(({ nom, dir, paquet }) => ({ nom, dossier: dir, paquet })),
|
|
253
227
|
joueDesTests,
|
|
254
228
|
lecteurs,
|
|
255
|
-
touches,
|
|
256
229
|
elementsDuLot,
|
|
257
230
|
commandes: racine => ({
|
|
258
231
|
tester: { script: ici('tests.mjs'), args: [] },
|
|
@@ -264,6 +237,14 @@ export default {
|
|
|
264
237
|
}),
|
|
265
238
|
verdict,
|
|
266
239
|
estUnTest,
|
|
240
|
+
// A night test, a bench or a time witness (./vitest-config/cibles.mjs, `estHorsDuJour`).
|
|
241
|
+
horsDuJour: (chemin, racine) => estHorsDuJour(path.resolve(racine, chemin)),
|
|
242
|
+
soeurDAvant,
|
|
243
|
+
// Its tool plays HEAD's version of each test file beside it (`soeurDAvant`): no tree, no name
|
|
244
|
+
// to read.
|
|
245
|
+
arbreDAvant: () => false,
|
|
246
|
+
envDArbre: () => ({}),
|
|
247
|
+
testsDeHead: () => null,
|
|
267
248
|
manifestes,
|
|
268
249
|
fichiersEngendres: () => [
|
|
269
250
|
engendre(
|
|
@@ -320,6 +301,7 @@ export default {
|
|
|
320
301
|
[ici('interfaces-contre-code.mjs')],
|
|
321
302
|
[ici('code-mort.mjs')],
|
|
322
303
|
[ici('tailles-des-tests.mjs')],
|
|
304
|
+
[ici('titres-de-tests.mjs')],
|
|
323
305
|
[ici('chemins-des-tests.mjs')],
|
|
324
306
|
[ici('resumes.mjs')],
|
|
325
307
|
],
|
|
@@ -330,6 +312,9 @@ export default {
|
|
|
330
312
|
matiereDansLesTests,
|
|
331
313
|
taillesDesTests,
|
|
332
314
|
cheminsDesTests,
|
|
315
|
+
taillesDesOutilsLourds,
|
|
316
|
+
prefixeDesTickets,
|
|
317
|
+
titresNommantUnTicket,
|
|
333
318
|
],
|
|
334
319
|
miseAJour: miseAJour(joueDesTests),
|
|
335
320
|
squelette,
|
|
@@ -140,7 +140,7 @@ function codesDuCode(dir, racine, prefixes) {
|
|
|
140
140
|
// Runs API Extractor on one component: whether the repository's report is up to date, the exports
|
|
141
141
|
// of the documentation model built from the code (whether or not the report exists) and the TSDoc
|
|
142
142
|
// messages of its comments.
|
|
143
|
-
function rapportApi(racine, c, entreeDts, ecrire, tsdocConfigFile) {
|
|
143
|
+
export function rapportApi(racine, c, entreeDts, ecrire, tsdocConfigFile) {
|
|
144
144
|
const { Extractor, ExtractorConfig } = require('@microsoft/api-extractor');
|
|
145
145
|
const { ApiModel } = require('@microsoft/api-extractor-model');
|
|
146
146
|
const pj = existsSync(path.join(c.dir, 'package.json'))
|
|
@@ -293,7 +293,7 @@ function fautesJugees(nom, textes, fautes, refus, codes) {
|
|
|
293
293
|
|
|
294
294
|
// The refusals for one export against its contract (`{ regle, texte }`), with the fault codes it
|
|
295
295
|
// and its members name.
|
|
296
|
-
function jugerExport(item, fautes) {
|
|
296
|
+
export function jugerExport(item, fautes) {
|
|
297
297
|
const refus = [];
|
|
298
298
|
const nom = `\`${item.displayName}\``;
|
|
299
299
|
const k = contratDe(item);
|
|
@@ -412,12 +412,12 @@ function entreeDe(item) {
|
|
|
412
412
|
}
|
|
413
413
|
|
|
414
414
|
// The text between the marks for <exports>: empty without export.
|
|
415
|
-
const partieGeneree = exports =>
|
|
415
|
+
export const partieGeneree = exports =>
|
|
416
416
|
exports.length ? `\n${exports.map(entreeDe).join('\n\n')}\n\n` : '\n';
|
|
417
417
|
|
|
418
418
|
// The text of an interface with its generated part replaced; the marks are added at the end of a
|
|
419
419
|
// text that has none.
|
|
420
|
-
function avecPartie(m, texte, partie) {
|
|
420
|
+
export function avecPartie(m, texte, partie) {
|
|
421
421
|
if (m.etat === 'absentes')
|
|
422
422
|
return `${texte}${texte.endsWith('\n') ? '' : '\n'}\n${DEBUT}${partie}${FIN}\n`;
|
|
423
423
|
const avant = m.lignes.slice(0, m.debut).join('\n');
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// From 0.30.0 the guard of the titles of the tests (scripts/langages/typescript/titres-de-tests.mjs)
|
|
2
|
+
// reads the prefix of the tickets from the key `issue-prefix` of `.beads/config.yaml`, committed,
|
|
3
|
+
// never from `bd`, which a CI does not have; a project without the key is refused by the guard.
|
|
4
|
+
// `bd init` writes that key commented out, and Beads keeps the prefix in its database.
|
|
5
|
+
//
|
|
6
|
+
// - The migration writes the key `issue-prefix: "<prefix>"` in `.beads/config.yaml` by the one
|
|
7
|
+
// writer of the key (`ecrireLePrefixe` of scripts/prefixe-des-tickets.mjs, which the preparation
|
|
8
|
+
// of a new project calls too), the prefix read once from Beads (`bd config get issue_prefix`,
|
|
9
|
+
// in the project), as the update runs at the poste, where bd is.
|
|
10
|
+
// - A file that already holds the key with a value is left, nothing said: a second pass changes
|
|
11
|
+
// nothing.
|
|
12
|
+
// - A project without `.beads/` holds no tickets of Beads in this tree: nothing to write. With
|
|
13
|
+
// `.beads/` but without its `config.yaml`, or a prefix Beads does not give, `aFaire` names the
|
|
14
|
+
// key to write.
|
|
15
|
+
import { spawnSync } from 'node:child_process';
|
|
16
|
+
import { existsSync } from 'node:fs';
|
|
17
|
+
import path from 'node:path';
|
|
18
|
+
import { CONFIG_BEADS as CONFIG, ecrireLePrefixe, prefixe } from '../../../services-du-noyau.mjs';
|
|
19
|
+
|
|
20
|
+
export const version = '0.30.0';
|
|
21
|
+
export const nom = 'préfixe des tickets';
|
|
22
|
+
|
|
23
|
+
// The prefix Beads gives in the project at <projet>, null without one.
|
|
24
|
+
function prefixeDeBeads(projet) {
|
|
25
|
+
const r = spawnSync('bd', ['config', 'get', 'issue_prefix'], {
|
|
26
|
+
cwd: projet,
|
|
27
|
+
encoding: 'utf8',
|
|
28
|
+
maxBuffer: 256 * 1024 * 1024,
|
|
29
|
+
});
|
|
30
|
+
const valeur = r.status === 0 ? String(r.stdout ?? '').trim() : '';
|
|
31
|
+
return valeur && !/\s/.test(valeur) ? valeur : null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** Writes the key `issue-prefix` of the project at <projet> when it lacks it; what it did. */
|
|
35
|
+
export function migrer(projet) {
|
|
36
|
+
const f = path.join(projet, CONFIG);
|
|
37
|
+
if (!existsSync(path.dirname(f))) {
|
|
38
|
+
return [];
|
|
39
|
+
}
|
|
40
|
+
if (!existsSync(f)) {
|
|
41
|
+
return [
|
|
42
|
+
{
|
|
43
|
+
aFaire: `${CONFIG} manque : écris-y la clé \`issue-prefix: "<préfixe>"\`, que la garde des titres des tests lit.`,
|
|
44
|
+
},
|
|
45
|
+
];
|
|
46
|
+
}
|
|
47
|
+
try {
|
|
48
|
+
prefixe(projet);
|
|
49
|
+
return [];
|
|
50
|
+
} catch {
|
|
51
|
+
// The key is missing or empty: it is written below.
|
|
52
|
+
}
|
|
53
|
+
const valeur = prefixeDeBeads(projet);
|
|
54
|
+
if (!valeur) {
|
|
55
|
+
return [
|
|
56
|
+
{
|
|
57
|
+
aFaire: `${CONFIG} : Beads ne donne pas le préfixe des tickets (\`bd config get issue_prefix\`) ; écris la clé \`issue-prefix: "<préfixe>"\`, que la garde des titres des tests lit.`,
|
|
58
|
+
},
|
|
59
|
+
];
|
|
60
|
+
}
|
|
61
|
+
const ligne = ecrireLePrefixe(projet, valeur);
|
|
62
|
+
return ligne ? [`${CONFIG} : ${ligne}, lu de Beads, que la garde des titres des tests lit`] : [];
|
|
63
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// From 0.30.0 the guard of the sizes of the tests (scripts/langages/typescript/tailles-des-tests.mjs)
|
|
2
|
+
// also sees large a test that mounts a temporary directory and starts a heavy tool of the product
|
|
3
|
+
// there (turbo, vitest, knip, depcruise, api-extractor), with a `cwd:`; the tests it classed medium
|
|
4
|
+
// become large tests of the day, and the main of a project that updates would turn red at its next
|
|
5
|
+
// pass. As the migration 0.25.0 does for the first rule, the update inscribes them as the project's
|
|
6
|
+
// known debt (scripts/dette.mjs), frozen: the count never rises and a new large test of the day is
|
|
7
|
+
// refused.
|
|
8
|
+
//
|
|
9
|
+
// - The migration inscribes the large tests of the day the guard finds that the debt does not hold
|
|
10
|
+
// yet; the debt already inscribed (the guard's, the other guards') stays.
|
|
11
|
+
// - It rewrites no test of the project: the project moves each one to the night (`*.nuit.test.*`)
|
|
12
|
+
// or reduces it, and the debt comes down with it.
|
|
13
|
+
// - Replayable without effect: once every finding is inscribed, nothing.
|
|
14
|
+
import { FICHIER, lire, trancher } from '../../../dette.mjs';
|
|
15
|
+
import { GARDE, verifier } from '../tailles-des-tests.mjs';
|
|
16
|
+
|
|
17
|
+
export const version = '0.30.0';
|
|
18
|
+
export const nom = 'tailles des outils lourds';
|
|
19
|
+
|
|
20
|
+
/** Inscribes the large tests of the day the debt of the project at <projet> lacks; what it did. */
|
|
21
|
+
export function migrer(projet) {
|
|
22
|
+
const inscrite = lire(projet)[GARDE] ?? {};
|
|
23
|
+
const constats = verifier(projet);
|
|
24
|
+
const neufs = constats.filter(c => !inscrite[c.fichier]?.[c.regle]);
|
|
25
|
+
if (neufs.length === 0) return [];
|
|
26
|
+
// Inscribed counts stay; a finding without key is added at its count.
|
|
27
|
+
trancher(projet, GARDE, constats, 'inscrire', {});
|
|
28
|
+
return [
|
|
29
|
+
`${FICHIER} : ${neufs.length} grand(s) test(s) de jour inscrit(s) dans la dette de ${GARDE}, gelée ; un grand test de jour neuf est refusé, et chacun passe à la nuit (*.nuit.test.*) ou se réduit`,
|
|
30
|
+
];
|
|
31
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// From 0.30.0 the guard of the titles of the tests (scripts/langages/typescript/titres-de-tests.mjs)
|
|
2
|
+
// refuses a test file whose titles name a ticket or a « critère N » beyond its debt; the titles a
|
|
3
|
+
// project already has would turn its main red at its next pass. As the migration of the large
|
|
4
|
+
// tests of the day does (./0.30.0-tailles-des-outils-lourds.mjs), the update inscribes them as the
|
|
5
|
+
// project's known debt (scripts/dette.mjs), frozen: the count never rises, and each title renamed
|
|
6
|
+
// by its behaviour lowers it.
|
|
7
|
+
//
|
|
8
|
+
// - It plays after the migration of the prefix of the tickets (./0.30.0-prefixe-des-tickets.mjs),
|
|
9
|
+
// whose key it reads; without the key it inscribes nothing, and the guard names the key.
|
|
10
|
+
// - The migration inscribes the files the debt does not hold yet; the debt already inscribed (the
|
|
11
|
+
// guard's, the other guards') stays.
|
|
12
|
+
// - It rewrites no test of the project.
|
|
13
|
+
// - Replayable without effect: once every finding is inscribed, nothing.
|
|
14
|
+
import { FICHIER, lire, trancher } from '../../../dette.mjs';
|
|
15
|
+
import { prefixe } from '../../../services-du-noyau.mjs';
|
|
16
|
+
import { GARDE, verifier } from '../titres-de-tests.mjs';
|
|
17
|
+
|
|
18
|
+
export const version = '0.30.0';
|
|
19
|
+
export const nom = 'titres nommant un ticket';
|
|
20
|
+
|
|
21
|
+
/** Inscribes the titles naming a ticket that the debt of the project at <projet> lacks; what it did. */
|
|
22
|
+
export function migrer(projet) {
|
|
23
|
+
let pref;
|
|
24
|
+
try {
|
|
25
|
+
pref = prefixe(projet);
|
|
26
|
+
} catch {
|
|
27
|
+
return [];
|
|
28
|
+
}
|
|
29
|
+
const inscrite = lire(projet)[GARDE] ?? {};
|
|
30
|
+
const constats = verifier(projet, pref);
|
|
31
|
+
const neufs = constats.filter(c => !inscrite[c.fichier]?.[c.regle]);
|
|
32
|
+
if (neufs.length === 0) {
|
|
33
|
+
return [];
|
|
34
|
+
}
|
|
35
|
+
trancher(projet, GARDE, constats, 'inscrire', {});
|
|
36
|
+
const fichiers = new Set(neufs.map(c => c.fichier)).size;
|
|
37
|
+
return [
|
|
38
|
+
`${FICHIER} : ${neufs.length} titre(s) de test nommant un ticket ou un « critère N », dans ${fichiers} fichier(s), inscrit(s) dans la dette de ${GARDE}, gelée ; chacun se renomme par son comportement, et la dette baisse avec lui`,
|
|
39
|
+
];
|
|
40
|
+
}
|
|
@@ -50,9 +50,8 @@ import { copyFileSync, existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
|
50
50
|
import { createRequire } from 'node:module';
|
|
51
51
|
import path from 'node:path';
|
|
52
52
|
import { CODE, paquets, TYPAGE } from '../../paquets.mjs';
|
|
53
|
-
import { sources } from '../../services-du-noyau.mjs';
|
|
53
|
+
import { SCRIPT_DES_TESTS, sources } from '../../services-du-noyau.mjs';
|
|
54
54
|
import { estUnTest } from './regle-des-tests.mjs';
|
|
55
|
-
import { SCRIPT_DES_TESTS } from './script-des-tests.mjs';
|
|
56
55
|
|
|
57
56
|
// The frame's package, as a project declares it, and its base configuration of Vitest.
|
|
58
57
|
const PAQUET_DU_CADRE = '@roomi-fields/grillhouse';
|
|
@@ -11,6 +11,10 @@
|
|
|
11
11
|
//
|
|
12
12
|
// Any other file is none of them: null.
|
|
13
13
|
//
|
|
14
|
+
// The sibling of HEAD's version of a test file Vitest plays (`soeurDAvant`), which the proof of
|
|
15
|
+
// the red plays beside it: `<nom>.circuit-avant.<test|spec>.<ext>`, the mark of a night test or of
|
|
16
|
+
// a bench kept before it (`<nom>.circuit-avant.nuit.test.<ext>`), so that it plays as its file.
|
|
17
|
+
//
|
|
14
18
|
// What the testwriter writes of the manifests (`manifestes`): the field that declares what the
|
|
15
19
|
// tests of a package depend on, `devDependencies` of its package.json (npm's docs,
|
|
16
20
|
// « devDependencies »), as the author of a test of Bazel declares the deps of its target; and
|
|
@@ -46,6 +50,15 @@ export function estUnTest(chemin, racine) {
|
|
|
46
50
|
return joue || test || matiere ? { joue, test, matiere } : null;
|
|
47
51
|
}
|
|
48
52
|
|
|
53
|
+
// The sibling of HEAD's version of the test file <chemin> (from the root <racine>), which Vitest
|
|
54
|
+
// plays in the same run: `<nom>.circuit-avant.<test|spec>.<ext>` beside it, a name of NOM_DE_TEST,
|
|
55
|
+
// of its file's kind (`.nuit` or `.budget` kept before `.test`);
|
|
56
|
+
// null for a file Vitest does not play.
|
|
57
|
+
export function soeurDAvant(chemin, racine) {
|
|
58
|
+
if (!estUnTest(chemin, racine)?.joue) return null;
|
|
59
|
+
return chemin.replace(/((?:\.nuit|\.budget)?\.(?:test|spec)\.[cm]?[jt]sx?)$/, '.circuit-avant$1');
|
|
60
|
+
}
|
|
61
|
+
|
|
49
62
|
// The field of a manifest that declares what its tests depend on.
|
|
50
63
|
const DES_TESTS = 'devDependencies';
|
|
51
64
|
|
|
@@ -17,9 +17,17 @@
|
|
|
17
17
|
// - The workspace: the root package.json receives the package's path in its `workspaces` (created
|
|
18
18
|
// when the root has none), unless a pattern there covers it already.
|
|
19
19
|
// - The lock of the versions: `npm install`, at the root.
|
|
20
|
+
// - A folder that already holds code is taken as it is when its code lies under `src/` and
|
|
21
|
+
// `tests/`, which its tsconfig.json and its vitest.config.ts cover, each file present kept; a
|
|
22
|
+
// file of code out of them (`.ts`, `.tsx`, `.mts`, `.cts`, `.js`, `.jsx`, `.mjs`, `.cjs`), which
|
|
23
|
+
// neither its typing nor its tests would reach, is refused by its name, nothing written, the
|
|
24
|
+
// layout named, in place of a skeleton beside it.
|
|
20
25
|
import { existsSync, readFileSync } from 'node:fs';
|
|
21
26
|
import path from 'node:path';
|
|
22
27
|
|
|
28
|
+
// A file of code of TypeScript or JavaScript.
|
|
29
|
+
const CODE = /\.(?:[cm]?[jt]s|[jt]sx)$/;
|
|
30
|
+
|
|
23
31
|
const CHAMPS = ['dependencies', 'devDependencies', 'optionalDependencies'];
|
|
24
32
|
// The tools of a package's tests and of its typing, at the versions of the module's template.
|
|
25
33
|
const OUTILS_DU_PAQUET = ['@types/node', 'typescript', 'vitest'];
|
|
@@ -68,12 +76,20 @@ export default mergeConfig(
|
|
|
68
76
|
`;
|
|
69
77
|
|
|
70
78
|
/** @type {import('../../jointure.js').Langage['squelette']} */
|
|
71
|
-
export function squelette(racine, { chemin, modele }) {
|
|
79
|
+
export function squelette(racine, { chemin, modele, existants }) {
|
|
72
80
|
if (!/^packages\/[^/]+$/.test(chemin)) {
|
|
73
81
|
throw new Error(
|
|
74
82
|
`${chemin} : un paquet typescript vit sous packages/<nom>, où le module trouve ses composants.`
|
|
75
83
|
);
|
|
76
84
|
}
|
|
85
|
+
const hors = existants.filter(
|
|
86
|
+
f => CODE.test(f) && !f.startsWith('src/') && !f.startsWith('tests/')
|
|
87
|
+
);
|
|
88
|
+
if (hors.length) {
|
|
89
|
+
throw new Error(
|
|
90
|
+
`${chemin} : ${hors.join(', ')} hors de la disposition du module typescript : son code sous src/, ses tests sous tests/, que son typage et ses tests couvrent. Range le code ainsi, puis relance la commande.`
|
|
91
|
+
);
|
|
92
|
+
}
|
|
77
93
|
const racinePkg = lireJson(path.join(racine, 'package.json')) ?? {};
|
|
78
94
|
const nom = path.posix.basename(chemin);
|
|
79
95
|
const portee = /^(@[^/]+)\//.exec(String(racinePkg.name ?? ''))?.[1];
|
|
@@ -116,5 +132,5 @@ export function squelette(racine, { chemin, modele }) {
|
|
|
116
132
|
}
|
|
117
133
|
espace = { fichier: 'package.json', texte: json(p) };
|
|
118
134
|
}
|
|
119
|
-
return { fichiers, espace, verrouiller: { commande: 'npm', args: ['install'], dossier: '.' } };
|
|
135
|
+
return { fichiers, espace, verrouiller: [{ commande: 'npm', args: ['install'], dossier: '.' }] };
|
|
120
136
|
}
|
|
@@ -18,11 +18,18 @@
|
|
|
18
18
|
// test is classed the day the rule arrives.
|
|
19
19
|
// - large (`grand`): it mounts a trial repository (git's `init`, `clone` or `worktree add`) and
|
|
20
20
|
// starts there something else than git (node, npm, a shell, a binary of the product);
|
|
21
|
+
// or it mounts a temporary directory (`mkdtemp`, `tmpdir`) and, in a process call carrying
|
|
22
|
+
// `cwd:` (or `-C`, `--prefix`), starts one of the heavy tools of OUTILS_LOURDS (turbo,
|
|
23
|
+
// vitest, knip, depcruise, api-extractor), named by a literal argument or a literal path to
|
|
24
|
+
// its binary, with no `git init` (grillhouse-44b.10.4, Bazel's test-encyclopedia: a test
|
|
25
|
+
// that runs the product in a trial project is large). A tool named by a variable, or run by
|
|
26
|
+
// an npm script (`npm run verifier`), escapes the reading and the test stays medium; so
|
|
27
|
+
// does a call without `cwd` (on the repository);
|
|
21
28
|
// - medium (`moyen`): it starts a process (it imports `child_process`, `execa` or `zx`), or it
|
|
22
29
|
// imports several modules of the repository;
|
|
23
30
|
// - small (`petit`): it imports one module of the repository at most, and starts no process.
|
|
24
31
|
// - A large test of the day is a finding, `{ fichier, regle: 'grand-de-jour', message }`; a night
|
|
25
|
-
// test or a time budget bench (
|
|
32
|
+
// test or a time budget bench (`deNuitOuBanc`, ./vitest-config/cibles.mjs) is never one. A finding
|
|
26
33
|
// inscribed in the project's debt (`grillhouse-dette.json`, ./dette.mjs) passes: the large tests
|
|
27
34
|
// of the day that exist when the rule arrives are inscribed there by the update
|
|
28
35
|
// (./migrations/0.25.0-tailles-des-tests.mjs), the count never rises, and a new one is refused.
|
|
@@ -33,7 +40,7 @@ import path from 'node:path';
|
|
|
33
40
|
import { pathToFileURL } from 'node:url';
|
|
34
41
|
import { trancher } from '../../dette.mjs';
|
|
35
42
|
import { matieres } from './composants.mjs';
|
|
36
|
-
import {
|
|
43
|
+
import { deNuitOuBanc } from './vitest-config/cibles.mjs';
|
|
37
44
|
import {
|
|
38
45
|
IMPORT,
|
|
39
46
|
lireLeDisque,
|
|
@@ -56,6 +63,33 @@ const APPEL =
|
|
|
56
63
|
/(?:(?<![\w$])(?:spawnSync|spawn|execFileSync|execFile|execSync|fork|execaSync|execa)|(?<![.\w$])exec)\s*\(\s*([^,)\n]*)/g;
|
|
57
64
|
// A first argument that names git.
|
|
58
65
|
const GIT = /^['"`]git(?:['"`]|\s)/;
|
|
66
|
+
/** The heavy tools of the product: a test that starts one in a trial project is large. */
|
|
67
|
+
export const OUTILS_LOURDS = ['turbo', 'vitest', 'knip', 'depcruise', 'api-extractor'];
|
|
68
|
+
// A temporary directory mounted.
|
|
69
|
+
const DOSSIER_TEMPORAIRE = /\bmkdtemp(?:Sync)?\b|\btmpdir\b/;
|
|
70
|
+
// An option of a call that carries the directory the process runs in.
|
|
71
|
+
const OPTION_DE_DOSSIER = /\bcwd\b|['"`](?:-C|--prefix)['"`]/;
|
|
72
|
+
// A heavy tool named by a literal in a call: a name, or the end of a path to its binary.
|
|
73
|
+
const OUTIL_LITTERAL = new RegExp(`(?:^|[\\s'"\`/])(?:${OUTILS_LOURDS.join('|')})(?=$|[\\s'"\`])`);
|
|
74
|
+
// The text of the call whose `(` is at <debut> in <texte>, to its closing parenthesis.
|
|
75
|
+
function appelComplet(texte, debut) {
|
|
76
|
+
let profondeur = 0;
|
|
77
|
+
const fin = Math.min(texte.length, debut + 2000);
|
|
78
|
+
for (let i = debut; i < fin; i++) {
|
|
79
|
+
if (texte[i] === '(') profondeur++;
|
|
80
|
+
else if (texte[i] === ')' && --profondeur === 0) return texte.slice(debut, i + 1);
|
|
81
|
+
}
|
|
82
|
+
return texte.slice(debut, fin);
|
|
83
|
+
}
|
|
84
|
+
// Whether <texte> mounts a temporary directory and, in a process call carrying `cwd`, `-C` or
|
|
85
|
+
// `--prefix`, starts a heavy tool named by a literal.
|
|
86
|
+
function outilLourdEnProjetDEssai(texte) {
|
|
87
|
+
if (!DOSSIER_TEMPORAIRE.test(texte)) return false;
|
|
88
|
+
return [...texte.matchAll(APPEL)].some(m => {
|
|
89
|
+
const appel = appelComplet(texte, m.index + m[0].indexOf('('));
|
|
90
|
+
return OPTION_DE_DOSSIER.test(appel) && OUTIL_LITTERAL.test(appel);
|
|
91
|
+
});
|
|
92
|
+
}
|
|
59
93
|
// A re-export of a whole module.
|
|
60
94
|
const TOUT_REEXPORTE = /\bexport\s*\*\s*from\b/;
|
|
61
95
|
// The names an import clause <clause> takes in braces (`import { a, b as c }` gives a and b);
|
|
@@ -90,7 +124,7 @@ function entreeDeLaMatiere(paquet) {
|
|
|
90
124
|
// The packages of the shared test material of the repository at <racine>: `[{ nom, dir, entree }]`,
|
|
91
125
|
// `nom` the name by which a test imports it, `dir` its directory and `entree` the file of its
|
|
92
126
|
// entry `./test-fixtures`, absolute.
|
|
93
|
-
function lesMatieres(racine) {
|
|
127
|
+
export function lesMatieres(racine) {
|
|
94
128
|
return matieres(racine).flatMap(({ dir, paquet }) => {
|
|
95
129
|
let pkg;
|
|
96
130
|
try {
|
|
@@ -150,7 +184,7 @@ export function classer(fichier, lire, racine = path.parse(fichier).root, lesMat
|
|
|
150
184
|
const processus = PROCESSUS.test(tout);
|
|
151
185
|
const autreQueGit = [...tout.matchAll(APPEL)].some(m => !GIT.test(m[1].trim()));
|
|
152
186
|
const taille =
|
|
153
|
-
processus && autreQueGit && DEPOT_D_ESSAI.test(tout)
|
|
187
|
+
processus && ((autreQueGit && DEPOT_D_ESSAI.test(tout)) || outilLourdEnProjetDEssai(tout))
|
|
154
188
|
? 'grand'
|
|
155
189
|
: processus || modules.size > 1
|
|
156
190
|
? 'moyen'
|
|
@@ -158,9 +192,6 @@ export function classer(fichier, lire, racine = path.parse(fichier).root, lesMat
|
|
|
158
192
|
return { taille, modules: [...modules] };
|
|
159
193
|
}
|
|
160
194
|
|
|
161
|
-
// Whether <r>, a path from the root, is a night test or a time budget bench.
|
|
162
|
-
const horsDuJour = r => HORS_DU_JOUR.some(p => path.matchesGlob(r, p));
|
|
163
|
-
|
|
164
195
|
// The directories a listing out of git leaves out.
|
|
165
196
|
const HORS = /(?:^|\/)(?:node_modules|dist|\.git|\.turbo|\.claude)$/;
|
|
166
197
|
|
|
@@ -186,7 +217,7 @@ export function tailles(racine) {
|
|
|
186
217
|
return testsDuDepot(racine).map(fichier => ({
|
|
187
218
|
fichier,
|
|
188
219
|
taille: classer(path.join(racine, fichier), lireLeDisque, racine, m).taille,
|
|
189
|
-
nuit:
|
|
220
|
+
nuit: deNuitOuBanc(fichier),
|
|
190
221
|
}));
|
|
191
222
|
}
|
|
192
223
|
|
|
@@ -200,7 +231,7 @@ export function verifier(racine) {
|
|
|
200
231
|
.map(({ fichier }) => ({
|
|
201
232
|
fichier,
|
|
202
233
|
regle: GRAND_DE_JOUR,
|
|
203
|
-
message: `${fichier} : un grand test (il monte un dépôt d'essai et y lance le produit ou le cadre) est un test de nuit, jamais joué au fil du travail ; il se renomme en *.nuit.test.*, ou il se réduit à la plus petite taille qui prouve son critère.`,
|
|
234
|
+
message: `${fichier} : un grand test (il monte un dépôt ou un projet d'essai et y lance le produit ou le cadre) est un test de nuit, jamais joué au fil du travail ; il se renomme en *.nuit.test.*, ou il se réduit à la plus petite taille qui prouve son critère.`,
|
|
204
235
|
}));
|
|
205
236
|
}
|
|
206
237
|
|