@mostajs/orm-cli 0.5.6 → 0.5.7

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.
Files changed (2) hide show
  1. package/bin/mostajs.sh +20 -3
  2. package/package.json +1 -1
package/bin/mostajs.sh CHANGED
@@ -2203,10 +2203,27 @@ action_rep_open_monitor() {
2203
2203
  local log_file="$PROJECT_ROOT/.mostajs/monitor.log"
2204
2204
  local pid_file="$PROJECT_ROOT/.mostajs/monitor.pid"
2205
2205
 
2206
- # If already running (pid file exists + process alive) : just open the URL.
2206
+ # If already running : propose to restart (pick up tree changes with
2207
+ # the new tree-only CLI). A stale instance from before 0.2.0 sees an
2208
+ # empty state even when the tree has replicas.
2207
2209
  if [[ -f "$pid_file" ]] && kill -0 "$(cat "$pid_file" 2>/dev/null)" 2>/dev/null; then
2208
- ok "Monitor already running at http://127.0.0.1:${port}"
2209
- else
2210
+ local old_pid
2211
+ old_pid=$(cat "$pid_file")
2212
+ dim " Monitor already running (pid=$old_pid) at http://127.0.0.1:${port}"
2213
+ if confirm "Restart it now? (picks up recent tree-file changes)"; then
2214
+ kill "$old_pid" 2>/dev/null || true
2215
+ sleep 0.5
2216
+ rm -f "$pid_file"
2217
+ else
2218
+ ok " Kept running — re-opening the URL"
2219
+ if command -v xdg-open >/dev/null 2>&1; then
2220
+ xdg-open "http://127.0.0.1:${port}${url_suffix}" >/dev/null 2>&1 &
2221
+ fi
2222
+ pause; return
2223
+ fi
2224
+ fi
2225
+
2226
+ if [[ ! -f "$pid_file" ]]; then
2210
2227
  # Spawn in background
2211
2228
  echo -e " ${DIM}spawning mostajs-monitor …${RESET}"
2212
2229
  MONITOR_TREE="$tree_file" MONITOR_PORT="$port" MONITOR_TOKEN="$token" \
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mostajs/orm-cli",
3
- "version": "0.5.6",
3
+ "version": "0.5.7",
4
4
  "description": "Universal CLI to integrate @mostajs/orm into any project — one-shot `mostajs bootstrap` migrates a Prisma project (codemod + deps + schema convert + DDL) to 13 databases with zero code change.",
5
5
  "author": "Dr Hamid MADANI <drmdh@msn.com>",
6
6
  "license": "AGPL-3.0-or-later",