create-entity-server 0.3.2 → 0.3.4

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.3.2",
3
+ "version": "0.3.4",
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",
@@ -183,6 +183,19 @@ show_port_in_use_message() {
183
183
  fi
184
184
  }
185
185
 
186
+ show_unmanaged_server_message() {
187
+ local port
188
+ port=$(get_server_value "port" "3400")
189
+
190
+ if [ "$LANGUAGE" = "en" ]; then
191
+ echo "ℹ️ A process is using port $port, but it was not started by this project's pid file."
192
+ echo " For safety, run.sh stop does not kill processes based on port match alone."
193
+ else
194
+ echo "ℹ️ 포트 $port 를 사용하는 프로세스가 있지만, 현재 프로젝트의 pid 파일로 시작한 서버가 아닙니다."
195
+ echo " 안전을 위해 run.sh stop 은 포트 일치만으로 프로세스를 종료하지 않습니다."
196
+ fi
197
+ }
198
+
186
199
  stop_pid_with_confirm() {
187
200
  local pid="$1"
188
201
  local reason="$2"
@@ -245,15 +258,9 @@ stop_pid_with_confirm() {
245
258
 
246
259
  stop_server() {
247
260
  if [ ! -f "$PID_FILE" ]; then
248
- local port_pid
249
- port_pid=$(find_pid_by_port)
250
- if [ -n "$port_pid" ]; then
251
- stop_pid_with_confirm "$port_pid" "port fallback"
252
- return $?
253
- fi
254
261
  if is_port_in_use; then
255
- show_port_in_use_message
256
- return 1
262
+ show_unmanaged_server_message
263
+ return 0
257
264
  fi
258
265
  if [ "$LANGUAGE" = "en" ]; then
259
266
  echo "ℹ️ Server is not running (pid file not found)."
@@ -267,11 +274,9 @@ stop_server() {
267
274
  pid=$(cat "$PID_FILE" 2>/dev/null)
268
275
  if [ -z "$pid" ]; then
269
276
  rm -f "$PID_FILE"
270
- local port_pid
271
- port_pid=$(find_pid_by_port)
272
- if [ -n "$port_pid" ]; then
273
- stop_pid_with_confirm "$port_pid" "port fallback"
274
- return $?
277
+ if is_port_in_use; then
278
+ show_unmanaged_server_message
279
+ return 0
275
280
  fi
276
281
  if [ "$LANGUAGE" = "en" ]; then
277
282
  echo "ℹ️ Empty pid file removed."
@@ -283,15 +288,9 @@ stop_server() {
283
288
 
284
289
  if ! kill -0 "$pid" 2>/dev/null; then
285
290
  rm -f "$PID_FILE"
286
- local port_pid
287
- port_pid=$(find_pid_by_port)
288
- if [ -n "$port_pid" ]; then
289
- stop_pid_with_confirm "$port_pid" "port fallback"
290
- return $?
291
- fi
292
291
  if is_port_in_use; then
293
- show_port_in_use_message
294
- return 1
292
+ show_unmanaged_server_message
293
+ return 0
295
294
  fi
296
295
  if [ "$LANGUAGE" = "en" ]; then
297
296
  echo "ℹ️ Stale pid file removed (process not found)."
@@ -163,6 +163,18 @@ function Install-Version([string]$TargetVer) {
163
163
  Write-Host " 서버를 재시작하면 새 버전이 적용됩니다."
164
164
  }
165
165
 
166
+ function Sync-ScriptsDir([string]$Src, [string]$Dest) {
167
+ if (Test-Path $Dest) {
168
+ Remove-Item -Recurse -Force $Dest
169
+ }
170
+ New-Item -ItemType Directory -Path $Dest | Out-Null
171
+
172
+ $Scripts = Get-ChildItem -Path $Src -Filter *.ps1 -File -ErrorAction SilentlyContinue
173
+ foreach ($Script in $Scripts) {
174
+ Copy-Item -Force $Script.FullName (Join-Path $Dest $Script.Name)
175
+ }
176
+ }
177
+
166
178
  # ── dist 파일 업데이트 (scripts / samples) ──────────────────────────────────
167
179
 
168
180
  function Install-Dist([string]$TargetVer) {
@@ -227,10 +239,14 @@ function Install-Dist([string]$TargetVer) {
227
239
  $Src = Join-Path $SrcRoot $Dir
228
240
  $Dest = Join-Path $ProjectRoot $Dir
229
241
  if (Test-Path $Src) {
230
- if (Test-Path $Dest) {
231
- Remove-Item -Recurse -Force $Dest
242
+ if ($Dir -eq "scripts") {
243
+ Sync-ScriptsDir $Src $Dest
244
+ } else {
245
+ if (Test-Path $Dest) {
246
+ Remove-Item -Recurse -Force $Dest
247
+ }
248
+ Copy-Item -Recurse -Force $Src $Dest
232
249
  }
233
- Copy-Item -Recurse -Force $Src $Dest
234
250
  Write-Host (" ✔ {0,-20}" -f ("$Dir/"))
235
251
  } else {
236
252
  Write-Host (" – {0,-20} (릴리스에 없음, 스킵)" -f ("$Dir/"))
@@ -194,6 +194,26 @@ _download_plain() {
194
194
  mv "$tmp" "$dest"
195
195
  }
196
196
 
197
+ _sync_scripts_dir() {
198
+ local src="$1"
199
+ local dest="$2"
200
+
201
+ rm -rf "$dest"
202
+ mkdir -p "$dest"
203
+
204
+ local copied=0
205
+ for script in "$src"/*.sh; do
206
+ [ -f "$script" ] || continue
207
+ cp "$script" "$dest/"
208
+ chmod +x "$dest/$(basename "$script")"
209
+ copied=1
210
+ done
211
+
212
+ if [ "$copied" -eq 0 ]; then
213
+ rmdir "$dest" 2>/dev/null || true
214
+ fi
215
+ }
216
+
197
217
  _install() {
198
218
  local target_ver="${1#v}" # v 접두사 제거
199
219
  local current_ver
@@ -287,8 +307,12 @@ _install_dist() {
287
307
  local src="${src_root}/${DIR}"
288
308
  local dest="${PROJECT_ROOT}/${DIR}"
289
309
  if [ -d "$src" ]; then
290
- rm -rf "$dest"
291
- cp -r "$src" "$dest"
310
+ if [ "$DIR" = "scripts" ]; then
311
+ _sync_scripts_dir "$src" "$dest"
312
+ else
313
+ rm -rf "$dest"
314
+ cp -r "$src" "$dest"
315
+ fi
292
316
  printf " ✔ %-20s\n" "${DIR}/"
293
317
  else
294
318
  printf " – %-20s (릴리스에 없음, 스킵)\n" "${DIR}/"