Update 2026-06-23 10:40:10
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* IDC设备管理系统 - 一键更新脚本
|
||||
* 云睿资产管理系统 - 一键更新脚本
|
||||
* 功能:拉取最新代码 → 安装依赖 → 数据库迁移 → 重建前端 → 重启服务 → 健康检查
|
||||
* 版本:2.0.0
|
||||
*/
|
||||
@@ -71,7 +71,7 @@ function parseArgs() {
|
||||
|
||||
function showHelp() {
|
||||
console.log(`
|
||||
${colors.bright}IDC设备管理系统 - 一键更新脚本 v${SCRIPT_VERSION}${colors.reset}
|
||||
${colors.bright}云睿资产管理系统 - 一键更新脚本 v${SCRIPT_VERSION}${colors.reset}
|
||||
|
||||
${colors.bright}用法:${colors.reset} node update.js [选项]
|
||||
|
||||
@@ -194,7 +194,7 @@ function findBackendServiceName() {
|
||||
}
|
||||
|
||||
for (const proc of processes) {
|
||||
if (proc.name === 'server' || proc.name === 'idc-backend' || proc.name === 'backend') {
|
||||
if (proc.name === 'server' || proc.name === 'yunrui_asset-backend' || proc.name === 'backend') {
|
||||
return proc.name;
|
||||
}
|
||||
}
|
||||
@@ -219,7 +219,7 @@ function findFrontendServiceName() {
|
||||
|
||||
if (script.includes('vite') || scriptPath.includes('vite') ||
|
||||
script.includes('react') || script.includes('nginx') ||
|
||||
proc.name === 'frontend' || proc.name === 'idc-frontend') {
|
||||
proc.name === 'frontend' || proc.name === 'yunrui_asset-frontend') {
|
||||
return proc.name;
|
||||
}
|
||||
}
|
||||
@@ -247,7 +247,7 @@ function backupDatabase(options) {
|
||||
const dbType = dbTypeMatch ? dbTypeMatch[1].toLowerCase() : 'sqlite';
|
||||
|
||||
if (dbType === 'sqlite') {
|
||||
const dbPath = path.join(__dirname, 'backend', 'idc_management.db');
|
||||
const dbPath = path.join(__dirname, 'backend', 'yunrui_management.db');
|
||||
if (!fs.existsSync(dbPath)) {
|
||||
log.warning('SQLite 数据库文件不存在,跳过备份');
|
||||
return { success: true, skipped: true };
|
||||
@@ -576,7 +576,7 @@ function syncFrontendToNginx(options) {
|
||||
if (isBtPanel) {
|
||||
nginxRoot = '/www/wwwroot/idc';
|
||||
} else {
|
||||
nginxRoot = '/var/www/idc';
|
||||
nginxRoot = '/var/www/yunrui_asset';
|
||||
}
|
||||
log.info(`未配置 nginxRoot,自动检测: ${nginxRoot} (${isBtPanel ? '宝塔' : '标准'})`);
|
||||
}
|
||||
@@ -819,7 +819,7 @@ function rollback(reason) {
|
||||
log.step('执行回滚...');
|
||||
|
||||
if (rollbackInfo.backupDbPath && fs.existsSync(rollbackInfo.backupDbPath)) {
|
||||
const dbPath = path.join(__dirname, 'backend', 'idc_management.db');
|
||||
const dbPath = path.join(__dirname, 'backend', 'yunrui_management.db');
|
||||
fs.copyFileSync(rollbackInfo.backupDbPath, dbPath);
|
||||
log.success('数据库已回滚');
|
||||
}
|
||||
@@ -897,7 +897,7 @@ async function main() {
|
||||
initLogFile(LOG_DIR);
|
||||
|
||||
log.banner(
|
||||
'IDC 设备管理系统',
|
||||
'云睿资产管理系统',
|
||||
'一键更新脚本',
|
||||
SCRIPT_VERSION
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user