create-entity-server 0.2.8 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-entity-server",
3
- "version": "0.2.8",
3
+ "version": "0.3.1",
4
4
  "description": "Create a new entity-server project in one command — like create-react-app or create-vite.",
5
5
  "keywords": [
6
6
  "entity-server",
@@ -1,3 +1,6 @@
1
+ # 서버 포트 (configs/server.json의 port를 오버라이드)
2
+ # SERVER_PORT=47200
3
+
1
4
  # Entity Server 환경변수 설정 예시
2
5
  # 실제 사용시 이 파일을 .env로 복사하고 값을 변경하세요: cp .env.example .env
3
6
  # ./scripts/generate-env-keys.sh 를 사용하여 랜덤 시크릿을 생성할 수 있습니다.
@@ -15,9 +18,6 @@ JWT_SECRET=your-jwt-secret-here
15
18
  # 비워두면 암호화 비활성화. 설정 시 충분한 길이의 랜덤 문자열 권장.
16
19
  # BACKUP_ENCRYPT_KEY=your-backup-encryption-key-here
17
20
 
18
- # 서버 포트 (configs/server.json의 port를 오버라이드)
19
- SERVER_PORT=47200
20
-
21
21
  # Database values (database.json의 ${ENV_VAR}와 매핑)
22
22
  DB_HOST_DEVELOPMENT=127.0.0.1
23
23
  DB_PORT_DEVELOPMENT=3306
@@ -337,38 +337,38 @@ if [ $# -eq 0 ]; then
337
337
  echo "Entity Server - Run Script"
338
338
  echo "=========================="
339
339
  echo ""
340
- echo "Adjust configs/server.json environment as needed, then start the compiled server binary."
340
+ echo "Uses the current configs/server.json as-is and starts the compiled server binary."
341
341
  echo ""
342
342
  echo "Usage: $0 <mode>"
343
343
  echo ""
344
344
  echo "Modes:"
345
345
  echo " dev environment=development, keep database.default, then run binary"
346
- echo " start environment=production, use database.default=production only in production, then run in background"
346
+ echo " start run current config in background without modifying configs"
347
347
  echo " stop stop background server started by this script"
348
348
  echo " status show server status"
349
349
  echo ""
350
350
  echo "Examples:"
351
351
  echo " $0 dev # Start in development mode"
352
- echo " $0 start # Start in production mode (background)"
352
+ echo " $0 start # Start current config in background"
353
353
  echo " $0 stop # Stop server"
354
354
  echo " $0 status # Show status"
355
355
  else
356
356
  echo "Entity Server - 실행 스크립트"
357
357
  echo "==========================="
358
358
  echo ""
359
- echo "configs/server.json environment를 기준으로 필요한 경우에만 database.default를 조정한 뒤 바이너리를 실행합니다."
359
+ echo "현재 configs/server.json 설정을 그대로 사용해서 바이너리를 실행합니다."
360
360
  echo ""
361
361
  echo "사용법: $0 <모드>"
362
362
  echo ""
363
363
  echo "모드:"
364
364
  echo " dev environment=development로 설정하고 database.default는 유지한 채 바이너리 실행"
365
- echo " start environment=production으로 설정하고 production일 때만 database.default=production으로 맞춘 백그라운드 실행"
365
+ echo " start 설정파일을 수정하지 않고 현재 설정 그대로 백그라운드 실행"
366
366
  echo " stop run.sh로 백그라운드 실행한 서버 중지"
367
367
  echo " status 서버 상태 조회"
368
368
  echo ""
369
369
  echo "예제:"
370
370
  echo " $0 dev # 개발 모드로 시작"
371
- echo " $0 start # 프로덕션 모드로 시작(백그라운드)"
371
+ echo " $0 start # 현재 설정 그대로 시작(백그라운드)"
372
372
  echo " $0 stop # 서버 중지"
373
373
  echo " $0 status # 상태 조회"
374
374
  fi
@@ -442,9 +442,6 @@ case "$MODE" in
442
442
  exit 1
443
443
  fi
444
444
 
445
- sed -E -i 's/("environment"[[:space:]]*:[[:space:]]*")[^"]+(")/\1production\2/' "$SERVER_CONFIG"
446
- sync_database_default_for_environment "$LINENO" || exit 1
447
-
448
445
  "$SERVER_BIN" banner
449
446
  nohup "$SERVER_BIN" >> "$STDOUT_LOG" 2>&1 &
450
447
  SERVER_PID=$!
@@ -160,6 +160,23 @@ _download() {
160
160
  chmod +x "$dest"
161
161
  }
162
162
 
163
+ _download_plain() {
164
+ local url="$1"
165
+ local dest="$2"
166
+ local tmp="${dest}.tmp"
167
+
168
+ if command -v curl >/dev/null 2>&1; then
169
+ curl -fsSL --retry 3 -o "$tmp" "$url"
170
+ elif command -v wget >/dev/null 2>&1; then
171
+ wget -q -O "$tmp" "$url"
172
+ else
173
+ echo "❌ curl 또는 wget 이 필요합니다."
174
+ exit 1
175
+ fi
176
+
177
+ mv "$tmp" "$dest"
178
+ }
179
+
163
180
  _install() {
164
181
  local target_ver="${1#v}" # v 접두사 제거
165
182
  local current_ver
@@ -203,17 +220,26 @@ _install_dist() {
203
220
  local target_ver="$1"
204
221
  local file="dist.tar.gz"
205
222
  local url="https://github.com/${REPO}/releases/download/v${target_ver}/${file}"
223
+ local fallback_url="https://github.com/${REPO}/archive/refs/tags/v${target_ver}.tar.gz"
206
224
  local tmp_tar="/tmp/entity-server-dist-${target_ver}.tar.gz"
207
225
  local tmp_dir="/tmp/entity-server-dist-${target_ver}"
226
+ local downloaded_from="release asset"
208
227
 
209
228
  printf " ↓ %-32s" "$file"
210
229
  if ! _download "$url" "$tmp_tar" 2>/dev/null; then
211
- echo " 실패 (업데이트 스킵)"
212
- echo " URL: $url"
213
- echo " ⚠️ dist.tar.gz 가 릴리스에 없익니다. 바이너리만 업데이트됨."
214
- return 0
230
+ if _download_plain "$fallback_url" "$tmp_tar" 2>/dev/null; then
231
+ downloaded_from="repository tag archive"
232
+ echo " (fallback)"
233
+ else
234
+ echo "✗ 실패 (업데이트 스킵)"
235
+ echo " release asset: $url"
236
+ echo " fallback tag archive: $fallback_url"
237
+ echo " ⚠️ dist 패키지를 가져오지 못했습니다. 바이너리만 업데이트됨."
238
+ return 0
239
+ fi
240
+ else
241
+ echo "✓"
215
242
  fi
216
- echo "✓"
217
243
 
218
244
  rm -rf "$tmp_dir"
219
245
  mkdir -p "$tmp_dir"
@@ -238,6 +264,7 @@ _install_dist() {
238
264
  fi
239
265
 
240
266
  echo ""
267
+ echo " dist 소스: $downloaded_from"
241
268
  echo " 파일 동기화 (configs/ entities/ 제외):"
242
269
  for DIR in "${DIST_DIRS[@]}"; do
243
270
  local src="${src_root}/${DIR}"