From 3edb0357b7841f1cd9314fd1917bb866a0cba11b Mon Sep 17 00:00:00 2001 From: Christophe Besson Date: Fri, 4 Sep 2026 10:47:21 +0200 Subject: feat(packaging): put the bundled meshbay-node on the per-user PATH MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The installer had no console entry point, so running the CLI meant cd-ing into resources\node-runtime\ every time. installer.nsh now adds that dir to HKCU\Environment\Path on install and removes it on uninstall, via stock WordFunc.nsh (electron-builder's NSIS bundle has no EnVar plugin). It points at the real meshbay-node.exe dir — not a shim — so `where meshbay-node`, findNodeBinary and the W3 autostart launcher all resolve to the same binary. A WM_SETTINGCHANGE broadcast nudges open shells; new ones just work. Rebuilt: electron-builder --win nsis compiles the WordFunc includes fine, MeshBay-Setup-0.1.0.exe (155 MB). test_packaging_win.py covers the add/remove symmetry. Co-Authored-By: Claude Sonnet 5 --- packages/meshbay-node/tests/test_packaging_win.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'packages/meshbay-node/tests/test_packaging_win.py') diff --git a/packages/meshbay-node/tests/test_packaging_win.py b/packages/meshbay-node/tests/test_packaging_win.py index 1b7521a..8c8e272 100644 --- a/packages/meshbay-node/tests/test_packaging_win.py +++ b/packages/meshbay-node/tests/test_packaging_win.py @@ -151,3 +151,25 @@ def test_customInstall_stops_a_running_daemon_before_overwriting_it(): nsh = NSH.read_text(encoding="utf-8") body = nsh.split("!macro customInstall", 1)[1].split("!macroend", 1)[0] assert "taskkill /IM meshbay-node.exe /F" in body + + +def test_the_bundled_daemon_goes_on_the_user_path_and_comes_back_off(): + """ + The installer has no console entry point of its own; without this the + operator has to `cd` into resources\\node-runtime\\ to run `meshbay-node`. + The add uses stock WordFunc (no EnVar plugin — electron-builder's NSIS does + not bundle it) and the same $INSTDIR-relative string on the way out. + """ + nsh = NSH.read_text(encoding="utf-8") + assert "!insertmacro WordAdd" in nsh and "!insertmacro un.WordAdd" in nsh + + install = nsh.split("!macro customInstall", 1)[1].split("!macroend", 1)[0] + uninstall = nsh.split("!macro customUnInstall", 1)[1].split("!macroend", 1)[0] + assert 'HKCU "Environment" "Path"' in install + assert "${WordAdd}" in install and '"+${MB_NODE_BIN}"' in install + assert "${un.WordAdd}" in uninstall and '"-${MB_NODE_BIN}"' in uninstall + # New shells need the broadcast to notice. + assert "WM_WININICHANGE" in install and "WM_WININICHANGE" in uninstall + # PATH points at the real .exe dir, so `where meshbay-node` resolves to the + # binary the client and the W3 launcher use too — not a shim. + assert 'MB_NODE_BIN "$INSTDIR\\resources\\node-runtime"' in nsh -- cgit v1.2.3