@ucm-kit/cli 0.1.35 → 0.1.36
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 +3 -3
- package/package.json +1 -1
- package/src/contrats.mjs +17 -0
- package/src/guide.mjs +2 -2
- package/src/icons.mjs +2 -2
- package/src/tokens-css.mjs +3 -2
package/README.md
CHANGED
|
@@ -11,8 +11,8 @@ next to the component's code. This command reads those files and says whether
|
|
|
11
11
|
they still hold together.
|
|
12
12
|
|
|
13
13
|
```sh
|
|
14
|
-
npx --yes @ucm-kit/cli@0.1.
|
|
15
|
-
npx --yes @ucm-kit/cli@0.1.
|
|
14
|
+
npx --yes @ucm-kit/cli@0.1.36 init
|
|
15
|
+
npx --yes @ucm-kit/cli@0.1.36 check --report ci-report.md
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
Pin an exact version, without `^`. A range would let npx install a build this
|
|
@@ -62,7 +62,7 @@ not write React states its own extension here, rather than carrying a `.tsx`
|
|
|
62
62
|
that was wrong the day it was installed:
|
|
63
63
|
|
|
64
64
|
```sh
|
|
65
|
-
npx --yes @ucm-kit/cli@0.1.
|
|
65
|
+
npx --yes @ucm-kit/cli@0.1.36 init --components Sources/DesignSystem --implementation '{dir}/{id}.swift'
|
|
66
66
|
```
|
|
67
67
|
|
|
68
68
|
All three act only on a first install: `ucm init` never overwrites an existing
|
package/package.json
CHANGED
package/src/contrats.mjs
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Les contrats d'un repository, lus par les commandes qui les parcourent. */
|
|
2
|
+
import { trouverContrats } from "@ucm-kit/core/lecteurs";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Les chemins des contrats sous `dossier`, et `[]` quand ce dossier n'existe
|
|
6
|
+
* pas : un repository neuf n'a pas de dossier de contrats avant son premier
|
|
7
|
+
* export, et `npm run dev` y lance déjà `ucm tokens css`. Toute autre erreur
|
|
8
|
+
* remonte, une panne ne valant pas zéro contrat.
|
|
9
|
+
*/
|
|
10
|
+
export function contratsDuDossier(dossier) {
|
|
11
|
+
try {
|
|
12
|
+
return trouverContrats(dossier);
|
|
13
|
+
} catch (erreur) {
|
|
14
|
+
if (erreur?.code === "ENOENT") return [];
|
|
15
|
+
throw erreur;
|
|
16
|
+
}
|
|
17
|
+
}
|
package/src/guide.mjs
CHANGED
|
@@ -26,13 +26,13 @@ import {
|
|
|
26
26
|
contextesDesAxes,
|
|
27
27
|
lireConfiguration,
|
|
28
28
|
messagesDExport,
|
|
29
|
-
trouverContrats,
|
|
30
29
|
validerGrapheDesContrats,
|
|
31
30
|
verdictDeVersion,
|
|
32
31
|
vueExacteDuVariant,
|
|
33
32
|
} from "@ucm-kit/core/lecteurs";
|
|
34
33
|
|
|
35
34
|
import { avertissements, catalogueDesAides } from "./aides.mjs";
|
|
35
|
+
import { contratsDuDossier } from "./contrats.mjs";
|
|
36
36
|
import { conventionsLesPlusProches, lireConventions } from "./conventions.mjs";
|
|
37
37
|
import { attributsDesAxes } from "./tokens-css.mjs";
|
|
38
38
|
|
|
@@ -346,7 +346,7 @@ function modesDuContrat(contrat, contratsParNom, racine, configuration) {
|
|
|
346
346
|
|
|
347
347
|
/** Lit les contrats du repository ; le contrat visé est toujours du lot. */
|
|
348
348
|
function documentsDuRepository(racine, configuration, cible) {
|
|
349
|
-
const chemins =
|
|
349
|
+
const chemins = contratsDuDossier(join(racine, configuration.components)).map((chemin) => resolve(chemin));
|
|
350
350
|
if (!chemins.includes(cible)) chemins.push(cible);
|
|
351
351
|
const documents = [];
|
|
352
352
|
for (const chemin of chemins) {
|
package/src/icons.mjs
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { readFileSync } from "node:fs";
|
|
6
6
|
import { join, relative } from "node:path";
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { contratsDuDossier } from "./contrats.mjs";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Les icônes réclamées par les contrats d'un repository.
|
|
@@ -17,7 +17,7 @@ import { trouverContrats } from "@ucm-kit/core/lecteurs";
|
|
|
17
17
|
export function iconesDuRepository(racine, dossierComponents) {
|
|
18
18
|
const parNom = new Map();
|
|
19
19
|
|
|
20
|
-
for (const chemin of
|
|
20
|
+
for (const chemin of contratsDuDossier(join(racine, dossierComponents))) {
|
|
21
21
|
let contrat;
|
|
22
22
|
try {
|
|
23
23
|
contrat = JSON.parse(readFileSync(chemin, "utf8").replace(/^/, ""));
|
package/src/tokens-css.mjs
CHANGED
|
@@ -31,9 +31,10 @@ import {
|
|
|
31
31
|
indexerTokensDtcg,
|
|
32
32
|
lireConfiguration,
|
|
33
33
|
sansEchantillon,
|
|
34
|
-
trouverContrats,
|
|
35
34
|
} from "@ucm-kit/core/lecteurs";
|
|
36
35
|
|
|
36
|
+
import { contratsDuDossier } from "./contrats.mjs";
|
|
37
|
+
|
|
37
38
|
export const USAGE_TOKENS = "ucm tokens css --out <fichier> [--sans-modes]";
|
|
38
39
|
|
|
39
40
|
const possede = (objet, cle) => Object.prototype.hasOwnProperty.call(objet, cle);
|
|
@@ -443,7 +444,7 @@ export function lireArgumentsTokens(arguments_) {
|
|
|
443
444
|
/** Les contrats du repository qui citent au moins une référence de token. */
|
|
444
445
|
function contratsQuiCitentDesTokens(racine, dossierComponents) {
|
|
445
446
|
const cites = [];
|
|
446
|
-
for (const chemin of
|
|
447
|
+
for (const chemin of contratsDuDossier(join(racine, dossierComponents))) {
|
|
447
448
|
try {
|
|
448
449
|
const contrat = JSON.parse(readFileSync(chemin, "utf8").replace(/^\uFEFF/, ""));
|
|
449
450
|
if (collecterReferences(sansEchantillon(contrat)).size > 0) cites.push(relative(racine, chemin).split("\\").join("/"));
|