@ucm-kit/cli 0.4.1 → 0.4.2
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 +5 -5
- package/package.json +1 -1
- package/src/rapport-github.mjs +6 -3
- package/src/rapport-gitlab.mjs +4 -1
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ matches them.
|
|
|
16
16
|
Requires Node 22 or later. At the root of the repository:
|
|
17
17
|
|
|
18
18
|
```sh
|
|
19
|
-
npx --yes @ucm-kit/cli@0.4.
|
|
19
|
+
npx --yes @ucm-kit/cli@0.4.2 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.4.1 init
|
|
|
27
27
|
To run the check locally:
|
|
28
28
|
|
|
29
29
|
```sh
|
|
30
|
-
npx --yes @ucm-kit/cli@0.4.
|
|
30
|
+
npx --yes @ucm-kit/cli@0.4.2 check --report ci-report.md
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
`--yes` skips the npx confirmation prompt. Pin an exact version, without `^`:
|
|
@@ -87,7 +87,7 @@ contract would resolve to the same file. A repository that does not write React
|
|
|
87
87
|
states its own extension:
|
|
88
88
|
|
|
89
89
|
```sh
|
|
90
|
-
npx --yes @ucm-kit/cli@0.4.
|
|
90
|
+
npx --yes @ucm-kit/cli@0.4.2 init --components Sources/DesignSystem --implementation '{dir}/{id}.swift'
|
|
91
91
|
```
|
|
92
92
|
|
|
93
93
|
The three path options act only on a first install. `ucm init` never overwrites
|
|
@@ -159,7 +159,7 @@ job runs no code from the repository: it receives the report as an artifact
|
|
|
159
159
|
and posts it with `ucm rapport-github`, replacing its previous comment:
|
|
160
160
|
|
|
161
161
|
```sh
|
|
162
|
-
npx --yes @ucm-kit/cli@0.4.
|
|
162
|
+
npx --yes @ucm-kit/cli@0.4.2 rapport-github --depot "$GITHUB_REPOSITORY" --demande "$NUMERO" --fichier ci-report.md
|
|
163
163
|
```
|
|
164
164
|
|
|
165
165
|
| Option | Effect |
|
|
@@ -222,7 +222,7 @@ directory. It writes a minimal report when the check stopped before writing
|
|
|
222
222
|
one, then posts the report:
|
|
223
223
|
|
|
224
224
|
```sh
|
|
225
|
-
npx --yes @ucm-kit/cli@0.4.
|
|
225
|
+
npx --yes @ucm-kit/cli@0.4.2 rapport-gitlab --projet "$CI_PROJECT_ID" --merge-request "$CI_MERGE_REQUEST_IID" --fichier "$CI_PROJECT_DIR/ci-report.md" --api "$CI_API_V4_URL"
|
|
226
226
|
```
|
|
227
227
|
|
|
228
228
|
| Option | Effect |
|
package/package.json
CHANGED
package/src/rapport-github.mjs
CHANGED
|
@@ -154,9 +154,11 @@ export async function rapportGithub(arguments_, {
|
|
|
154
154
|
return reponse;
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
-
async function lireJson(reponse, objet) {
|
|
157
|
+
async function lireJson(reponse, objet, accepte = () => true) {
|
|
158
158
|
try {
|
|
159
|
-
|
|
159
|
+
const valeur = await reponse.json();
|
|
160
|
+
if (!accepte(valeur)) throw new TypeError();
|
|
161
|
+
return valeur;
|
|
160
162
|
} catch {
|
|
161
163
|
throw new RefusGithub(null, `GitHub a rendu une réponse illisible en lisant ${objet}. Relancez le job.`);
|
|
162
164
|
}
|
|
@@ -179,7 +181,8 @@ export async function rapportGithub(arguments_, {
|
|
|
179
181
|
`${depot}/issues/${valeurs.demande}/comments?per_page=${PAR_PAGE}&page=${page}`,
|
|
180
182
|
"lire les commentaires de la pull request",
|
|
181
183
|
);
|
|
182
|
-
const lues = await lireJson(reponse, "les commentaires de la pull request")
|
|
184
|
+
const lues = await lireJson(reponse, "les commentaires de la pull request", (valeur) => Array.isArray(valeur)
|
|
185
|
+
&& valeur.every((note) => note !== null && typeof note === "object" && !Array.isArray(note)));
|
|
183
186
|
for (const note of lues) {
|
|
184
187
|
notes.push({ id: note.id, auteur: note.user?.login, corps: note.body, systeme: false });
|
|
185
188
|
}
|
package/src/rapport-gitlab.mjs
CHANGED
|
@@ -163,7 +163,10 @@ export async function rapportGitlab(arguments_, {
|
|
|
163
163
|
while (page) {
|
|
164
164
|
const reponse = await appeler(`${notes}?per_page=100&sort=asc&page=${page}`, "lire les notes de la merge request");
|
|
165
165
|
let lues;
|
|
166
|
-
try {
|
|
166
|
+
try {
|
|
167
|
+
lues = await reponse.json();
|
|
168
|
+
if (!Array.isArray(lues) || !lues.every((note) => note !== null && typeof note === "object" && !Array.isArray(note))) throw new TypeError();
|
|
169
|
+
} catch {
|
|
167
170
|
throw new RefusGitlab(null, "GitLab a rendu une réponse illisible en lisant les notes de la merge request. Relancez le job.");
|
|
168
171
|
}
|
|
169
172
|
for (const note of lues) {
|