Skip to content

GreenChiip/devCLI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🚀 DevCLI

This project provides a CLI tool to manage and streamline development workflows. The tool allows adding, removing, and listing aliases while supporting custom directory navigation and execution of commands for easy boot up projects.


🌟 Features

  • 🛠️ Manage aliases (add, remove, list) stored in a JSON file.
  • ✨ Open projects in Visual Studio Code.
  • 🔥 Automatically run npm run dev.
    • 📂 Looks after package.json in selected folder.
  • 🐳 Docker Support: Includes a fast method to boot any docker compose projects.

Note

Other commands coming as the need is there

TODO

  • 🛠️ Add an init function to generate a new project, complete with Docker Compose setup:

    • 🐍 Python: Pre-configured with virtual environment and basic Docker support.
    • 🟢 Node: Pre-configured with npm init and a Docker environment.
      • NextJS: as framework..
    • More: Expand support based on the need (e.g., Ruby, Go, or Java).
  • Rewrite Setup after testing...

⚙️ Setup

Prerequisites

  • Python: Ensure Python 3.7+ is installed.
  • Node.js: Install Node.js and ensure npm is in your PATH.
  • pip: Ensure you have pip installed for Python package management.

1. Install Required Dependencies

Run the following command to install dependencies:

pip install click python-dotenv InquirerPy

2. Create a .env File

Create a .env file in the project root with the following structure:

# Path to the JSON file storing aliases
ALIAS_PATH=<full/path/alias.json>

# Path to the npm executable
NODE_PATH=</full/path/nodejs/npm.cmd>

# Path to the Visual Studio Code executable
VSCODE_PATH=</full/path/Code.exe>

# Base path for project directories
BASE_PATH=</full/path>
  • Windows: Update paths for NODE_PATH and VSCODE_PATH as per your installation.
  • Mac/Linux: Use /usr/local/bin/npm for NODE_PATH and /Applications/Visual Studio Code.app/Contents/Resources/app/bin/code for VSCODE_PATH.

3. Set Up the CLI for Your Shell

Windows (PowerShell Profile) 🖥️

  1. Open your PowerShell profile:
    notepad $PROFILE
  2. Add the following line:
    function dev { python path\\to\\your\\src\\main.py @args }
  3. Save the file and reload the profile:
    . $PROFILE

MacOS/Linux 🐧

  1. Open your shell configuration file (.bashrc, .zshrc, or .bash_profile):
    nano ~/.bashrc  # Or ~/.zshrc for Zsh users
  2. Add the following line:
    alias dev="python /path/to/your/src/main.py"
  3. Save the file and reload the shell:
    source ~/.bashrc  # Or source ~/.zshrc

📜 Usage

Adding an Alias

dev alias add <alias_name> <alias_for>

Example:

dev alias add myproject "MyProject\\subFolder"

Removing an Alias

dev alias remove <alias_name>

Example:

dev alias remove myproject

Listing Aliases

dev alias list

Running the CLI

To navigate to a folder and run npm run dev:

dev run <folder_name>

📝 Important!

  • Ensure your .env file is configured correctly to avoid path-related issues.
  • Use the appropriate shell setup instructions for your OS to enable the dev command globally.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages