@ucm-kit/cli 0.1.151 → 0.1.152
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/README.md +18 -6
- package/package.json +2 -2
- package/src/guide.mjs +27 -1
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ matches them.
|
|
|
16
16
|
Requires Node 20 or later. At the root of the repository:
|
|
17
17
|
|
|
18
18
|
```sh
|
|
19
|
-
npx --yes @ucm-kit/cli@0.1.
|
|
19
|
+
npx --yes @ucm-kit/cli@0.1.152 init
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
1. Commit and push the files `init` wrote.
|
|
@@ -27,7 +27,7 @@ npx --yes @ucm-kit/cli@0.1.151 init
|
|
|
27
27
|
To run the check locally:
|
|
28
28
|
|
|
29
29
|
```sh
|
|
30
|
-
npx --yes @ucm-kit/cli@0.1.
|
|
30
|
+
npx --yes @ucm-kit/cli@0.1.152 check --report ci-report.md
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
`--yes` skips the npx confirmation prompt. Pin an exact version, without `^`:
|
|
@@ -78,7 +78,7 @@ contract would resolve to the same file. A repository that does not write React
|
|
|
78
78
|
states its own extension:
|
|
79
79
|
|
|
80
80
|
```sh
|
|
81
|
-
npx --yes @ucm-kit/cli@0.1.
|
|
81
|
+
npx --yes @ucm-kit/cli@0.1.152 init --components Sources/DesignSystem --implementation '{dir}/{id}.swift'
|
|
82
82
|
```
|
|
83
83
|
|
|
84
84
|
The three path options act only on a first install. `ucm init` never overwrites
|
|
@@ -188,7 +188,7 @@ directory. It writes a minimal report when the check stopped before writing
|
|
|
188
188
|
one, then posts the report:
|
|
189
189
|
|
|
190
190
|
```sh
|
|
191
|
-
npx --yes @ucm-kit/cli@0.1.
|
|
191
|
+
npx --yes @ucm-kit/cli@0.1.152 rapport-gitlab --projet "$CI_PROJECT_ID" --merge-request "$CI_MERGE_REQUEST_IID" --fichier "$CI_PROJECT_DIR/ci-report.md" --api "$CI_API_V4_URL"
|
|
192
192
|
```
|
|
193
193
|
|
|
194
194
|
| Option | Effect |
|
|
@@ -265,6 +265,17 @@ information that never blocks the merge. The contract does not say whether a
|
|
|
265
265
|
text is large, where the threshold drops to 3:1: a false signal stays
|
|
266
266
|
information. A colour outside sRGB, or translucent, is not measured.
|
|
267
267
|
|
|
268
|
+
The check also judges the architecture of `tokens.json`, with the two checks
|
|
269
|
+
UCM Architect runs on a Figma file: the theme's variables, the layers they
|
|
270
|
+
target, scopes, modes and the sizing scales. It applies without any option,
|
|
271
|
+
because every tool except the Exporter follows the UCM architecture. Its
|
|
272
|
+
findings are information and never block the merge, so a pull request that
|
|
273
|
+
carries only tokens stays green. The report groups them by kind, with the count
|
|
274
|
+
and three examples of each, in its last section, and only when the pull request
|
|
275
|
+
changes `tokens.json` (without `--base`, always). A file where no collection has
|
|
276
|
+
a UCM name gets one line saying the architecture is not judged. Composite tokens
|
|
277
|
+
(typography, shadow, curve) are not Figma variables and are not judged.
|
|
278
|
+
|
|
268
279
|
A gap with the code warns: a developer closes it, and the merge goes through. A
|
|
269
280
|
token removed from the design system warns too, so an older contract does not
|
|
270
281
|
hold back the tokens. A contract may land before the code that implements it.
|
|
@@ -393,8 +404,9 @@ overwritten.
|
|
|
393
404
|
writes to `<file>`:
|
|
394
405
|
|
|
395
406
|
1. what to read again first: conventions anomalies, copied sections whose
|
|
396
|
-
default writing changed,
|
|
397
|
-
relays, the workflow and `package.json
|
|
407
|
+
default writing changed, `@ucm-kit/cli` pins that differ between the two
|
|
408
|
+
relays, the workflow and `package.json`, and an `@ucm-kit/core` installed in
|
|
409
|
+
the repository at another version than the one this CLI runs with;
|
|
398
410
|
2. the procedure, `procedure.md`;
|
|
399
411
|
3. the text before the first section of the closest conventions file;
|
|
400
412
|
4. the target contract's version, portable coverage and export diagnostics,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ucm-kit/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.152",
|
|
4
4
|
"description": "La ligne de commande UCM : initialiser un repository, lister ce qu'il doit couvrir.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"test": "node scripts/run-tests.cjs"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@ucm-kit/core": "0.
|
|
32
|
+
"@ucm-kit/core": "0.17.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"yaml": "^2.9.1"
|
package/src/guide.mjs
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* incohérent, 2 invocation, configuration ou contrat illisible.
|
|
13
13
|
*/
|
|
14
14
|
import { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
|
|
15
|
+
import { createRequire } from "node:module";
|
|
15
16
|
import { dirname, join, relative, resolve } from "node:path";
|
|
16
17
|
|
|
17
18
|
import { NOM_CONFIGURATION, etatDuFormatDeTokens } from "@ucm-kit/core/format";
|
|
@@ -227,6 +228,30 @@ export function pinsEnDesaccord(racine) {
|
|
|
227
228
|
];
|
|
228
229
|
}
|
|
229
230
|
|
|
231
|
+
/** La version de `@ucm-kit/core` que cette CLI embarque : celle qui juge le repository avec elle. */
|
|
232
|
+
const versionDuNoyauDeLaCli = () => createRequire(import.meta.url)("@ucm-kit/core/package.json").version;
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Le `@ucm-kit/core` installé dans le repository, nommé quand sa version n'est
|
|
236
|
+
* pas celle de la CLI : deux kits peuvent juger le même contrat autrement, et
|
|
237
|
+
* le module qui appelle l'un laisse `ucm check` appeler l'autre. Rend une
|
|
238
|
+
* ligne, ou rien si le repository n'installe pas le kit ou s'il le tient à la
|
|
239
|
+
* même version.
|
|
240
|
+
*/
|
|
241
|
+
export function noyauEnDesaccord(racine, versionDeLaCli = versionDuNoyauDeLaCli()) {
|
|
242
|
+
let installee;
|
|
243
|
+
try {
|
|
244
|
+
installee = lireJson(join(racine, "node_modules", "@ucm-kit", "core", "package.json")).version;
|
|
245
|
+
} catch {
|
|
246
|
+
return [];
|
|
247
|
+
}
|
|
248
|
+
if (typeof installee !== "string" || installee === versionDeLaCli) return [];
|
|
249
|
+
return [
|
|
250
|
+
`${GLYPHES.corriger.brut} Le @ucm-kit/core installé dans ce repository (${installee}) n'est pas celui de cette CLI (${versionDeLaCli}) : `
|
|
251
|
+
+ "épinglez le même numéro des deux côtés.",
|
|
252
|
+
];
|
|
253
|
+
}
|
|
254
|
+
|
|
230
255
|
/**
|
|
231
256
|
* Les modes qui touchent le contrat : un refus quand le fichier de tokens est
|
|
232
257
|
* incohérent, sinon le texte de la section.
|
|
@@ -374,6 +399,7 @@ export function guide(arguments_, {
|
|
|
374
399
|
alerter = console.error,
|
|
375
400
|
ecrireFichier = writeFileSync,
|
|
376
401
|
catalogue = catalogueDesAides(),
|
|
402
|
+
versionDuNoyau = versionDuNoyauDeLaCli(),
|
|
377
403
|
} = {}) {
|
|
378
404
|
const { options, erreur } = lireArgumentsGuide(arguments_);
|
|
379
405
|
if (erreur) {
|
|
@@ -439,7 +465,7 @@ export function guide(arguments_, {
|
|
|
439
465
|
const caracteristiques = caracteristiquesDuContrat(contrat, contratsParNom, modes.cones);
|
|
440
466
|
const { aides, nonTranches } = aidesDuContrat(caracteristiques, catalogue, conventions);
|
|
441
467
|
|
|
442
|
-
const aRelire = [...avertissements(conventions, cheminConventions, racine, catalogue), ...pinsEnDesaccord(racine)];
|
|
468
|
+
const aRelire = [...avertissements(conventions, cheminConventions, racine, catalogue), ...pinsEnDesaccord(racine), ...noyauEnDesaccord(racine, versionDuNoyau)];
|
|
443
469
|
const icones = entreesCitees(contrat.icons, iconesUtilisees(contrat));
|
|
444
470
|
const parties = [
|
|
445
471
|
["à relire", aRelire.length === 0 ? "" : ["## À relire avant de commencer", "", ...aRelire, ""].join("\n")],
|