SPB Git

rebuild désactivable par manifeste ; prepare : ngrok.yml via write_remote_file, pm2 fallback npm

Simon-Pierre Boucher committed (Sep 4, 2026) parent f7a1e39 Browse files

2 changed files +5 −5

modified mld/deploy.py +1 −1
@@ -165,7 +165,7 @@ def deploy(app, alias, reinstall=False, skip_sync=False):
165 if reinstall: 165 if reinstall:
166 script += "if [ -f pnpm-lock.yaml ]; then pnpm install --frozen-lockfile; elif [ -f package-lock.json ]; then npm ci; elif [ -f package.json ]; then npm install; fi\n" 166 script += "if [ -f pnpm-lock.yaml ]; then pnpm install --frozen-lockfile; elif [ -f package-lock.json ]; then npm ci; elif [ -f package.json ]; then npm install; fi\n"
167 script += "if [ -f requirements.txt ] && [ -x .venv/bin/pip ]; then .venv/bin/pip install -q -r requirements.txt; fi\n" 167 script += "if [ -f requirements.txt ] && [ -x .venv/bin/pip ]; then .venv/bin/pip install -q -r requirements.txt; fi\n"
168− elif os.path.exists(os.path.join(sd, "package.json")) and os.path.isdir(os.path.join(sd, "node_modules")): 168+ elif m.get("rebuild", True) and os.path.exists(os.path.join(sd, "package.json")) and os.path.isdir(os.path.join(sd, "node_modules")):
169 script += "npm rebuild >/dev/null 2>&1 && echo ' npm rebuild ok' || echo ' npm rebuild: avertissement'\n" 169 script += "npm rebuild >/dev/null 2>&1 && echo ' npm rebuild ok' || echo ' npm rebuild: avertissement'\n"
170 script += _install_hooks(m, ip, ctx) 170 script += _install_hooks(m, ip, ctx)
171 rc, out, err = ssh.run(ip, script, timeout=1800) 171 rc, out, err = ssh.run(ip, script, timeout=1800)
modified mld/prepare.py +4 −4
@@ -25,15 +25,15 @@ def prepare(alias, runtimes=None, ka_helpers=False):
25 script = "" 25 script = ""
26 for r in missing: 26 for r in missing:
27 if r in config.BREW_FORMULAE: 27 if r in config.BREW_FORMULAE:
28− script += "echo ' brew install %s'; brew install -q %s >/dev/null 2>&1 || echo ' ! échec %s'\n" % (r, config.BREW_FORMULAE[r], r) 28+ fallback = " || npm install -g pm2 >/dev/null 2>&1" if r == "pm2" else ""
29+ script += "echo ' brew install %s'; brew install -q %s >/dev/null 2>&1%s || echo ' ! échec %s'\n" % (r, config.BREW_FORMULAE[r], fallback, r)
29 elif r in config.BREW_CASKS: 30 elif r in config.BREW_CASKS:
30 script += "echo ' brew install --cask ngrok'; brew install -q --cask ngrok >/dev/null 2>&1 || brew install -q ngrok/ngrok/ngrok >/dev/null 2>&1 || echo ' ! échec ngrok'\n" 31 script += "echo ' brew install --cask ngrok'; brew install -q --cask ngrok >/dev/null 2>&1 || brew install -q ngrok/ngrok/ngrok >/dev/null 2>&1 || echo ' ! échec ngrok'\n"
31 # config ngrok (authtoken) depuis la passerelle 32 # config ngrok (authtoken) depuis la passerelle
32 if "ngrok" in missing or not have.get("ngrok"): 33 if "ngrok" in missing or not have.get("ngrok"):
33 if os.path.exists(config.NGROK_CFG): 34 if os.path.exists(config.NGROK_CFG):
34− ssh.run(ip, "mkdir -p \"$HOME/Library/Application Support/ngrok\"") 35+ rc0, _, _ = ssh.write_remote_file(ip, "/Users/%s/Library/Application Support/ngrok/ngrok.yml" % config.USER, open(config.NGROK_CFG).read(), mode="600")
35− ssh.scp_to(ip, config.NGROK_CFG, "'/Users/%s/Library/Application Support/ngrok/ngrok.yml'" % config.USER) 36+ script += "echo ' ngrok.yml %s'\n" % ("copié" if rc0 == 0 else "ÉCHEC de copie")
36− script += "echo ' ngrok.yml copié'\n"
37 # marqueur 37 # marqueur
38 script += "[ -f ~/.maclustr-node ] || echo %s > ~/.maclustr-node\n" % alias 38 script += "[ -f ~/.maclustr-node ] || echo %s > ~/.maclustr-node\n" % alias
39 # pm2 startup (launchd) — nécessite sudo 39 # pm2 startup (launchd) — nécessite sudo
40 40
Menu

Theme