multicloud_rule_manager 1.1.27 → 1.1.28

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "multicloud_rule_manager",
3
- "version": "1.1.27",
3
+ "version": "1.1.28",
4
4
  "description": "CLI interna per retrieve/upload con token",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -81,20 +81,20 @@ function hasValidWhenThenBlock(content, fileName) {
81
81
  const matches = content.match(regex);
82
82
 
83
83
  if (!matches || matches.length === 0) {
84
- console.error(`❌ Il file ${fileName} deve contenere un blocco "when {} then {}"`);
85
- return false;
84
+ return { valid: false, message: `❌ Il file ${fileName} deve contenere un blocco "when {} then {}"`};
85
+
86
86
  }
87
87
 
88
88
  if (matches.length > 1) {
89
- console.error(`❌ Il file ${fileName} contiene più blocchi "when {} then {}", è consentito solo uno`);
90
- return false;
89
+ return { valid: false, message: `❌ Il file ${fileName} contiene più blocchi "when {} then {}", è consentito solo uno`};
90
+
91
91
  }
92
92
 
93
93
  // opzionale: controlla se ci sono altre parole 'when' o 'then' nel file fuori dal blocco principale
94
94
  const cleaned = content.replace(regex, ''); // rimuove il blocco valido
95
95
  if (/when|then/.test(cleaned)) {
96
- console.error(`❌ Il file ${fileName} contiene 'when' o 'then' extra fuori dal blocco principale`);
97
- return false;
96
+ return { valid: false, message: `❌ Il file ${fileName} contiene 'when' o 'then' extra fuori dal blocco principale`};
97
+
98
98
  }
99
99
 
100
100
  return true;