Last active
October 14, 2024 10:57
-
-
Save malerba118/4ce65a816fed837946c563b8511cc2c0 to your computer and use it in GitHub Desktop.
create sandbox
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
new-sandbox() { | |
# If no argument is provided, prompt the user for an app name | |
if [ -z "$1" ]; then | |
echo -n "Enter the app name (or press Enter to use timestamp): " | |
read appname | |
# Use current time as the fallback if the user doesn't input a name | |
appname=${appname:-$(date +%B-%d-%Y-%I%M%p | tr '[:upper:]' '[:lower:]')} | |
else | |
# Set the app name to the first argument | |
appname="$1" | |
fi | |
# Ensure the sandboxes directory exists | |
mkdir -p ~/sandboxes | |
# Navigate to the sandboxes directory | |
cd ~/sandboxes || exit | |
# Create a new React app with Vite | |
npm create vite@latest "$appname" | |
# Change into the new app directory | |
cd "$appname" || exit | |
# Run npm install to install dependencies | |
npm install | |
# Open the project in cursor | |
cursor . | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment