@elia97/officina 0.6.0 → 0.6.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.
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { readLines } from './cli.js';
|
|
2
|
+
import { isLive } from './workflows.js';
|
|
3
|
+
const EXPRESSION = /\$\{\{[^}]*\}\}/g;
|
|
4
|
+
const DESCRIPTION = /^\s*description:/;
|
|
5
|
+
const FORBIDDEN = ['secrets', 'needs', 'matrix'];
|
|
6
|
+
const contextIn = (expression) => FORBIDDEN.find((name) => new RegExp(`(^|[^\\w.])${name}\\.`).test(expression));
|
|
7
|
+
function lineFindings(text) {
|
|
8
|
+
const expressions = [...text.matchAll(EXPRESSION)];
|
|
9
|
+
if (expressions.length === 0)
|
|
10
|
+
return [];
|
|
11
|
+
if (DESCRIPTION.test(text)) {
|
|
12
|
+
return ['`description` non ammette espressioni: il runner la valuta e il manifesto non si carica'];
|
|
13
|
+
}
|
|
14
|
+
return expressions.flatMap(([expression]) => {
|
|
15
|
+
const context = contextIn(expression);
|
|
16
|
+
return context === undefined ? [] : [`\`${context}\` non è un contesto di una composite action: passalo come input`];
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
// Il runner valuta le espressioni del manifesto prima di eseguire qualunque passo: un contesto che una
|
|
20
|
+
// composite action non conosce non è un valore vuoto, è un'action che non si carica.
|
|
21
|
+
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 }))));
|
|
25
|
+
}
|
package/dist/lib/workflows.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ProjectFiles } from './alignment.ts';
|
|
2
2
|
import type { ContractGap } from './contract.ts';
|
|
3
|
+
export declare const isLive: (line: string) => boolean;
|
|
3
4
|
export declare const mentions: (source: string | undefined, needle: string) => boolean;
|
|
4
5
|
/** Le action del progetto devono stare alla stessa versione del pacchetto installato. */
|
|
5
6
|
export declare function workflowGaps({ read }: ProjectFiles, version: string): ContractGap[];
|
package/dist/lib/workflows.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
|
|
4
|
-
const liveLines = (source) => source.split(/\r?\n/).filter(
|
|
1
|
+
// Niente parser YAML nel pacchetto: la ricerca è testuale. Una riga commentata non soddisfa nessun
|
|
2
|
+
// controllo, altrimenti basta commentare un passo per avere un progetto «a posto» che non lo lancia.
|
|
3
|
+
export const isLive = (line) => !line.trimStart().startsWith('#');
|
|
4
|
+
const liveLines = (source) => source.split(/\r?\n/).filter(isLive);
|
|
5
5
|
export const mentions = (source, needle) => source !== undefined && liveLines(source).some((line) => line.includes(needle));
|
|
6
6
|
const ACTIONS = [
|
|
7
7
|
{ workflow: '.github/workflows/ci.yml', action: 'ci' },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elia97/officina",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.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",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@biomejs/biome": "2.5.10",
|
|
58
|
-
"@types/node": "^
|
|
58
|
+
"@types/node": "^26.5.1",
|
|
59
59
|
"@vitest/coverage-v8": "^4.1.11",
|
|
60
60
|
"fallow": "^3.26.0",
|
|
61
61
|
"typescript": "^7.0.2",
|