Skip to content

Instantly share code, notes, and snippets.

@slavcodev
Last active January 4, 2022 23:08
Show Gist options
  • Save slavcodev/e59f11f500b719723b0c6edcbc3bd139 to your computer and use it in GitHub Desktop.
Save slavcodev/e59f11f500b719723b0c6edcbc3bd139 to your computer and use it in GitHub Desktop.
Composer useful scripts
{
"scripts": {
"test": "phpunit",
"test-coverage": "phpunit --coverage-clover build/logs/clover.xml",
"show-coverage": "phpunit --coverage-text=php://stdout",
"report-coverage": "phpunit --coverage-html build/logs/report",
"diff-files": "f() { git diff --name-only --diff-filter=ACMRTUXB $1 | grep -ivE composer\\.\\|\\.git ; }; f",
"cs": "f() { if test \"$1\"; then php-cs-fixer fix --dry-run --config=.php_cs -v --using-cache=no --diff --diff-format=udiff --ansi $1 ; else echo \"Nothing to fix\" ; fi ; }; f",
"cs-fix": "f() { if test \"$1\"; then php-cs-fixer fix --config=.php_cs -v --using-cache=no --diff --diff-format=udiff --ansi $1 ; else echo \"Nothing to fix\" ; fi ; }; f",
"cs-feature": "composer cs -- \"$(composer diff-files origin/master)\"",
"cs-fix-feature": "composer cs-fix -- \"$(composer diff-files origin/master)\"",
"cs-changes": "composer cs -- \"$(composer diff-files HEAD)\"",
"cs-fix-changes": "composer cs-fix -- \"$(composer diff-files HEAD)\""
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment