(improvement)(script) optimize bat script encoding (#168)

* (improvement)(script) optimize bat script encoding

---------

Co-authored-by: jolunoluo
This commit is contained in:
LXW
2023-10-07 12:00:33 +08:00
committed by GitHub
parent 1e1803d148
commit 3d6878fe9f
3 changed files with 35 additions and 51 deletions

View File

@@ -1,28 +1,24 @@
@echo off
:: 获取Node.js版本
for /f "delims=" %%i in ('node -v') do set "node_version=%%i"
:: 提取主版本号
for /f "tokens=2 delims=v." %%i in ("%node_version%") do set "major_version=%%i"
if %major_version% GEQ 17 (
set "NODE_OPTIONS=--openssl-legacy-provider"
echo Node.js版本大于等于17已设置NODE_OPTIONS为--openssl-legacy-provider
echo Node.js version is greater than or equal to 17. NODE_OPTIONS has been set to --openssl-legacy-provider.
)
:: 检查pnpm是否未安装
where /q pnpm
if errorlevel 1 (
echo pnpm未安装,正在进行安装...
echo pnpm is not installed. Installing...
npm install -g pnpm
if errorlevel 1 (
echo pnpm安装失败请检查npm是否已安装并且网络连接正常
echo Failed to install pnpm. Please check if npm is installed and the network connection is working.
) else (
echo pnpm安装成功
echo pnpm installed successfully.
)
) else (
echo pnpm已安装
echo pnpm is already installed.
)
rmdir /s /q ".\packages\supersonic-fe\src\.umi"

View File

@@ -1,58 +1,34 @@
setlocal
@echo off
:: 获取Node.js版本
for /f "delims=" %%i in ('node -v') do set "node_version=%%i"
:: 提取主版本号
for /f "tokens=2 delims=v." %%i in ("%node_version%") do set "major_version=%%i"
if %major_version% GEQ 17 (
set "NODE_OPTIONS=--openssl-legacy-provider"
echo Node.js版本大于等于17已设置NODE_OPTIONS为--openssl-legacy-provider
echo Node.js version is greater than or equal to 17. NODE_OPTIONS has been set to --openssl-legacy-provider.
)
:: 检查pnpm是否未安装
where /q pnpm
if errorlevel 1 (
echo pnpm未安装,正在进行安装...
echo pnpm is not installed. Installing...
npm install -g pnpm
if errorlevel 1 (
echo pnpm安装失败请检查npm是否已安装并且网络连接正常
echo Failed to install pnpm. Please check if npm is installed and the network connection is working.
) else (
echo pnpm安装成功
echo pnpm installed successfully.
)
) else (
echo pnpm已安装
echo pnpm is already installed.
)
del /F /Q supersonic-webapp.tar.gz
rmdir /S /Q .\packages\supersonic-fe\src\.umi
rmdir /S /Q .\packages\supersonic-fe\src\.umi-production
cd ./packages/chat-sdk
call pnpm i
call pnpm run build
call pnpm link --global
cd ../supersonic-fe
call pnpm link ../chat-sdk
call pnpm i
call pnpm run build:os-local
tar -zcvf supersonic-webapp.tar.gz supersonic-webapp
move supersonic-webapp.tar.gz ..\..\
cd ..
endlocal