Skip to content

Commit d3e6d9e

Browse files
authored
deps: alternative update of node-gyp for electron (v5 & v6), windows (#1245)
* deps: alternative update of node-gyp for electron (v5 & v6), windows
1 parent 460931b commit d3e6d9e

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

scripts/build-appveyor.bat

+20
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,26 @@ IF %ERRORLEVEL% NEQ 0 GOTO ERROR
7272
IF "%nodejs_version:~0,1%"=="5" CALL npm install node-gyp@3.x
7373
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
7474

75+
::Need to force update node-gyp to v6+ for electron v6 and v5
76+
ECHO ===== conditional node-gyp upgrade START ============
77+
:: Find the folder to install the node-gyp in
78+
SET npm_in_nodejs_dir="%ProgramFiles%\nodejs\node_modules\npm"
79+
ECHO npm_in_nodejs_dir^: %npm_in_nodejs_dir%
80+
IF /I "%platform%"=="x86" SET npm_in_nodejs_dir="%ProgramFiles(x86)%\nodejs\node_modules\npm"
81+
ECHO npm_in_nodejs_dir^: %npm_in_nodejs_dir%
82+
:: Set boolean whether the update has to happen
83+
SET "needs_patch="
84+
IF DEFINED NODE_RUNTIME_VERSION (
85+
ECHO NODE_RUNTIME_VERSION_REDUCED^: %NODE_RUNTIME_VERSION:~0,1%
86+
IF "%NODE_RUNTIME_VERSION:~0,1%"=="5" SET "needs_patch=y"
87+
IF "%NODE_RUNTIME_VERSION:~0,1%"=="6" SET "needs_patch=y"
88+
)
89+
:: Check if electron and install
90+
ECHO NODE_RUNTIME^: %NODE_RUNTIME%
91+
IF DEFINED needs_patch CALL npm install --prefix %npm_in_nodejs_dir% node-gyp@6.x
92+
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
93+
ECHO ===== conditional node-gyp upgrade END ============
94+
7595
CALL npm install --build-from-source --msvs_version=%msvs_version% %TOOLSET_ARGS% --loglevel=http
7696
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
7797

0 commit comments

Comments
 (0)