@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
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// From 0.31.0 every package enters the graph of Turborepo by a `package.json` beside its manifest
|
|
2
|
+
// (grillhouse-44b.4, node_modules/turbo/docs/guides/multi-language.mdx:191): the crate and the
|
|
3
|
+
// project of Python of an existing project, which `grillhouse paquet` did not create, receive the
|
|
4
|
+
// same one.
|
|
5
|
+
//
|
|
6
|
+
// - The packages are those the column « Langage » of the tables of the components of
|
|
7
|
+
// docs/ARCHITECTURE.md declares `cargo` or `python`, and whose folder holds the manifest of their
|
|
8
|
+
// language with a package name (a `Cargo.toml` of a virtual workspace names none), the root
|
|
9
|
+
// excluded; a folder is named by its path, its name or its manifest's name, as the guard of the
|
|
10
|
+
// languages reads a component. A package of another language receives nothing.
|
|
11
|
+
// - The package.json of a package is the one the command writes (./paquet-npm.mjs): the manifest's
|
|
12
|
+
// name, `private`, the scripts `build`, `test:unit` and `typecheck`. A package.json present is
|
|
13
|
+
// kept as it is when its name is the manifest's; any other is left to the project (`aFaire`,
|
|
14
|
+
// both names), as is a name another package of the workspaces bears, and nothing else is written
|
|
15
|
+
// for that package.
|
|
16
|
+
// - The folder of each package is entered in the `workspaces` of the root package.json when its
|
|
17
|
+
// patterns do not select it, after the pattern `!` that takes it out.
|
|
18
|
+
// - A project already migrated, or without crate nor project of Python, is not written: a second
|
|
19
|
+
// pass changes nothing and returns no line.
|
|
20
|
+
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
21
|
+
import path from 'node:path';
|
|
22
|
+
import {
|
|
23
|
+
inscrireAuxEspaces,
|
|
24
|
+
packageJsonDuPaquet,
|
|
25
|
+
paquetsSansPackageJson,
|
|
26
|
+
} from '../paquet-npm.mjs';
|
|
27
|
+
import { paquets } from '../paquets.mjs';
|
|
28
|
+
|
|
29
|
+
export const version = '0.31.0';
|
|
30
|
+
export const nom = 'paquets dans le graphe';
|
|
31
|
+
|
|
32
|
+
export function migrer(projet) {
|
|
33
|
+
const racinePj = path.join(projet, 'package.json');
|
|
34
|
+
if (!existsSync(racinePj)) return [];
|
|
35
|
+
const lignes = [];
|
|
36
|
+
const inscrire = [];
|
|
37
|
+
for (const { chemin, nom: nomNpm } of paquetsSansPackageJson(projet)) {
|
|
38
|
+
const f = `${chemin}/package.json`;
|
|
39
|
+
const abs = path.join(projet, f);
|
|
40
|
+
if (existsSync(abs)) {
|
|
41
|
+
let present;
|
|
42
|
+
try {
|
|
43
|
+
present = JSON.parse(readFileSync(abs, 'utf8')).name;
|
|
44
|
+
} catch (e) {
|
|
45
|
+
lignes.push({ aFaire: `${f} : ${e.message} ; le nom du paquet est ${JSON.stringify(nomNpm)}.` });
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
if (present !== nomNpm) {
|
|
49
|
+
lignes.push({
|
|
50
|
+
aFaire: `${f} : son nom est ${JSON.stringify(present)}, celui de son manifeste ${JSON.stringify(nomNpm)} ; accorde-les, le paquet entre alors aux workspaces.`,
|
|
51
|
+
});
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
} else {
|
|
55
|
+
const autre = paquets(projet).find(p => p.pkg.name === nomNpm && p.dossier !== chemin);
|
|
56
|
+
if (autre) {
|
|
57
|
+
lignes.push({
|
|
58
|
+
aFaire: `${f} : le nom ${JSON.stringify(nomNpm)} est déjà celui de ${autre.dossier}/package.json ; un nom ne désigne qu'un paquet, renomme l'un des deux.`,
|
|
59
|
+
});
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
writeFileSync(abs, packageJsonDuPaquet(nomNpm, chemin));
|
|
63
|
+
lignes.push(`${f} : écrit, le paquet entre dans le graphe de Turborepo`);
|
|
64
|
+
}
|
|
65
|
+
inscrire.push(chemin);
|
|
66
|
+
}
|
|
67
|
+
let texte = readFileSync(racinePj, 'utf8');
|
|
68
|
+
const inscrits = [];
|
|
69
|
+
for (const chemin of inscrire) {
|
|
70
|
+
const neuf = inscrireAuxEspaces(texte, chemin);
|
|
71
|
+
if (neuf !== null) {
|
|
72
|
+
texte = neuf;
|
|
73
|
+
inscrits.push(chemin);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (inscrits.length) {
|
|
77
|
+
writeFileSync(racinePj, texte);
|
|
78
|
+
lignes.push(`package.json : workspaces, ${inscrits.join(', ')} ajouté(s)`);
|
|
79
|
+
}
|
|
80
|
+
return lignes;
|
|
81
|
+
}
|
package/scripts/migrations.mjs
CHANGED
|
@@ -33,6 +33,9 @@ import * as triDesDecouvertes from './migrations/0.24.12-tri-des-decouvertes.mjs
|
|
|
33
33
|
import * as scriptDesTests from './migrations/0.25.0-script-des-tests.mjs';
|
|
34
34
|
import * as langagesDansLArchitecture from './migrations/0.27.0-langages-dans-l-architecture.mjs';
|
|
35
35
|
|
|
36
|
+
import * as ciAppelleLaVerification from './migrations/0.30.0-ci-appelle-la-verification.mjs';
|
|
37
|
+
import * as paquetsDansLeGraphe from './migrations/0.31.0-paquets-dans-le-graphe.mjs';
|
|
38
|
+
|
|
36
39
|
/** The migrations of the core. */
|
|
37
40
|
export const MIGRATIONS = [
|
|
38
41
|
crochetsDeSeance,
|
|
@@ -44,6 +47,8 @@ export const MIGRATIONS = [
|
|
|
44
47
|
triDesDecouvertes,
|
|
45
48
|
scriptDesTests,
|
|
46
49
|
langagesDansLArchitecture,
|
|
50
|
+
ciAppelleLaVerification,
|
|
51
|
+
paquetsDansLeGraphe,
|
|
47
52
|
];
|
|
48
53
|
|
|
49
54
|
/**
|
package/scripts/nuit.sh
CHANGED
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
# the commit accepts the push.
|
|
74
74
|
# - The copies whose content is on main: once its steps are played, whatever their verdict, the
|
|
75
75
|
# night passes each copy `git worktree list` names, the main tree and its own left out, through
|
|
76
|
-
# scripts/retirer-copie.sh without `--jetable` (scripts/copies-finies.mjs), as a CI cleans its
|
|
76
|
+
# scripts/retirer-copie.sh without `--jetable` (scripts/retirer-les-copies-finies.mjs), as a CI cleans its
|
|
77
77
|
# workspaces at the end of a pipeline: a copy whose commits and local work have all entered
|
|
78
78
|
# main by their content goes, and its branch (main and a branch another copy holds stay); a copy
|
|
79
79
|
# refused (commits or work not entered, a lock) or held by a running circuit (its ticket in progress, its
|
|
@@ -226,6 +226,13 @@ jouer() {
|
|
|
226
226
|
return 1
|
|
227
227
|
fi
|
|
228
228
|
eval "$outils"
|
|
229
|
+
# The data of the project (donnees-cles.mjs), exported the same way.
|
|
230
|
+
local donnees
|
|
231
|
+
if ! donnees=$(node "$ici/donnees-cles.mjs" "$copie"); then
|
|
232
|
+
echo "✗ la clé grillhouse.donnees est refusée : rien n'est joué."
|
|
233
|
+
return 1
|
|
234
|
+
fi
|
|
235
|
+
eval "$donnees"
|
|
229
236
|
if [ -f "$copie/package-lock.json" ] && ! cmp -s "$copie/package-lock.json" "$copie/node_modules/.nuit-lock"; then
|
|
230
237
|
monter npm --prefix "$copie" ci --no-audit --no-fund --silent || return 1
|
|
231
238
|
cp "$copie/package-lock.json" "$copie/node_modules/.nuit-lock"
|
|
@@ -233,7 +240,7 @@ jouer() {
|
|
|
233
240
|
# The full pass, played for real: the night replays no log of the cache. Each step plays even
|
|
234
241
|
# when one before it is red; a step à repasser ends the night there, red if a step before it is.
|
|
235
242
|
local code tache avant
|
|
236
|
-
GRILLHOUSE_ROUGES="$rouges" monter npm --prefix "$copie" run verifier -- --force
|
|
243
|
+
GRILLHOUSE_ROUGES="$rouges" GRILLHOUSE_VERIFICATION_SORTE=Nuit monter npm --prefix "$copie" run verifier -- --force
|
|
237
244
|
code=$?
|
|
238
245
|
if [ "$code" -eq 75 ]; then
|
|
239
246
|
echo "⏱ la passe complète est à repasser (code 75) : l'attente de la machine a atteint sa borne."
|
|
@@ -296,7 +303,7 @@ jouer >> "$journal" 2>&1
|
|
|
296
303
|
verdict=$?
|
|
297
304
|
# The copies whose content is on main go once the steps are played, the night's own kept and
|
|
298
305
|
# pruned of its tools' outputs; their removal never changes the verdict.
|
|
299
|
-
(cd "$racine" && node "$ici/copies-finies.mjs" "$copie") >> "$journal" 2>&1 || true
|
|
306
|
+
(cd "$racine" && node "$ici/retirer-les-copies-finies.mjs" "$copie") >> "$journal" 2>&1 || true
|
|
300
307
|
|
|
301
308
|
if [ "$verdict" -eq 75 ]; then
|
|
302
309
|
echo "⏱ à repasser : ${tete:0:7} n'est ni vert ni rouge, la machine est restée chargée ; le dernier vert reste, aucun ticket, la nuit suivante rejoue." >> "$journal"
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// The types of ./outils-cles.mjs, for the frame's TypeScript (src/temporal/installation.ts) and
|
|
2
|
+
// its tests.
|
|
3
|
+
|
|
4
|
+
/** The tools of the package.json <pkg> (`grillhouse.outils`), each path resolved, and its faults. */
|
|
5
|
+
export function lireOutils(
|
|
6
|
+
pkg: unknown,
|
|
7
|
+
options?: {
|
|
8
|
+
maison?: string;
|
|
9
|
+
existe?: (p: string) => boolean;
|
|
10
|
+
reel?: (p: string) => string;
|
|
11
|
+
montages?: string[];
|
|
12
|
+
}
|
|
13
|
+
): { outils: Record<string, string>; fautes: string[] };
|
|
14
|
+
/** The main tree of the repository that holds <dir>. */
|
|
15
|
+
export function arbrePrincipal(dir: string): string;
|
|
16
|
+
/** The tools of the project that holds <dir>; throws the faults of the key. */
|
|
17
|
+
export function outilsDe(dir: string, options?: { montages?: string[] }): Record<string, string>;
|
|
18
|
+
/** The environment <env> of a pass with the tools <outils>, the tools winning. */
|
|
19
|
+
export function avecLesOutils<T extends Record<string, string | undefined>>(
|
|
20
|
+
outils: Record<string, string>,
|
|
21
|
+
env: T
|
|
22
|
+
): T & Record<string, string>;
|
|
23
|
+
/** The shell's text that exports the tools <outils>, one line each. */
|
|
24
|
+
export function exportsDesOutils(outils: Record<string, string>): string;
|
package/scripts/outils-cles.mjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
1
|
// The reading of the `grillhouse.outils` key of a package.json, the tools of the project, as Bazel
|
|
3
2
|
// declares what an action sees out of its sandbox (--sandbox_add_mount_pair) and the environment
|
|
4
3
|
// it gets (--action_env): `{ "<VARIABLE>": "<chemin>" }`, each path absolute or under `~`. The
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
// The package.json of a package of a language other than TypeScript (a crate, a project of Python):
|
|
2
|
+
// the entry by which it enters the graph of Turborepo, which reads a `package.json` beside each
|
|
3
|
+
// project that is no JavaScript (node_modules/turbo/docs/guides/multi-language.mdx:191), as Turborepo's
|
|
4
|
+
// own example of Rust writes one beside the crate. `grillhouse paquet` writes it with the package
|
|
5
|
+
// (./paquet.mjs), and the migration of 0.31.0 for the packages of an existing project
|
|
6
|
+
// (./migrations/0.31.0-paquets-dans-le-graphe.mjs).
|
|
7
|
+
//
|
|
8
|
+
// - Its name is the manifest's: the `name` of the `[package]` of a Cargo.toml, of the `[project]`
|
|
9
|
+
// of a pyproject.toml.
|
|
10
|
+
// - Its scripts call the commands of the package's module on its path, from the root of the
|
|
11
|
+
// project, where the module plays: `build` the module's `construire`, `test:unit` its
|
|
12
|
+
// `tests-du-paquet` (the body of the task, which never runs Turborepo: its `tests` does, and
|
|
13
|
+
// would loop), `typecheck` its `typer`.
|
|
14
|
+
// - The entry of its folder in the `workspaces` of the root package.json: none for a folder the
|
|
15
|
+
// patterns already select; else its path, after the pattern `!` that takes it out when one does.
|
|
16
|
+
import { existsSync, readdirSync, readFileSync } from 'node:fs';
|
|
17
|
+
import path from 'node:path';
|
|
18
|
+
import { LANGAGES, langage, langagesDeclares } from './langages.mjs';
|
|
19
|
+
import { selectionne } from './paquets.mjs';
|
|
20
|
+
import { hors } from './sources.mjs';
|
|
21
|
+
import {
|
|
22
|
+
colonneDesNoms,
|
|
23
|
+
langageDeLaCellule,
|
|
24
|
+
nomme,
|
|
25
|
+
nomsDe,
|
|
26
|
+
tableauxDesComposants,
|
|
27
|
+
} from './tableau-des-composants.mjs';
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The languages of the frame whose package has no package.json of its own, the ones whose manifest
|
|
31
|
+
* is another file: the package.json is written beside that manifest.
|
|
32
|
+
*/
|
|
33
|
+
export const sansPackageJson = () =>
|
|
34
|
+
Object.keys(LANGAGES).filter(n => langage(n).manifeste !== 'package.json');
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The name the manifest <texte> of the language <langageNom> gives its package; null for none
|
|
38
|
+
* (the module of the language reads it).
|
|
39
|
+
* @param {string} langageNom
|
|
40
|
+
* @param {string} texte
|
|
41
|
+
*/
|
|
42
|
+
export const nomDuManifeste = (langageNom, texte) => langage(langageNom).nomDuManifeste(texte);
|
|
43
|
+
|
|
44
|
+
// The folders under <dossier> that hold <manifeste>, as `{ dossier, nom, paquet }` (the component
|
|
45
|
+
// shape of the tables), <dossier> itself left out; hidden folders and the ones the sources of the
|
|
46
|
+
// project leave out are not walked.
|
|
47
|
+
function avecManifeste(dossier, manifeste, langageNom, exclus) {
|
|
48
|
+
const out = [];
|
|
49
|
+
for (const e of readdirSync(dossier, { withFileTypes: true })) {
|
|
50
|
+
if (!e.isDirectory() || e.name.startsWith('.') || exclus.has(e.name)) continue;
|
|
51
|
+
const d = path.join(dossier, e.name);
|
|
52
|
+
const f = path.join(d, manifeste);
|
|
53
|
+
const paquet = existsSync(f) ? nomDuManifeste(langageNom, readFileSync(f, 'utf8')) : null;
|
|
54
|
+
if (paquet !== null) out.push({ dossier: d, nom: e.name, paquet });
|
|
55
|
+
out.push(...avecManifeste(d, manifeste, langageNom, exclus));
|
|
56
|
+
}
|
|
57
|
+
return out;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* The packages of a language without package.json of its own (`sansPackageJson`) the tables of the
|
|
62
|
+
* components of docs/ARCHITECTURE.md declare in the project at <racine>: `{ langage, chemin, nom }`,
|
|
63
|
+
* `chemin` from the root, `nom` the manifest's name, sorted by language then path. A package is a
|
|
64
|
+
* folder under the root that holds the manifest of its language with a package name (a
|
|
65
|
+
* `Cargo.toml` of a virtual workspace names none) and that a row of the language names, by its
|
|
66
|
+
* path, its folder's name or its manifest's name, as the guard of the languages reads a component.
|
|
67
|
+
* @param {string} racine
|
|
68
|
+
*/
|
|
69
|
+
export function paquetsSansPackageJson(racine) {
|
|
70
|
+
const sortie = [];
|
|
71
|
+
const declares = langagesDeclares(racine);
|
|
72
|
+
for (const langageNom of sansPackageJson().filter(n => declares.includes(n))) {
|
|
73
|
+
const candidats = avecManifeste(
|
|
74
|
+
racine,
|
|
75
|
+
langage(langageNom).manifeste,
|
|
76
|
+
langageNom,
|
|
77
|
+
hors(racine)
|
|
78
|
+
);
|
|
79
|
+
const trouves = new Set();
|
|
80
|
+
for (const t of tableauxDesComposants(racine)) {
|
|
81
|
+
const colonne = colonneDesNoms(t.lignes, candidats, racine, t.colonne);
|
|
82
|
+
if (colonne < 0) continue;
|
|
83
|
+
for (const l of t.lignes) {
|
|
84
|
+
if (langageDeLaCellule(l.cellules[t.colonne]) !== langageNom) continue;
|
|
85
|
+
for (const c of candidats) {
|
|
86
|
+
if (nomme(nomsDe(l.cellules[colonne]), c, racine)) trouves.add(c);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
sortie.push(
|
|
91
|
+
...[...trouves]
|
|
92
|
+
.map(c => ({
|
|
93
|
+
langage: langageNom,
|
|
94
|
+
chemin: path.relative(racine, c.dossier).split(path.sep).join('/'),
|
|
95
|
+
nom: c.paquet,
|
|
96
|
+
}))
|
|
97
|
+
.sort((a, b) => (a.chemin < b.chemin ? -1 : 1))
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
return sortie;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* The text of the package.json of the package <nom> in <chemin> (from the root of the project).
|
|
105
|
+
* @param {string} nom
|
|
106
|
+
* @param {string} chemin
|
|
107
|
+
*/
|
|
108
|
+
export function packageJsonDuPaquet(nom, chemin) {
|
|
109
|
+
const racine = chemin
|
|
110
|
+
.split('/')
|
|
111
|
+
.map(() => '..')
|
|
112
|
+
.join('/');
|
|
113
|
+
const appel = commande => `cd ${racine} && grillhouse ${commande} ${chemin}`;
|
|
114
|
+
const p = {
|
|
115
|
+
name: nom,
|
|
116
|
+
private: true,
|
|
117
|
+
scripts: {
|
|
118
|
+
build: appel('construire'),
|
|
119
|
+
'test:unit': appel('tests-du-paquet'),
|
|
120
|
+
typecheck: appel('typer'),
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
return `${JSON.stringify(p, null, 2)}\n`;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* The text of the root package.json <texte> with <chemin> entered in its `workspaces`; null when
|
|
128
|
+
* its patterns select the folder already.
|
|
129
|
+
* @param {string} texte
|
|
130
|
+
* @param {string} chemin
|
|
131
|
+
*/
|
|
132
|
+
export function inscrireAuxEspaces(texte, chemin) {
|
|
133
|
+
const p = JSON.parse(texte);
|
|
134
|
+
if (selectionne(p, chemin)) {
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
const indent = /^([ \t]+)"/m.exec(texte)?.[1] ?? 2;
|
|
138
|
+
const fin = texte.endsWith('\n') ? '\n' : '';
|
|
139
|
+
if (Array.isArray(p.workspaces)) {
|
|
140
|
+
p.workspaces = [...p.workspaces, chemin];
|
|
141
|
+
} else if (Array.isArray(p.workspaces?.packages)) {
|
|
142
|
+
p.workspaces = { ...p.workspaces, packages: [...p.workspaces.packages, chemin] };
|
|
143
|
+
} else {
|
|
144
|
+
p.workspaces = [chemin];
|
|
145
|
+
}
|
|
146
|
+
return `${JSON.stringify(p, null, indent)}${fin}`;
|
|
147
|
+
}
|
package/scripts/paquet.mjs
CHANGED
|
@@ -25,6 +25,11 @@
|
|
|
25
25
|
// and its language written in. Each file absent is written, a file present stays; the manifest
|
|
26
26
|
// of the workspace receives the entry. The command commits nothing: the second and the third
|
|
27
27
|
// times enter one commit, after a green verification.
|
|
28
|
+
// - The entry into the Turborepo graph: a crate or a Python project, whose manifest is not a
|
|
29
|
+
// package.json, receives one beside it (./paquet-npm.mjs: the `name` of its manifest, `private`,
|
|
30
|
+
// the scripts build, test:unit and typecheck that call the module's commands on its path) and
|
|
31
|
+
// its path in the `workspaces` of the root when no pattern selects it (after the `!` pattern
|
|
32
|
+
// that excludes it). A package.json already there is never rewritten: a different name is refused.
|
|
28
33
|
// - The tools of the language, as `nx add` installs them before the first generator: the share
|
|
29
34
|
// of the update of each declared language (`mettreAJour` of ./grillhouse-maj.mjs: its tools at
|
|
30
35
|
// its template's versions, its scripts, its files, `turbo.json` for typescript), then `npm
|
|
@@ -48,6 +53,13 @@ import {
|
|
|
48
53
|
regenerer,
|
|
49
54
|
} from './grillhouse-maj.mjs';
|
|
50
55
|
import { LANGAGES, langage } from './langages.mjs';
|
|
56
|
+
import {
|
|
57
|
+
inscrireAuxEspaces,
|
|
58
|
+
nomDuManifeste,
|
|
59
|
+
packageJsonDuPaquet,
|
|
60
|
+
sansPackageJson,
|
|
61
|
+
} from './paquet-npm.mjs';
|
|
62
|
+
import { paquets } from './paquets.mjs';
|
|
51
63
|
import { hors } from './sources.mjs';
|
|
52
64
|
import {
|
|
53
65
|
ARCHITECTURE,
|
|
@@ -122,6 +134,58 @@ function existants(racine, dossier) {
|
|
|
122
134
|
.sort();
|
|
123
135
|
}
|
|
124
136
|
|
|
137
|
+
// The package.json of the package at <rel> when its language has none of its own (a crate, a
|
|
138
|
+
// project of Python; ./paquet-npm.mjs): `{ fichiers, espace }`, its text when it lacks, and the
|
|
139
|
+
// root package.json with the entry of <rel> in its `workspaces` (null when its patterns select
|
|
140
|
+
// it). A package.json present is never rewritten: refused, by its name, when its `name` is not the
|
|
141
|
+
// manifest's or is already another package's of the workspaces. Nothing for the other languages.
|
|
142
|
+
/**
|
|
143
|
+
* @param {string} racine
|
|
144
|
+
* @param {string} rel
|
|
145
|
+
* @param {string} langage
|
|
146
|
+
* @param {{ manifeste: string }} m
|
|
147
|
+
* @param {{ fichiers: Record<string, string> }} squelette
|
|
148
|
+
* @returns {{ fichiers: Record<string, string>, espace: { fichier: string, texte: string } | null }}
|
|
149
|
+
*/
|
|
150
|
+
function packageJsonDuPaquetNonJs(racine, rel, langage, m, squelette) {
|
|
151
|
+
if (!sansPackageJson().includes(langage)) {
|
|
152
|
+
return { fichiers: {}, espace: null };
|
|
153
|
+
}
|
|
154
|
+
const manifeste = squelette.fichiers[`${rel}/${m.manifeste}`];
|
|
155
|
+
const nom = manifeste === undefined ? null : nomDuManifeste(langage, manifeste);
|
|
156
|
+
if (nom === null) {
|
|
157
|
+
throw new Refus(`${rel}/${m.manifeste} : le squelette du module n'écrit aucun nom de paquet.`);
|
|
158
|
+
}
|
|
159
|
+
const f = `${rel}/package.json`;
|
|
160
|
+
const abs = path.join(racine, f);
|
|
161
|
+
/** @type {Record<string, string>} */
|
|
162
|
+
const fichiers = {};
|
|
163
|
+
if (existsSync(abs)) {
|
|
164
|
+
let present;
|
|
165
|
+
try {
|
|
166
|
+
present = JSON.parse(readFileSync(abs, 'utf8')).name;
|
|
167
|
+
} catch (e) {
|
|
168
|
+
throw new Refus(`${f} : ${e.message} ; la commande ne réécrit pas un package.json.`);
|
|
169
|
+
}
|
|
170
|
+
if (present !== nom) {
|
|
171
|
+
throw new Refus(
|
|
172
|
+
`${f} : son nom est ${JSON.stringify(present)}, celui de ${m.manifeste} est ${JSON.stringify(nom)} ; la commande ne réécrit pas un package.json, le nom s'accorde au manifeste.`
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
} else {
|
|
176
|
+
fichiers[f] = packageJsonDuPaquet(nom, rel);
|
|
177
|
+
}
|
|
178
|
+
const autre = paquets(racine).find(p => p.pkg.name === nom && p.dossier !== rel);
|
|
179
|
+
if (autre) {
|
|
180
|
+
throw new Refus(
|
|
181
|
+
`${f} : le nom ${JSON.stringify(nom)} est déjà celui de ${autre.dossier}/package.json, un paquet des workspaces ; un nom ne désigne qu'un paquet.`
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
const fr = path.join(racine, 'package.json');
|
|
185
|
+
const texte = existsSync(fr) ? inscrireAuxEspaces(readFileSync(fr, 'utf8'), rel) : null;
|
|
186
|
+
return { fichiers, espace: texte === null ? null : { fichier: 'package.json', texte } };
|
|
187
|
+
}
|
|
188
|
+
|
|
125
189
|
/**
|
|
126
190
|
* The plan of the package at <chemin> of the project at <racine>, nothing written: `{ chemin,
|
|
127
191
|
* langage, fichiers, espace, verrouiller }`, `fichiers` the skeleton of its language and its
|
|
@@ -171,7 +235,9 @@ export function planDuPaquet(racine, chemin, { source = CADRE } = {}) {
|
|
|
171
235
|
} catch (e) {
|
|
172
236
|
throw new Refus(e.message);
|
|
173
237
|
}
|
|
238
|
+
const npm = packageJsonDuPaquetNonJs(racine, rel, l.langage, m, s);
|
|
174
239
|
const nom = path.posix.basename(rel);
|
|
240
|
+
/** @type {Record<string, string>} */
|
|
175
241
|
const documents = Object.fromEntries(
|
|
176
242
|
DOCUMENTS.map(d => [
|
|
177
243
|
`${rel}/${d}`,
|
|
@@ -183,8 +249,9 @@ export function planDuPaquet(racine, chemin, { source = CADRE } = {}) {
|
|
|
183
249
|
return {
|
|
184
250
|
chemin: rel,
|
|
185
251
|
langage: m,
|
|
186
|
-
fichiers: { ...s.fichiers, ...documents },
|
|
252
|
+
fichiers: { ...s.fichiers, ...npm.fichiers, ...documents },
|
|
187
253
|
espace: s.espace,
|
|
254
|
+
espaceNpm: npm.espace,
|
|
188
255
|
verrouiller: s.verrouiller,
|
|
189
256
|
};
|
|
190
257
|
}
|
|
@@ -206,9 +273,11 @@ export function ecrireLePaquet(racine, plan) {
|
|
|
206
273
|
writeFileSync(abs, texte);
|
|
207
274
|
ecrits.push(f);
|
|
208
275
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
276
|
+
for (const espace of [plan.espace, plan.espaceNpm]) {
|
|
277
|
+
if (espace) {
|
|
278
|
+
writeFileSync(path.join(racine, espace.fichier), espace.texte);
|
|
279
|
+
ecrits.push(espace.fichier);
|
|
280
|
+
}
|
|
212
281
|
}
|
|
213
282
|
return ecrits;
|
|
214
283
|
}
|
package/scripts/paquets.mjs
CHANGED
|
@@ -65,14 +65,19 @@ const lireJson = f => {
|
|
|
65
65
|
}
|
|
66
66
|
};
|
|
67
67
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
/**
|
|
69
|
+
* The patterns of the `workspaces` of the root `package.json` <p> (an array, or its `packages` key):
|
|
70
|
+
* `{ declares, motifs, nies }`, the patterns as written, those that select, and those that take out
|
|
71
|
+
* what the others select, none put back by a later pattern.
|
|
72
|
+
* @param {Record<string, any> | null} p
|
|
73
|
+
*/
|
|
74
|
+
export function motifsDesEspaces(p) {
|
|
75
|
+
const declares = (
|
|
76
|
+
Array.isArray(p?.workspaces) ? p.workspaces : (p?.workspaces?.packages ?? [])
|
|
77
|
+
).map(String);
|
|
73
78
|
const motifs = [];
|
|
74
79
|
let nies = [];
|
|
75
|
-
for (const brut of declares
|
|
80
|
+
for (const brut of declares) {
|
|
76
81
|
const excl = /^!+/.exec(brut)?.[0] ?? '';
|
|
77
82
|
const motif = brut
|
|
78
83
|
.slice(excl.length)
|
|
@@ -86,6 +91,29 @@ export function paquets(racine) {
|
|
|
86
91
|
motifs.push(motif);
|
|
87
92
|
}
|
|
88
93
|
}
|
|
94
|
+
return { declares, motifs, nies };
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Whether the `workspaces` of the root `package.json` <p> select the directory <dossier> (from the
|
|
99
|
+
* root), as `paquets` maps them, whether or not it holds its package.json yet.
|
|
100
|
+
* @param {Record<string, any> | null} p
|
|
101
|
+
* @param {string} dossier
|
|
102
|
+
*/
|
|
103
|
+
export function selectionne(p, dossier) {
|
|
104
|
+
const { motifs, nies } = motifsDesEspaces(p);
|
|
105
|
+
return (
|
|
106
|
+
!dossier.split('/').includes('node_modules') &&
|
|
107
|
+
motifs.some(m => path.matchesGlob(dossier, m)) &&
|
|
108
|
+
!nies.some(n => path.matchesGlob(dossier, n))
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// The packages of the repository at <racine>: [{ dossier, pkg, hors }], sorted by directory;
|
|
113
|
+
// `hors` whether `docs/agents/hors-cadre.txt` lists it (a directory under `packages/` or `src/`).
|
|
114
|
+
export function paquets(racine) {
|
|
115
|
+
const p = lireJson(path.join(racine, 'package.json'));
|
|
116
|
+
const { motifs, nies } = motifsDesEspaces(p);
|
|
89
117
|
const dossiers = new Set();
|
|
90
118
|
for (const motif of motifs) {
|
|
91
119
|
for (const f of globSync(`${motif}/package.json`, { cwd: racine })) {
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// A pass of the circuit on the machine: each takes a place of the machine, like a session of an
|
|
2
|
+
// agent (scripts/places-de-la-machine.mjs); a heavy pass (the final pass, `npm run verifier`)
|
|
3
|
+
// holds besides the exclusive lock of the machine (scripts/verrou-de-machine.mjs), once its place
|
|
4
|
+
// is given (`avecLaMachineEtUnePlace`). A targeted pass (the proof of the red and the checks,
|
|
5
|
+
// which play the tests of the ticket only) starts while a heavy one holds the lock.
|
|
6
|
+
import { sousNiceEtIonice } from './enveloppe/enveloppe.mjs';
|
|
7
|
+
import {
|
|
8
|
+
VARIABLE_TRAVAILLEURS,
|
|
9
|
+
avecLaMachineEtUnePlace,
|
|
10
|
+
avecUnePlace,
|
|
11
|
+
travailleursDe,
|
|
12
|
+
} from './places-de-la-machine.mjs';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Whether the npm command of a step is a heavy pass: `npm run verifier`, whatever its step.
|
|
16
|
+
* @param {{ etape: string, args: string[] }} o
|
|
17
|
+
*/
|
|
18
|
+
export function passeLourde({ args }) {
|
|
19
|
+
return args.includes('verifier');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* What a pass or a session out of the envelope launches: a heavy pass runs its command as it is,
|
|
24
|
+
* every core kept (no GRILLHOUSE_TRAVAILLEURS, even inherited); any other runs under `nice` and
|
|
25
|
+
* `ionice`, GRILLHOUSE_TRAVAILLEURS set to max(1, cores ÷ places).
|
|
26
|
+
* @param {{ lourde: boolean, cmd: string, args: string[], env: Record<string, string | undefined> }} o
|
|
27
|
+
* @returns {{ cmd: string, args: string[], env: Record<string, string | undefined> }}
|
|
28
|
+
*/
|
|
29
|
+
export function lancementDeLaPasse({ lourde, cmd, args, env }) {
|
|
30
|
+
const { [VARIABLE_TRAVAILLEURS]: _herite, ...sansTravailleurs } = env;
|
|
31
|
+
if (lourde) return { cmd, args, env: sansTravailleurs };
|
|
32
|
+
const [commande, ...arguments_] = sousNiceEtIonice([cmd, ...args]);
|
|
33
|
+
return {
|
|
34
|
+
cmd: commande,
|
|
35
|
+
args: arguments_,
|
|
36
|
+
env: { ...sansTravailleurs, [VARIABLE_TRAVAILLEURS]: String(travailleursDe({ env })) },
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Plays <mesure> on a place of the machine, and under its lock besides when it is <lourde>, the
|
|
42
|
+
* environment it receives being the pass's own. The wait of either says its reason and stops at
|
|
43
|
+
* the bound (75).
|
|
44
|
+
* @template T
|
|
45
|
+
* @param {(env: Record<string, string | undefined>) => T} mesure
|
|
46
|
+
* @param {{ lourde: boolean, env?: Record<string, string | undefined>, racine?: string,
|
|
47
|
+
* ticket?: string, sorte?: string, rang?: number, dire?: (l: string) => void,
|
|
48
|
+
* borneMs?: number, rappelMs?: number } & Record<string, unknown>} options
|
|
49
|
+
* @returns {T}
|
|
50
|
+
*/
|
|
51
|
+
export function avecLaPasse(mesure, { lourde, env = process.env, racine, ticket, sorte, ...options }) {
|
|
52
|
+
if (lourde) {
|
|
53
|
+
const { dire, borneMs, rappelMs, rang } = options;
|
|
54
|
+
return avecLaMachineEtUnePlace(mesure, {
|
|
55
|
+
env,
|
|
56
|
+
racine,
|
|
57
|
+
ticket,
|
|
58
|
+
sorte,
|
|
59
|
+
...(rang !== undefined ? { rang } : {}),
|
|
60
|
+
...(dire ? { dire } : {}),
|
|
61
|
+
...(borneMs !== undefined ? { borneMs } : {}),
|
|
62
|
+
...(rappelMs !== undefined ? { rappelMs } : {}),
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
return avecUnePlace(place => mesure(place.env), { ...options, env, ticket });
|
|
66
|
+
}
|