@ucm-kit/cli 0.1.132 → 0.1.148

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 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.132 init
19
+ npx --yes @ucm-kit/cli@0.1.148 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.132 init
27
27
  To run the check locally:
28
28
 
29
29
  ```sh
30
- npx --yes @ucm-kit/cli@0.1.132 check --report ci-report.md
30
+ npx --yes @ucm-kit/cli@0.1.148 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.132 init --components Sources/DesignSystem --implementation '{dir}/{id}.swift'
81
+ npx --yes @ucm-kit/cli@0.1.148 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.132 rapport-gitlab --projet "$CI_PROJECT_ID" --merge-request "$CI_MERGE_REQUEST_IID" --fichier "$CI_PROJECT_DIR/ci-report.md" --api "$CI_API_V4_URL"
191
+ npx --yes @ucm-kit/cli@0.1.148 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 |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ucm-kit/cli",
3
- "version": "0.1.132",
3
+ "version": "0.1.148",
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.13.36"
32
+ "@ucm-kit/core": "0.15.0"
33
33
  },
34
34
  "devDependencies": {
35
35
  "yaml": "^2.9.1"
package/src/aides.mjs CHANGED
@@ -16,6 +16,9 @@ import {
16
16
  marqueurDeCopie,
17
17
  sectionsARelire,
18
18
  } from "./conventions.mjs";
19
+ import { TYPES_D_ALERTE } from "@ucm-kit/core/referentiel";
20
+
21
+ const GLYPHES = Object.fromEntries(TYPES_D_ALERTE.map(({ id, texte }) => [id, texte]));
19
22
 
20
23
  export const DOSSIER_AIDES = fileURLToPath(new URL("../aides/", import.meta.url));
21
24
 
@@ -80,10 +83,10 @@ export function avertissements(conventions, chemin, racine, catalogue) {
80
83
  if (!conventions) return [];
81
84
  const ou = relative(racine, chemin).split("\\").join("/");
82
85
  return [
83
- ...conventions.anomalies.map((anomalie) => `⚠ ${ou} : ${anomalie}`),
86
+ ...conventions.anomalies.map((anomalie) => `${GLYPHES.corriger.brut} ${ou} : ${anomalie}`),
84
87
  ...sectionsARelire(conventions, catalogue).map(({ nom, version, sansEmpreinte }) => (sansEmpreinte
85
- ? `⚠ ${ou} : la section « ${nom} » copie l'écriture par défaut de la version ${version}, sans empreinte qui dise si elle a changé depuis. Comparez-la à \`ucm aides ${nom}\`.`
86
- : `⚠ ${ou} : la section « ${nom} » copie l'écriture par défaut de la version ${version}, qui a changé depuis. Relisez-la.`
88
+ ? `${GLYPHES.corriger.brut} ${ou} : la section « ${nom} » copie l'écriture par défaut de la version ${version}, sans empreinte qui dise si elle a changé depuis. Comparez-la à \`ucm aides ${nom}\`.`
89
+ : `${GLYPHES.corriger.brut} ${ou} : la section « ${nom} » copie l'écriture par défaut de la version ${version}, qui a changé depuis. Relisez-la.`
87
90
  )),
88
91
  ];
89
92
  }
package/src/guide.mjs CHANGED
@@ -35,6 +35,9 @@ import { avertissements, catalogueDesAides } from "./aides.mjs";
35
35
  import { contratsDuDossier } from "./contrats.mjs";
36
36
  import { conventionsLesPlusProches, lireConventions } from "./conventions.mjs";
37
37
  import { attributsDesAxes, memeFichier, refusDuGrapheDesTokens } from "./tokens-css.mjs";
38
+ import { TYPES_D_ALERTE } from "@ucm-kit/core/referentiel";
39
+
40
+ const GLYPHES = Object.fromEntries(TYPES_D_ALERTE.map(({ id, texte }) => [id, texte]));
38
41
 
39
42
  export const USAGE_GUIDE = "ucm guide <contrat> [--out <fichier>]";
40
43
 
@@ -219,7 +222,7 @@ export function pinsEnDesaccord(racine) {
219
222
  }
220
223
  if (new Set(trouves.map(({ version }) => version)).size < 2) return [];
221
224
  return [
222
- "⚠ Les pins de @ucm-kit/cli diffèrent : alignez-les sur une seule version.",
225
+ `${GLYPHES.corriger.brut} Les pins de @ucm-kit/cli diffèrent : alignez-les sur une seule version.`,
223
226
  ...trouves.map(({ chemin, version }) => ` ${chemin} : ${version}`),
224
227
  ];
225
228
  }
package/src/init.mjs CHANGED
@@ -29,6 +29,7 @@ import { dirname, join } from "node:path";
29
29
 
30
30
  import {
31
31
  CONFIGURATION_PAR_DEFAUT,
32
+ EXTENSION_AXES_TOKENS,
32
33
  MOTIF_IMPLEMENTATION_PAR_DEFAUT,
33
34
  NOM_CONFIGURATION,
34
35
  estCheminDuRepository,
@@ -37,6 +38,9 @@ import { MARQUEUR_RAPPORT, MARQUEUR_SANS_OBJET, lireConfiguration } from "@ucm-k
37
38
 
38
39
  import { NOM_ADAPTATEUR_TYPESCRIPT } from "./adaptateur.mjs";
39
40
  import { CHEMIN_CONVENTIONS } from "./conventions.mjs";
41
+ import { TYPES_D_ALERTE } from "@ucm-kit/core/referentiel";
42
+
43
+ const GLYPHES = Object.fromEntries(TYPES_D_ALERTE.map(({ id, texte }) => [id, texte]));
40
44
 
41
45
  /** Les options qui reçoivent un dossier, et la clé que chacune décide. */
42
46
  const OPTIONS_DE_DOSSIER = { "--components": "components", "--tokens": "tokens" };
@@ -371,7 +375,7 @@ function lignesRestantes(racine, version, configuration) {
371
375
  }
372
376
  if (configuration && configuration.modes === undefined) {
373
377
  try {
374
- const axes = JSON.parse(readFileSync(join(racine, configuration.tokens), "utf8"))?.$extensions?.["com.ucm.axes"];
378
+ const axes = JSON.parse(readFileSync(join(racine, configuration.tokens), "utf8"))?.$extensions?.[EXTENSION_AXES_TOKENS];
375
379
  if (axes && typeof axes === "object" && Object.keys(axes).length > 0) {
376
380
  lignes.push({
377
381
  fichier: NOM_CONFIGURATION,
@@ -488,7 +492,7 @@ function workflow(version) {
488
492
  // que le noyau aurait posé. Sans lui, le commentaire qu'il crée ne serait
489
493
  // retrouvé par aucune exécution suivante, et chaque push en empilerait un.
490
494
  ` ${MARQUEUR_RAPPORT}`,
491
- " ## ❌ La vérification n'a pas pu rendre son diagnostic",
495
+ ` ## ${GLYPHES.bloquant.forge} La vérification n'a pas pu rendre son diagnostic`,
492
496
  "",
493
497
  " Les contrôles se sont arrêtés avant d'avoir pu analyser cet export : le rapport habituel n'a pas été produit. **Votre design n'est pas en cause** et ré-exporter depuis Figma n'y changerait rien.",
494
498
  "",
@@ -648,7 +652,7 @@ function workflowGitlab(version) {
648
652
  " - |",
649
653
  " if [ ! -f ci-report.md ]; then",
650
654
  " printf '%s\\n\\n%s\\n\\n%s\\n' \\",
651
- " \"## ❌ La vérification n'a pas pu rendre son diagnostic\" \\",
655
+ ` "## ${GLYPHES.bloquant.forge} La vérification n'a pas pu rendre son diagnostic" \\`,
652
656
  " \"Les contrôles se sont arrêtés avant d'avoir pu analyser cet export : le rapport habituel n'a pas été produit. **Votre design n'est pas en cause** et réexporter depuis Figma n'y changerait rien.\" \\",
653
657
  " \"**Action attendue :** un développeur doit ouvrir [le pipeline de la CI]($CI_PIPELINE_URL) pour en connaître la raison.\" \\",
654
658
  " > ci-report.md",
@@ -832,7 +836,7 @@ export function rendreInit({
832
836
  lignes: restantes = [],
833
837
  }) {
834
838
  const lignes = [];
835
- for (const chemin of ecrits) lignes.push(`✓ ${chemin}`);
839
+ for (const chemin of ecrits) lignes.push(`${GLYPHES.tenu.brut} ${chemin}`);
836
840
  for (const chemin of conserves) lignes.push(`· ${chemin} existait déjà, laissé tel quel`);
837
841
  lignes.push("");
838
842
  // L'endroit vient de la configuration écrite, jamais d'une convention
@@ -15,6 +15,9 @@ import { existsSync, mkdirSync, readFileSync, renameSync, rmSync, statSync, writ
15
15
  import { dirname, join, relative, resolve } from "node:path";
16
16
 
17
17
  import {
18
+ EXTENSION_MODES_TOKENS,
19
+ EXTENSION_SURCHARGES_TOKENS,
20
+ MODE_DE_BASE,
18
21
  NOM_CONFIGURATION,
19
22
  PREFIXE_DES_INTERMEDIAIRES,
20
23
  attributDeMode,
@@ -243,9 +246,9 @@ export function refusDuGrapheDesTokens(document, axes = []) {
243
246
  juger(chemin, feuille, feuille.$value);
244
247
  continue;
245
248
  }
246
- const modes = feuille.$extensions["com.ucm.modes"];
249
+ const modes = feuille.$extensions[EXTENSION_MODES_TOKENS];
247
250
  for (const mode of axe.modes) juger(chemin, feuille, modes[mode], mode);
248
- const surcharges = feuille.$extensions["com.ucm.extensions"] ?? {};
251
+ const surcharges = feuille.$extensions[EXTENSION_SURCHARGES_TOKENS] ?? {};
249
252
  for (const extension of Object.keys(axe.extensions ?? {})) {
250
253
  if (!possede(surcharges, extension)) continue;
251
254
  for (const mode of axe.modes) {
@@ -292,7 +295,7 @@ export function feuilleDesTokens(document, { axes = [], attributs = new Map(), r
292
295
  const parProjection = new Map();
293
296
  for (const extension of Object.keys(axe.extensions ?? {})) {
294
297
  const projection = tokenCssVariable(extension).slice(2);
295
- if (projection === "" || projection === "base") {
298
+ if (projection === "" || projection === MODE_DE_BASE) {
296
299
  refus.push(projection === ""
297
300
  ? `L'extension « ${extension} » de l'axe « ${axe.nom} » ne donne aucun nom CSS.`
298
301
  : `L'extension « ${extension} » de l'axe « ${axe.nom} » donne le nom CSS « base », réservé à la collection elle-même.`);
@@ -350,11 +353,11 @@ export function feuilleDesTokens(document, { axes = [], attributs = new Map(), r
350
353
  variables.push({ nom, axe: null, valeur: texteDe(chemin, feuille, feuille.$value) });
351
354
  continue;
352
355
  }
353
- const modes = feuille.$extensions["com.ucm.modes"];
356
+ const modes = feuille.$extensions[EXTENSION_MODES_TOKENS];
354
357
  const parMode = (valeurDuMode, extension) => new Map(axe.modes.map((mode) => (
355
358
  [mode, valeurDuMode(mode, extension)]
356
359
  )));
357
- const surcharges = feuille.$extensions["com.ucm.extensions"] ?? {};
360
+ const surcharges = feuille.$extensions[EXTENSION_SURCHARGES_TOKENS] ?? {};
358
361
  const extensions = Object.keys(axe.extensions ?? {});
359
362
  if (extensions.length === 0 || Object.keys(surcharges).length === 0) {
360
363
  variables.push({ nom, axe: axe.nom, valeurs: parMode((mode) => texteDe(chemin, feuille, modes[mode], mode)) });
@@ -364,14 +367,14 @@ export function feuilleDesTokens(document, { axes = [], attributs = new Map(), r
364
367
  const suffixe = nom.slice(2);
365
368
  const intermediaire = (extension) => `${PREFIXE_DES_INTERMEDIAIRES}${tokenCssVariable(extension).slice(2)}--${suffixe}`;
366
369
  const plusProche = (extension) => {
367
- for (let courante = extension; courante !== undefined && courante !== "base"; courante = axe.extensions[courante]?.parent) {
370
+ for (let courante = extension; courante !== undefined && courante !== MODE_DE_BASE; courante = axe.extensions[courante]?.parent) {
368
371
  if (possede(surcharges, courante)) return courante;
369
372
  }
370
- return "base";
373
+ return MODE_DE_BASE;
371
374
  };
372
375
 
373
376
  variables.push({
374
- nom: intermediaire("base"),
377
+ nom: intermediaire(MODE_DE_BASE),
375
378
  axe: axe.nom,
376
379
  valeurs: parMode((mode) => texteDe(chemin, feuille, modes[mode], mode)),
377
380
  });
@@ -391,9 +394,9 @@ export function feuilleDesTokens(document, { axes = [], attributs = new Map(), r
391
394
  const propres = new Map();
392
395
  for (const extension of extensions) {
393
396
  const proche = plusProche(extension);
394
- if (proche !== "base") propres.set(extension, `var(${intermediaire(proche)})`);
397
+ if (proche !== MODE_DE_BASE) propres.set(extension, `var(${intermediaire(proche)})`);
395
398
  }
396
- variables.push({ nom, axe: axeDesExtensions(axe.nom), base: `var(${intermediaire("base")})`, propres });
399
+ variables.push({ nom, axe: axeDesExtensions(axe.nom), base: `var(${intermediaire(MODE_DE_BASE)})`, propres });
397
400
  }
398
401
 
399
402
  refus.push(...refusDuGrapheDesTokens(document, axes));