deploy:各平台脚本制作

This commit is contained in:
fleyx 2025-04-01 21:22:48 +08:00
parent d0b90a4cc8
commit f2a63a35ae
15 changed files with 152 additions and 26 deletions

View File

@ -0,0 +1,63 @@
#!/bin/bash
script_abs=$(readlink -f "$0")
script_dir=$(dirname "${script_abs}")
# shellcheck disable=SC2164
cd "$script_dir"/../../openRenamerFront
npm run build
cp -r dist/* ../openRenamerBackend/static
# shellcheck disable=SC2164
cd ../openRenamerBackend
# mac-arm-arm打包
npm run pkg-mac-arm
# 打zip包
# shellcheck disable=SC2164
cd ./desktop/mac-arm
zip renamer-mac-arm-desktop.zip renamer-mac mac-start.command
echo mac-arm over
# 解压后首次运行会因为mac安全检查导致无法启动解决步骤如下
# 1. 双击renamer-mac启动应用
# 2. 此时会弹窗未打开“renamer-mac-arm" Apple无法验证。。。。。。 点击完成按钮关闭告警
# 3. 然后进入设置-隐私与安全性-安全性 点击仍要打开 弹窗选择仍要打开 完成设置
# 4. 双击mac-start.command启动脚本此脚本会自动打开浏览器页面
# 5. 重复2-3步骤
# mac-arm-x64打包
cd ../../
npm run pkg-mac-x64
# 打zip包
# shellcheck disable=SC2164
cd ./desktop/mac-x64
zip renamer-mac-x64-desktop.zip renamer-mac mac-start.command
echo mac-x64 over
# windows-x64打包
cd ../../
npm run pkg-win-x64
# 打zip包
# shellcheck disable=SC2164
cd ./desktop/win-x64
zip renamer-win-x64-desktop.zip renamer-win.exe win-start.bat node_sqlite3.node
echo win-x64 over
# linux-x64打包
cd ../../
npm run pkg-linux-x64
# 打zip包
# shellcheck disable=SC2164
cd ./desktop/linux-x64
zip renamer-linux-x64-desktop.zip renamer-linux linux-start.sh node_sqlite3.node
echo linux-x64 over
# linux-arm打包
cd ../../
npm run pkg-linux-arm
# 打zip包
# shellcheck disable=SC2164
cd ./desktop/linux-arm
zip renamer-linux-arm-desktop.zip renamer-linux linux-start.sh node_sqlite3.node
echo linux-arm over

View File

@ -0,0 +1,16 @@
#!/bin/bash
script_abs=$(readlink -f "$0")
script_dir=$(dirname "${script_abs}")
echo 当前目录:"$script_dir"
# 删除历史port文件
rm "$script_dir"/data/port
# 启动应用
"$script_dir"/renamer-linux env:desktop &
# 循环等待启动成功
while [ ! -f "$script_dir"/data/port ]; do
echo 等待程序启动
sleep 1
done
port=$(cat "$script_dir"/data/port)
echo $port
open 'http://localhost:'"$port"

Binary file not shown.

View File

@ -0,0 +1,16 @@
#!/bin/bash
script_abs=$(readlink -f "$0")
script_dir=$(dirname "${script_abs}")
echo 当前目录:"$script_dir"
# 删除历史port文件
rm "$script_dir"/data/port
# 启动应用
"$script_dir"/renamer-linux env:desktop &
# 循环等待启动成功
while [ ! -f "$script_dir"/data/port ]; do
echo 等待程序启动
sleep 1
done
port=$(cat "$script_dir"/data/port)
echo $port
open 'http://localhost:'"$port"

Binary file not shown.

View File

@ -5,7 +5,7 @@ echo 当前目录:"$script_dir"
# 删除历史port文件
rm "$script_dir"/data/port
# 启动应用
"$script_dir"/macapp env:desktop &
"$script_dir"/renamer-mac env:desktop &
# 循环等待启动成功
while [ ! -f "$script_dir"/data/port ]; do
echo 等待程序启动

Binary file not shown.

View File

@ -0,0 +1,16 @@
#!/bin/bash
script_abs=$(readlink -f "$0")
script_dir=$(dirname "${script_abs}")
echo 当前目录:"$script_dir"
# 删除历史port文件
rm "$script_dir"/data/port
# 启动应用
"$script_dir"/renamer-mac env:desktop &
# 循环等待启动成功
while [ ! -f "$script_dir"/data/port ]; do
echo 等待程序启动
sleep 1
done
port=$(cat "$script_dir"/data/port)
echo $port
open 'http://localhost:'"$port"

Binary file not shown.

View File

@ -1,22 +0,0 @@
#!/bin/bash
script_abs=$(readlink -f "$0")
script_dir=$(dirname "${script_abs}")
# shellcheck disable=SC2164
cd "$script_dir"/../../../openRenamerFront
npm run build
cp -r dist/* ../openRenamerBackend/static
# shellcheck disable=SC2164
cd ../openRenamerBackend
npm run pkg-mac
# 打zip包
# shellcheck disable=SC2164
cd ./desktop/mac
zip renamer-mac-desktop.zip renamer-mac mac-start.command
# 解压后首次运行会因为mac安全检查导致无法启动解决步骤如下
# 1. 双击renamer-mac启动应用
# 2. 此时会弹窗未打开“renamer-mac" Apple无法验证。。。。。。 点击完成按钮关闭告警
# 3. 然后进入设置-隐私与安全性-安全性 点击仍要打开 弹窗选择仍要打开 完成设置
# 4. 双击mac-start.command启动脚本此脚本会自动打开浏览器页面
# 5. 重复2-3步骤

Binary file not shown.

View File

@ -0,0 +1,28 @@
@echo off
setlocal
REM get bat path
set "script_dir=%~dp0"
echo current path:"%script_dir%"
REM delete port file
if exist "%script_dir%data\port" del "%script_dir%data\port"
REM start app
start "" /B "%script_dir%renamer-win.exe" env:desktop
REM wait app start
:wait_for_port
if not exist "%script_dir%data\port" (
echo wait app start
timeout /t 1 >nul
goto wait_for_port
)
REM open browser
set /p port=<"%script_dir%data\port"
echo %port%
start "" "http://localhost:%port%"
exit
endlocal

View File

@ -4,7 +4,11 @@
"description": "文件备份用",
"main": "index.js",
"scripts": {
"pkg-mac": "tsc && pkg . -t macos -o desktop/mac/renamer-mac"
"pkg-mac-arm": "tsc && pkg . -t macos-arm64 -o desktop/mac-arm/renamer-mac",
"pkg-mac-x64": "tsc && pkg . -t macos-x64 -o desktop/mac-x64/renamer-mac",
"pkg-win-x64": "tsc && pkg . -t win-x64 -o desktop/win-x64/renamer-win",
"pkg-linux-arm": "tsc && pkg . -t linux-arm64 -o desktop/linux-arm/renamer-linux",
"pkg-linux-x64": "tsc && pkg . -t linux-x64 -o desktop/linux-x64/renamer-linux"
},
"bin": "dist/index.js",
"pkg": {

View File

@ -20,7 +20,7 @@ export function checkFree(port: number): boolean {
if (platform.includes("win32")) {
} else if (platform.includes('darwin')) {
//mac
//mac-arm
stdout = execSync(`lsof -i:${port}`)
} else {
//Linux

View File

@ -1,6 +1,7 @@
import * as childPrecess from 'child_process';
import logUtil from "./LogUtil";
import logger from "./LogUtil";
import config from "../config";
class ProcessHelper {
static exec(cmd): Promise<string> {
@ -20,7 +21,11 @@ class ProcessHelper {
static kill(pid: number): void {
try {
childPrecess.execSync("kill " + pid)
if(config.isWindows){
childPrecess.execSync("taskkill /pid " + pid)
}else{
childPrecess.execSync("kill " + pid)
}
} catch (e) {
logger.info("进程kill报错:" + (e as Error).message);
}