버전 관리 시스템 안정화: 업데이트 스크립트 실행력 강화 및 윈도우 호환성 개선

This commit is contained in:
choibk 2026-01-25 02:04:44 +09:00
parent 5e740a39a9
commit 254cc34daf
2 changed files with 7 additions and 5 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "smartims",
"version": "0.1.0",
"version": "0.4.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "smartims",
"version": "0.1.0",
"version": "0.4.0.0",
"dependencies": {
"@dnd-kit/core": "^6.3.1",
"@dnd-kit/sortable": "^10.0.0",

View File

@ -590,10 +590,12 @@ router.post('/version/update', isAuthenticated, hasRole('admin'), async (req, re
authPrefix = `git remote set-url origin ${auth.url} && `;
}
const updateScript = `${authPrefix} git fetch --tags --force && git checkout -f ${targetTag} && npm install && npm run build && cd server && npm install && pm2 reload smartims-api`;
// Build a more robust update script
// On dev environments, pm2 might fail, so we make it optional (|| echo)
const updateScript = isWindows
? `${authPrefix} git fetch --tags --force && git checkout -f ${targetTag} && npm install && npm run build`
: `${authPrefix} git fetch --tags --force && git checkout -f ${targetTag} && npm install && npm run build && cd server && npm install && pm2 reload smartims-api || echo "PM2 not found, skipping reload"`;
// Note: On Windows, use cmd.exe /c which supports '&&' better than default PowerShell
const isWindows = process.platform === 'win32';
const shellCommand = isWindows ? `cmd.exe /c "${updateScript}"` : updateScript;
console.log(`🚀 Starting system update to ${targetTag}...`);