create-nuxt-base 2.6.3 → 2.6.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.
@@ -1,37 +1,52 @@
1
1
  #!/usr/bin/env bash
2
- set -e
2
+ # Verify the built Nuxt server boots and stays up, then exit cleanly.
3
+ #
4
+ # Previously this script also streamed logs via a parallel `tail -f` and waited
5
+ # on both PIDs on EXIT. On macOS / bash that pattern hangs intermittently:
6
+ # `tail -f` does not always honor SIGTERM while blocked on the kqueue file
7
+ # watch, so `wait $TAIL_PID` blocks indefinitely and the surrounding
8
+ # `pnpm run check` never returns. We now skip the live stream and print the
9
+ # relevant log excerpt at the end instead.
3
10
 
4
- # Temp file for server output
5
- LOG_FILE=$(mktemp)
11
+ set -e
6
12
 
7
- # Start the built Nuxt server in background, redirect output to log file
8
- # The build step already ran before this script is called
9
- node .output/server/index.mjs > "$LOG_FILE" 2>&1 &
10
- SERVER_PID=$!
13
+ LOG_FILE=$(mktemp -t nuxt-check-server.XXXXXX)
11
14
 
12
- # Show log output in real-time
13
- tail -f "$LOG_FILE" &
14
- TAIL_PID=$!
15
+ cleanup() {
16
+ if [[ -n "${SERVER_PID:-}" ]]; then
17
+ # SIGTERM first, then SIGKILL if still alive after ~2s. We do NOT `wait`
18
+ # on the child — it was the original hang. Nitro can take a moment to
19
+ # unwind its listeners; the escalation gives it that moment.
20
+ kill "$SERVER_PID" 2>/dev/null || true
21
+ for _ in 1 2 3 4; do
22
+ kill -0 "$SERVER_PID" 2>/dev/null || break
23
+ sleep 0.5
24
+ done
25
+ kill -9 "$SERVER_PID" 2>/dev/null || true
26
+ fi
27
+ rm -f "$LOG_FILE"
28
+ }
29
+ trap cleanup EXIT
15
30
 
16
- # Ensure cleanup on exit: kill server, tail, and remove temp file
17
- trap 'kill $SERVER_PID $TAIL_PID 2>/dev/null; wait $SERVER_PID $TAIL_PID 2>/dev/null || true; rm -f "$LOG_FILE"' EXIT
31
+ node .output/server/index.mjs >"$LOG_FILE" 2>&1 &
32
+ SERVER_PID=$!
33
+ # Remove from job table so bash does not print "Terminated: 15" on SIGTERM
34
+ disown "$SERVER_PID" 2>/dev/null || true
18
35
 
19
- # Wait for the Nitro server ready message (max 60 seconds)
20
- for i in $(seq 1 60); do
36
+ for _ in $(seq 1 60); do
21
37
  if grep -q "Listening on\|Nitro ready\|Local:" "$LOG_FILE" 2>/dev/null; then
22
- echo ""
38
+ tail -n 5 "$LOG_FILE"
23
39
  echo "Server started successfully - check complete"
24
40
  exit 0
25
41
  fi
26
- # Check if server process died unexpectedly
27
- if ! kill -0 $SERVER_PID 2>/dev/null; then
28
- echo ""
29
- echo "Server process exited unexpectedly"
42
+ if ! kill -0 "$SERVER_PID" 2>/dev/null; then
43
+ echo "Server process exited unexpectedly. Full log:"
44
+ cat "$LOG_FILE"
30
45
  exit 1
31
46
  fi
32
47
  sleep 1
33
48
  done
34
49
 
35
- echo ""
36
- echo "Server failed to start within 60 seconds"
50
+ echo "Server failed to start within 60 seconds. Last 30 log lines:"
51
+ tail -n 30 "$LOG_FILE"
37
52
  exit 1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-nuxt-base",
3
- "version": "2.6.3",
3
+ "version": "2.6.4",
4
4
  "description": "Starter to generate a configured environment with VueJS, Nuxt, Tailwind, Linting, Unit Tests, Playwright etc.",
5
5
  "license": "MIT",
6
6
  "author": "lenne.Tech GmbH",