Total Posts

0

Total Commits

0

(v1: 0, v2: 0)
Total Deployments

0

Latest commit:Unable to fetch commit info
7/9/2025
Latest deployment:
pending
7/9/2025
v2
Started 7/9/2025

Built by Remco Stoeten with a little ❤️

Snippets.remcostoeten
Snippets.remcostoeten
Snippets
Welcome to Snippets
Cleanup enviorment
Clipboard Copy Commands
Fish Shell Port and File Utilities
Recursive file & folder creation
Dotfiles/Scripts

Cleanup enviorment

Cleans up generated development files based on if it's a nextjs or vite app

[!NOTE] This is for .fish style shell

Create the extensionless script file at ~/.config/dotfiles/scripts/cleanup-node:

#!/usr/bin/env fish
 
function rmnode
    bash -c '
        set -euo pipefail
 
        RED="\033[0;31m"
        GREEN="\033[0;32m"
        BLUE="\033[0;34m"
        RESET="\033[0m"
 
        log() {
            echo -e "${BLUE}[INFO]${RESET} $1"
        }
 
        success() {
            echo -e "${GREEN}[DONE]${RESET} $1"
        }
 
        error() {
            echo -e "${RED}[ERROR]${RESET} $1" >&2
        }
 
        # Remove common build/dependency folders
        remove_folder() {
            local folder=$1
            if [ -d "$folder" ]; then
                log "Removing $folder..."
                rm -rf "$folder"
                success "$folder removed"
            fi
        }
 
        # Main logic
        log "Cleaning project..."
 
        remove_folder node_modules
        remove_folder .next
        remove_folder dist
        remove_folder .vite
        remove_folder out
 
        if ! command -v bun >/dev/null 2>&1; then
            error "bun is not installed or not in PATH"
            exit 1
        fi
 
        log "Reinstalling dependencies with bun..."
        bun install && success "Dependencies reinstalled with bun"
 
        success "Project cleaned and ready!"
 
    ' -- $argv
end

Setup Instructions

  1. Create the script directory:

    mkdir -p ~/.config/dotfiles/scripts
  2. Make the script executable:

    chmod +x ~/.config/dotfiles/scripts/cleanup-node
  3. Source it in your fish config (~/.config/fish/config.fish):

    # Source all scripts in dotfiles/scripts directory
    for script in ~/.config/dotfiles/scripts/*
        if test -f $script
            source $script
        end
    end

    Or source just this specific script:

    source ~/.config/dotfiles/scripts/cleanup-node
  4. Reload your fish config:

    source ~/.config/fish/config.fish

Now you can use rmnode command from anywhere in your terminal!

Warp terminal - rules

Rules for Warp terminal to adhere to

Clipboard Copy Commands

A set of functions to simplify copying to the clipboard in the terminal.

On this page

Setup Instructions
Jul 9, 2025
5 min read
878 words