MCPcopy Create free account
hub / github.com/UI5/webcomponents / parseScripts

Method parseScripts

packages/tools/bin/ui5nps.js:62–80  ·  view source on GitHub ↗

* 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 = "")

Source from the content-addressed store, hash-verified

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

Callers 1

constructorMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected