@elia97/officina 0.7.0 → 0.7.1

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.
@@ -1,3 +1,4 @@
1
+ import { LineCounter, parseDocument } from 'yaml';
1
2
  import { readLines } from './cli.js';
2
3
  import { isLive } from './workflows.js';
3
4
  const EXPRESSION = /\$\{\{[^}]*\}\}/g;
@@ -16,10 +17,20 @@ function lineFindings(text) {
16
17
  return context === undefined ? [] : [`\`${context}\` non è un contesto di una composite action: passalo come input`];
17
18
  });
18
19
  }
20
+ function syntaxFindings(source) {
21
+ const lineCounter = new LineCounter();
22
+ return parseDocument(source, { lineCounter, prettyErrors: false }).errors.map(({ message, pos }) => ({
23
+ line: lineCounter.linePos(pos[0]).line,
24
+ message: `non è YAML valido: ${message}`,
25
+ }));
26
+ }
19
27
  // Il runner valuta le espressioni del manifesto prima di eseguire qualunque passo: un contesto che una
20
28
  // composite action non conosce non è un valore vuoto, è un'action che non si carica.
21
29
  export function manifestFindings(manifests) {
22
- return manifests.flatMap(({ path, source }) => readLines(source)
23
- .filter(({ text }) => isLive(text))
24
- .flatMap(({ n, text }) => lineFindings(text).map((message) => ({ path, line: n, message }))));
30
+ return manifests.flatMap(({ path, source }) => [
31
+ ...syntaxFindings(source).map((hit) => ({ path, ...hit })),
32
+ ...readLines(source)
33
+ .filter(({ text }) => isLive(text))
34
+ .flatMap(({ n, text }) => lineFindings(text).map((message) => ({ path, line: n, message }))),
35
+ ]);
25
36
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elia97/officina",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Gli strumenti dei progetti nati dai template di Elia: gate di qualità, generatori e verifiche di build e di produzione.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -54,7 +54,7 @@
54
54
  "test:pack": "bash scripts/pack-test.sh"
55
55
  },
56
56
  "devDependencies": {
57
- "@biomejs/biome": "2.5.10",
57
+ "@biomejs/biome": "2.5.14",
58
58
  "@types/node": "^26.5.1",
59
59
  "@vitest/coverage-v8": "^4.1.11",
60
60
  "fallow": "^3.26.0",