@roomi-fields/grillhouse 0.24.1 → 0.24.2
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/cadre/templates/projet/package.json +0 -1
- package/cadre/templates/projet/tsdoc.json +1 -1
- package/docs/ARCHITECTURE.md +5 -1
- package/package.json +4 -2
- package/scripts/cadre.mjs +5 -2
- package/scripts/grillhouse-maj.mjs +13 -11
- package/scripts/migrations/0.23.2-copies-du-cadre.mjs +6 -12
- package/scripts/migrations/0.24.2-api-extractor-du-paquet.mjs +68 -0
- package/scripts/migrations.mjs +2 -0
- package/scripts/sources.mjs +8 -1
- package/tsdoc-base.json +4 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json",
|
|
3
|
-
"extends": ["@
|
|
3
|
+
"extends": ["@roomi-fields/grillhouse/tsdoc-base.json"],
|
|
4
4
|
"tagDefinitions": [{ "tagName": "@faute", "syntaxKind": "block", "allowMultiple": true }],
|
|
5
5
|
"supportForTags": { "@faute": true }
|
|
6
6
|
}
|
package/docs/ARCHITECTURE.md
CHANGED
|
@@ -211,7 +211,11 @@ la fonction, sans réexport, avec sa déclaration de types à côté (`scripts/<
|
|
|
211
211
|
`@roomi-fields/grillhouse/consommateurs` (`matieres`, les paquets de la matière de test
|
|
212
212
|
partagée), `@roomi-fields/grillhouse/paquets` (`horsCadre`, les paquets hors cadre), et la
|
|
213
213
|
configuration de base de Vitest, `@roomi-fields/grillhouse/vitest-config` et
|
|
214
|
-
`@roomi-fields/grillhouse/vitest-config/mesure
|
|
214
|
+
`@roomi-fields/grillhouse/vitest-config/mesure`, et la base TSDoc,
|
|
215
|
+
`@roomi-fields/grillhouse/tsdoc-base.json`, dont hérite le `tsdoc.json` d'un projet : elle hérite
|
|
216
|
+
de celle d'API Extractor, que le paquet déclare, comme un rig de Rushstack porte la configuration
|
|
217
|
+
de base à côté de la dépendance qu'elle nomme ; TSDoc lit un `extends` par son chemin sous le
|
|
218
|
+
paquet, sans le champ `exports`, et le fichier se tient donc à la racine du paquet. Une entrée s'ajoute ou se retire avec ce
|
|
215
219
|
paragraphe, que `tests/unit/paquet-publie.spec.ts` confronte au champ `exports`. Un paquet du
|
|
216
220
|
projet dont le code de `src/` hors des tests importe une entrée déclare le paquet du cadre dans
|
|
217
221
|
ses `dependencies`, comme npm y met ce que le code publié importe : `npx grillhouse maj` l'y
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@roomi-fields/grillhouse",
|
|
3
|
-
"version": "0.24.
|
|
3
|
+
"version": "0.24.2",
|
|
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",
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"hooks",
|
|
24
24
|
"scripts",
|
|
25
25
|
"skills",
|
|
26
|
+
"tsdoc-base.json",
|
|
26
27
|
"types"
|
|
27
28
|
],
|
|
28
29
|
"bin": {
|
|
@@ -49,7 +50,8 @@
|
|
|
49
50
|
"./vitest-config/mesure": {
|
|
50
51
|
"types": "./scripts/vitest-config/mesure.d.ts",
|
|
51
52
|
"default": "./scripts/vitest-config/mesure.mjs"
|
|
52
|
-
}
|
|
53
|
+
},
|
|
54
|
+
"./tsdoc-base.json": "./tsdoc-base.json"
|
|
53
55
|
},
|
|
54
56
|
"scripts": {
|
|
55
57
|
"prepack": "node scripts/cadre.mjs --empaqueter",
|
package/scripts/cadre.mjs
CHANGED
|
@@ -39,8 +39,11 @@ const INSTALLE = PAQUET.split(path.sep).includes('node_modules');
|
|
|
39
39
|
/** The frame's files the package reads under CADRE, which `--empaqueter` copies under cadre/. */
|
|
40
40
|
export const FICHIERS_DU_CADRE = ['templates'];
|
|
41
41
|
|
|
42
|
-
/**
|
|
43
|
-
|
|
42
|
+
/**
|
|
43
|
+
* The entries the package publishes of its own; `docs/` holds the architecture the charter names,
|
|
44
|
+
* `tsdoc-base.json` the TSDoc base a project's tsdoc.json extends.
|
|
45
|
+
*/
|
|
46
|
+
export const PROPRES_DU_PAQUET = ['bin', 'cadre', 'docs', 'scripts', 'tsdoc-base.json'];
|
|
44
47
|
|
|
45
48
|
/** The entries of the plugin's source the package leaves out. */
|
|
46
49
|
export const HORS_DU_GREFFON = ['tests', 'tsconfig.json'];
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
// the project keeps the version it recorded, so that the next update plays that migration again.
|
|
20
20
|
// Last, after the update and the regeneration, what stays to the project (`restes` of a
|
|
21
21
|
// migration played, scripts/migrations.mjs: in 0.24.0, a file that still calls a former copy of
|
|
22
|
-
// the frame) is reported on the standard output, « reste au projet », with no effect on the exit
|
|
22
|
+
// the frame; in 0.24.2, API Extractor still declared by the project) is reported on the standard output, « reste au projet », with no effect on the exit
|
|
23
23
|
// code nor on the version recorded.
|
|
24
24
|
// - The frame copies no file into a project: its scripts are the package's, its skills, agents,
|
|
25
25
|
// hooks of Claude Code, common charter and meta-frame the plugin's, which the package carries
|
|
@@ -65,15 +65,17 @@
|
|
|
65
65
|
// A `turbo.json` present is never written again by the update; only the generator of the
|
|
66
66
|
// packages' turbo.json (below) writes in it the `dependsOn` of the guard tasks, and adds one it
|
|
67
67
|
// lacks.
|
|
68
|
-
// - The tools the frame's checks run as commands (
|
|
69
|
-
//
|
|
70
|
-
//
|
|
71
|
-
//
|
|
72
|
-
//
|
|
73
|
-
//
|
|
74
|
-
//
|
|
75
|
-
//
|
|
76
|
-
//
|
|
68
|
+
// - The tools the frame's checks run as commands (dependency-cruiser, knip, Turborepo) are added
|
|
69
|
+
// to the project's `devDependencies` at the version the template's `devDependencies` give; a
|
|
70
|
+
// tool the project already declares in `dependencies`, `devDependencies` or
|
|
71
|
+
// `optionalDependencies` keeps its declaration, one a previous version added stays, and
|
|
72
|
+
// `devDependencies` are written sorted by name. The report names each tool added and
|
|
73
|
+
// `npm install`, which installs them. What the package's scripts import, it declares itself (its
|
|
74
|
+
// `dependencies`, API Extractor among them; Vitest and TypeScript as peers), as npm leaves to a
|
|
75
|
+
// package what it imports; the project's `tsdoc.json` extends the package's TSDoc base
|
|
76
|
+
// (`@roomi-fields/grillhouse/tsdoc-base.json`), which extends API Extractor's. A project without
|
|
77
|
+
// `packageManager` receives the template's (Turborepo requires it), and a `.gitignore` that does
|
|
78
|
+
// not ignore `.turbo/` (Turborepo's runs and cache) receives the line.
|
|
77
79
|
// - A project that runs Vitest (its `test` script names it, or `vitest` is in the `dependencies` or
|
|
78
80
|
// `devDependencies` of its root `package.json` or of one of its packages, the workspaces as npm
|
|
79
81
|
// maps them, read by `paquets` of scripts/paquets.mjs, the frame's one list of the
|
|
@@ -158,7 +160,7 @@ export const LIGNE_ETAT = '"$CLAUDE_PROJECT_DIR/node_modules/.bin/grillhouse" li
|
|
|
158
160
|
|
|
159
161
|
// The frame's tools a project runs as commands: their names are the frame's, their versions are
|
|
160
162
|
// read in the template.
|
|
161
|
-
const OUTILS_DU_CADRE = ['
|
|
163
|
+
const OUTILS_DU_CADRE = ['dependency-cruiser', 'knip', 'turbo'];
|
|
162
164
|
// The root scripts of the tests, written together from the template.
|
|
163
165
|
const SCRIPTS_DES_TESTS = ['test', 'test:vitest', 'test:forcer', 'verifier'];
|
|
164
166
|
const CHAMPS_INSTALLES = ['dependencies', 'devDependencies', 'optionalDependencies'];
|
|
@@ -27,7 +27,8 @@
|
|
|
27
27
|
// named, not rewritten.
|
|
28
28
|
// - A dependency of the project's root that a copy removed imported, that the package declares in
|
|
29
29
|
// its own `dependencies`, that the template of a project does not declare, and that no source of
|
|
30
|
-
// the project still imports, is named, not removed: the project decides.
|
|
30
|
+
// the project still imports, is named, not removed: the project decides. API Extractor is named
|
|
31
|
+
// by the migration of 0.24.2 alone (`DU_PAQUET` of 0.24.2-api-extractor-du-paquet.mjs), once.
|
|
31
32
|
// - A project without `fichiers.txt` and `empreintes.json` is not written: a second pass finds
|
|
32
33
|
// neither, or finds only the copies left to the project, which it names again.
|
|
33
34
|
import { createHash } from 'node:crypto';
|
|
@@ -35,10 +36,11 @@ import { existsSync, readdirSync, readFileSync, rmSync, writeFileSync } from 'no
|
|
|
35
36
|
import path from 'node:path';
|
|
36
37
|
import { CADRE, PAQUET } from '../cadre.mjs';
|
|
37
38
|
import { paquets } from '../paquets.mjs';
|
|
38
|
-
import { sources } from '../sources.mjs';
|
|
39
|
+
import { importe, sources } from '../sources.mjs';
|
|
39
40
|
import { SOUS_COMMANDES } from '../sous-commandes.mjs';
|
|
40
41
|
import { formesAnterieures } from './0.23.0-config-vitest.mjs';
|
|
41
42
|
import { deRoleSupprime } from './0.24.0-circuit-simplifie.mjs';
|
|
43
|
+
import { dependanceDuPaquet, DU_PAQUET } from './0.24.2-api-extractor-du-paquet.mjs';
|
|
42
44
|
|
|
43
45
|
export const version = '0.23.2';
|
|
44
46
|
export const nom = 'copies du cadre';
|
|
@@ -56,12 +58,6 @@ const GENERE = /^\/\/ Généré par `[^`\n]*turbo-des-paquets[^`\n]*`/;
|
|
|
56
58
|
|
|
57
59
|
const hacher = octets => createHash('sha256').update(octets).digest('hex');
|
|
58
60
|
const lireJson = f => JSON.parse(readFileSync(f, 'utf8'));
|
|
59
|
-
const echapper = t => t.replace(/[.*+?^${}()|[\]\\/]/g, '\\$&');
|
|
60
|
-
// Whether the source text <texte> imports the package <dep> (or a path into it).
|
|
61
|
-
const importe = (texte, dep) =>
|
|
62
|
-
new RegExp(
|
|
63
|
-
`(?:\\bfrom\\s*|\\bimport\\s*\\(?\\s*|\\brequire\\s*\\(\\s*)(['"])${echapper(dep)}(?:/[^'"]*)?\\1`
|
|
64
|
-
).test(texte);
|
|
65
61
|
|
|
66
62
|
// The subcommand that runs each script of the package, by the path of its former copy.
|
|
67
63
|
const PAR_COPIE = new Map(Object.entries(SOUS_COMMANDES).map(([n, s]) => [`scripts/${s}`, n]));
|
|
@@ -188,14 +184,12 @@ export function migrer(projet) {
|
|
|
188
184
|
const duPaquet = Object.keys(lireJson(path.join(PAQUET, 'package.json')).dependencies ?? {});
|
|
189
185
|
const gabarit = lireJson(path.join(CADRE, GABARIT, 'package.json'));
|
|
190
186
|
const textes = sources(projet).map(f => readFileSync(path.join(projet, f), 'utf8'));
|
|
191
|
-
for (const dep of duPaquet) {
|
|
187
|
+
for (const dep of duPaquet.filter(d => d !== DU_PAQUET)) {
|
|
192
188
|
if (!CHAMPS.some(c => pkg[c]?.[dep] !== undefined)) continue;
|
|
193
189
|
if (CHAMPS.some(c => gabarit[c]?.[dep] !== undefined)) continue;
|
|
194
190
|
if (![...retires.values()].some(t => importe(t, dep))) continue;
|
|
195
191
|
if (textes.some(t => importe(t, dep))) continue;
|
|
196
|
-
sortie.push(
|
|
197
|
-
`package.json : la dépendance ${dep} n'est plus importée que par le paquet, qui la déclare lui-même ; \`npm uninstall ${dep}\` la retire si le projet n'en a pas l'usage`
|
|
198
|
-
);
|
|
192
|
+
sortie.push(dependanceDuPaquet(dep));
|
|
199
193
|
}
|
|
200
194
|
return sortie;
|
|
201
195
|
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// API Extractor is the package's dependency, not the project's: the package imports it as a library
|
|
2
|
+
// (scripts/interfaces-contre-code.mjs) and declares it in its own `dependencies`, and no command of
|
|
3
|
+
// a project runs it, as npm leaves to a package what it imports. The update of 0.23.0 to 0.24.1
|
|
4
|
+
// added it to the devDependencies of a project's root as a tool the project runs, and
|
|
5
|
+
// `grillhouse code-mort` then refused it as a development dependency without use. The project's
|
|
6
|
+
// `tsdoc.json` extended its TSDoc base, resolved only when npm hoists API Extractor to the root:
|
|
7
|
+
// the package now publishes its own base (`tsdoc-base.json`, which extends API Extractor's), as a
|
|
8
|
+
// rig of Rushstack carries the base configuration beside the dependency it names.
|
|
9
|
+
//
|
|
10
|
+
// - The `tsdoc.json` of the project's root whose `extends` names the base of API Extractor
|
|
11
|
+
// (ANCIENNE_BASE) extends the package's (BASE): that name is rewritten in place, the rest of the
|
|
12
|
+
// file kept byte for byte. A `tsdoc.json` that extends another base, or none, is not written.
|
|
13
|
+
// - What stays to the project (`restes`, which the update plays after its own update, so after the
|
|
14
|
+
// rewrite above): a root `package.json` that declares `@microsoft/api-extractor`
|
|
15
|
+
// (`dependencies`, `devDependencies` or `optionalDependencies`), while no source of the project
|
|
16
|
+
// imports it (scripts/sources.mjs), hears the line of the other dependencies only the package
|
|
17
|
+
// imports (`dependanceDuPaquet`), with `npm uninstall`. The dependency is named, never removed:
|
|
18
|
+
// the project decides. The migration of the copies (0.23.2-copies-du-cadre.mjs) leaves it to this
|
|
19
|
+
// one (DU_PAQUET), so that it is named once.
|
|
20
|
+
// - A project already in the new form is not written, and a second pass returns no line.
|
|
21
|
+
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
22
|
+
import path from 'node:path';
|
|
23
|
+
import { importe, sources } from '../sources.mjs';
|
|
24
|
+
|
|
25
|
+
export const version = '0.24.2';
|
|
26
|
+
export const nom = 'API Extractor du paquet';
|
|
27
|
+
|
|
28
|
+
/** The dependency this migration names, which the migration of the copies leaves to it. */
|
|
29
|
+
export const DU_PAQUET = '@microsoft/api-extractor';
|
|
30
|
+
const CHAMPS = ['dependencies', 'devDependencies', 'optionalDependencies'];
|
|
31
|
+
const TSDOC = 'tsdoc.json';
|
|
32
|
+
const ANCIENNE_BASE = `${DU_PAQUET}/extends/tsdoc-base.json`;
|
|
33
|
+
const BASE = '@roomi-fields/grillhouse/tsdoc-base.json';
|
|
34
|
+
|
|
35
|
+
/** The line that names <dep>, a dependency of a project only the package imports. */
|
|
36
|
+
export const dependanceDuPaquet = dep =>
|
|
37
|
+
`package.json : la dépendance ${dep} n'est plus importée que par le paquet, qui la déclare lui-même ; \`npm uninstall ${dep}\` la retire si le projet n'en a pas l'usage`;
|
|
38
|
+
|
|
39
|
+
/** The line naming API Extractor when the project at <projet> declares it without importing it. */
|
|
40
|
+
export function restes(projet) {
|
|
41
|
+
const f = path.join(projet, 'package.json');
|
|
42
|
+
if (!existsSync(f)) {
|
|
43
|
+
return [];
|
|
44
|
+
}
|
|
45
|
+
const pkg = JSON.parse(readFileSync(f, 'utf8'));
|
|
46
|
+
if (!CHAMPS.some(c => pkg[c]?.[DU_PAQUET] !== undefined)) {
|
|
47
|
+
return [];
|
|
48
|
+
}
|
|
49
|
+
const importee = sources(projet).some(s =>
|
|
50
|
+
importe(readFileSync(path.join(projet, s), 'utf8'), DU_PAQUET)
|
|
51
|
+
);
|
|
52
|
+
return importee ? [] : [dependanceDuPaquet(DU_PAQUET)];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** Brings the `extends` of the project's tsdoc.json at <projet> to the package's base. */
|
|
56
|
+
export function migrer(projet) {
|
|
57
|
+
const f = path.join(projet, TSDOC);
|
|
58
|
+
if (!existsSync(f)) {
|
|
59
|
+
return [];
|
|
60
|
+
}
|
|
61
|
+
const texte = readFileSync(f, 'utf8');
|
|
62
|
+
const { extends: bases } = JSON.parse(texte);
|
|
63
|
+
if (!Array.isArray(bases) || !bases.includes(ANCIENNE_BASE)) {
|
|
64
|
+
return [];
|
|
65
|
+
}
|
|
66
|
+
writeFileSync(f, texte.replace(`"${ANCIENNE_BASE}"`, `"${BASE}"`));
|
|
67
|
+
return [`${TSDOC} : hérite de ${BASE}, la base TSDoc du paquet, au lieu de ${ANCIENNE_BASE}`];
|
|
68
|
+
}
|
package/scripts/migrations.mjs
CHANGED
|
@@ -25,6 +25,7 @@ import * as crochetsDeSeance from './migrations/0.23.0-crochets-de-seance.mjs';
|
|
|
25
25
|
import * as marcheDuProjet from './migrations/0.23.0-marche-du-projet.mjs';
|
|
26
26
|
import * as copiesDuCadre from './migrations/0.23.2-copies-du-cadre.mjs';
|
|
27
27
|
import * as circuitSimplifie from './migrations/0.24.0-circuit-simplifie.mjs';
|
|
28
|
+
import * as apiExtractorDuPaquet from './migrations/0.24.2-api-extractor-du-paquet.mjs';
|
|
28
29
|
|
|
29
30
|
/** The migrations of the package. */
|
|
30
31
|
export const MIGRATIONS = [
|
|
@@ -34,6 +35,7 @@ export const MIGRATIONS = [
|
|
|
34
35
|
charteImportee,
|
|
35
36
|
copiesDuCadre,
|
|
36
37
|
circuitSimplifie,
|
|
38
|
+
apiExtractorDuPaquet,
|
|
37
39
|
];
|
|
38
40
|
|
|
39
41
|
/**
|
package/scripts/sources.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// The source files of a project, as the migrations read them (scripts/migrations/): each `.ts`,
|
|
2
2
|
// `.mts`, `.cts`, `.js`, `.mjs`, `.cjs` under its root, as a path from it, the directories of
|
|
3
3
|
// tools and of what is installed or built (node_modules, .git, dist, coverage, .turbo, .claude,
|
|
4
|
-
// .beads, .codegraph, .rtfm) left out.
|
|
4
|
+
// .beads, .codegraph, .rtfm) left out; and whether a source text imports a package (`importe`).
|
|
5
5
|
import { readdirSync } from 'node:fs';
|
|
6
6
|
import path from 'node:path';
|
|
7
7
|
|
|
@@ -26,3 +26,10 @@ export function sources(racine, rel = '') {
|
|
|
26
26
|
return e.isFile() && EXTENSIONS.test(e.name) ? [r] : [];
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
|
+
|
|
30
|
+
const echapper = t => t.replace(/[.*+?^${}()|[\]\\/]/g, '\\$&');
|
|
31
|
+
/** Whether the source text <texte> imports the package <dep> (or a path into it). */
|
|
32
|
+
export const importe = (texte, dep) =>
|
|
33
|
+
new RegExp(
|
|
34
|
+
`(?:\\bfrom\\s*|\\bimport\\s*\\(?\\s*|\\brequire\\s*\\(\\s*)(['"])${echapper(dep)}(?:/[^'"]*)?\\1`
|
|
35
|
+
).test(texte);
|
package/tsdoc-base.json
ADDED