Skip to content

Conversation

Rozkalns
Copy link
Contributor

@Rozkalns Rozkalns commented Apr 22, 2025

What changes were made

Added a new Artisan command that automates the setup of commonly used composer scripts: essentials:add-scripts

  1. Code Quality Scripts:
    • composer lint - Format code using Laravel Pint
    • composer refactor - Refactor code using Rector
  2. Test Scripts:
    • composer test:spellcheck - Check for spelling errors using Peck
    • composer test:refactor - Check for possible refactoring opportunities
    • composer test:lint - Verify code formatting
    • composer test:types - Run static analysis with PHPStan
    • composer test:unit - Run unit tests with coverage and parallel execution
    • composer test:type-coverage - Check type coverage (minimum 100%)
    • composer test - Run all test scripts in sequence
  3. Package Detection:
    • Command automatically detects installed packages
    • Only adds scripts for tools that are available in the project
    • Provides recommendations for missing packages
    • Includes option to bypass package verification --skip-checks

Why these changes were made

  1. Standardize Development Workflow:
    • Establish consistent testing and code quality checks across projects
    • Reduce setup time for new Laravel applications
    • Ensure best practices are followed
  2. Improve Developer Experience:
    • Eliminate manual script configuration
    • Provide clear naming conventions for different types of checks
    • Make it easier to maintain code quality standards

Context and Inspiration

This contribution was inspired by several key factors:

  1. Community Need: While watching Nuno Maduro's video (https://www.youtube.com/watch?v=cfD7uCWXxZk), I noticed several community members in the comments struggling to see and implement the composer test commands being demonstrated. One specific comment highlighted this issue (including at least 4 likes): image
  2. Research and Collection: I gathered these scripts from various sources:
  3. Previous Work and Improvements: While there is an existing PR (feat: Add essentials:composer command for adding composer scripts #19) addressing similar functionality, I identified several crucial additions and improvements that weren't covered. This implementation aims to provide a more comprehensive solution.
  4. My own interest: I haven't programmed in a while, and just wanted to some on hands experience with the tools available today.

This command solves real problems faced by the community:

  • Automates the script setup process
  • Ensures consistent naming across projects
  • Provides helpful feedback about missing dependencies
  • Makes it easy to standardize workflows across teams

The implementation is flexible enough to work with existing scripts, preserving custom configurations while adding standardized testing capabilities.
This contribution is my first to the package, answering Nuno's invitation during the initial livestreams to contribute to the project.

@AsafMazuz1
Copy link

Exactly what I have been looking for 😄
@nunomaduro, any chances that this will merge?
Thanks 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants