#!/bin/bash

# 1. Define the target directory path
# Replace './my-project' with your actual path
TARGET_DIR="./nextjs"

# 2. Execute npm install in the background
# --prefix: Tells npm where the package.json is located
# --quiet: Suppresses progress bars (shows only warnings/errors)
# > install.log 2>&1: Redirects all output to a log file
# &: Sends the process to the background
npm install --quiet --prefix "$TARGET_DIR" > install.log 2>&1 &

# 3. Capture and display the Process ID (PID)
echo "npm install started in the background for $TARGET_DIR"
echo "Process ID: $!"
echo "Check progress with: tail -f install.log"