Getting Started
Getting Started with pjt
Section titled “Getting Started with pjt”pjt is a powerful cross-platform CLI tool. It removes empty directories, ignored files, and reinstalls dependencies with support for npm, pnpm, and yarn.
Prerequisites
Section titled “Prerequisites”- Node.js >= 18.0.0
- Git repository
Installation
Section titled “Installation”Install pjt globally using your favorite package manager:
npm install -g pjtpnpm add -g pjtyarn global add pjtVerify installation
Section titled “Verify installation”After installation, check if pjt is available:
pjt --versionBasic Usage
Section titled “Basic Usage”Navigate to your Git repository and run:
pjtThis command will:
- Remove empty directories
- Remove files ignored by .gitignore
- Reinstall dependencies based on your package manager
What does pjt do exactly?
Section titled “What does pjt do exactly?”When you run pjt, the tool executes the following steps:
- Package manager detection: Automatically detects if you use npm, pnpm or yarn
- Empty directory cleaning: Recursively removes all empty folders
- Ignored files cleaning: Removes files and folders listed in .gitignore
- Dependency reinstallation: Cleans node_modules and reinstalls all dependencies
Example output
Section titled “Example output”🔍 Detected package manager: pnpm🗂️ Removed 3 empty directories🚫 Removed 12 ignored files📦 Reinstalling dependencies...✅ Done! Repository is clean.Advanced usage
Section titled “Advanced usage”With options
Section titled “With options”# Clean only, without reinstallationpjt --clean-only
# Verbose mode for more detailed outputpjt --verbose
# Helppjt --helpIn CI/CD pipeline
Section titled “In CI/CD pipeline”Add pjt to your CI/CD process:
- name: Clean repository run: npx pjtTroubleshooting
Section titled “Troubleshooting”Problem: “pjt: command not found”
Section titled “Problem: “pjt: command not found””Solution: Check if pjt is installed globally and PATH is set correctly.
# Check installationwhich pjt
# Reinstall if necessarynpm install -g pjtProblem: Errors during cleaning
Section titled “Problem: Errors during cleaning”Solution: Run with verbose option to see details:
pjt --verboseProblem: Package manager not recognized
Section titled “Problem: Package manager not recognized”Solution: Check if you have package.json or pnpm-lock.yaml in the root directory.
Next steps
Section titled “Next steps”Check the Guides for more detailed instructions on usage and configuration.