10704ebd2Sopenharmony_ci@rem Copyright (C) 2024 Huawei Device Co., Ltd.
20704ebd2Sopenharmony_ci@rem Licensed under the Apache License, Version 2.0 (the "License");
30704ebd2Sopenharmony_ci@rem you may not use this file except in compliance with the License.
40704ebd2Sopenharmony_ci@rem You may obtain a copy of the License at
50704ebd2Sopenharmony_ci@rem
60704ebd2Sopenharmony_ci@rem     http://www.apache.org/licenses/LICENSE-2.0
70704ebd2Sopenharmony_ci@rem
80704ebd2Sopenharmony_ci@rem Unless required by applicable law or agreed to in writing, software
90704ebd2Sopenharmony_ci@rem distributed under the License is distributed on an "AS IS" BASIS,
100704ebd2Sopenharmony_ci@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
110704ebd2Sopenharmony_ci@rem See the License for the specific language governing permissions and
120704ebd2Sopenharmony_ci@rem limitations under the License.
130704ebd2Sopenharmony_ci@echo off
140704ebd2Sopenharmony_ci@rem
150704ebd2Sopenharmony_ci@rem  -------------------------------------------------------------------
160704ebd2Sopenharmony_ci@rem  Hvigor startup script for Windows, version 1.0.0
170704ebd2Sopenharmony_ci@rem
180704ebd2Sopenharmony_ci@rem  Required ENV vars:
190704ebd2Sopenharmony_ci@rem  ------------------
200704ebd2Sopenharmony_ci@rem    NODE_HOME - location of a Node home dir
210704ebd2Sopenharmony_ci@rem    or
220704ebd2Sopenharmony_ci@rem    Add %NODE_HOME%/bin to the PATH environment variable
230704ebd2Sopenharmony_ci@rem  -------------------------------------------------------------------
240704ebd2Sopenharmony_ci@rem
250704ebd2Sopenharmony_ci
260704ebd2Sopenharmony_ciset DIRNAME=%~dp0
270704ebd2Sopenharmony_ciset APP_BASE_NAME=%~n0
280704ebd2Sopenharmony_ciset NODE_EXE_PATH=""
290704ebd2Sopenharmony_ciset APP_HOME=.
300704ebd2Sopenharmony_ciset WRAPPER_MODULE_PATH=%APP_HOME%\hvigor\hvigor-wrapper.js
310704ebd2Sopenharmony_ciset NODE_EXE=node.exe
320704ebd2Sopenharmony_ci@rem set NODE_OPTS="--max-old-space-size=4096"
330704ebd2Sopenharmony_ci
340704ebd2Sopenharmony_ci@rem Resolve any "." and ".." in APP_HOME to make it shorter.
350704ebd2Sopenharmony_cifor %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
360704ebd2Sopenharmony_ci
370704ebd2Sopenharmony_ciif not defined NODE_OPTS set NODE_OPTS="--"
380704ebd2Sopenharmony_ci
390704ebd2Sopenharmony_ci@rem Find node.exe
400704ebd2Sopenharmony_ciif defined NODE_HOME (
410704ebd2Sopenharmony_ci    set NODE_HOME=%NODE_HOME:"=%
420704ebd2Sopenharmony_ci    set "PATH=%PATH%;%NODE_HOME%"
430704ebd2Sopenharmony_ci    set NODE_EXE_PATH=%NODE_HOME%/%NODE_EXE%
440704ebd2Sopenharmony_ci)
450704ebd2Sopenharmony_ci
460704ebd2Sopenharmony_ci%NODE_EXE% --version >NUL 2>&1
470704ebd2Sopenharmony_ciif "%ERRORLEVEL%" == "0" (
480704ebd2Sopenharmony_ci    "%NODE_EXE%" "%NODE_OPTS%" "%WRAPPER_MODULE_PATH%" %*
490704ebd2Sopenharmony_ci) else if exist "%NODE_EXE_PATH%" (
500704ebd2Sopenharmony_ci    "%NODE_EXE_PATH%" "%NODE_OPTS%" "%WRAPPER_MODULE_PATH%" %*
510704ebd2Sopenharmony_ci) else (
520704ebd2Sopenharmony_ci    echo.
530704ebd2Sopenharmony_ci    echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH.
540704ebd2Sopenharmony_ci    echo.
550704ebd2Sopenharmony_ci    echo Please set the NODE_HOME variable in your environment to match the
560704ebd2Sopenharmony_ci    echo location of your NodeJs installation.
570704ebd2Sopenharmony_ci)
580704ebd2Sopenharmony_ci
590704ebd2Sopenharmony_ciif "%ERRORLEVEL%" == "0"(
600704ebd2Sopenharmony_ci    if "%OS%" == "Windows_NT" endlocal
610704ebd2Sopenharmony_ci) else (
620704ebd2Sopenharmony_ci    exit /b %ERRORLEVEL%
630704ebd2Sopenharmony_ci)
64