-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-and-deploy.bat
More file actions
47 lines (39 loc) · 1.06 KB
/
Copy pathbuild-and-deploy.bat
File metadata and controls
47 lines (39 loc) · 1.06 KB
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
@echo off
cd /d "%~dp0"
echo === Installing dependencies ...
call npm install
if %errorlevel% neq 0 (
echo npm install failed
pause
exit /b 1
)
echo === Building ...
call npm run build
if %errorlevel% neq 0 (
echo Build failed
pause
exit /b 1
)
echo Build OK
echo === Finding global npm location ...
for /f "delims=" %%i in ('npm root -g') do set GLOBAL_NM=%%i
set TARGET=%GLOBAL_NM%\@grinev\opencode-telegram-bot\dist
if not exist "%TARGET%" (
echo Package not found globally. Installing from local build ...
call npm install -g .
if %errorlevel% neq 0 (
echo Global install failed. Make sure you have npm permissions.
pause
exit /b 1
)
)
echo === Copying dist to %TARGET% ...
xcopy /E /Y dist "%TARGET%" >nul
echo Done.
echo === Stopping old bot ...
wmic process where "name='node.exe' and commandline like '%%opencode-telegram%%'" delete 2>nul
timeout /t 2 /nobreak >nul
echo === Starting bot ...
start "opencode-telegram" cmd /c "opencode-telegram start --mode installed"
echo Bot started in new window.
pause