Skip to content

Commit df9c927

Browse files
committed
build: add shim to call node from wsl
Signed-off-by: Nad Alaba <37968805+nadalaba@users.noreply.github.com>
1 parent 6e2188e commit df9c927

4 files changed

Lines changed: 16 additions & 0 deletions

File tree

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ vcbuild.bat text eol=crlf
44
deps/crates/vendor/**/* -text
55
deps/npm/bin/npm text eol=lf
66
deps/npm/bin/npx text eol=lf
7+
tools/msvs/shims/node text eol=lf
78
deps/corepack/shims/corepack text eol=lf
89
tools/msvs/find_python.cmd text eol=crlf
910
doc/**/*.md text eol=lf

tools/msvs/msi/nodemsi/product.wxs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
Description="!(loc.NodeRuntime_Description)"
6767
AllowAbsent="no">
6868
<ComponentRef Id="NodeExecutable"/>
69+
<ComponentRef Id="NodeBashShim"/>
6970
<ComponentRef Id="NodeRegistryEntries"/>
7071
<ComponentRef Id="NodeVarsScript"/>
7172
<ComponentRef Id="NodeStartMenu"/>
@@ -142,6 +143,10 @@
142143
Value="$(var.ProductVersion)"/>
143144
</Component>
144145

146+
<Component Id="NodeBashShim">
147+
<File Id="node" KeyPath="yes" Source="$(var.RepoDir)\tools\msvs\shims\node"/>
148+
</Component>
149+
145150
<Component Id="NodeVarsScript">
146151
<File Id="nodevars.bat" KeyPath="yes" Source="$(var.RepoDir)\tools\msvs\nodevars.bat"/>
147152
</Component>

tools/msvs/shims/node

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env sh
2+
3+
# This allows calling node (without .exe) from WSL bash
4+
5+
WIN_NODE_DIR=$(cd "$(dirname "$0")" && pwd)
6+
WIN_NODE_EXE="$WIN_NODE_DIR/node.exe"
7+
8+
exec "$WIN_NODE_EXE" "$@"

vcbuild.bat

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,8 @@ copy /Y ..\tools\msvs\nodevars.bat %TARGET_NAME%\ > nul
553553
if errorlevel 1 echo Cannot copy nodevars.bat && goto package_error
554554
copy /Y ..\tools\msvs\install_tools\*.* %TARGET_NAME%\ > nul
555555
if errorlevel 1 echo Cannot copy install_tools scripts && goto package_error
556+
copy /Y ..\tools\msvs\shims\*.* %TARGET_NAME%\ > nul
557+
if errorlevel 1 echo Cannot copy shims && goto package_error
556558
if defined dll (
557559
copy /Y libnode.dll %TARGET_NAME%\ > nul
558560
if errorlevel 1 echo Cannot copy libnode.dll && goto package_error

0 commit comments

Comments
 (0)