[feature](webapp) add script command to accommodate different Node.js versions and change lerna + npm to pnpm workspaces (#61)

This commit is contained in:
williamhliu
2023-09-07 21:29:13 +08:00
committed by GitHub
parent 898108d7e1
commit 90f6a20516
26 changed files with 332 additions and 149 deletions

View File

@@ -1,13 +1,45 @@
@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
)
:: 检查pnpm是否未安装
where /q pnpm
if errorlevel 1 (
echo pnpm未安装正在进行安装...
npm install -g pnpm
if errorlevel 1 (
echo pnpm安装失败请检查npm是否已安装并且网络连接正常
) else (
echo pnpm安装成功
)
) else (
echo pnpm已安装
)
rmdir /s /q ".\packages\supersonic-fe\src\.umi"
rmdir /s /q ".\packages\supersonic-fe\src\.umi-production"
call npm i
cd ./packages/chat-sdk
call npx lerna add supersonic-chat-sdk --scope supersonic-fe
call pnpm i
call npx lerna bootstrap
call pnpm run build
call npx lerna exec --scope supersonic-chat-sdk npm run build
call pnpm link --global
call npx lerna exec --scope supersonic-fe npm start
cd ../supersonic-fe
call pnpm link ../chat-sdk
call pnpm i
call pnpm start