@roomi-fields/grillhouse 0.29.0 → 0.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +769 -0
- package/agents/developpeur.md +0 -1
- package/agents/explorateur.md +0 -1
- package/agents/questionneur.md +0 -1
- package/agents/testwriter.md +0 -1
- package/bin/grillhouse.mjs +79 -18
- package/cadre/templates/projet/.github/workflows/ci.yml +2 -13
- package/cadre/templates/projet/CLAUDE.md +5 -1
- package/cadre/templates/projet/docs/agents/issue-tracker.md +1 -1
- package/cadre/templates/projet/package.json +2 -2
- package/charte.md +24 -0
- package/dist/temporal/acte.d.ts +24 -0
- package/dist/temporal/acte.js +139 -0
- package/dist/temporal/acte.js.map +1 -0
- package/dist/temporal/attributs.d.ts +6 -0
- package/dist/temporal/attributs.js +15 -0
- package/dist/temporal/attributs.js.map +1 -0
- package/dist/temporal/circuit/activites.d.ts +13 -0
- package/dist/temporal/circuit/activites.js +33 -0
- package/dist/temporal/circuit/activites.js.map +1 -0
- package/dist/temporal/circuit/client.d.ts +72 -0
- package/dist/temporal/circuit/client.js +247 -0
- package/dist/temporal/circuit/client.js.map +1 -0
- package/dist/temporal/circuit/commande.d.ts +2 -0
- package/dist/temporal/circuit/commande.js +238 -0
- package/dist/temporal/circuit/commande.js.map +1 -0
- package/dist/temporal/circuit/contrat.d.ts +305 -0
- package/dist/temporal/circuit/contrat.js +30 -0
- package/dist/temporal/circuit/contrat.js.map +1 -0
- package/dist/temporal/circuit/deroule.d.ts +3 -0
- package/dist/temporal/circuit/deroule.js +540 -0
- package/dist/temporal/circuit/deroule.js.map +1 -0
- package/dist/temporal/client.d.ts +47 -0
- package/dist/temporal/client.js +69 -0
- package/dist/temporal/client.js.map +1 -0
- package/dist/temporal/commande.d.ts +2 -0
- package/dist/temporal/commande.js +94 -0
- package/dist/temporal/commande.js.map +1 -0
- package/dist/temporal/deroules.d.ts +5 -0
- package/dist/temporal/deroules.js +10 -0
- package/dist/temporal/deroules.js.map +1 -0
- package/dist/temporal/etat.d.ts +33 -0
- package/dist/temporal/etat.js +59 -0
- package/dist/temporal/etat.js.map +1 -0
- package/dist/temporal/file/activites.d.ts +10 -0
- package/dist/temporal/file/activites.js +25 -0
- package/dist/temporal/file/activites.js.map +1 -0
- package/dist/temporal/file/client.d.ts +4 -0
- package/dist/temporal/file/client.js +6 -0
- package/dist/temporal/file/client.js.map +1 -0
- package/dist/temporal/file/contrat.d.ts +158 -0
- package/dist/temporal/file/contrat.js +14 -0
- package/dist/temporal/file/contrat.js.map +1 -0
- package/dist/temporal/file/deroule.d.ts +15 -0
- package/dist/temporal/file/deroule.js +235 -0
- package/dist/temporal/file/deroule.js.map +1 -0
- package/dist/temporal/installation.d.ts +120 -0
- package/dist/temporal/installation.js +386 -0
- package/dist/temporal/installation.js.map +1 -0
- package/dist/temporal/places/activites.d.ts +8 -0
- package/dist/temporal/places/activites.js +13 -0
- package/dist/temporal/places/activites.js.map +1 -0
- package/dist/temporal/places/client.d.ts +28 -0
- package/dist/temporal/places/client.js +64 -0
- package/dist/temporal/places/client.js.map +1 -0
- package/dist/temporal/places/contrat.d.ts +106 -0
- package/dist/temporal/places/contrat.js +21 -0
- package/dist/temporal/places/contrat.js.map +1 -0
- package/dist/temporal/places/deroule.d.ts +3 -0
- package/dist/temporal/places/deroule.js +198 -0
- package/dist/temporal/places/deroule.js.map +1 -0
- package/dist/temporal/sonde/activites.d.ts +6 -0
- package/dist/temporal/sonde/activites.js +52 -0
- package/dist/temporal/sonde/activites.js.map +1 -0
- package/dist/temporal/sonde/contrat.d.ts +35 -0
- package/dist/temporal/sonde/contrat.js +10 -0
- package/dist/temporal/sonde/contrat.js.map +1 -0
- package/dist/temporal/sonde/deroule.d.ts +3 -0
- package/dist/temporal/sonde/deroule.js +39 -0
- package/dist/temporal/sonde/deroule.js.map +1 -0
- package/dist/temporal/tickets/activites.d.ts +7 -0
- package/dist/temporal/tickets/activites.js +81 -0
- package/dist/temporal/tickets/activites.js.map +1 -0
- package/dist/temporal/tickets/client.d.ts +10 -0
- package/dist/temporal/tickets/client.js +31 -0
- package/dist/temporal/tickets/client.js.map +1 -0
- package/dist/temporal/tickets/contrat.d.ts +56 -0
- package/dist/temporal/tickets/contrat.js +13 -0
- package/dist/temporal/tickets/contrat.js.map +1 -0
- package/dist/temporal/tickets/deroule.d.ts +3 -0
- package/dist/temporal/tickets/deroule.js +94 -0
- package/dist/temporal/tickets/deroule.js.map +1 -0
- package/dist/temporal/travailleur.d.ts +2 -0
- package/dist/temporal/travailleur.js +69 -0
- package/dist/temporal/travailleur.js.map +1 -0
- package/docs/ARCHITECTURE.md +646 -87
- package/docs/CADRE.md +27 -0
- package/docs/INTERFACE.md +139 -42
- package/hooks/crochet.mjs +19 -2
- package/hooks/hooks.json +11 -0
- package/package.json +16 -4
- package/scripts/activites.mjs +2255 -0
- package/scripts/aiguillage.d.mts +37 -0
- package/scripts/aiguillage.mjs +40 -14
- package/scripts/avancement.mjs +155 -26
- package/scripts/bilan.mjs +137 -43
- package/scripts/cadre.mjs +16 -4
- package/scripts/circuit.mjs +993 -4075
- package/scripts/circuits-cles.d.mts +4 -0
- package/scripts/circuits-cles.mjs +21 -0
- package/scripts/circuits-du-serveur.mjs +105 -0
- package/scripts/codes-de-sortie.mjs +9 -0
- package/scripts/commandes-composees.mjs +45 -41
- package/scripts/commandes-du-path.d.mts +7 -0
- package/scripts/commandes-du-path.mjs +25 -0
- package/scripts/composants-affectes.mjs +64 -21
- package/scripts/composition-des-langages.mjs +18 -12
- package/scripts/conformite.mjs +56 -28
- package/scripts/copies-finies.mjs +52 -47
- package/scripts/depart-du-ticket.d.mts +53 -0
- package/scripts/depart-du-ticket.mjs +124 -0
- package/scripts/dependances-internes.mjs +121 -0
- package/scripts/dernier-vert.mjs +61 -34
- package/scripts/dette.mjs +32 -11
- package/scripts/donnees-cles.mjs +244 -0
- package/scripts/droits.mjs +51 -16
- package/scripts/effets.mjs +352 -0
- package/scripts/empreinte-d-etape.mjs +17 -0
- package/scripts/engendres.mjs +15 -5
- package/scripts/enveloppe/enveloppe.mjs +259 -55
- package/scripts/enveloppe/lancer.sh +14 -18
- package/scripts/enveloppe/paquets-du-plan.mjs +2 -2
- package/scripts/enveloppe/travail-de-la-copie.mjs +41 -13
- package/scripts/etapes.mjs +5 -2
- package/scripts/faits-du-circuit.mjs +493 -0
- package/scripts/file-des-tickets.d.mts +21 -0
- package/scripts/file-des-tickets.mjs +58 -0
- package/scripts/flux-des-paquets.mjs +201 -0
- package/scripts/gardes-du-cadre.mjs +21 -5
- package/scripts/init.mjs +11 -4
- package/scripts/integration/file.mjs +544 -434
- package/scripts/integration/integrer.mjs +87 -43
- package/scripts/integration/rejeu.mjs +45 -13
- package/scripts/jointure.d.ts +151 -28
- package/scripts/langages/cargo/commandes.mjs +383 -124
- package/scripts/langages/cargo/composants.mjs +154 -42
- package/scripts/langages/cargo/exemples.mjs +12 -21
- package/scripts/langages/cargo/index.mjs +22 -8
- package/scripts/langages/cargo/sccache.mjs +8 -14
- package/scripts/langages/cargo/tests-de-head.mjs +25 -9
- package/scripts/langages/python/commandes.mjs +218 -100
- package/scripts/langages/python/composants.mjs +53 -21
- package/scripts/langages/python/exemples.mjs +6 -16
- package/scripts/langages/python/index.mjs +28 -8
- package/scripts/langages/python/lot.mjs +1 -36
- package/scripts/langages/typescript/chemins-des-tests.mjs +6 -2
- package/scripts/langages/typescript/composants.mjs +9 -3
- package/scripts/langages/typescript/consommateurs-arbitres.mjs +40 -14
- package/scripts/langages/typescript/consommateurs.mjs +39 -14
- package/scripts/langages/typescript/construire.mjs +6 -163
- package/scripts/langages/typescript/elements-du-lot.mjs +36 -12
- package/scripts/langages/typescript/exemples.mjs +3 -11
- package/scripts/langages/typescript/frontieres.mjs +66 -22
- package/scripts/langages/typescript/index-interfaces.mjs +36 -13
- package/scripts/langages/typescript/index.mjs +50 -61
- package/scripts/langages/typescript/interfaces-contre-code.mjs +113 -45
- package/scripts/langages/typescript/lecteurs.mjs +36 -11
- package/scripts/langages/typescript/migrations/0.23.0-config-vitest.mjs +15 -5
- package/scripts/langages/typescript/migrations/0.25.0-chemins-des-tests.mjs +6 -2
- package/scripts/langages/typescript/migrations/0.25.0-tailles-des-tests.mjs +6 -2
- package/scripts/langages/typescript/migrations/0.30.0-prefixe-des-tickets.mjs +63 -0
- package/scripts/langages/typescript/migrations/0.30.0-tailles-des-outils-lourds.mjs +33 -0
- package/scripts/langages/typescript/migrations/0.30.0-titres-nommant-un-ticket.mjs +40 -0
- package/scripts/langages/typescript/mise-a-jour.mjs +1 -2
- package/scripts/langages/typescript/parcours.mjs +12 -4
- package/scripts/langages/typescript/regle-des-tests.mjs +9 -3
- package/scripts/langages/typescript/resumes.mjs +9 -3
- package/scripts/langages/typescript/tailles-des-tests.mjs +93 -20
- package/scripts/langages/typescript/tests-de-nuit.mjs +15 -10
- package/scripts/langages/typescript/tests.mjs +40 -15
- package/scripts/langages/typescript/titres-de-tests.mjs +320 -0
- package/scripts/langages/typescript/turbo-des-paquets.mjs +327 -81
- package/scripts/langages/typescript/verdict.mjs +4 -2
- package/scripts/langages/typescript/verifier.mjs +58 -20
- package/scripts/langages/typescript/vitest-config/avancement.reporter.mjs +15 -5
- package/scripts/langages/typescript/vitest-config/base.mjs +29 -3
- package/scripts/langages/typescript/vitest-config/bornes.mjs +13 -0
- package/scripts/langages/typescript/vitest-config/changements.mjs +21 -8
- package/scripts/langages/typescript/vitest-config/cibles.mjs +36 -14
- package/scripts/langages/typescript/vitest-config/delais.mjs +60 -0
- package/scripts/langages/typescript/vitest-config/delais.setup.mjs +11 -0
- package/scripts/langages/typescript/vitest-config/duree.classement.mjs +108 -0
- package/scripts/langages/typescript/vitest-config/duree.reporter.mjs +56 -59
- package/scripts/langages/typescript/vitest-config/lances.mjs +83 -27
- package/scripts/langages/typescript/vitest-config/machine.setup.mjs +10 -0
- package/scripts/langages/typescript/vitest-config/resultats.mjs +3 -1
- package/scripts/langages/typescript/vitest.nuit.config.mjs +4 -0
- package/scripts/lint-des-scripts.mjs +58 -0
- package/scripts/mesure/base-de-passe.mjs +117 -25
- package/scripts/mesure/pression.mjs +12 -6
- package/scripts/mesure-de-la-machine.d.mts +21 -0
- package/scripts/mesure-de-la-machine.mjs +76 -0
- package/scripts/migrations/0.23.0-charte-importee.mjs +6 -2
- package/scripts/migrations/0.23.0-crochets-de-seance.mjs +25 -8
- package/scripts/migrations/0.23.0-marche-du-projet.mjs +18 -6
- package/scripts/migrations/0.23.2-copies-du-cadre.mjs +56 -18
- package/scripts/migrations/0.24.12-tri-des-decouvertes.mjs +6 -2
- package/scripts/migrations/0.25.0-script-des-tests.mjs +15 -5
- package/scripts/migrations/0.30.0-ci-appelle-la-verification.mjs +124 -0
- package/scripts/migrations/0.31.0-paquets-dans-le-graphe.mjs +81 -0
- package/scripts/migrations.mjs +5 -0
- package/scripts/nuit.sh +25 -3
- package/scripts/outil.mjs +3 -1
- package/scripts/outils-cles.d.mts +24 -0
- package/scripts/outils-cles.mjs +18 -8
- package/scripts/paquet-npm.mjs +157 -0
- package/scripts/paquet.mjs +73 -4
- package/scripts/paquets.mjs +46 -10
- package/scripts/passe-de-la-machine.mjs +71 -0
- package/scripts/places-de-la-machine.mjs +414 -0
- package/scripts/places-du-serveur.mjs +170 -0
- package/scripts/prefixe-des-tickets.mjs +68 -0
- package/scripts/preparation.mjs +25 -8
- package/scripts/registre.mjs +9 -4
- package/scripts/regles-des-places.d.mts +36 -0
- package/scripts/regles-des-places.mjs +70 -0
- package/scripts/reponses-du-circuit.d.mts +6 -0
- package/scripts/reponses-du-circuit.mjs +28 -0
- package/scripts/reprise.mjs +66 -0
- package/scripts/resultats.mjs +112 -46
- package/scripts/retirer-les-copies-finies.mjs +25 -0
- package/scripts/sans-reponse.d.mts +4 -0
- package/scripts/sans-reponse.mjs +13 -0
- package/scripts/seances.mjs +936 -0
- package/scripts/services-du-noyau.mjs +27 -8
- package/scripts/session-start.sh +2 -2
- package/scripts/sortie.mjs +3 -3
- package/scripts/sous-commandes.mjs +41 -10
- package/scripts/style-a-l-ecriture.mjs +260 -0
- package/scripts/superviseur.mjs +122 -111
- package/scripts/tableau.mjs +180 -117
- package/scripts/taches-du-graphe.mjs +348 -0
- package/scripts/ticket-du-circuit.mjs +216 -0
- package/scripts/transitions.d.mts +148 -0
- package/scripts/transitions.mjs +1018 -0
- package/scripts/verrou-de-fichier.mjs +8 -4
- package/scripts/verrou-de-machine.mjs +150 -51
- package/scripts/verrous/commande.mjs +50 -17
- package/scripts/verrous/ticket-du-sous-agent.mjs +9 -3
- package/scripts/verrous/verrou.mjs +42 -14
- package/skills/explorateur/SKILL.md +9 -2
- package/skills/grill/SKILL.md +1 -1
- package/skills/mesure/SKILL.md +3 -0
- package/skills/pitmaster/SKILL.md +17 -18
- package/skills/pitmaster/references/consigne-agent.md +5 -1
- package/skills/release/SKILL.md +3 -3
- package/skills/relecteur/SKILL.md +5 -3
- package/skills/testwriter/SKILL.md +49 -31
- package/scripts/demon.mjs +0 -251
- package/scripts/integration/file-attente.mjs +0 -61
- package/scripts/langages/cargo/touches.mjs +0 -93
- package/scripts/langages/typescript/script-des-tests.mjs +0 -6
|
@@ -40,10 +40,14 @@ const dossiers = projet => [
|
|
|
40
40
|
// The script of the package.json <rel> of <projet>; what it did, or what it leaves.
|
|
41
41
|
function renommerLeScript(projet, rel) {
|
|
42
42
|
const f = path.join(projet, rel);
|
|
43
|
-
if (!existsSync(f))
|
|
43
|
+
if (!existsSync(f)) {
|
|
44
|
+
return [];
|
|
45
|
+
}
|
|
44
46
|
const pkg = lireJson(f);
|
|
45
47
|
const scripts = pkg.scripts;
|
|
46
|
-
if (!scripts || !Object.hasOwn(scripts, ANCIEN))
|
|
48
|
+
if (!scripts || !Object.hasOwn(scripts, ANCIEN)) {
|
|
49
|
+
return [];
|
|
50
|
+
}
|
|
47
51
|
if (Object.hasOwn(scripts, NOUVEAU) && scripts[NOUVEAU] !== scripts[ANCIEN]) {
|
|
48
52
|
return [
|
|
49
53
|
{
|
|
@@ -54,7 +58,9 @@ function renommerLeScript(projet, rel) {
|
|
|
54
58
|
const double = Object.hasOwn(scripts, NOUVEAU);
|
|
55
59
|
pkg.scripts = Object.fromEntries(
|
|
56
60
|
Object.entries(scripts).flatMap(([k, v]) => {
|
|
57
|
-
if (k !== ANCIEN)
|
|
61
|
+
if (k !== ANCIEN) {
|
|
62
|
+
return [[k, v]];
|
|
63
|
+
}
|
|
58
64
|
return double ? [] : [[NOUVEAU, v]];
|
|
59
65
|
})
|
|
60
66
|
);
|
|
@@ -65,9 +71,13 @@ function renommerLeScript(projet, rel) {
|
|
|
65
71
|
// The task of the turbo.json <rel> of <projet>; what it did, or what it leaves.
|
|
66
72
|
function renommerLaTache(projet, rel) {
|
|
67
73
|
const f = path.join(projet, rel);
|
|
68
|
-
if (!existsSync(f))
|
|
74
|
+
if (!existsSync(f)) {
|
|
75
|
+
return [];
|
|
76
|
+
}
|
|
69
77
|
const texte = readFileSync(f, 'utf8');
|
|
70
|
-
if (texte.search(TACHE) < 0)
|
|
78
|
+
if (texte.search(TACHE) < 0) {
|
|
79
|
+
return [];
|
|
80
|
+
}
|
|
71
81
|
if (TACHE_NEUVE.test(texte)) {
|
|
72
82
|
return [
|
|
73
83
|
{
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
// From 0.30.0 `npm run verifier` plays the format check and the lint beside the guards, the typing
|
|
2
|
+
// and the tests, and the CI calls it alone (grillhouse-61z): a control played in the CI is played
|
|
3
|
+
// at the poste.
|
|
4
|
+
//
|
|
5
|
+
// - The `.github/workflows/ci.yml` of the project that is identical, spaces normalized, to the
|
|
6
|
+
// template of the version before is replaced by the new template.
|
|
7
|
+
// - One that differs (a step the project added) stays, and `aFaire` names the steps to remove from
|
|
8
|
+
// its test job: `format:check`, `lint`, `typecheck` and `build`.
|
|
9
|
+
// - One that already calls the verification alone, and a project without CI, are left, nothing
|
|
10
|
+
// said: a second pass changes nothing.
|
|
11
|
+
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
12
|
+
import path from 'node:path';
|
|
13
|
+
import { CADRE } from '../cadre.mjs';
|
|
14
|
+
|
|
15
|
+
export const version = '0.30.0';
|
|
16
|
+
export const nom = 'ci appelle la vérification';
|
|
17
|
+
|
|
18
|
+
const CI = '.github/workflows/ci.yml';
|
|
19
|
+
const GABARIT = path.join(CADRE, 'templates', 'projet');
|
|
20
|
+
|
|
21
|
+
// The template of 0.29.0, the version before this one.
|
|
22
|
+
const D_AVANT = `name: CI
|
|
23
|
+
|
|
24
|
+
on:
|
|
25
|
+
push:
|
|
26
|
+
branches: [main, develop]
|
|
27
|
+
pull_request:
|
|
28
|
+
branches: [main, develop]
|
|
29
|
+
|
|
30
|
+
jobs:
|
|
31
|
+
test:
|
|
32
|
+
runs-on: ubuntu-latest
|
|
33
|
+
|
|
34
|
+
strategy:
|
|
35
|
+
matrix:
|
|
36
|
+
node-version: [22.x, 24.x]
|
|
37
|
+
|
|
38
|
+
steps:
|
|
39
|
+
- name: Checkout
|
|
40
|
+
uses: actions/checkout@v5
|
|
41
|
+
|
|
42
|
+
- name: Setup Node.js \${{ matrix.node-version }}
|
|
43
|
+
uses: actions/setup-node@v5
|
|
44
|
+
with:
|
|
45
|
+
node-version: \${{ matrix.node-version }}
|
|
46
|
+
cache: 'npm'
|
|
47
|
+
|
|
48
|
+
- name: Install dependencies
|
|
49
|
+
run: npm ci
|
|
50
|
+
|
|
51
|
+
- name: Check formatting
|
|
52
|
+
run: npm run format:check
|
|
53
|
+
|
|
54
|
+
- name: Lint
|
|
55
|
+
run: npm run lint
|
|
56
|
+
|
|
57
|
+
- name: Typecheck
|
|
58
|
+
run: npm run typecheck
|
|
59
|
+
|
|
60
|
+
- name: Build
|
|
61
|
+
run: npm run build --if-present
|
|
62
|
+
|
|
63
|
+
- name: Guards and tests
|
|
64
|
+
run: npm run verifier
|
|
65
|
+
|
|
66
|
+
build:
|
|
67
|
+
runs-on: ubuntu-latest
|
|
68
|
+
needs: test
|
|
69
|
+
|
|
70
|
+
steps:
|
|
71
|
+
- name: Checkout
|
|
72
|
+
uses: actions/checkout@v5
|
|
73
|
+
|
|
74
|
+
- name: Setup Node.js
|
|
75
|
+
uses: actions/setup-node@v5
|
|
76
|
+
with:
|
|
77
|
+
node-version: '22'
|
|
78
|
+
cache: 'npm'
|
|
79
|
+
|
|
80
|
+
- name: Install dependencies
|
|
81
|
+
run: npm ci
|
|
82
|
+
|
|
83
|
+
- name: Build
|
|
84
|
+
run: npm run build --if-present
|
|
85
|
+
|
|
86
|
+
- name: Check package
|
|
87
|
+
run: npm pack --dry-run
|
|
88
|
+
`;
|
|
89
|
+
|
|
90
|
+
// The versions before of the template (each one's text, to compare with the project's).
|
|
91
|
+
const ANCIENNES = [D_AVANT];
|
|
92
|
+
|
|
93
|
+
// A text with its blanks normalized: line ends, trailing spaces, runs of blanks.
|
|
94
|
+
const normaliser = t =>
|
|
95
|
+
t
|
|
96
|
+
.split(/\r?\n/)
|
|
97
|
+
.map(l => l.trim().replace(/[ \t]+/g, ' '))
|
|
98
|
+
.filter(l => l !== '')
|
|
99
|
+
.join('\n');
|
|
100
|
+
|
|
101
|
+
/** Replaces the CI of the project by the template's when it is a former one; returns what it did. */
|
|
102
|
+
export function migrer(projet) {
|
|
103
|
+
const f = path.join(projet, CI);
|
|
104
|
+
if (!existsSync(f)) {
|
|
105
|
+
return [];
|
|
106
|
+
}
|
|
107
|
+
const actuel = normaliser(readFileSync(f, 'utf8'));
|
|
108
|
+
const neuf = readFileSync(path.join(GABARIT, CI), 'utf8');
|
|
109
|
+
if (actuel === normaliser(neuf)) {
|
|
110
|
+
return [];
|
|
111
|
+
}
|
|
112
|
+
if (ANCIENNES.some(a => normaliser(a) === actuel)) {
|
|
113
|
+
writeFileSync(f, neuf);
|
|
114
|
+
return [`${CI} : remplacé par celui du gabarit, qui n'appelle que \`npm run verifier\``];
|
|
115
|
+
}
|
|
116
|
+
if (!/^\s*run:\s*npm run (format:check|lint|typecheck|build)\b/m.test(readFileSync(f, 'utf8'))) {
|
|
117
|
+
return [];
|
|
118
|
+
}
|
|
119
|
+
return [
|
|
120
|
+
{
|
|
121
|
+
aFaire: `${CI} : \`npm run verifier\` joue la mise en forme, le lint, le typage et la construction ; retirer du job de test les étapes \`format:check\`, \`lint\`, \`typecheck\` et \`build\`, et ne garder après l'installation que \`npm run verifier\`.`,
|
|
122
|
+
},
|
|
123
|
+
];
|
|
124
|
+
}
|
|
@@ -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 { inscrireAuxEspaces, packageJsonDuPaquet, paquetsSansPackageJson } from '../paquet-npm.mjs';
|
|
23
|
+
import { paquets } from '../paquets.mjs';
|
|
24
|
+
|
|
25
|
+
export const version = '0.31.0';
|
|
26
|
+
export const nom = 'paquets dans le graphe';
|
|
27
|
+
|
|
28
|
+
export function migrer(projet) {
|
|
29
|
+
const racinePj = path.join(projet, 'package.json');
|
|
30
|
+
if (!existsSync(racinePj)) {
|
|
31
|
+
return [];
|
|
32
|
+
}
|
|
33
|
+
const lignes = [];
|
|
34
|
+
const inscrire = [];
|
|
35
|
+
for (const { chemin, nom: nomNpm } of paquetsSansPackageJson(projet)) {
|
|
36
|
+
const f = `${chemin}/package.json`;
|
|
37
|
+
const abs = path.join(projet, f);
|
|
38
|
+
if (existsSync(abs)) {
|
|
39
|
+
let present;
|
|
40
|
+
try {
|
|
41
|
+
present = JSON.parse(readFileSync(abs, 'utf8')).name;
|
|
42
|
+
} catch (e) {
|
|
43
|
+
lignes.push({
|
|
44
|
+
aFaire: `${f} : ${e.message} ; le nom du paquet est ${JSON.stringify(nomNpm)}.`,
|
|
45
|
+
});
|
|
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
|
@@ -39,6 +39,12 @@
|
|
|
39
39
|
# (scripts/outils-cles.mjs) gives each command of the project its variables, each set to its
|
|
40
40
|
# path, whatever the environment of the night's launcher; a faulty key turns the night red, the
|
|
41
41
|
# log naming it, and nothing runs.
|
|
42
|
+
# - TEMPORAL: after the tools of the project, before any command, the night lays the pinned program of
|
|
43
|
+
# Temporal down (`grillhouse temporal installer --programme-seul`, by the built command of the
|
|
44
|
+
# version playing the night, not the copy's: the copy has no build yet; idempotent: a program
|
|
45
|
+
# already laid down is not downloaded again) and exports its path as TEMPORAL, over any key left
|
|
46
|
+
# in a package.json; a laying that fails turns the night red, the log naming its cause, and
|
|
47
|
+
# nothing runs.
|
|
42
48
|
# - The night tests: after the full pass, the night tests, then the measures of time alone (the
|
|
43
49
|
# time budget benches and the time witnesses), which `npm test` and the integration leave out
|
|
44
50
|
# (grillhouse-bd7), played by the command `tests-de-nuit` of the module of the copy's language
|
|
@@ -73,7 +79,7 @@
|
|
|
73
79
|
# the commit accepts the push.
|
|
74
80
|
# - The copies whose content is on main: once its steps are played, whatever their verdict, the
|
|
75
81
|
# 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
|
|
82
|
+
# scripts/retirer-copie.sh without `--jetable` (scripts/retirer-les-copies-finies.mjs), as a CI cleans its
|
|
77
83
|
# workspaces at the end of a pipeline: a copy whose commits and local work have all entered
|
|
78
84
|
# main by their content goes, and its branch (main and a branch another copy holds stay); a copy
|
|
79
85
|
# refused (commits or work not entered, a lock) or held by a running circuit (its ticket in progress, its
|
|
@@ -226,6 +232,22 @@ jouer() {
|
|
|
226
232
|
return 1
|
|
227
233
|
fi
|
|
228
234
|
eval "$outils"
|
|
235
|
+
# The pinned program of Temporal, laid down and exported for every command. The command is that
|
|
236
|
+
# of the version playing the night (already built), not the copy's: the copy is cleaned of its
|
|
237
|
+
# build and has no node_modules before the `npm ci` below.
|
|
238
|
+
local temporal
|
|
239
|
+
if ! temporal=$(env -C "$copie" node "$ici/../bin/grillhouse.mjs" temporal installer --programme-seul); then
|
|
240
|
+
echo "✗ la pose du programme temporal échoue : rien n'est joué."
|
|
241
|
+
return 1
|
|
242
|
+
fi
|
|
243
|
+
export TEMPORAL="$temporal"
|
|
244
|
+
# The data of the project (donnees-cles.mjs), exported the same way.
|
|
245
|
+
local donnees
|
|
246
|
+
if ! donnees=$(node "$ici/donnees-cles.mjs" "$copie"); then
|
|
247
|
+
echo "✗ la clé grillhouse.donnees est refusée : rien n'est joué."
|
|
248
|
+
return 1
|
|
249
|
+
fi
|
|
250
|
+
eval "$donnees"
|
|
229
251
|
if [ -f "$copie/package-lock.json" ] && ! cmp -s "$copie/package-lock.json" "$copie/node_modules/.nuit-lock"; then
|
|
230
252
|
monter npm --prefix "$copie" ci --no-audit --no-fund --silent || return 1
|
|
231
253
|
cp "$copie/package-lock.json" "$copie/node_modules/.nuit-lock"
|
|
@@ -233,7 +255,7 @@ jouer() {
|
|
|
233
255
|
# The full pass, played for real: the night replays no log of the cache. Each step plays even
|
|
234
256
|
# when one before it is red; a step à repasser ends the night there, red if a step before it is.
|
|
235
257
|
local code tache avant
|
|
236
|
-
GRILLHOUSE_ROUGES="$rouges" monter npm --prefix "$copie" run verifier -- --force
|
|
258
|
+
GRILLHOUSE_ROUGES="$rouges" GRILLHOUSE_VERIFICATION_SORTE=Nuit monter npm --prefix "$copie" run verifier -- --force
|
|
237
259
|
code=$?
|
|
238
260
|
if [ "$code" -eq 75 ]; then
|
|
239
261
|
echo "⏱ la passe complète est à repasser (code 75) : l'attente de la machine a atteint sa borne."
|
|
@@ -296,7 +318,7 @@ jouer >> "$journal" 2>&1
|
|
|
296
318
|
verdict=$?
|
|
297
319
|
# The copies whose content is on main go once the steps are played, the night's own kept and
|
|
298
320
|
# pruned of its tools' outputs; their removal never changes the verdict.
|
|
299
|
-
(cd "$racine" && node "$ici/copies-finies.mjs" "$copie") >> "$journal" 2>&1 || true
|
|
321
|
+
(cd "$racine" && node "$ici/retirer-les-copies-finies.mjs" "$copie") >> "$journal" 2>&1 || true
|
|
300
322
|
|
|
301
323
|
if [ "$verdict" -eq 75 ]; then
|
|
302
324
|
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"
|
package/scripts/outil.mjs
CHANGED
|
@@ -39,7 +39,9 @@ function versionAInstaller(racine, args) {
|
|
|
39
39
|
refus: `⛔ grillhouse outil : aucun package.json dans ${racine} ; la clé ${CLE} s'écrit au package.json racine du dépôt.\n`,
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
if (args[0] !== undefined)
|
|
42
|
+
if (args[0] !== undefined) {
|
|
43
|
+
ecrireLaCle(racine, args[0]);
|
|
44
|
+
}
|
|
43
45
|
try {
|
|
44
46
|
const version = versionDeLOutil(racine);
|
|
45
47
|
return version === null
|
|
@@ -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
|
|
@@ -90,7 +89,9 @@ export function lireOutils(
|
|
|
90
89
|
{ maison = os.homedir(), existe = existsSync, reel = realpath, montages = [] } = {}
|
|
91
90
|
) {
|
|
92
91
|
const o = pkg?.grillhouse?.outils;
|
|
93
|
-
if (o === undefined || o === null)
|
|
92
|
+
if (o === undefined || o === null) {
|
|
93
|
+
return { outils: {}, fautes: [] };
|
|
94
|
+
}
|
|
94
95
|
if (typeof o !== 'object' || Array.isArray(o)) {
|
|
95
96
|
return {
|
|
96
97
|
outils: {},
|
|
@@ -118,10 +119,15 @@ export function lireOutils(
|
|
|
118
119
|
const cible = !refus && existe(chemin) ? reel(chemin) : chemin;
|
|
119
120
|
const refusDeLaCible =
|
|
120
121
|
cible !== chemin ? refusDuChemin(cle, cible, path.resolve(maison), montages) : null;
|
|
121
|
-
if (refus)
|
|
122
|
-
|
|
123
|
-
else if (
|
|
124
|
-
|
|
122
|
+
if (refus) {
|
|
123
|
+
fautes.push(refus);
|
|
124
|
+
} else if (refusDeLaCible) {
|
|
125
|
+
fautes.push(`${refusDeLaCible} (la cible du lien ${chemin})`);
|
|
126
|
+
} else if (existe(chemin)) {
|
|
127
|
+
outils[nom] = chemin;
|
|
128
|
+
} else {
|
|
129
|
+
fautes.push(`la clé ${cle} nomme ${chemin}, qui n'existe pas.`);
|
|
130
|
+
}
|
|
125
131
|
}
|
|
126
132
|
}
|
|
127
133
|
return { outils: fautes.length ? {} : outils, fautes };
|
|
@@ -152,12 +158,16 @@ export function arbrePrincipal(dir) {
|
|
|
152
158
|
export function outilsDe(dir, { montages = [] } = {}) {
|
|
153
159
|
const racine = arbrePrincipal(dir);
|
|
154
160
|
const f = path.join(racine, 'package.json');
|
|
155
|
-
if (!existsSync(f))
|
|
161
|
+
if (!existsSync(f)) {
|
|
162
|
+
return {};
|
|
163
|
+
}
|
|
156
164
|
const temporaires = [process.env.CLAUDE_CODE_TMPDIR, os.tmpdir(), '/tmp'].filter(Boolean);
|
|
157
165
|
const { outils, fautes } = lireOutils(JSON.parse(readFileSync(f, 'utf8')), {
|
|
158
166
|
montages: [racine, ...temporaires, ...montages],
|
|
159
167
|
});
|
|
160
|
-
if (fautes.length)
|
|
168
|
+
if (fautes.length) {
|
|
169
|
+
throw new Error(fautes.join('\n'));
|
|
170
|
+
}
|
|
161
171
|
return outils;
|
|
162
172
|
}
|
|
163
173
|
|
|
@@ -0,0 +1,157 @@
|
|
|
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)) {
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
const d = path.join(dossier, e.name);
|
|
54
|
+
const f = path.join(d, manifeste);
|
|
55
|
+
const paquet = existsSync(f) ? nomDuManifeste(langageNom, readFileSync(f, 'utf8')) : null;
|
|
56
|
+
if (paquet !== null) {
|
|
57
|
+
out.push({ dossier: d, nom: e.name, paquet });
|
|
58
|
+
}
|
|
59
|
+
out.push(...avecManifeste(d, manifeste, langageNom, exclus));
|
|
60
|
+
}
|
|
61
|
+
return out;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* The packages of a language without package.json of its own (`sansPackageJson`) the tables of the
|
|
66
|
+
* components of docs/ARCHITECTURE.md declare in the project at <racine>: `{ langage, chemin, nom }`,
|
|
67
|
+
* `chemin` from the root, `nom` the manifest's name, sorted by language then path. A package is a
|
|
68
|
+
* folder under the root that holds the manifest of its language with a package name (a
|
|
69
|
+
* `Cargo.toml` of a virtual workspace names none) and that a row of the language names, by its
|
|
70
|
+
* path, its folder's name or its manifest's name, as the guard of the languages reads a component.
|
|
71
|
+
* @param {string} racine
|
|
72
|
+
*/
|
|
73
|
+
export function paquetsSansPackageJson(racine) {
|
|
74
|
+
const sortie = [];
|
|
75
|
+
const declares = langagesDeclares(racine);
|
|
76
|
+
for (const langageNom of sansPackageJson().filter(n => declares.includes(n))) {
|
|
77
|
+
const candidats = avecManifeste(
|
|
78
|
+
racine,
|
|
79
|
+
langage(langageNom).manifeste,
|
|
80
|
+
langageNom,
|
|
81
|
+
hors(racine)
|
|
82
|
+
);
|
|
83
|
+
const trouves = new Set();
|
|
84
|
+
for (const t of tableauxDesComposants(racine)) {
|
|
85
|
+
const colonne = colonneDesNoms(t.lignes, candidats, racine, t.colonne);
|
|
86
|
+
if (colonne < 0) {
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
for (const l of t.lignes) {
|
|
90
|
+
if (langageDeLaCellule(l.cellules[t.colonne]) !== langageNom) {
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
for (const c of candidats) {
|
|
94
|
+
if (nomme(nomsDe(l.cellules[colonne]), c, racine)) {
|
|
95
|
+
trouves.add(c);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
sortie.push(
|
|
101
|
+
...[...trouves]
|
|
102
|
+
.map(c => ({
|
|
103
|
+
langage: langageNom,
|
|
104
|
+
chemin: path.relative(racine, c.dossier).split(path.sep).join('/'),
|
|
105
|
+
nom: c.paquet,
|
|
106
|
+
}))
|
|
107
|
+
.sort((a, b) => (a.chemin < b.chemin ? -1 : 1))
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
return sortie;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* The text of the package.json of the package <nom> in <chemin> (from the root of the project).
|
|
115
|
+
* @param {string} nom
|
|
116
|
+
* @param {string} chemin
|
|
117
|
+
*/
|
|
118
|
+
export function packageJsonDuPaquet(nom, chemin) {
|
|
119
|
+
const racine = chemin
|
|
120
|
+
.split('/')
|
|
121
|
+
.map(() => '..')
|
|
122
|
+
.join('/');
|
|
123
|
+
const appel = commande => `cd ${racine} && grillhouse ${commande} ${chemin}`;
|
|
124
|
+
const p = {
|
|
125
|
+
name: nom,
|
|
126
|
+
private: true,
|
|
127
|
+
scripts: {
|
|
128
|
+
build: appel('construire'),
|
|
129
|
+
'test:unit': appel('tests-du-paquet'),
|
|
130
|
+
typecheck: appel('typer'),
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
return `${JSON.stringify(p, null, 2)}\n`;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* The text of the root package.json <texte> with <chemin> entered in its `workspaces`; null when
|
|
138
|
+
* its patterns select the folder already.
|
|
139
|
+
* @param {string} texte
|
|
140
|
+
* @param {string} chemin
|
|
141
|
+
*/
|
|
142
|
+
export function inscrireAuxEspaces(texte, chemin) {
|
|
143
|
+
const p = JSON.parse(texte);
|
|
144
|
+
if (selectionne(p, chemin)) {
|
|
145
|
+
return null;
|
|
146
|
+
}
|
|
147
|
+
const indent = /^([ \t]+)"/m.exec(texte)?.[1] ?? 2;
|
|
148
|
+
const fin = texte.endsWith('\n') ? '\n' : '';
|
|
149
|
+
if (Array.isArray(p.workspaces)) {
|
|
150
|
+
p.workspaces = [...p.workspaces, chemin];
|
|
151
|
+
} else if (Array.isArray(p.workspaces?.packages)) {
|
|
152
|
+
p.workspaces = { ...p.workspaces, packages: [...p.workspaces.packages, chemin] };
|
|
153
|
+
} else {
|
|
154
|
+
p.workspaces = [chemin];
|
|
155
|
+
}
|
|
156
|
+
return `${JSON.stringify(p, null, indent)}${fin}`;
|
|
157
|
+
}
|