Initial commit for resumeformatter project
This commit is contained in:
48
new_project.sh
Executable file
48
new_project.sh
Executable file
@@ -0,0 +1,48 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Check if APP_NAME parameter is provided
|
||||
if [ -z "$1" ]; then
|
||||
echo "Error: APP_NAME parameter is required"
|
||||
echo "Usage: ./new_project.sh <APP_NAME>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Store the APP_NAME parameter
|
||||
APP_NAME="$1"
|
||||
APP_NAME_LOWER=$(echo "$APP_NAME" | tr '[:upper:]' '[:lower:]')
|
||||
|
||||
echo "Creating new project with name: $APP_NAME"
|
||||
|
||||
# Delete the .git folder
|
||||
echo "Removing Git history..."
|
||||
rm -rf .git
|
||||
|
||||
# Replace all references to NEW_APP_NAME with the provided APP_NAME
|
||||
echo "Replacing NEW_APP_NAME with $APP_NAME in all files..."
|
||||
find . -type f -not -path "*/\.*" -not -path "./node_modules/*" -not -path "./venv/*" -not -name "new_project.sh" -exec grep -l "NEW_APP_NAME" {} \; | xargs -I{} sed -i '' "s/NEW_APP_NAME/$APP_NAME/g" {}
|
||||
|
||||
# Create .env file with APP_NAME
|
||||
echo "Creating .env file..."
|
||||
echo "APP_NAME=$APP_NAME" > .env
|
||||
|
||||
# Initialize a new git repository
|
||||
echo "Initializing new Git repository..."
|
||||
git init
|
||||
git add .
|
||||
git commit -m "Initial commit for $APP_NAME project"
|
||||
|
||||
# Get the current directory name
|
||||
CURRENT_DIR=$(basename "$(pwd)")
|
||||
PARENT_DIR=$(dirname "$(pwd)")
|
||||
|
||||
# Move up one folder and rename the folder to the app name in lowercase
|
||||
echo "Renaming project folder to $APP_NAME_LOWER..."
|
||||
cd ..
|
||||
mv "$CURRENT_DIR" "$APP_NAME_LOWER"
|
||||
|
||||
echo "Project setup complete!"
|
||||
echo "Your new project is available at: $PARENT_DIR/$APP_NAME_LOWER"
|
||||
echo "You can now cd into $APP_NAME_LOWER to start working on your project"
|
||||
|
||||
# The script will delete itself when executed from the new directory
|
||||
# This is handled by the script not including itself in the files to be kept
|
||||
Reference in New Issue
Block a user