@roomi-fields/grillhouse 0.29.0 → 0.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +739 -0
- package/bin/grillhouse.mjs +79 -18
- package/cadre/templates/projet/.github/workflows/ci.yml +2 -13
- package/cadre/templates/projet/CLAUDE.md +5 -1
- package/cadre/templates/projet/docs/agents/issue-tracker.md +1 -1
- package/cadre/templates/projet/package.json +2 -2
- package/charte.md +24 -0
- package/dist/temporal/acte.d.ts +24 -0
- package/dist/temporal/acte.js +139 -0
- package/dist/temporal/acte.js.map +1 -0
- package/dist/temporal/attributs.d.ts +6 -0
- package/dist/temporal/attributs.js +15 -0
- package/dist/temporal/attributs.js.map +1 -0
- package/dist/temporal/circuit/activites.d.ts +13 -0
- package/dist/temporal/circuit/activites.js +33 -0
- package/dist/temporal/circuit/activites.js.map +1 -0
- package/dist/temporal/circuit/client.d.ts +72 -0
- package/dist/temporal/circuit/client.js +247 -0
- package/dist/temporal/circuit/client.js.map +1 -0
- package/dist/temporal/circuit/commande.d.ts +2 -0
- package/dist/temporal/circuit/commande.js +238 -0
- package/dist/temporal/circuit/commande.js.map +1 -0
- package/dist/temporal/circuit/contrat.d.ts +305 -0
- package/dist/temporal/circuit/contrat.js +24 -0
- package/dist/temporal/circuit/contrat.js.map +1 -0
- package/dist/temporal/circuit/deroule.d.ts +3 -0
- package/dist/temporal/circuit/deroule.js +540 -0
- package/dist/temporal/circuit/deroule.js.map +1 -0
- package/dist/temporal/client.d.ts +47 -0
- package/dist/temporal/client.js +69 -0
- package/dist/temporal/client.js.map +1 -0
- package/dist/temporal/commande.d.ts +2 -0
- package/dist/temporal/commande.js +95 -0
- package/dist/temporal/commande.js.map +1 -0
- package/dist/temporal/deroules.d.ts +5 -0
- package/dist/temporal/deroules.js +10 -0
- package/dist/temporal/deroules.js.map +1 -0
- package/dist/temporal/etat.d.ts +33 -0
- package/dist/temporal/etat.js +59 -0
- package/dist/temporal/etat.js.map +1 -0
- package/dist/temporal/file/activites.d.ts +10 -0
- package/dist/temporal/file/activites.js +25 -0
- package/dist/temporal/file/activites.js.map +1 -0
- package/dist/temporal/file/client.d.ts +4 -0
- package/dist/temporal/file/client.js +6 -0
- package/dist/temporal/file/client.js.map +1 -0
- package/dist/temporal/file/contrat.d.ts +158 -0
- package/dist/temporal/file/contrat.js +14 -0
- package/dist/temporal/file/contrat.js.map +1 -0
- package/dist/temporal/file/deroule.d.ts +15 -0
- package/dist/temporal/file/deroule.js +235 -0
- package/dist/temporal/file/deroule.js.map +1 -0
- package/dist/temporal/installation.d.ts +124 -0
- package/dist/temporal/installation.js +408 -0
- package/dist/temporal/installation.js.map +1 -0
- package/dist/temporal/places/activites.d.ts +8 -0
- package/dist/temporal/places/activites.js +13 -0
- package/dist/temporal/places/activites.js.map +1 -0
- package/dist/temporal/places/client.d.ts +28 -0
- package/dist/temporal/places/client.js +64 -0
- package/dist/temporal/places/client.js.map +1 -0
- package/dist/temporal/places/contrat.d.ts +106 -0
- package/dist/temporal/places/contrat.js +21 -0
- package/dist/temporal/places/contrat.js.map +1 -0
- package/dist/temporal/places/deroule.d.ts +3 -0
- package/dist/temporal/places/deroule.js +198 -0
- package/dist/temporal/places/deroule.js.map +1 -0
- package/dist/temporal/sonde/activites.d.ts +6 -0
- package/dist/temporal/sonde/activites.js +52 -0
- package/dist/temporal/sonde/activites.js.map +1 -0
- package/dist/temporal/sonde/contrat.d.ts +35 -0
- package/dist/temporal/sonde/contrat.js +10 -0
- package/dist/temporal/sonde/contrat.js.map +1 -0
- package/dist/temporal/sonde/deroule.d.ts +3 -0
- package/dist/temporal/sonde/deroule.js +39 -0
- package/dist/temporal/sonde/deroule.js.map +1 -0
- package/dist/temporal/tickets/activites.d.ts +7 -0
- package/dist/temporal/tickets/activites.js +81 -0
- package/dist/temporal/tickets/activites.js.map +1 -0
- package/dist/temporal/tickets/client.d.ts +10 -0
- package/dist/temporal/tickets/client.js +31 -0
- package/dist/temporal/tickets/client.js.map +1 -0
- package/dist/temporal/tickets/contrat.d.ts +56 -0
- package/dist/temporal/tickets/contrat.js +13 -0
- package/dist/temporal/tickets/contrat.js.map +1 -0
- package/dist/temporal/tickets/deroule.d.ts +3 -0
- package/dist/temporal/tickets/deroule.js +94 -0
- package/dist/temporal/tickets/deroule.js.map +1 -0
- package/dist/temporal/travailleur.d.ts +2 -0
- package/dist/temporal/travailleur.js +69 -0
- package/dist/temporal/travailleur.js.map +1 -0
- package/docs/ARCHITECTURE.md +609 -80
- package/docs/CADRE.md +17 -0
- package/docs/INTERFACE.md +134 -42
- package/hooks/crochet.mjs +19 -2
- package/hooks/hooks.json +11 -0
- package/package.json +16 -4
- package/scripts/activites.mjs +2182 -0
- package/scripts/aiguillage.d.mts +37 -0
- package/scripts/aiguillage.mjs +7 -3
- package/scripts/avancement.mjs +128 -16
- package/scripts/bilan.mjs +37 -19
- package/scripts/cadre.mjs +11 -2
- package/scripts/circuit.mjs +881 -4059
- package/scripts/circuits-cles.d.mts +4 -0
- package/scripts/circuits-cles.mjs +21 -0
- package/scripts/circuits-du-serveur.mjs +105 -0
- package/scripts/codes-de-sortie.mjs +9 -0
- package/scripts/commandes-composees.mjs +45 -41
- package/scripts/commandes-du-path.d.mts +7 -0
- package/scripts/commandes-du-path.mjs +25 -0
- package/scripts/composition-des-langages.mjs +16 -12
- package/scripts/conformite.mjs +6 -13
- package/scripts/copies-finies.mjs +52 -47
- package/scripts/depart-du-ticket.d.mts +53 -0
- package/scripts/depart-du-ticket.mjs +124 -0
- package/scripts/dependances-internes.mjs +115 -0
- package/scripts/dernier-vert.mjs +7 -15
- package/scripts/donnees-cles.mjs +228 -0
- package/scripts/droits.mjs +11 -1
- package/scripts/effets.mjs +352 -0
- package/scripts/enveloppe/enveloppe.mjs +119 -8
- package/scripts/enveloppe/lancer.sh +14 -18
- package/scripts/enveloppe/paquets-du-plan.mjs +2 -2
- package/scripts/enveloppe/travail-de-la-copie.mjs +5 -1
- package/scripts/etapes.mjs +5 -2
- package/scripts/faits-du-circuit.mjs +493 -0
- package/scripts/file-des-tickets.d.mts +21 -0
- package/scripts/file-des-tickets.mjs +58 -0
- package/scripts/flux-des-paquets.mjs +187 -0
- package/scripts/gardes-du-cadre.mjs +12 -2
- package/scripts/integration/file.mjs +475 -420
- package/scripts/integration/integrer.mjs +17 -19
- package/scripts/integration/rejeu.mjs +19 -4
- package/scripts/jointure.d.ts +145 -27
- package/scripts/langages/cargo/commandes.mjs +289 -109
- package/scripts/langages/cargo/composants.mjs +130 -34
- package/scripts/langages/cargo/exemples.mjs +12 -21
- package/scripts/langages/cargo/index.mjs +18 -8
- package/scripts/langages/cargo/sccache.mjs +8 -14
- package/scripts/langages/python/commandes.mjs +216 -100
- package/scripts/langages/python/composants.mjs +53 -21
- package/scripts/langages/python/exemples.mjs +6 -16
- package/scripts/langages/python/index.mjs +24 -8
- package/scripts/langages/python/lot.mjs +1 -36
- package/scripts/langages/typescript/construire.mjs +6 -163
- package/scripts/langages/typescript/exemples.mjs +3 -11
- package/scripts/langages/typescript/frontieres.mjs +1 -1
- package/scripts/langages/typescript/index.mjs +43 -61
- package/scripts/langages/typescript/interfaces-contre-code.mjs +4 -4
- package/scripts/langages/typescript/migrations/0.30.0-prefixe-des-tickets.mjs +63 -0
- package/scripts/langages/typescript/migrations/0.30.0-tailles-des-outils-lourds.mjs +31 -0
- package/scripts/langages/typescript/migrations/0.30.0-titres-nommant-un-ticket.mjs +40 -0
- package/scripts/langages/typescript/mise-a-jour.mjs +1 -2
- package/scripts/langages/typescript/tailles-des-tests.mjs +40 -9
- package/scripts/langages/typescript/tests-de-nuit.mjs +12 -9
- package/scripts/langages/typescript/tests.mjs +17 -8
- package/scripts/langages/typescript/titres-de-tests.mjs +297 -0
- package/scripts/langages/typescript/turbo-des-paquets.mjs +183 -38
- package/scripts/langages/typescript/verdict.mjs +1 -1
- package/scripts/langages/typescript/verifier.mjs +31 -11
- package/scripts/langages/typescript/vitest-config/base.mjs +22 -1
- package/scripts/langages/typescript/vitest-config/bornes.mjs +13 -0
- package/scripts/langages/typescript/vitest-config/cibles.mjs +36 -14
- package/scripts/langages/typescript/vitest-config/delais.mjs +54 -0
- package/scripts/langages/typescript/vitest-config/delais.setup.mjs +11 -0
- package/scripts/langages/typescript/vitest-config/duree.classement.mjs +100 -0
- package/scripts/langages/typescript/vitest-config/duree.reporter.mjs +49 -63
- package/scripts/langages/typescript/vitest-config/machine.setup.mjs +3 -0
- package/scripts/langages/typescript/vitest.nuit.config.mjs +4 -0
- package/scripts/mesure/pression.mjs +3 -3
- package/scripts/mesure-de-la-machine.d.mts +21 -0
- package/scripts/mesure-de-la-machine.mjs +76 -0
- package/scripts/migrations/0.23.2-copies-du-cadre.mjs +8 -2
- package/scripts/migrations/0.30.0-ci-appelle-la-verification.mjs +120 -0
- package/scripts/migrations/0.31.0-paquets-dans-le-graphe.mjs +81 -0
- package/scripts/migrations.mjs +5 -0
- package/scripts/nuit.sh +10 -3
- package/scripts/outils-cles.d.mts +24 -0
- package/scripts/outils-cles.mjs +0 -1
- package/scripts/paquet-npm.mjs +147 -0
- package/scripts/paquet.mjs +73 -4
- package/scripts/paquets.mjs +34 -6
- package/scripts/passe-de-la-machine.mjs +66 -0
- package/scripts/places-de-la-machine.mjs +360 -0
- package/scripts/places-du-serveur.mjs +170 -0
- package/scripts/prefixe-des-tickets.mjs +68 -0
- package/scripts/preparation.mjs +10 -3
- package/scripts/registre.mjs +3 -2
- package/scripts/regles-des-places.d.mts +36 -0
- package/scripts/regles-des-places.mjs +70 -0
- package/scripts/reponses-du-circuit.d.mts +6 -0
- package/scripts/reponses-du-circuit.mjs +28 -0
- package/scripts/resultats.mjs +7 -9
- package/scripts/retirer-les-copies-finies.mjs +25 -0
- package/scripts/sans-reponse.d.mts +4 -0
- package/scripts/sans-reponse.mjs +13 -0
- package/scripts/seances.mjs +918 -0
- package/scripts/services-du-noyau.mjs +26 -8
- package/scripts/session-start.sh +2 -2
- package/scripts/sortie.mjs +3 -3
- package/scripts/sous-commandes.mjs +38 -9
- package/scripts/style-a-l-ecriture.mjs +229 -0
- package/scripts/superviseur.mjs +122 -111
- package/scripts/tableau.mjs +148 -110
- package/scripts/taches-du-graphe.mjs +328 -0
- package/scripts/ticket-du-circuit.mjs +206 -0
- package/scripts/transitions.d.mts +148 -0
- package/scripts/transitions.mjs +901 -0
- package/scripts/verrou-de-fichier.mjs +2 -2
- package/scripts/verrou-de-machine.mjs +28 -13
- package/skills/explorateur/SKILL.md +2 -1
- package/skills/pitmaster/SKILL.md +17 -18
- package/skills/pitmaster/references/consigne-agent.md +5 -1
- package/skills/release/SKILL.md +3 -3
- package/skills/relecteur/SKILL.md +4 -2
- package/skills/testwriter/SKILL.md +36 -24
- package/scripts/demon.mjs +0 -251
- package/scripts/integration/file-attente.mjs +0 -61
- package/scripts/langages/cargo/touches.mjs +0 -93
- package/scripts/langages/typescript/script-des-tests.mjs +0 -6
|
@@ -18,9 +18,10 @@
|
|
|
18
18
|
// `requires-python` and `.python-version`. The rules that refuse a role that writes pytest run
|
|
19
19
|
// directly (`droits`).
|
|
20
20
|
// - The packages, a file's, the test files, what the testwriter writes, of the manifests too, the
|
|
21
|
-
// readers, the entries of the index of the interfaces (./composants.mjs); the
|
|
22
|
-
//
|
|
23
|
-
// - The commands `tester
|
|
21
|
+
// readers, the entries of the index of the interfaces (./composants.mjs); the elements of a lot
|
|
22
|
+
// (./lot.mjs).
|
|
23
|
+
// - The commands `tester` (the projects' tasks of Turborepo), `tests-du-paquet` (the body of a
|
|
24
|
+
// project's task), `verifier`, `typer`, `preparer` and `tests-de-nuit` (./commandes.mjs),
|
|
24
25
|
// each described, never run, and the verdict of a run (./verdict.mjs); the guard of the sizes of
|
|
25
26
|
// the tests (./tailles-des-tests.mjs) and the index of the interfaces up to date, each a command
|
|
26
27
|
// by its name too. The generated file, the index of the interfaces (./index-interfaces.mjs), its
|
|
@@ -37,14 +38,17 @@ import {
|
|
|
37
38
|
composantDans,
|
|
38
39
|
composants,
|
|
39
40
|
entreesDeLIndex,
|
|
41
|
+
estDeNuit,
|
|
40
42
|
estUnTest,
|
|
41
|
-
|
|
43
|
+
arbreDAvant,
|
|
42
44
|
joueDesTests,
|
|
43
45
|
lecteurs,
|
|
46
|
+
liensDuManifeste,
|
|
44
47
|
manifestes,
|
|
48
|
+
nomDuManifeste,
|
|
45
49
|
} from './composants.mjs';
|
|
46
50
|
import { enRetard, SORTIE } from './index-interfaces.mjs';
|
|
47
|
-
import { elementsDuLot
|
|
51
|
+
import { elementsDuLot } from './lot.mjs';
|
|
48
52
|
import { miseAJour } from './mise-a-jour.mjs';
|
|
49
53
|
import { squelette } from './squelette.mjs';
|
|
50
54
|
import { verdict } from './verdict.mjs';
|
|
@@ -54,6 +58,15 @@ const ici = nom => path.join(path.dirname(fileURLToPath(import.meta.url)), nom);
|
|
|
54
58
|
export default {
|
|
55
59
|
nom: 'python',
|
|
56
60
|
manifeste: 'pyproject.toml',
|
|
61
|
+
nomDuManifeste,
|
|
62
|
+
liensDuManifeste,
|
|
63
|
+
construireLesPaquets: () => {
|
|
64
|
+
throw new Error('construction non prise en charge pour python');
|
|
65
|
+
},
|
|
66
|
+
// No output of a project of Python is a datum of another package's tests.
|
|
67
|
+
sortieDuPaquet: () => {
|
|
68
|
+
throw new Error('sortie non prise en charge pour python');
|
|
69
|
+
},
|
|
57
70
|
outils: ['smol-toml'],
|
|
58
71
|
binaires: JSON.parse(readFileSync(ici('binaires.json'), 'utf8')),
|
|
59
72
|
ignorer: ['.venv', '.pytest_cache', PYCACHE],
|
|
@@ -74,13 +87,16 @@ export default {
|
|
|
74
87
|
matieres: () => [],
|
|
75
88
|
joueDesTests,
|
|
76
89
|
lecteurs,
|
|
77
|
-
touches,
|
|
78
90
|
elementsDuLot,
|
|
79
91
|
commandes,
|
|
80
92
|
verdict,
|
|
81
93
|
estUnTest,
|
|
82
|
-
|
|
83
|
-
|
|
94
|
+
// A night test, `*_nuit_test.py` (`estDeNuit`).
|
|
95
|
+
horsDuJour: chemin => estDeNuit(path.basename(chemin)),
|
|
96
|
+
arbreDAvant,
|
|
97
|
+
// Its tree needs no environment of its own: the virtual environment of a tree is uv's.
|
|
98
|
+
envDArbre: () => ({}),
|
|
99
|
+
// Its tool plays HEAD's version of each test file in a tree (`arbreDAvant`): no name to read.
|
|
84
100
|
testsDeHead: () => null,
|
|
85
101
|
manifestes,
|
|
86
102
|
fichiersEngendres: () => [
|
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
// The changes of a project of Python read by git: the
|
|
2
|
-
// of the join, scripts/jointure.d.ts) and the elements of a lot (`elementsDuLot`).
|
|
1
|
+
// The changes of a project of Python read by git: the elements of a lot (`elementsDuLot`).
|
|
3
2
|
//
|
|
4
|
-
// - The files changed since a commit: what git sees changed, the working tree and the untracked
|
|
5
|
-
// files included (`git diff --name-only --no-renames <depuis>`, `git ls-files -o
|
|
6
|
-
// --exclude-standard`). Each touches the package of the longest folder that holds it
|
|
7
|
-
// (./composants.mjs); a file out of every package is out of the graph. No dependent: the module
|
|
8
|
-
// reads no dependency between packages of Python.
|
|
9
3
|
// - The lot between two commits (`git diff --name-only --no-renames <avant> <apres>`): every file
|
|
10
4
|
// it changes in `fichiers`; the module reads no element of a source of Python, so each `.py` is
|
|
11
5
|
// named in `horsDuService`, which the reviewer surveys himself.
|
|
12
6
|
import { spawnSync } from 'node:child_process';
|
|
13
|
-
import { composantDans, composants } from './composants.mjs';
|
|
14
7
|
|
|
15
8
|
const lignesDeGit = (racine, args) => {
|
|
16
9
|
const r = spawnSync('git', ['-C', racine, ...args, '-z'], {
|
|
@@ -23,34 +16,6 @@ const lignesDeGit = (racine, args) => {
|
|
|
23
16
|
return r.stdout.split('\0').filter(Boolean);
|
|
24
17
|
};
|
|
25
18
|
|
|
26
|
-
/** The packages the files <fichiers> (from <racine>) touch, and the files out of the graph. */
|
|
27
|
-
export function touchesDesFichiers(racine, fichiers) {
|
|
28
|
-
const liste = composants(racine);
|
|
29
|
-
const touches = new Set();
|
|
30
|
-
const horsGraphe = [];
|
|
31
|
-
for (const f of new Set(fichiers)) {
|
|
32
|
-
const c = composantDans(liste, racine, f);
|
|
33
|
-
if (c) {
|
|
34
|
-
touches.add(c);
|
|
35
|
-
} else {
|
|
36
|
-
horsGraphe.push(f);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return {
|
|
40
|
-
touches: [...touches].sort((a, b) => a.nom.localeCompare(b.nom)),
|
|
41
|
-
dependants: [],
|
|
42
|
-
horsGraphe: horsGraphe.sort(),
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/** The packages touched in <racine> since the commit <depuis>, and the files out of the graph. */
|
|
47
|
-
export function touches(racine, { depuis }) {
|
|
48
|
-
return touchesDesFichiers(racine, [
|
|
49
|
-
...lignesDeGit(racine, ['diff', '--name-only', '--no-renames', depuis]),
|
|
50
|
-
...lignesDeGit(racine, ['ls-files', '-o', '--exclude-standard']),
|
|
51
|
-
]);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
19
|
/** The elements of the lot of <racine> between <avant> and <apres>. */
|
|
55
20
|
export function elementsDuLot(racine, { avant, apres }) {
|
|
56
21
|
try {
|
|
@@ -5,172 +5,15 @@
|
|
|
5
5
|
//
|
|
6
6
|
// node construire.mjs --echec <fichier> <plan> from the root of the copy
|
|
7
7
|
//
|
|
8
|
-
// -
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
// read in Turborepo's graph, `turbo run build --filter=<paquet>… --dry=json`), and a failure
|
|
13
|
-
// stops the launch; then the traces of other packages their tests wait for
|
|
14
|
-
// (`grillhouse.traces`, read in Turborepo's plan of their tests, `turbo run test:unit
|
|
15
|
-
// --filter=<paquet>… --dry=json`), which the envelope shows read-only, and a failure stops the
|
|
16
|
-
// launch. A task of either step that waits, directly or not, for a task of a package of the plan
|
|
17
|
-
// (`attendentLePlan` of ./turbo-des-paquets.mjs) is not played there: as with Bazel's
|
|
18
|
-
// --keep_going, a package of the plan stays a target of the plan even as another's provider
|
|
19
|
-
// (BPScript's 990-corpus, the shared test material, which the trace of 060-encoder waits for),
|
|
20
|
-
// and goes with the plan. Then the packages, the traces of the plan or that wait for it, and what
|
|
21
|
-
// their tests read (`turbo run build <those traces> --filter=<paquet>...…
|
|
22
|
-
// --continue=dependencies-successful`), whose failure does not stop the launch: each task whose
|
|
23
|
-
// dependencies succeed goes to its end, so what their tests read without depending on them is
|
|
24
|
-
// built whole. Their consumers are not built.
|
|
25
|
-
// - Any other plan, the whole repository (`.`) included, or a path that is no package of the frame
|
|
26
|
-
// (BPScript's libraries/), reads the graph of the whole copy dry (`turbo run build --dry=json`),
|
|
27
|
-
// whose failure (Turborepo absent, its configuration refused) stops the launch, then builds the
|
|
28
|
-
// copy whole as far as it builds (`turbo run build --continue=dependencies-successful`), whose
|
|
29
|
-
// failure does not stop the launch either.
|
|
30
|
-
// - A build that fails without stopping the launch writes in <fichier> the line that says which
|
|
31
|
-
// build failed and what was built, then its output, which the launcher puts in the session's
|
|
32
|
-
// instruction (« La construction échoue »): repairing it is the session's work. Its output goes
|
|
33
|
-
// to the standard output too.
|
|
8
|
+
// - The launcher is the core's, one for every language (`construireDepuisLesArguments` of
|
|
9
|
+
// scripts/taches-du-graphe.mjs): the plan and its providers by `turbo run build
|
|
10
|
+
// --filter=<paquet>…`, the whole copy for a plan with a path that is no package of the graph.
|
|
11
|
+
// This module gives it Turborepo, the task runner of the graph.
|
|
34
12
|
// - The exit code: 0 when the launch goes on, a build failure included; 1 for a step that stops it;
|
|
35
13
|
// 2 for a malformed call.
|
|
36
|
-
import { spawnSync } from 'node:child_process';
|
|
37
|
-
import { closeSync, openSync, readFileSync, writeFileSync } from 'node:fs';
|
|
38
|
-
import path from 'node:path';
|
|
39
14
|
import { pathToFileURL } from 'node:url';
|
|
40
|
-
import {
|
|
41
|
-
import { lireLaListe } from '../../services-du-noyau.mjs';
|
|
42
|
-
import { SCRIPT_DES_TESTS } from './script-des-tests.mjs';
|
|
43
|
-
import { attendentLePlan, tracesDuPlan } from './turbo-des-paquets.mjs';
|
|
44
|
-
|
|
45
|
-
const TURBO = ['--no-install', 'turbo'];
|
|
46
|
-
const ENTIERE =
|
|
47
|
-
"La construction de la copie entière échoue ; ce qui n'attend pas la construction en échec est construit.";
|
|
48
|
-
const DU_PLAN =
|
|
49
|
-
"La construction des paquets de ton plan échoue ; leurs fournisseurs et ce que leurs tests lisent sans dépendre d'eux sont construits.";
|
|
50
|
-
|
|
51
|
-
class Arret extends Error {}
|
|
52
|
-
|
|
53
|
-
// Turborepo with <args> in <racine>, its output on this process's; throws Arret on a failure.
|
|
54
|
-
function turbo(racine, args) {
|
|
55
|
-
const r = spawnSync('npx', [...TURBO, ...args], { cwd: racine, stdio: 'inherit' });
|
|
56
|
-
if (r.status !== 0) {
|
|
57
|
-
throw new Arret(`turbo ${args.join(' ')}`);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// Turborepo's plan of <args> in <racine>, parsed; throws Arret on a failure.
|
|
62
|
-
function plan(racine, args) {
|
|
63
|
-
const r = spawnSync('npx', [...TURBO, ...args, '--dry=json'], {
|
|
64
|
-
cwd: racine,
|
|
65
|
-
encoding: 'utf8',
|
|
66
|
-
maxBuffer: 256 * 1024 * 1024,
|
|
67
|
-
stdio: ['ignore', 'pipe', 'inherit'],
|
|
68
|
-
});
|
|
69
|
-
if (r.status !== 0) {
|
|
70
|
-
throw new Arret(`turbo ${args.join(' ')} --dry=json`);
|
|
71
|
-
}
|
|
72
|
-
return JSON.parse(r.stdout);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// The build <args> in <racine>, its output in <echec> then on this process's: when it fails,
|
|
76
|
-
// <echec> holds <ligne> then that output, and the warning <alerte> follows it.
|
|
77
|
-
function construireJusquOuIlConstruit(racine, args, echec, ligne, alerte) {
|
|
78
|
-
const fd = openSync(echec, 'w');
|
|
79
|
-
let r;
|
|
80
|
-
try {
|
|
81
|
-
r = spawnSync('npx', [...TURBO, ...args], { cwd: racine, stdio: ['ignore', fd, fd] });
|
|
82
|
-
} finally {
|
|
83
|
-
closeSync(fd);
|
|
84
|
-
}
|
|
85
|
-
const sortie = readFileSync(echec, 'utf8');
|
|
86
|
-
process.stdout.write(sortie);
|
|
87
|
-
if (r.status === 0) {
|
|
88
|
-
writeFileSync(echec, '');
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
process.stdout.write(`${alerte}\n`);
|
|
92
|
-
writeFileSync(echec, `${ligne}\n${sortie}`);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Builds the copy at <racine> for the plan <liste>, the failure of a build that does not stop the
|
|
97
|
-
* launch written in <echec>: the exit code (see the header).
|
|
98
|
-
* @param {string} racine the root of the copy
|
|
99
|
-
* @param {string} liste the plan, in the form of the envelope's variable
|
|
100
|
-
* @param {string} echec the file of a build that fails
|
|
101
|
-
*/
|
|
102
|
-
export function construire(racine, liste, echec) {
|
|
103
|
-
writeFileSync(echec, '');
|
|
104
|
-
const tous = paquets(racine).filter(p => !p.hors);
|
|
105
|
-
const noms = lireLaListe(liste).map(
|
|
106
|
-
d => tous.find(p => p.dossier === path.normalize(d).replace(/\/$/, ''))?.pkg.name ?? null
|
|
107
|
-
);
|
|
108
|
-
try {
|
|
109
|
-
if (noms.length === 0 || !noms.every(Boolean)) {
|
|
110
|
-
plan(racine, ['run', 'build']);
|
|
111
|
-
construireJusquOuIlConstruit(
|
|
112
|
-
racine,
|
|
113
|
-
['run', 'build', '--continue=dependencies-successful'],
|
|
114
|
-
echec,
|
|
115
|
-
ENTIERE,
|
|
116
|
-
"⚠️ La construction de la copie échoue : la séance s'ouvre, la consigne porte l'erreur."
|
|
117
|
-
);
|
|
118
|
-
return 0;
|
|
119
|
-
}
|
|
120
|
-
const cibles = noms.map(n => `--filter=${n}`);
|
|
121
|
-
// Their providers: the builds their own builds wait for, save those that wait for a package
|
|
122
|
-
// of the plan, which go with the plan below.
|
|
123
|
-
const graphe = plan(racine, ['run', 'build', ...cibles]);
|
|
124
|
-
const avecLePlan = attendentLePlan(graphe, noms);
|
|
125
|
-
const fournisseurs = graphe.tasks
|
|
126
|
-
.map(t => t.taskId)
|
|
127
|
-
.filter(id => !avecLePlan.has(id))
|
|
128
|
-
.sort();
|
|
129
|
-
if (fournisseurs.length) {
|
|
130
|
-
turbo(racine, ['run', ...fournisseurs]);
|
|
131
|
-
}
|
|
132
|
-
// The traces their tests wait for: another package's trace that waits for no package of the
|
|
133
|
-
// plan is produced here, a failure stopping the launch, as a provider's; a trace of the plan,
|
|
134
|
-
// or one that waits for it, is produced with the plan below.
|
|
135
|
-
const tests = plan(racine, ['run', SCRIPT_DES_TESTS, ...cibles]);
|
|
136
|
-
const attend = attendentLePlan(tests, noms);
|
|
137
|
-
const autres = tracesDuPlan(tests, t => !attend.has(t.taskId));
|
|
138
|
-
if (autres.length) {
|
|
139
|
-
turbo(racine, ['run', ...autres]);
|
|
140
|
-
}
|
|
141
|
-
const avec = tracesDuPlan(tests, t => attend.has(t.taskId));
|
|
142
|
-
construireJusquOuIlConstruit(
|
|
143
|
-
racine,
|
|
144
|
-
[
|
|
145
|
-
'run',
|
|
146
|
-
'build',
|
|
147
|
-
...avec,
|
|
148
|
-
...noms.map(n => `--filter=${n}...`),
|
|
149
|
-
'--continue=dependencies-successful',
|
|
150
|
-
],
|
|
151
|
-
echec,
|
|
152
|
-
DU_PLAN,
|
|
153
|
-
`⚠️ La construction du plan (${noms.join(' ')}) échoue : la séance s'ouvre, la consigne porte l'erreur.`
|
|
154
|
-
);
|
|
155
|
-
return 0;
|
|
156
|
-
} catch (e) {
|
|
157
|
-
if (!(e instanceof Arret)) {
|
|
158
|
-
throw e;
|
|
159
|
-
}
|
|
160
|
-
process.stderr.write(`⛔ ${e.message} échoue.\n`);
|
|
161
|
-
return 1;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
15
|
+
import { construireDepuisLesArguments } from '../../services-du-noyau.mjs';
|
|
164
16
|
|
|
165
17
|
if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
|
|
166
|
-
|
|
167
|
-
const i = args.indexOf('--echec');
|
|
168
|
-
const echec = i >= 0 ? args[i + 1] : undefined;
|
|
169
|
-
const reste = i >= 0 ? [...args.slice(0, i), ...args.slice(i + 2)] : args;
|
|
170
|
-
if (!echec || reste.length !== 1) {
|
|
171
|
-
process.stderr.write('usage: construire.mjs --echec <fichier> <plan>\n');
|
|
172
|
-
process.exitCode = 2;
|
|
173
|
-
} else {
|
|
174
|
-
process.exitCode = construire(process.cwd(), reste[0], echec);
|
|
175
|
-
}
|
|
18
|
+
process.exitCode = construireDepuisLesArguments('turbo', process.argv.slice(2));
|
|
176
19
|
}
|
|
@@ -8,8 +8,7 @@
|
|
|
8
8
|
// interfaces, the turbo.json of the packages): `aJour`; the same with each generated file out
|
|
9
9
|
// of date: the interface of `a` changed after its index, a fault listed that its code never
|
|
10
10
|
// produces (the check of the interfaces against the code), the turbo.json of `b` stale:
|
|
11
|
-
// `enRetard`; the same
|
|
12
|
-
// added: `change`, measured from its commit; the same where the code of `b` imports `a` and the
|
|
11
|
+
// `enRetard`; the same where the code of `b` imports `a` and the
|
|
13
12
|
// code of `c` imports `b`: `lus`; the same with a second commit that changes a file of `a`:
|
|
14
13
|
// `lot`. A directory whose package.json names no package: `vide`. A
|
|
15
14
|
// repository of two packages, one with the script of the tests (`test:unit`): `avecTests`.
|
|
@@ -141,10 +140,6 @@ export default {
|
|
|
141
140
|
const avantLeLot = tete(lot);
|
|
142
141
|
writeFileSync(path.join(lot, 'packages/a/src/index.ts'), 'export const a = 3;\n');
|
|
143
142
|
git(lot, 'commit', '-q', '-am', 'lot');
|
|
144
|
-
const change = depot(dans);
|
|
145
|
-
const depuis = tete(change);
|
|
146
|
-
writeFileSync(path.join(change, 'packages/a/src/index.ts'), 'export const a = 2;\n');
|
|
147
|
-
writeFileSync(path.join(change, 'notes.txt'), 'hors des paquets\n');
|
|
148
143
|
return {
|
|
149
144
|
racine: aJour,
|
|
150
145
|
composants: {
|
|
@@ -169,11 +164,6 @@ export default {
|
|
|
169
164
|
invalide: { racine: lus, noms: ['package.json'] },
|
|
170
165
|
attendu: ['b lit a', 'c lit b', 'package.json : sans fournisseur'],
|
|
171
166
|
},
|
|
172
|
-
touches: {
|
|
173
|
-
valide: { racine: aJour, depuis: 'HEAD' },
|
|
174
|
-
invalide: { racine: change, depuis },
|
|
175
|
-
attendu: ['touché a', 'dépendant b', 'dépendant c', 'hors notes.txt'],
|
|
176
|
-
},
|
|
177
167
|
commandes: {
|
|
178
168
|
valide: [
|
|
179
169
|
'tester',
|
|
@@ -188,6 +178,7 @@ export default {
|
|
|
188
178
|
'interfaces-contre-code',
|
|
189
179
|
'resumes',
|
|
190
180
|
'tailles-des-tests',
|
|
181
|
+
'titres-de-tests',
|
|
191
182
|
'turbo-des-paquets',
|
|
192
183
|
],
|
|
193
184
|
invalide: ['tester', 'deployer'],
|
|
@@ -270,6 +261,7 @@ export default {
|
|
|
270
261
|
'interfaces-contre-code',
|
|
271
262
|
'code-mort',
|
|
272
263
|
'tailles-des-tests',
|
|
264
|
+
'titres-de-tests',
|
|
273
265
|
'chemins-des-tests',
|
|
274
266
|
'resumes',
|
|
275
267
|
],
|
|
@@ -165,7 +165,7 @@ export function configuration(racine) {
|
|
|
165
165
|
severity: 'warn',
|
|
166
166
|
from: {
|
|
167
167
|
orphan: true,
|
|
168
|
-
pathNot: [`${TESTS}|(^|/)index[.][a-z]+$|[.]d[.]ts$|[.]config[.][a-z]+$`, ...bin].join('|'),
|
|
168
|
+
pathNot: [`${TESTS}|(^|/)index[.][a-z]+$|[.]d[.][mc]?ts$|[.]config[.][a-z]+$`, ...bin].join('|'),
|
|
169
169
|
},
|
|
170
170
|
to: {},
|
|
171
171
|
},
|
|
@@ -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`).
|
|
@@ -57,23 +51,26 @@ 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
53
|
import { estUnTest, manifestes, soeurDAvant } from './regle-des-tests.mjs';
|
|
60
|
-
import { SCRIPT_DES_TESTS } from '
|
|
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,8 +237,13 @@ 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)),
|
|
267
242
|
soeurDAvant,
|
|
268
|
-
// Its tool plays HEAD's version of each test file beside it (`soeurDAvant`): no
|
|
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: () => ({}),
|
|
269
247
|
testsDeHead: () => null,
|
|
270
248
|
manifestes,
|
|
271
249
|
fichiersEngendres: () => [
|
|
@@ -323,6 +301,7 @@ export default {
|
|
|
323
301
|
[ici('interfaces-contre-code.mjs')],
|
|
324
302
|
[ici('code-mort.mjs')],
|
|
325
303
|
[ici('tailles-des-tests.mjs')],
|
|
304
|
+
[ici('titres-de-tests.mjs')],
|
|
326
305
|
[ici('chemins-des-tests.mjs')],
|
|
327
306
|
[ici('resumes.mjs')],
|
|
328
307
|
],
|
|
@@ -333,6 +312,9 @@ export default {
|
|
|
333
312
|
matiereDansLesTests,
|
|
334
313
|
taillesDesTests,
|
|
335
314
|
cheminsDesTests,
|
|
315
|
+
taillesDesOutilsLourds,
|
|
316
|
+
prefixeDesTickets,
|
|
317
|
+
titresNommantUnTicket,
|
|
336
318
|
],
|
|
337
319
|
miseAJour: miseAJour(joueDesTests),
|
|
338
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
|
+
}
|