improved build script.
This commit is contained in:
parent
b6f9de2894
commit
a849e65f9a
@ -22,16 +22,22 @@ def ensure_node_tool(package_name, binary_name=None):
|
||||
|
||||
os.makedirs(tools_dir, exist_ok=True)
|
||||
|
||||
# Wenn Binary schon vorhanden ist, einfach zurückgeben
|
||||
if os.path.isfile(local_bin):
|
||||
return local_bin
|
||||
|
||||
print(f"🛠️ Installing missing node tool: {package_name}")
|
||||
|
||||
# Initialisiere npm, falls noch nicht geschehen
|
||||
if not os.path.isfile(os.path.join(tools_dir, 'package.json')):
|
||||
print("🛠️ Initializing local npm project in tools_node...")
|
||||
print("📦 Initializing local npm project...")
|
||||
subprocess.run(['npm', 'init', '-y'], cwd=tools_dir, check=True)
|
||||
|
||||
# Installiere Tool (idempotent)
|
||||
try:
|
||||
subprocess.run(['npm', 'install', package_name], cwd=tools_dir, check=True)
|
||||
except Exception as e:
|
||||
print(f"❌ Fehler beim Installieren von {package_name}: {e}")
|
||||
return binary_name # Fallback: globale binary
|
||||
|
||||
return local_bin if os.path.isfile(local_bin) else binary_name
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user