* Recursively parses script definitions from package-scripts file * @param {Object} scripts - Script definitions object * @param {string} parentKey - Parent key for nested scripts
(scripts = this.scripts, parentKey = "")
| 60 | * @param {string} parentKey - Parent key for nested scripts |
| 61 | */ |
| 62 | parseScripts(scripts = this.scripts, parentKey = "") { |
| 63 | for (const [key, value] of Object.entries(scripts)) { |
| 64 | if (key === "__ui5envs") continue; // Skip envs key |
| 65 | |
| 66 | if (parentKey && key === "default") { |
| 67 | this.parsedScripts.set(parentKey, value); |
| 68 | } |
| 69 | |
| 70 | const fullKey = parentKey ? `${parentKey}.${key}` : key; |
| 71 | |
| 72 | if (typeof value === "string") { |
| 73 | this.parsedScripts.set(fullKey, value); |
| 74 | } else if (typeof value === "object") { |
| 75 | this.parseScripts(value, fullKey); |
| 76 | } else { |
| 77 | throw new Error(`Invalid script definition for key: ${fullKey}`); |
| 78 | } |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | /** |
| 83 | * Resolves script commands and determines if they should run in parallel |