1@rem Copyright (C) 2024 Huawei Device Co., Ltd.
2@rem Licensed under the Apache License, Version 2.0 (the "License");
3@rem you may not use this file except in compliance with the License.
4@rem You may obtain a copy of the License at
5@rem
6@rem     http://www.apache.org/licenses/LICENSE-2.0
7@rem
8@rem Unless required by applicable law or agreed to in writing, software
9@rem distributed under the License is distributed on an "AS IS" BASIS,
10@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11@rem See the License for the specific language governing permissions and
12@rem limitations under the License.
13@echo off
14@rem
15@rem  -------------------------------------------------------------------
16@rem  Hvigor startup script for Windows, version 1.0.0
17@rem
18@rem  Required ENV vars:
19@rem  ------------------
20@rem    NODE_HOME - location of a Node home dir
21@rem    or
22@rem    Add %NODE_HOME%/bin to the PATH environment variable
23@rem  -------------------------------------------------------------------
24@rem
25
26set DIRNAME=%~dp0
27set APP_BASE_NAME=%~n0
28set NODE_EXE_PATH=""
29set APP_HOME=.
30set WRAPPER_MODULE_PATH=%APP_HOME%\hvigor\hvigor-wrapper.js
31set NODE_EXE=node.exe
32@rem set NODE_OPTS="--max-old-space-size=4096"
33
34@rem Resolve any "." and ".." in APP_HOME to make it shorter.
35for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
36
37if not defined NODE_OPTS set NODE_OPTS="--"
38
39@rem Find node.exe
40if defined NODE_HOME (
41    set NODE_HOME=%NODE_HOME:"=%
42    set "PATH=%PATH%;%NODE_HOME%"
43    set NODE_EXE_PATH=%NODE_HOME%/%NODE_EXE%
44)
45
46%NODE_EXE% --version >NUL 2>&1
47if "%ERRORLEVEL%" == "0" (
48    "%NODE_EXE%" "%NODE_OPTS%" "%WRAPPER_MODULE_PATH%" %*
49) else if exist "%NODE_EXE_PATH%" (
50    "%NODE_EXE_PATH%" "%NODE_OPTS%" "%WRAPPER_MODULE_PATH%" %*
51) else (
52    echo.
53    echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH.
54    echo.
55    echo Please set the NODE_HOME variable in your environment to match the
56    echo location of your NodeJs installation.
57)
58
59if "%ERRORLEVEL%" == "0"(
60    if "%OS%" == "Windows_NT" endlocal
61) else (
62    exit /b %ERRORLEVEL%
63)
64