Skip to content

callmeBron/project-creation-macos-script

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ Project Creator Script

A simple bash script to quickly create new project directories from a template folder on macOS.

Table of Contents

Features

  • πŸš€ Quickly scaffold new projects from a base template
  • βœ… Validates input and checks for existing directories
  • 🎨 Color-coded terminal output (because pretty terminals make us happy)
  • πŸ”’ Safe operation with confirmation prompts (no accidental overwrites!)
  • πŸ“ Easy to customize and extend
  • 🎯 Interactive prompts ... just run and answer questions!

Installation

  1. Download or copy the entire folder containing:

    • create-project.sh (the script)
    • vscode-cpp-template/ (your template folder with all base files)
    • README.md (this documentation)
  2. Make the script executable (required):

    chmod +x create-project.sh

    ⚠️ Important: If you skip this step, you'll get a "permission denied" error!

    and then run the command

    ./create-project.sh
  3. (Optional) Move to a directory in your PATH for global access:

    # Note: You'll need to keep the template folder accessible
    sudo mv create-project.sh /usr/local/bin/create-project

    Then you can run create-project from anywhere! πŸŽ‰

Usage

First Time Setup

Before running the script for the first time, make it executable (if you have not already done this):

chmod +x create-project.sh

Basic Usage

./create-project.sh

The script will prompt you interactively:

Create new project
Directory name: my-awesome-app
Output path (leave empty for current directory): ~/Projects

This will create a new directory at the specified location, copying all files from the default base template folder.

πŸ’‘ Tip: Leave the output path empty to create your project in the current directory!

Examples

# Create a new project in current directory
./create-project.sh
# Directory name: my-awesome-app
# Output path: (press Enter for current directory)

# Create a new project in a specific location
./create-project.sh
# Directory name: gameDev
# Output path: ~/Documents/Projects

# Create a new project using a custom template
./create-project.sh ~/templates/web-template
# Directory name: web-project
# Output path: ~/Sites

# If installed globally
create-project
# Then enter your project details when prompted

Output Path Options

  • Leave empty: Creates project in current directory
  • Relative path: ../projects or subfolder
  • Absolute path: /Users/yourname/Projects
  • Home directory: ~/Projects (tilde expands to your home directory)

πŸ“ Note: If the path doesn't exist, the script will ask if you want to create it!

βš™οΈ Configuration

Default Template Folder

The script looks for a vscode-cpp-template folder in the same directory. Your folder structure should be:

CreateNewProjectFolder/
β”œβ”€β”€ create-project.sh          # The script ✨
β”œβ”€β”€ vscode-cpp-template/       # Your template files
β”‚   β”œβ”€β”€ main.code-workspace
β”‚   β”œβ”€β”€ libstdc++-6.dll
β”‚   └── ... (all your template files)
└── README.md                  # This file!

The script automatically finds the template folder relative to its own location, so you can move the entire folder anywhere and it will still work.

Using a Different Template Folder Name

If you want to use a different folder name, edit the script and change this line:

DEFAULT_BASE_FOLDER="$SCRIPT_DIR/template"

For example, to use a folder named base-project:

DEFAULT_BASE_FOLDER="$SCRIPT_DIR/base-project"

Template Folder Structure

Your template folder (bundled with the script) should contain all the files and folders you want in every new project:

template/
β”œβ”€β”€ .gitignore
β”œβ”€β”€ README.md
β”œβ”€β”€ LICENSE
β”œβ”€β”€ src/
β”‚   └── main.js
β”œβ”€β”€ tests/
β”‚   └── test.js
β”œβ”€β”€ package.json
└── .env.example

When you run the script, all of these files and folders will be copied to your new project directory.

Safety Features

  • Existence Check: Validates that the template folder exists before proceeding
  • Overwrite Protection: Prompts for confirmation if target directory already exists
  • Error Handling: Exits on errors to prevent partial copies

Troubleshooting

"Permission denied" error

Make sure the script is executable:

chmod +x create-project.sh

"Base folder does not exist" error

Make sure you have a template folder in the same directory as the script:

ls -la template/

Your folder structure should be:

YourFolder/
β”œβ”€β”€ create-project.sh
└── template/

Script doesn't run

Ensure you're using bash (default on macOS):

bash create-project.sh

Requirements

  • macOS (or any Unix-like system with bash)
  • Bash 3.0 or higher (included in macOS)

License

Free to use and modify as needed.

Support

If you encounter issues, check that:

  1. The script has execute permissions
  2. Your template folder path is correct
  3. You have write permissions in the current directory

πŸŽ‰ Congratulations!

When you successfully create a project, you'll see this beauty: image

Made with ❀️ and lots of β˜•

Report Bug Β· Request Feature

β €β €β €

About

A small bash script which takes the included template project and allows users to create new projects using the contents of the template

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors