Skip to content

Instantly share code, notes, and snippets.

@a-partovii
Created April 22, 2026 19:25
Show Gist options
  • Select an option

  • Save a-partovii/f4cbbef09db95bd8f4e93c849a54d359 to your computer and use it in GitHub Desktop.

Select an option

Save a-partovii/f4cbbef09db95bd8f4e93c849a54d359 to your computer and use it in GitHub Desktop.
RUN-DEV Script

I have two simple bash scripts on Windows and Linux or mac that I want to share here,
this scripts actually run the npm run dev command on click and will help on dev phase.

💡 Tips:

  1. Ensure the script is placed in the root directory of your project.
  2. Keep the terminal window open until you have finished working. Closing it will stop the server.
  3. On Linux/macOS, make the script executable using the following command:
chmod +x script-name.sh

Also you can replace other commands or maybe add multiple commands on this template, have fun!

@echo off
title Run Dev Server
color 0A
REM # Get the directory of where this script is located
set "SCRIPT_DIR=%~dp0"
REM # Change current directory to the script's location
cd /d "%SCRIPT_DIR%"
echo ----------------------------------
echo Current Path: %CD%
echo Running command: npm run dev
echo ~
echo To run this command, make sure you are in the correct development path
echo and keep the terminal open until you want to finish.
echo ----------------------------------
REM # Execute the command
call npm run dev
pause
#!/bin/bash
# Get the directory of where this script is located
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
# Change current directory to the script's location
cd "$SCRIPT_DIR" || { echo "Error: Cannot access directory $SCRIPT_DIR"; exit 1; }
echo "----------------------------------------"
echo "Current Path: $SCRIPT_DIR"
echo "Running command: npm run dev"
echo "×"
echo "To run this command, make sure you are in the correct development path"
echo "and keep the terminal open until you want to finish."
echo "----------------------------------------"
echo "Press 'Ctrl + C' to stop the server."
echo "----------------------------------------"
# Execute the command
npm run dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment