Skip to content

Commit

Permalink
Bundle local copy of node.exe
Browse files Browse the repository at this point in the history
  • Loading branch information
minogian committed Oct 13, 2016
1 parent 05ef1c5 commit 066dc68
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ $RECYCLE.BIN/
.DS_Store

.idea
staging/node.exe
staging/node_modules
staging/windows
output
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ Make sure MSBuild and the WiX folder are in the path.
### Staging
- Build GPII/windows (including the listeners - see https://github.com/GPII/windows/blob/master/provisioning/build.bat)
- Edit [`setup/staging.rcj`](https://github.com/GPII/gpii-wix-installer/blob/master/setup/staging.rcj) and replace `C:\projects\gpii\windows\` with the path of your local GPII/windows repository
- Edit [`setup/build.cmd`](https://github.com/GPII/gpii-wix-installer/blob/master/setup/build.cmd) and uncomment lines 4-5.
- Run [`setup/build.cmd`](https://github.com/GPII/gpii-wix-installer/blob/master/setup/build.cmd)

Staging makes a private copy of the GPII/windows repository inside the `staging` folder and uses that for building the installer. Any files not needed (eg Git and Vagrant related folders) are excluded.
Expand Down
69 changes: 64 additions & 5 deletions setup/build.cmd
Original file line number Diff line number Diff line change
@@ -1,9 +1,68 @@
rem Staging
echo off

rem Edit staging.rcj and then uncomment the following lines as needed
rem rmdir /s /q ..\staging\windows
rem robocopy /job:staging.rcj

setlocal
rem Edit and uncomment the following line (or set a global environment variable) if node is installed in a non-default location
rem set GPII_INST_NODE=C:\Program Files\nodejs\node.exe

if defined ProgramFiles(x86) set GPII_INST_X64=1

rem Bundle local copy of node
if defined GPII_INST_NODE (

rem Using custom node location
if exist "%GPII_INST_NODE%" (
echo Copying "%GPII_INST_NODE%" to staging...
copy "%GPII_INST_NODE%" ..\staging /y
) else (
rem Node not found, exit
echo ERROR - "%GPII_INST_NODE%" is missing
exit /b 1
)

) else (

rem Autodetect x86 node location
if defined GPII_INST_X64 (

rem 64bit OS
if exist "%ProgramFiles(x86)%\nodejs\node.exe" (
echo Copying "%ProgramFiles(x86)%\nodejs\node.exe" to staging...
copy "%ProgramFiles(x86)%\nodejs\node.exe" ..\staging /y
) else (
rem Node not found, exit
echo ERROR - "%ProgramFiles(x86)%\nodejs\node.exe" is missing
exit /b 1
)

) else (

rem 32bit OS
if exist "%ProgramFiles%\nodejs\node.exe" (
echo Copying "%ProgramFiles%\nodejs\node.exe" to staging...
copy "%ProgramFiles%\nodejs\node.exe" ..\staging /y
) else (
rem Node not found, exit
echo ERROR - "%ProgramFiles%\nodejs\node.exe" is missing
exit /b -1
)
)
)

endlocal

rem Copy files to staging\windows
if exist "..\staging\windows" (
echo Cleaning up staging\windows...
rmdir /s /q ..\staging\windows
)
robocopy /job:staging.rcj

if not exist "..\staging\windows" (
echo ERROR - You need to edit staging.rcj before proceeding
exit /b -1
)

rem Remove development/testing modules
pushd ..\staging\windows
call npm prune --production
popd
Expand Down
Binary file removed staging/node.exe
Binary file not shown.

0 comments on commit 066dc68

Please sign in to comment.