-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.cmd
executable file
·73 lines (54 loc) · 1.83 KB
/
build.cmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
@echo off
set BASE=%~dp0
set NODE_DIR=%BASE%tools\node\windows\
set BIT_64=
set BIT_32=32
If Defined ProgramFiles(x86) (
set BIT=%BIT_64%
) Else (
set BIT=%BIT_32%
)
if exist "%NODE_DIR%node.exe" (
REM If a standalone node installation exists, use that
goto standalone
) else (
REM Otherwise, assume local install is available
goto local
)
REM ===========================================================================
:standalone
set NODE=%NODE_DIR%node%BIT%.exe
echo :: Standalone node installation found!
echo :: Location: "%NODE%"
echo :: Installing dependencies...
CALL "%NODE_DIR%npm" install || exit /b 1
CALL "%NODE_DIR%bower" install || exit /b 1
echo :: Performing Grunt build...
CALL "%NODE_DIR%grunt" %* || exit /b 1
goto finish
REM ===========================================================================
:local
set NODE=node
echo :: Node installation found!
echo :: Installing dependencies...
CALL npm install || exit /b 1
CALL bower install || exit /b 1
echo :: Performing Grunt build...
CALL grunt %* || exit /b 1
goto finish
REM ===========================================================================
:check_node_version
REM Check the installed version of node with the latest version
REM If installed node is not up-to-date, echo a message
REM TODO: scrape site for latest version number
SET LATEST_VERSION=v4.1.1
IF "%LATEST_VERSION%" NEQ "%1" (
echo :: WARNING: You are using an outdated version of Node. The latest version is %LATEST_VERSION%
echo :: If the build is failing, please update node to the latest version
)
EXIT /B 0
REM ===========================================================================
:finish
for /f "delims=" %%a in ('"%NODE%" -v') do @set version=%%a
CALL :check_node_version %version%
echo DONE