Skip to content

cihatksm/update-modules

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

40 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ update-modules

A comprehensive, enterprise-grade module updater with advanced features including backup/restore, security audits, selective updates, and intelligent update strategies. Keep your projects up-to-date effortlessly with fine-grained control over the update process.

✨ Features

  • πŸ”„ Smart Update Strategies - Patch, minor, or major update strategies
  • 🎯 Selective Updates - Update only specific modules or exclude certain ones
  • πŸ’Ύ Backup & Restore - Automatic backup of package-lock.json with restore capability
  • πŸ”’ Security Audits - Built-in npm audit integration for vulnerability checks
  • πŸ“Š Detailed Reports - Generate update reports in JSON or text format
  • πŸŽ›οΈ Interactive Mode - Choose which modules to update individually
  • βš™οΈ Configuration File - Project-specific settings via .updaterc.json
  • πŸ€– CI/CD Ready - Silent mode perfect for automated environments
  • 🧹 Cache Management - Advanced cleanup options for node_modules and lock files
  • πŸ“‹ Dry Run Mode - See what would be updated without making changes

πŸ“¦ Installation

Local Installation

npm install update-modules@latest

Global Installation

npm install -g update-modules@latest

Add to package.json

{
  "scripts": {
    "update-modules": "update-modules"
  }
}

🎯 Usage

Basic Operations

# Check and update all modules
update-modules

# Dry run - see what would be updated
update-modules --dry-run

# Interactive mode - choose modules individually
update-modules --interactive

# Silent mode for CI/CD
update-modules --ci

Update Strategies

# Only patch updates (1.0.0 β†’ 1.0.1)
update-modules --strategy=patch

# Patch and minor updates (1.0.0 β†’ 1.1.0)
update-modules --strategy=minor

# All updates including major (1.0.0 β†’ 2.0.0) - default
update-modules --strategy=major

Selective Updates

# Update only specific modules
update-modules --only=express,lodash,moment

# Exclude specific modules
update-modules --exclude=react,vue,angular

# Update only development dependencies
update-modules --dev-only

# Update only production dependencies
update-modules --prod-only

Backup & Restore

# Create backup of package-lock.json
update-modules --backup

# Restore from backup (interactive selection)
update-modules --restore

# List available backups
update-modules --list-backups

Security & Audits

# Run security vulnerability check
update-modules --security

# Run npm audit
update-modules --audit

# Combine with updates
update-modules --security --strategy=patch

Reports & Export

# Generate update report
update-modules --report

# Export report in specific format
update-modules --export=json
update-modules --export=txt

# Combine with dry run for planning
update-modules --dry-run --export=json

Cache Management

# Clear both node_modules and package-lock.json
update-modules -clear

# Clear only node_modules
update-modules -clear node_modules

# Clear only package-lock.json
update-modules -clear package-lock.json

Advanced Usage

# Combined operations
update-modules --strategy=minor --backup --interactive --report

# CI/CD pipeline
update-modules --ci --strategy=patch --export=json

# Development workflow
update-modules --dev-only --interactive --backup

βš™οΈ Configuration

Create a .updaterc.json file in your project root for custom settings:

{
  "ignore": ["update-modules", "legacy-module"],
  "autoUpdate": false,
  "updateStrategy": "minor",
  "clearBeforeUpdate": false,
  "backupPackageLock": true,
  "maxBackups": 10
}

Configuration Options

Option Type Default Description
ignore Array [] Modules to ignore during updates
autoUpdate Boolean false Skip confirmation prompts
updateStrategy String "major" Default update strategy (patch, minor, major)
clearBeforeUpdate Boolean false Clear cache before updating
backupPackageLock Boolean true Automatically backup package-lock.json
maxBackups Number 10 Maximum number of backups to keep

πŸš€ CLI Reference

Main Commands

update-modules [options]

Options

Basic Operations

  • --help, -h - Show help message
  • --debug - Enable debug mode with verbose output
  • --dry-run - Show what would be updated without making changes
  • --interactive - Interactive mode for selecting modules
  • --ci - Silent mode for CI/CD environments

Update Strategies

  • --strategy=patch - Only patch updates
  • --strategy=minor - Patch and minor updates
  • --strategy=major - All updates (default)

Selective Updates

  • --only=module1,module2 - Update only specified modules
  • --exclude=module1,module2 - Exclude specified modules from updates
  • --dev-only - Update only devDependencies
  • --prod-only - Update only dependencies

Backup Operations

  • --backup - Create backup of package-lock.json
  • --restore - Restore from backup interactively
  • --list-backups - List all available backups

Security & Reports

  • --security - Run security vulnerability check
  • --audit - Run npm audit
  • --report - Generate update report
  • --export=format - Export report (json, txt)

Cache Management

  • -clear - Clear node_modules and package-lock.json
  • -clear node_modules - Clear only node_modules
  • -clear package-lock.json - Clear only package-lock.json

πŸ’‘ Examples

Development Workflow

# 1. Check for updates with backup
update-modules --backup --dry-run --report

# 2. Update only patch versions interactively
update-modules --strategy=patch --interactive

# 3. Update dev dependencies only
update-modules --dev-only --strategy=minor

Production Deployment

# 1. Security audit before update
update-modules --security --audit

# 2. Safe production update
update-modules --strategy=patch --backup --ci

# 3. Generate deployment report
update-modules --dry-run --export=json

Emergency Recovery

# 1. List available backups
update-modules --list-backups

# 2. Restore from backup
update-modules --restore

# 3. Clear corrupted cache
update-modules -clear

πŸ“‹ Changelog

v0.2.0 - Major Feature Release

  • ✨ Added intelligent update strategies (patch, minor, major)
  • ✨ Implemented backup and restore functionality
  • ✨ Added selective update options (--only, --exclude, --dev-only, --prod-only)
  • ✨ Integrated security audit capabilities
  • ✨ Added comprehensive reporting system
  • ✨ Implemented interactive mode for granular control
  • ✨ Added configuration file support (.updaterc.json)
  • ✨ Enhanced CI/CD integration with silent mode
  • ✨ Added dry-run mode for safe testing
  • πŸ› Improved error handling and user feedback
  • πŸ“š Comprehensive documentation and examples

View previous changes from commits.

πŸ“„ License

MIT License

πŸ“ž Contact

If you have any feedback, contribution, bug report or suggestion, please feel free to contact me@cihatksm.com.


Made with ❀️ by cihatksm

πŸ€– Acknowledgments

This project was developed with assistance from GitHub Copilot AI

About

This module is used to update all modules in the project.

Topics

Resources

License

Stars

Watchers

Forks