@roomi-fields/grillhouse 0.25.1 → 0.25.3

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.
@@ -5,5 +5,5 @@
5
5
  "author": {
6
6
  "name": "Romain Peyrichou"
7
7
  },
8
- "version": "0.25.1"
8
+ "version": "0.25.3"
9
9
  }
@@ -19,6 +19,8 @@ allow = [
19
19
  "Apache-2.0 WITH LLVM-exception",
20
20
  "BSD-2-Clause",
21
21
  "BSD-3-Clause",
22
+ # webpki-roots, Mozilla's certificate authorities, which most TLS in Rust pulls in.
23
+ "CDLA-Permissive-2.0",
22
24
  "ISC",
23
25
  "Unicode-3.0",
24
26
  "Zlib",
@@ -409,7 +409,12 @@ npm vaut pour les deux : `npx grillhouse maj` met à jour le greffon resté derr
409
409
  (`claude plugin update`), comme `npm install` aligne ce qui est installé sur ce qui est déclaré,
410
410
  et finit non nulle, avec la commande à taper, quand les deux restent en désaccord ; l'ouverture
411
411
  de séance nomme un greffon chargé à une autre version que le paquet du projet, avec la commande
412
- qui les remet d'accord. Un projet n'en garde aucune copie
412
+ qui les remet d'accord. Dans un projet de TypeScript, `npx grillhouse maj` monte à `^<version>` la
413
+ plage du paquet dans chaque manifeste qui la déclare plus basse (la racine et chaque paquet,
414
+ `dependencies` ou `devDependencies`), comme `npm install <paquet>@<version> --workspaces` ou
415
+ syncpack alignent les déclarations d'une dépendance : un paquet resté sur l'ancienne plage
416
+ garderait sous lui une copie de l'ancienne version ; une plage qui couvre déjà la version reste.
417
+ Un projet n'en garde aucune copie
413
418
  (`npx grillhouse maj` retire, à leur empreinte, celles que posait la 0.22) ; sans le paquet installé, l'ouverture de séance dit « lance `npm install` », et les autres crochets
414
419
  sortent sans effet. Les crochets git du cadre suivent le modèle de Husky : le `prepare` du
415
420
  projet lance `grillhouse hooks`, qui les pose à côté des sections de Beads, et chacun appelle
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roomi-fields/grillhouse",
3
- "version": "0.25.1",
3
+ "version": "0.25.3",
4
4
  "description": "Roomi's Grillhouse: the frame's scripts, called by one command, grillhouse <sous-commande>",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -17,6 +17,15 @@
17
17
  // version, the project's scripts stay (the frame's included) and the report names the version
18
18
  // found and the range required. A `test` that runs anything else stays. A repository of packages
19
19
  // keeps its tests in its packages: its root gets no `test:unit`, and the frame's own leaves.
20
+ // - The frame's range: each manifest of the project (the root's, and each package's the workspaces
21
+ // select, out of the frame included) that declares the frame's package in its `dependencies` or
22
+ // `devDependencies` at a range lower than the version installed (no version it covers reaches
23
+ // it) passes to `^<version>`, as `npm install <pkg>@<version> --workspaces`, Renovate and syncpack
24
+ // align every declaration of a dependency of the workspace; a range that covers the version, one
25
+ // above it, or one that is no range of versions (`file:`, `workspace:`) stays. The report names
26
+ // each manifest brought up. Witness: BPScript at 0.25.1 (bp-mono-vbwf.322.15), whose packages kept
27
+ // `^0.24.0`: npm left a copy 0.24.15 under each `packages/*/node_modules`, where the entry
28
+ // `./vitest-config/duree` does not resolve.
20
29
  // - A package of the frame whose code imports the frame's package (a file of its `src/` out of the
21
30
  // tests, its imports read by TypeScript's `preProcessFile`) declares it in its `dependencies`, as
22
31
  // npm puts there what the published code imports: a declaration in its `devDependencies` moves
@@ -25,7 +34,7 @@
25
34
  // which each Vitest configuration imports by its name: in a project with `workspaces`, each
26
35
  // package of the frame that plays tests (`joueDesTests`: its script `test:unit`) declares the
27
36
  // frame's package in its `devDependencies`, at the range the root declares (else `^<version>`),
28
- // a declaration it holds kept. The update writes no Vitest configuration.
37
+ // a declaration it holds kept (at its range, brought up as above). The update writes no Vitest configuration.
29
38
  // - The typing: each package of TypeScript (a `tsconfig.json`) that has no `typecheck` script
30
39
  // receives the template's, `tsc -p tsconfig.json --noEmit`: each package of the frame in a
31
40
  // project with `workspaces` (the root's `typecheck` stays the project's), the root in a project
@@ -63,6 +72,42 @@ const trie = deps =>
63
72
  const plageDeLaRacine = p =>
64
73
  CHAMPS_INSTALLES.map(c => p[c]?.[PAQUET_DU_CADRE]).find(v => v !== undefined);
65
74
 
75
+ // Brings the frame's range up to `^<version>` in each manifest of the project at <projet> that
76
+ // declares it lower (see the header): the root's in <p>, which the core writes, each package's on
77
+ // disk. { plage, manifestes } (each manifest's path from the root), or null when nothing changes.
78
+ export function alignerLaPlageDuCadre(projet, p, version) {
79
+ // semver, required when the update runs, not when the module loads (see poserLesTests).
80
+ const semver = createRequire(import.meta.url)('semver');
81
+ const plage = `^${version}`;
82
+ const basse = v =>
83
+ typeof v === 'string' &&
84
+ semver.validRange(v) !== null &&
85
+ !semver.satisfies(version, v) &&
86
+ semver.lt(semver.minVersion(v), version);
87
+ const monter = pkg => {
88
+ let monte = false;
89
+ for (const c of ['dependencies', 'devDependencies']) {
90
+ if (basse(pkg[c]?.[PAQUET_DU_CADRE])) {
91
+ pkg[c][PAQUET_DU_CADRE] = plage;
92
+ monte = true;
93
+ }
94
+ }
95
+ return monte;
96
+ };
97
+ const manifestes = [];
98
+ if (monter(p)) {
99
+ manifestes.push('package.json');
100
+ }
101
+ // A project without workspaces has no package (paquets).
102
+ for (const { dossier, pkg } of paquets(projet)) {
103
+ if (monter(pkg)) {
104
+ ecrireJson(path.join(projet, dossier, 'package.json'), pkg);
105
+ manifestes.push(path.join(dossier, 'package.json'));
106
+ }
107
+ }
108
+ return manifestes.length > 0 ? { plage, manifestes } : null;
109
+ }
110
+
66
111
  // Whether `vitest` is declared in the dependencies of the package.json <p> (read at <dossier>) or of
67
112
  // one of its packages of the frame.
68
113
  const declareVitest = (dossier, p) => {
@@ -243,8 +288,14 @@ function poserTurbo(projet, p, source) {
243
288
  }
244
289
 
245
290
  // The lines of the report of the share <b>.
246
- function rapport(b) {
291
+ export function rapport(b) {
247
292
  const lignes = [];
293
+ if (b.plageDuCadre) {
294
+ const { plage, manifestes } = b.plageDuCadre;
295
+ lignes.push(
296
+ `Plage du cadre : ${PAQUET_DU_CADRE} monté à ${plage} dans ${manifestes.join(', ')}, qui déclaraient une plage plus basse. \`npm install\` relie cette version dans chaque paquet.`
297
+ );
298
+ }
248
299
  if (b.configVitest) {
249
300
  const { nom, paquets: declarants } = b.configVitest;
250
301
  lignes.push(
@@ -284,9 +335,12 @@ function rapport(b) {
284
335
  function appliquer(projet, { p, modele, source, version }, joueDesTests) {
285
336
  p.scripts ??= {};
286
337
  const { test, vitest } = poserLesTests(projet, p, modele);
338
+ // First: the declarations written after take the root's range, brought up.
339
+ const plageDuCadre = alignerLaPlageDuCadre(projet, p, version);
287
340
  const bilan = {
288
341
  test,
289
342
  vitest,
343
+ plageDuCadre,
290
344
  dependanceDuCadre: declarerDependanceDuCadre(projet, p, version),
291
345
  configVitest: poserConfigVitest(projet, p, version, joueDesTests),
292
346
  typage: poserTypage(projet, p, modele.scripts?.[TYPAGE]),
@@ -295,7 +349,10 @@ function appliquer(projet, { p, modele, source, version }, joueDesTests) {
295
349
  return {
296
350
  bilan,
297
351
  lignes: rapport(bilan),
298
- installer: bilan.configVitest !== null || bilan.dependanceDuCadre !== null,
352
+ installer:
353
+ bilan.plageDuCadre !== null ||
354
+ bilan.configVitest !== null ||
355
+ bilan.dependanceDuCadre !== null,
299
356
  sansVerifier: bilan.vitest
300
357
  ? 'La ligne « Vitest : » ci-dessus dit pourquoi : installe à la racine le Vitest que le cadre exige, puis relance `npx grillhouse maj`, qui écrit le script.'
301
358
  : 'La mise à jour l’écrit dans un projet testé par Vitest ; sinon, écris-le pour ses tests.',