@ucm-kit/cli 0.2.2 → 0.4.0
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 +79 -7
- package/aides/attributs-natifs.md +4 -0
- package/aides/chargement-feuilles.md +4 -0
- package/aides/composant.md +4 -5
- package/aides/comptage-dependances.md +4 -0
- package/aides/contour-border.md +6 -4
- package/aides/contour-ring.md +5 -5
- package/aides/controles.md +4 -0
- package/aides/focus-clavier.md +4 -0
- package/aides/grille.md +2 -4
- package/aides/icone-composant.md +4 -0
- package/aides/icone.md +3 -1
- package/aides/identifiants.md +5 -1
- package/aides/ombre.md +1 -2
- package/aides/opacite.md +1 -2
- package/aides/portee-mode.md +4 -0
- package/aides/position-absolue.md +1 -3
- package/aides/resolution-token.md +10 -3
- package/aides/rotation.md +1 -1
- package/aides/typographie.md +1 -1
- package/package.json +3 -3
- package/procedure.md +6 -5
- package/src/aides.mjs +15 -4
- package/src/check.mjs +4 -0
- package/src/conventions.mjs +2 -2
- package/src/deroger.mjs +99 -0
- package/src/fichiers-du-consommateur.mjs +76 -0
- package/src/guide.mjs +39 -19
- package/src/icons.mjs +3 -2
- package/src/init.mjs +98 -123
- package/src/rangs.mjs +11 -2
- package/src/rapport-github.mjs +210 -0
- package/src/rapport-gitlab.mjs +21 -16
- package/src/tokens-css.mjs +35 -29
- package/src/tokens-references.mjs +215 -0
- package/src/ucm.mjs +61 -5
package/src/ucm.mjs
CHANGED
|
@@ -9,16 +9,20 @@ import { dirname, resolve } from "node:path";
|
|
|
9
9
|
import process from "node:process";
|
|
10
10
|
import { pathToFileURL } from "node:url";
|
|
11
11
|
|
|
12
|
+
import { NOM_CONFIGURATION } from "@ucm-kit/core/format";
|
|
12
13
|
import { lireConfiguration } from "@ucm-kit/core/lecteurs";
|
|
13
14
|
|
|
14
15
|
import { chargerAdaptateur } from "./adaptateur.mjs";
|
|
15
16
|
import { aides } from "./aides.mjs";
|
|
16
17
|
import { check } from "./check.mjs";
|
|
18
|
+
import { USAGE_DEROGER, deroger } from "./deroger.mjs";
|
|
17
19
|
import { guide } from "./guide.mjs";
|
|
18
20
|
import { iconesDuRepository, rendreIcones } from "./icons.mjs";
|
|
19
|
-
import { init, lireArgumentsInit, rendreInit } from "./init.mjs";
|
|
21
|
+
import { FORGES, init, lireArgumentsInit, rendreInit } from "./init.mjs";
|
|
22
|
+
import { rapportGithub } from "./rapport-github.mjs";
|
|
20
23
|
import { rapportGitlab } from "./rapport-gitlab.mjs";
|
|
21
|
-
import { tokensCss } from "./tokens-css.mjs";
|
|
24
|
+
import { USAGE_TOKENS, tokensCss } from "./tokens-css.mjs";
|
|
25
|
+
import { tokensReferences } from "./tokens-references.mjs";
|
|
22
26
|
|
|
23
27
|
/** Le verdict de tests qu'un orchestrateur de stack peut transmettre au CLI. */
|
|
24
28
|
function echecsDeTestsDepuis(env) {
|
|
@@ -46,7 +50,7 @@ function echecsDeTestsDepuis(env) {
|
|
|
46
50
|
export const COMMANDES = [
|
|
47
51
|
{
|
|
48
52
|
nom: "init",
|
|
49
|
-
usage:
|
|
53
|
+
usage: `ucm init [--components <dossier>] [--tokens <dossier>] [--implementation <motif>] [--sans-agents] [--forge ${FORGES.join("|")}]`,
|
|
50
54
|
role: "installe ce qui manque à ce repository, sans rien écraser",
|
|
51
55
|
options: [
|
|
52
56
|
{ nom: "--components", role: "dossier sous lequel les contrats sont rangés" },
|
|
@@ -69,6 +73,16 @@ export const COMMANDES = [
|
|
|
69
73
|
{ nom: "--report", role: "écrit le rapport markdown à ce chemin, en plus du terminal" },
|
|
70
74
|
],
|
|
71
75
|
},
|
|
76
|
+
{
|
|
77
|
+
nom: "deroger",
|
|
78
|
+
usage: USAGE_DEROGER,
|
|
79
|
+
role: "écrit la dérogation motivée d'un constat du code",
|
|
80
|
+
options: [
|
|
81
|
+
{ nom: "--motif", role: "la raison pour laquelle le code garde l'écart" },
|
|
82
|
+
{ nom: "--par", role: "l'auteur ; sans lui, git config user.name" },
|
|
83
|
+
],
|
|
84
|
+
note: "Les coordonnées suivent le genre du constat, dans l'ordre que le\nconstat donne. Seules --motif et --par sont des options.",
|
|
85
|
+
},
|
|
72
86
|
{ nom: "icons", usage: "ucm icons", role: "liste les icônes que les contrats réclament", options: [] },
|
|
73
87
|
{
|
|
74
88
|
nom: "tokens css",
|
|
@@ -79,6 +93,15 @@ export const COMMANDES = [
|
|
|
79
93
|
{ nom: "--sans-modes", role: "écrit la valeur par défaut de chaque token, pour un\nfichier exporté avant la déclaration des axes" },
|
|
80
94
|
],
|
|
81
95
|
},
|
|
96
|
+
{
|
|
97
|
+
nom: "tokens references",
|
|
98
|
+
usage: "ucm tokens references [--verifier] <fichiers…>",
|
|
99
|
+
role: "remplace \"{chemin}\" par \"var(--nom)\" dans le code",
|
|
100
|
+
options: [
|
|
101
|
+
{ nom: "--verifier", role: "n'écrit rien, sort en 1 s'il reste une référence à\nremplacer ou un cas laissé" },
|
|
102
|
+
{ nom: "<fichiers>", role: "les fichiers de code à réécrire" },
|
|
103
|
+
],
|
|
104
|
+
},
|
|
82
105
|
{
|
|
83
106
|
nom: "aides",
|
|
84
107
|
usage: "ucm aides [<aide> [--personnaliser [<chemin>]]]",
|
|
@@ -97,6 +120,18 @@ export const COMMANDES = [
|
|
|
97
120
|
{ nom: "--out", role: "écrit le guide dans ce fichier plutôt que dans le terminal" },
|
|
98
121
|
],
|
|
99
122
|
},
|
|
123
|
+
{
|
|
124
|
+
nom: "rapport-github",
|
|
125
|
+
usage: "ucm rapport-github --depot <propriétaire/nom> --demande <numéro> --fichier <chemin> [--api <url>]",
|
|
126
|
+
role: "publie le rapport en commentaire d'une pull request GitHub",
|
|
127
|
+
options: [
|
|
128
|
+
{ nom: "--depot", role: "le repository, écrit propriétaire/nom" },
|
|
129
|
+
{ nom: "--demande", role: "le numéro de la pull request dans ce repository" },
|
|
130
|
+
{ nom: "--fichier", role: "le rapport écrit par ucm check --report" },
|
|
131
|
+
{ nom: "--api", role: "l'API GitHub, https://api.github.com par défaut" },
|
|
132
|
+
],
|
|
133
|
+
note: "Le jeton se lit dans GITHUB_TOKEN. Sans lui, la commande le dit et\nsort en 0.",
|
|
134
|
+
},
|
|
100
135
|
{
|
|
101
136
|
nom: "rapport-gitlab",
|
|
102
137
|
usage: "ucm rapport-gitlab --projet <id> --merge-request <iid> --fichier <chemin> [--api <url>]",
|
|
@@ -154,7 +189,7 @@ function executerCommande(arguments_, {
|
|
|
154
189
|
} = {}) {
|
|
155
190
|
const racineInitiale = racine;
|
|
156
191
|
for (let candidate = resolve(racine); ; candidate = dirname(candidate)) {
|
|
157
|
-
if (existsSync(resolve(candidate,
|
|
192
|
+
if (existsSync(resolve(candidate, NOM_CONFIGURATION)) || existsSync(resolve(candidate, ".git"))) {
|
|
158
193
|
racine = candidate;
|
|
159
194
|
break;
|
|
160
195
|
}
|
|
@@ -215,13 +250,24 @@ function executerCommande(arguments_, {
|
|
|
215
250
|
}
|
|
216
251
|
|
|
217
252
|
if (commande === "tokens") {
|
|
218
|
-
|
|
253
|
+
if (arguments_[1] !== undefined && arguments_[1] !== "css" && arguments_[1] !== "references") {
|
|
254
|
+
(sorties.alerter ?? console.error)(`Sous-commande inconnue : ${arguments_[1]}. ucm tokens attend css ou references.
|
|
255
|
+
|
|
256
|
+
${USAGE_TOKENS}`);
|
|
257
|
+
return 2;
|
|
258
|
+
}
|
|
259
|
+
const sousCommande = arguments_[1] === "references" ? tokensReferences : tokensCss;
|
|
260
|
+
return sousCommande(arguments_.slice(1).slice(arguments_[1] === "references" ? 1 : 0), {
|
|
219
261
|
racine,
|
|
220
262
|
ecrire,
|
|
221
263
|
alerter: sorties.alerter ?? console.error,
|
|
222
264
|
});
|
|
223
265
|
}
|
|
224
266
|
|
|
267
|
+
if (commande === "deroger") {
|
|
268
|
+
return deroger(arguments_.slice(1), { racine, ecrire, alerter: sorties.alerter ?? console.error, executerGit: sorties.executerGit });
|
|
269
|
+
}
|
|
270
|
+
|
|
225
271
|
if (commande === "aides") {
|
|
226
272
|
return aides(arguments_.slice(1), { racine, ecrire, alerter: sorties.alerter ?? console.error });
|
|
227
273
|
}
|
|
@@ -230,6 +276,16 @@ function executerCommande(arguments_, {
|
|
|
230
276
|
return guide(arguments_.slice(1), { racine, ecrire, alerter: sorties.alerter ?? console.error });
|
|
231
277
|
}
|
|
232
278
|
|
|
279
|
+
if (commande === "rapport-github") {
|
|
280
|
+
return rapportGithub(arguments_.slice(1), {
|
|
281
|
+
racine,
|
|
282
|
+
env,
|
|
283
|
+
fetch: sorties.fetch,
|
|
284
|
+
ecrire,
|
|
285
|
+
alerter: sorties.alerter ?? console.error,
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
|
|
233
289
|
if (commande === "rapport-gitlab") {
|
|
234
290
|
return rapportGitlab(arguments_.slice(1), {
|
|
235
291
|
racine,
|