@ucm-kit/cli 0.1.130 → 0.1.143

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.130 init
19
+ npx --yes @ucm-kit/cli@0.1.143 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.130 init
27
27
  To run the check locally:
28
28
 
29
29
  ```sh
30
- npx --yes @ucm-kit/cli@0.1.130 check --report ci-report.md
30
+ npx --yes @ucm-kit/cli@0.1.143 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.130 init --components Sources/DesignSystem --implementation '{dir}/{id}.swift'
81
+ npx --yes @ucm-kit/cli@0.1.143 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.130 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.143 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.130",
3
+ "version": "0.1.143",
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.33"
32
+ "@ucm-kit/core": "0.14.10"
33
33
  },
34
34
  "devDependencies": {
35
35
  "yaml": "^2.9.1"
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,
@@ -371,7 +372,7 @@ function lignesRestantes(racine, version, configuration) {
371
372
  }
372
373
  if (configuration && configuration.modes === undefined) {
373
374
  try {
374
- const axes = JSON.parse(readFileSync(join(racine, configuration.tokens), "utf8"))?.$extensions?.["com.ucm.axes"];
375
+ const axes = JSON.parse(readFileSync(join(racine, configuration.tokens), "utf8"))?.$extensions?.[EXTENSION_AXES_TOKENS];
375
376
  if (axes && typeof axes === "object" && Object.keys(axes).length > 0) {
376
377
  lignes.push({
377
378
  fichier: NOM_CONFIGURATION,
@@ -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));