Skip to content

Prewind v2.1.0

Choose a tag to compare

@art70x art70x released this 26 Feb 08:25

Prewind Changelog

v2.1.0 — 2026-02-26

🚀 New Features

  • Verbose Logging:

    • Added -v, --verbose option to log detailed file processing information.
    • Prints Changed / Unchanged files along with their output path for all modes (dry-run, write, out).
  • Colored Console Output:

    • Integrated picocolors for cleaner CLI display.
    • Spinner and summary messages now use colors for better readability (green for success, red for errors, dim for informational messages).
  • Safe --out Handling:

    • CLI now fully supports --out for single files or directories.
    • File targets are type-safe and guaranteed to be strings (target variable).
  • Dry-Run Default:

    • CLI defaults to --dry-run if no mode is specified.
    • Shows preview of transformed files without modifying them.
  • Concurrency Support:

    • File processing now uses concurrent workers (default 8) for faster performance on large projects.
  • Prettier-Plugin Friendly Imports:

    • Added prettier-plugin-organize-imports support.
    • Improves import order and code formatting automatically.

⚡ CLI Updates

  • New Options:

    --dry-run      # Preview changes without writing (default)
    -w, --write    # Overwrite files in place
    -o, --out <dir># Output directory or file for transformed files
    -v, --verbose  # Show detailed file processing logs
    --ignore <patterns...> # Glob patterns to ignore
  • Behavior Improvements:

    • --write now prompts confirmation before destructive file changes.

    • Summary now includes:

      • Files scanned
      • Files changed
      • Unchanged
      • Replacements
      • Mode
      • Time (ms)

🛠 Under-the-Hood Improvements

  • ProcessFiles Refactor:

    • queue now uses Array#toSorted() instead of sort() for immutability and ESLint unicorn/no-array-sort compliance.
    • countReplacements() moved to outer scope to satisfy unicorn/consistent-function-scoping.
    • target type is fully safe (string) for all modes.
  • Error Handling Enhancements:

    • Improved dry-run and out mode error messages.
    • CLI now exits gracefully with informative messages for invalid combinations (--write + --out, no matched files, etc.).
  • Spinner Integration:

    • Processing uses @clack/prompts spinner for visual feedback.
    • Spinner stops on success, failure, or cancellation.

📝 Usage Examples

# Preview files in dry-run mode (default)
pw "src/**/*.jsx" --dry-run

# Overwrite files in place
pw src --write

# Output to a folder
pw src --out dist

# Preview with verbose logging
pw "src/**/*.jsx" --dry-run -v

# Overwrite with verbose logging
pw src --write --verbose

# Ignore files matching glob
pw "src/**/*.jsx" --ignore "**/*.test.jsx"